Alias for Matrix.rows.
Creates a single column matrix with the given values.
Creates a matrix interpreting each argument as a column.
Creates a diagonal matrix with the supplied arguments.
Creates a Matrix(Int32), whose diagonal values are 1 and the rest are 0.
Creates a matrix with the given number of rows and columns.
Creates a single row matrix with the given values.
Creates a matrix interpreting each argument as a row.
Performs multiplication with another matrix.
Performs exponentiation
Performs addition with another matrix.
Performs substraction with another matrix.
Returns a new matrix of the same size after calling the unary #- method on every element.
Performs division with another matrix.
Checks equality between self and another matrix.
Retrieves the element at the given linear index.
Retrieves the element at the given row and column indexes.
Replaces the element at the given row and column with the given value.
Replaces the element at the given linear index with the given value.
Retrieves the element at the given row and column indexes.
Retrieves the element at the given linear index.
Retrieves the element at the given linear index.
Retrieves the element at the given linear index.
Retrieves the element at the given row and column indexes.
Retrieves the element at the given row and column indexes.
Creates an identical matrix.
Returns an iterator for the elements of the column at the given index.
Yields elements of the column at the given index.
The number of columns.
Returns an array of smaller matrices, each representing a column from self.
Returns an array of arrays that correspond to the columns of the matrix.
Returns the determinant of the matrix.
Returns true if all non-diagonal elements are 0.
Like #each but with a Symbol directive that causes the method to skip certain indices: :all -> equivalent to a simple #each (yields every element) :diagonal -> yields elements in the diagonal :off_diagonal -> yields elements not in the diagonal :lower -> yields elements at or below the diagonal :strict_lower -> yields elements below the diagonal :upper -> yields elements at or above the diagonal :strict_upper -> yields elements above the diagonal
Yields every element of the matrix linearly: First the elements of the first row, then the elements of the second row, etc.
Yields every row and column index.
Yields every element along with its row and column index.
Returns true if the matrix has either 0 rows or 0 columns.
Returns the row and column index of the first occurrence of "value" in the matrix, nil otherwise.
Returns the row and column index of the first ocurrence of the block returning true, nil otherwise
Returns the inverse of the matrix.
Returns true if the matrix is a lower triangular matrix.
Returns a new matrix with the return values of the block.
Changes the values of the matrix according to the return values of the block.
Returns a subsection of the matrix.
Returns a subsection of the matrix.
Returns true if the matrix is a permutation matrix.
Returns the rank of the matrix.
Returns true if the matrix is regular.
Reverses the order of the matrix.
Yields elements of the row at the given index.
Returns an iterator for the elements of the row at the given index.
The number of rows.
Returns an array of smaller matrices, each representing a row from self.
Returns an array of arrays that correspond to the rows of the matrix.
Shuffles the elements of the matrix.
Shuffles the elements of each column.
Shuffles the elements of each row.
Returns true if the matrix is singular.
The total number of elements.
Returns true if the number of rows equals the number of columns.
Swaps two columns.
Swaps two rows.
Returns true if the matrix is symmetric.
Returns an array of every element in the matrix.
Returns a hash: {row_index, column_index} => element
Displays the matrix in a more readable form.
Returns the sum of the diagonal elements.
Changes the rows into columns and vice versa.
Returns true if the matrix is an upper triangular matrix.
Alias for Matrix.rows.
Creates a single column matrix with the given values.
Creates a matrix interpreting each argument as a column.
Creates a diagonal matrix with the supplied arguments. Best suited to numeric matrices.
Creates a Matrix(Int32), whose diagonal values are 1 and the rest are 0.
Creates a matrix with the given number of rows and columns. It yields the linear, row and column indexes in that order.
Creates a single row matrix with the given values.
Performs multiplication with another matrix.
Performs exponentiation
Performs addition with another matrix.
Performs substraction with another matrix.
Returns a new matrix of the same size after calling the unary #- method on every element. Best suited to numeric matrices.
Performs division with another matrix.
Checks equality between self and another matrix.
Retrieves the element at the given linear index. Raises IndexError.
Retrieves the element at the given row and column indexes. Raises IndexError.
Replaces the element at the given row and column with the given value.
Replaces the element at the given linear index with the given value.
Retrieves the element at the given row and column indexes. Returns nil if out of bounds.
Retrieves the element at the given linear index. Returns nil if out of bounds
Retrieves the element at the given linear index. Raises if out of bounds.
Retrieves the element at the given linear index. Yields if out of bounds.
Retrieves the element at the given row and column indexes. Yields if out of bounds.
Retrieves the element at the given row and column indexes. Raises IndexError.
Creates an identical matrix.
Returns an iterator for the elements of the column at the given index.
Yields elements of the column at the given index.
The number of columns.
Returns an array of smaller matrices, each representing a column from self.
Returns an array of arrays that correspond to the columns of the matrix.
Returns the determinant of the matrix. Only useful for numeric matrices.
Returns true if all non-diagonal elements are 0.
Like #each but with a Symbol directive that causes the method to skip certain indices: :all -> equivalent to a simple #each (yields every element) :diagonal -> yields elements in the diagonal :off_diagonal -> yields elements not in the diagonal :lower -> yields elements at or below the diagonal :strict_lower -> yields elements below the diagonal :upper -> yields elements at or above the diagonal :strict_upper -> yields elements above the diagonal
Yields every element of the matrix linearly: First the elements of the first row, then the elements of the second row, etc.
Yields every row and column index. See #each for the optional directives.
Yields every element along with its row and column index. See #each for the optional directives.
Returns true if the matrix has either 0 rows or 0 columns.
Returns the row and column index of the first occurrence of "value" in the matrix, nil otherwise.
Returns the row and column index of the first ocurrence of the block returning true, nil otherwise
Returns the inverse of the matrix. Only useful for numeric matrices.
Returns true if the matrix is a lower triangular matrix.
Returns a new matrix with the return values of the block. Yields the element and its linear, row and column indices in that order.
Changes the values of the matrix according to the return values of the block. Yields the element and its linear, row and column indices in that order.
Returns a subsection of the matrix.
Returns a subsection of the matrix.
Returns true if the matrix is a permutation matrix.
Returns the rank of the matrix. Only useful for numeric matrices.
Returns true if the matrix is regular.
Reverses the order of the matrix.
Yields elements of the row at the given index.
Returns an iterator for the elements of the row at the given index.
The number of rows.
Returns an array of smaller matrices, each representing a row from self.
Returns an array of arrays that correspond to the rows of the matrix.
Shuffles the elements of the matrix.
Shuffles the elements of each column.
Shuffles the elements of each row.
Returns true if the matrix is singular.
The total number of elements.
Returns true if the number of rows equals the number of columns.
Returns true if the matrix is symmetric.
Returns an array of every element in the matrix.
Returns a hash: {row_index, column_index} => element
Displays the matrix in a more readable form.
Returns the sum of the diagonal elements. Only useful for numeric matrices.
Changes the rows into columns and vice versa.
Returns true if the matrix is an upper triangular matrix.