Ruby | Matrix conj() function Last Updated : 12 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report 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" # Initialize a matrix mat1 = mat1 = Matrix[[1, Complex(2, 1)], [Complex(8, -9), 18]] # prints the conjugate matrix puts mat1.conj() Output: Matrix[[1, 2-1i], [8+9i, 18]] Example 2: Ruby # Ruby program for conj() method in Matrix # Include matrix require "matrix" # Initialize a matrix mat1 = Matrix[[Complex(2, 5), 1, 5], [Complex(12, 1), 1, 5], [11, 2, Complex(6, -1)]] # prints the conjugate matrix puts mat1.conj() Output: Matrix[[2-5i, 1, 5], [12-1i, 1, 5], [11, 2, 6+1i]] Comment More infoAdvertise with us Next Article Ruby | Matrix clone() 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 conjugate() function The conjugate() is an inbuilt method in Ruby returns the conjugate matrix. Syntax: mat1.conjugate() Parameters: The function does not accepts any parameter. Return Value: It returns the conjugate matrix.Example 1: Ruby # Ruby program for conjugate() method in Matrix # Include matrix require "matrix" 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 Ruby | Matrix component() function 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 1 min read Ruby | Matrix row_count() function The row_count() is an inbuilt method in Ruby returns the number of rows in the given matrix. Syntax: mat1.row_count() Parameters: The function does not takes any mandatory parameter. Return Value: It returns the number of rows in the matrix. Example 1: Ruby # Ruby program for row_count() method in M 1 min read Like