Ruby | Matrix empty?() function Last Updated : 07 Jan, 2020 Comments Improve Suggest changes Like Article Like Report The empty?() is an inbuilt method in Ruby returns a boolean value. It returns true if the matrix is empty, else it returns false. Syntax: mat1.empty?() Parameters: The function does not accepts any parameter. Return Value: It returns a boolean value. Example 1: Ruby # Ruby program for empty() method in Matrix # Include matrix require "matrix" # Initialize a matrix mat1 = Matrix[[1, 21], [31, 18]] # prints if empty or not puts mat1.empty?() Output: false Example 2: Ruby # Ruby program for empty() method in Matrix # Include matrix require "matrix" # Initialize a matrix mat1 = Matrix[] # prints if empty or not puts mat1.empty?() Output: true Comment More infoAdvertise with us Next Article Ruby | Matrix empty?() function gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Matrix-class Similar Reads Ruby | Matrix det() function The det() is an inbuilt method in Ruby returns the determinant of the given matrix Syntax: mat1.det() Parameters: The function does not accepts any parameter. Return Value: It returns the determinant of the given matrix. Example 1: Ruby # Ruby program for det() method in Matrix # Include matrix requ 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 eql? function The eql? is an inbuilt method in Ruby returns a boolean value. It returns true if both the matrix are equal or else it returns false.. Syntax: mat1.eql?(mat2)Parameters: The function need two matrix mat1 and mat2 which are to be compared.Return Value: It returns true if both the matrix are equal or 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 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 | Hash empty? function Hash#empty?() is a Hash class method which checks whether the Hash array has any key-value pair. Syntax: Hash.empty?()Parameter: Hash valuesReturn: true - if no key value pair otherwise return false Example #1 :  Ruby # Ruby code for Hash.empty?() method # declaring Hash value a = {a:100, b:200} # 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 I() function The I() is an inbuilt method in Ruby returns a Identity matrix of N X N size. Syntax: mat1.I(N) Parameters: The function accepts a mandatory parameter N which is the size of the Identity matrix. Return Value: It returns the Identity matrix. Example 1: Ruby # Ruby program for I() method in Matrix # I 1 min read Ruby | Matrix determinant() function The determinant () is an inbuilt method in Ruby returns the determinant of the given matrix. Syntax: mat1.det() Parameters: The function does not accepts any parameter. Return Value: It returns the determinant of the given matrix. Example 1: Ruby # Ruby program for determinant() method in Matrix # I 1 min read Ruby | Matrix t() function The t() is an inbuilt method in Ruby returns the transpose of the matrix. Syntax: mat1.t() Parameters: The function needs the matrix to be transposed. Return Value: It returns the transposed matrix. Example 1: Ruby # Ruby program for t() method in Matrix # Include matrix require "matrix" # 1 min read Like