class Apatite::LinearAlgebra::Matrix
- Apatite::LinearAlgebra::Matrix
- Reference
- Object
Included Modules
- Comparable(Apatite::LinearAlgebra::Matrix)
- Enumerable(Apatite::LinearAlgebra::Vector)
- Indexable(Apatite::LinearAlgebra::Vector)
Defined in:
apatite/linear_algebra/matrix.crConstructors
Class Method Summary
-
.[](*rows)
Creates a matrix where each argument is a row.
-
.build(row_count, column_count = row_count, &block)
Creates a matrix of size
row_count x column_count
. -
.col_vector(column)
Creates a single-column matrix where the values of that column are as given in column.
-
.columns(columns)
Creates a matrix using
.columns
as an array of column vectors. -
.diagonal(values)
Creates a matrix where the diagonal elements are composed of
values
. -
.diagonal(*values)
Creates a matrix where the diagonal elements are composed of
values
. -
.empty(row_count = 0, column_count = 0)
Creates a empty matrix of
row_count x column_count
. -
.hstack(x, *matrices)
TODO
-
.identity(n)
Creates a
n x n
identity matrix. -
.row_vector(row)
Creates a single-row matrix where the values of that row are as given in
#row
. -
.rows(rows)
Creates a matrix where rows is an array of arrays, each of which is a row of the matrix.
-
.scalar(n, value)
Creates an
n
byn
diagonal matrix where each diagonal element is value. -
.vstack(x, y)
TODO
-
.zero(row_count, column_count = row_count)
Creates a zero matrix.
Instance Method Summary
- #*(other : Matrix)
- #*(int : Int)
- #*(ind : Indexable)
- #**(int)
- #+(other : Matrix)
- #+(vec : Indexable)
- #-(vec : Indexable)
- #-(other : Matrix)
- #/(other : Matrix)
- #/(vec : Indexable)
- #==(other : Matrix)
-
#[](row : Int, col : Int)
Returns element
(row, col)
of the matrix. -
#[]?(row : Int, col : Int)
Returns element
(row, col)
of the matrix, or nil if the index is not found. -
#adjugate
Returns the adjugate of the matrix.
-
#cofactor(row, column)
Returns the (row, column) cofactor which is obtained by multiplying the first minor by (-1)**(row + column)
-
#column(j, &block)
Iterates over the specified column in the matrix, returning the Vector's items.
-
#column(j)
Returns column vector number
j
of the matrix as aVector
(starting at 0 like an array). -
#column?(j)
Returns column vector number
j
of the matrix as aVector
(starting at 0 like an array). - #column_count : Int32
-
#column_vectors
Returns an array of the column vectors of the matrix.
- #determinant
- #first_minor(row, column)
-
#inverse
Returns the inverse of the matrix.
-
#laplace_expansion(*, row = nil, column = nil)
Returns the Laplace expansion along given row or column.
- #pretty_print(pp) : Nil
- #row(i, &block)
- #row(i)
- #row_count : Int32
- #rows
- #square?
- #to_s(io)
- #transpose
- #unsafe_fetch(index : Int)
Constructor Detail
Class Method Detail
Creates a matrix of size row_count x column_count
. It fills the values by calling
the given block, passing the current row and column.
Creates a single-column matrix where the values of that column are as given in column.
Creates a empty matrix of row_count x column_count
. At least one of
#row_count
or #column_count
must be 0.
Creates a single-row matrix where the values of that row are as given in #row
.
Creates a matrix where rows is an array of arrays, each of which is a row of the matrix.
Instance Method Detail
Returns element (row, col)
of the matrix. Throws error on index error.
Returns element (row, col)
of the matrix, or nil if the index is not found.
Returns the (row, column) cofactor which is obtained by multiplying the first minor by (-1)**(row + column)
Iterates over the specified column in the matrix, returning the Vector's items.
Returns column vector number j
of the matrix as a Vector
(starting at 0 like an array).
Returns column vector number j
of the matrix as a Vector
(starting at 0 like an array).
Returns the Laplace expansion along given row or column.