7.1.3.17 Matrix_sparse_rational Objects

class Matrix_sparse_rational
The Matrix_sparse_rational class derives from Matrix, and defines functionality for sparse matrices over the field $ \mathbf{Q}$ of rational numbers.
Matrix_sparse_rational( parent, [entries=True], [coerce_entries=True], [copy=0])

Instances of class Matrix_sparse_rational have the following methods (in addition to inherited methods and special methods):

charpoly,$  $ echelon_form,$  $ hessenberg_form

Further documentation:

charpoly( )

Return the characteristic polynomial of this matrix.

echelon_form( [height_guess=True], [include_zero_rows=None])

Return the echelon form of this sparse matrix over the rational numbers, computed using a sparse multi-modular algorithm.

The height guess is a guess for a bound on the height of the entries of the echelon form. If you know for some reason that the entries of the echelon form are bounded, giving a good height bound can speed up this function. At the end of the computation the result is checked for correctness and the height bound increased if necessary, so giving too small of a guess will not lead to incorrect results (though it may slow down the algorithm).

sage: A = MatrixSpace(RationalField(),3, sparse=True)(range(9))
sage: A.echelon_form()
[ 1  0 -1]
[ 0  1  2]
[ 0  0  0]
sage: A = 9999999*MatrixSpace(RationalField(),3, sparse=True)(range(9))
sage: A
[       0  9999999 19999998]
[29999997 39999996 49999995]
[59999994 69999993 79999992]
sage: A.echelon_form(height_guess=1)
[ 1  0 -1]
[ 0  1  2]
[ 0  0  0]

hessenberg_form( )

Return the Hessenberg form of this sparse matrix.

sage: A = MatrixSpace(RationalField(),3, sparse=True)(range(9))
sage: A.hessenberg_form()
[ 0  5  2]
[ 3 14  5]
[ 0 -5 -2]

Instances of class Matrix_sparse_rational also have the following special methods:

_sparse_list,$  $ _sparse_matrix_rational

See About this document... for information on suggesting changes.