Ruby | Matrix column() function Last Updated : 07 Jan, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report 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_num. Example 1: Ruby # Ruby program for column() method in Matrix # Include matrix require "matrix" # Initialize a matrix mat1 = Matrix[[1, 21], [31, 18]] # Prints the value of mat1.column puts mat1.column(1) Output: Vector[21, 18] Example 2: Ruby # Ruby program for column() method in Matrix # Include matrix require "matrix" # Initialize a matrix mat1 = Matrix[[13, 1, 5], [12, 1, 5], [11, 2, 5]] # Prints the value of mat1.column puts mat1.column(1) Output: Vector[1, 1, 2] Comment More infoAdvertise with us Next Article Ruby | Matrix column_size() function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Matrix-class Similar Reads Ruby | Matrix column_size() function The column_size() is an inbuilt method in Ruby returns the number of columns in a matrix. Syntax: mat1.column_size() Parameters: The function does not accepts any parameter. Return Value: It returns the number of columns in a matrix. Example 1: Ruby # Ruby program for column_size() method in Matrix 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 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_count() function The column_count() is an inbuilt method in Ruby returns the number of columns in a matrix. Syntax: mat1.column_count() Parameters: The function does not accepts any parameter. Return Value: It returns the number of columns in a matrix. Example 1: Ruby # Ruby program for column_count() method in Matr 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