5.4.1.3 Matrix_generic_sparse Objects

class Matrix_generic_sparse
The Matrix_generic_sparse class derives from Matrix, and defines functionality for dense matrices over any base ring. A generic sparse matrix is represented using a dictionary with keys pairs $ (i,j)$ and values in the base ring.
Matrix_generic_sparse( parent, [entries=True], [coerce_entries=True], [copy=0])

Instances of class Matrix_generic_sparse have the following functions (in addition to inherited functions and special functions):

denominator,$  $ dict,$  $ entries,$  $ get,$  $ hessenberg_form,$  $ nonzero_positions,$  $ set,$  $ sparse_columns,$  $ sparse_rows,$  $ submatrix_from_columns,$  $ submatrix_from_rows,$  $ swap_rows,$  $ transpose

Further documentation:

get( ij)

Like __getitem__ but with no type or bounds checking. For (i,j) access, returns 0 if access is out of bounds.

hessenberg_form( )

Return the Hessenberg form of this matrix.

nonzero_positions( )

Returns the set of pairs (i,j) such that self[i,j] != 0.

set( ij, x)

Like __setitem__ but with no type or bounds checking. Only works for single entries, not whole rows.

submatrix_from_columns( columns)

Return the submatrix of self of columns col[i] for i in the list of columns.

submatrix_from_rows( rows)

Return the submatrix of self of rows row[i] for i in the list of rows.

swap_rows( r1, r2)

Swap rows r1 and r2 of self.

Instances of class Matrix_generic_sparse also have the following special functions:

__getitem__,$  $ __mul__,$  $ __rmul__,$  $ __setitem__

Further documentation:

__getitem__( ij)

USAGE: A[i, j] - the i,j of A, and A[i] - the i-th row of A.

__setitem__( ij, value)

USAGE: A[i, j] = value - set the (i,j) entry of A A[i] = value - set the ith row of A

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