Ruby | Matrix component() function Last Updated : 07 Jan, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The component() is an inbuilt method in Ruby returns the element present at the intersection of i-th row and j-th column. Syntax: mat1.component(i, j) Parameters: The function accepts two parameters i and j which signifies the row_number and column_number. Return Value: It returns the element at mat[i][j]. Example 1: Ruby # Ruby program for component() method in Matrix # Include matrix require "matrix" # Initialize a matrix mat1 = Matrix[[1, 21], [31, 18]] # prints the element at 1, 1 puts mat1.component(1, 1) Output: 18 Example 2: CPP # Ruby program for component() method in Matrix # Include matrix require "matrix" # Initialize a matrix mat1 = Matrix[[13, 1, 5], [12, 1, 5], [11, 2, 5]] # prints the element at 0, 1 puts mat1.component(0, 1) Output: 1 Comment More infoAdvertise with us Next Article Ruby | Matrix component() function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Matrix-class Similar Reads Ruby | Matrix clone() function The clone() is an inbuilt method in Ruby returns a clone of the given matrix such that the contents are not referenced by identical objects. Syntax: mat1.clone() Parameters: The function needs a matrix whose clone is to returned. Return Value: It returns the clone matrix. Example 1: Ruby # Ruby prog 1 min read Ruby | Matrix column() function The column() is an inbuilt method in Ruby returns a vector that has all the elements in the column number col_num. Syntax: mat1.column(col_num) Parameters: The function accepts a parameter col_num which is the column number. Return Value: It returns a vector which has all the elements of column col_ 1 min read Ruby | Matrix conj() function The conj() is an inbuilt method in Ruby returns the conjugate matrix. Syntax: mat1.conj() Parameters: The function does not accepts any parameter. Return Value: It returns the conjugate matrix. Example 1: Ruby # Ruby program for conj() method in Matrix # Include matrix require "matrix" # I 1 min read Ruby | Matrix element() function The element() is an inbuilt method in Ruby returns the element present at the intersection of i-th row and j-th column. Syntax: mat1.element(i, j) Parameters: The function accepts two parameters i and j which signifies the row_number and column_number. Return Value: It returns the element at mat[i][ 1 min read Ruby | Matrix collect() function The collect() is an inbuilt method in Ruby returns the new matrix after performing the operation that is given in the block. Syntax: mat1.collect{|el| operation} Parameters: The function has the parameter as a block which is the operation which is performed on all elements. Return Value: It returns 1 min read Like