Go to the first, previous, next, last section, table of contents.
A matrix
object can be constructed from an integer_matrix
(see section Matrix Manipulation), a fract_matrix
or another
matrix
. A constructor is also available that takes the number of
rows and columns and creates an empty matrix
(the elements are
initialized to 0).
The m
method returns the number of rows in the matrix, and the
n
method returns the number of columns. The elt
method
takes a row and a column as arguments and returns a reference to the
fraction at that position in the matrix. The get_row
and
get_col
methods take an integer argument and return the
corresponding row or column, respectively. Also, the set_col
takes a column number and a fract_vector
and sets the column to
the given vector.
Equality, inequality and assignment operators are also provided for matrices. The equality and inequality operators only check if the elements of the matrices are equal, and do not compare the LU decompositions. The reason for this is that if the LU decomposition of one of the matrices is out-of-date, the matrices are still considered equal if they have the same elements.
Go to the first, previous, next, last section, table of contents.