Home | Trees | Index | Help |
|
---|
Package sage :: Package linalg :: Module sparse_matrix |
|
Sparse matrices To create an m x n sparse matrix over a ring R, use the command SparseMatrix(base_ring, nrows, ncols, entries=[]) where entries is a list of 3-tuples (i,j,x). The matrix then has i,j entry equal to x. WARNING: The i,j pairs *must* be distinct. The algorithms assume they are and if they are not, then you will get nonsense.
Classes | |
---|---|
Sparse_matrix_generic |
A generic sparse matrix. |
Sparse_matrix_rational |
A sparse matrix over the rational numbers. |
Sparse_vector_space_generic |
Sparse vector space. |
SparseMatrix |
|
SparseVector |
A generic sparse vector. |
SparseVectorSpace |
Function Summary | |
---|---|
Given a list X of dictionaries and a corresponding list M of Integer moduli (of the same length), use the CRT to make a single dict. | |
Lift A mod m using rational reconstruction. | |
INPUT: X -- nonempty list of SparseVector rows OUTPUT: Sparse_matrix with those rows. | |
Given Matrix_modint's X, this function uses the chinese remainder theorem to create a SparseMatrix over the integers. |
Function Details |
---|
crt_dict(X, M, M2)Given a list X of dictionaries and a corresponding list M of Integer moduli (of the same length), use the CRT to make a single dict. M2 - should be the partial products of elements of M, so M2[i] = M[0] * ... * M[i-1], and M2[0] = 1. This is an optimization. |
rational_reconstruction(A, m, denom_optimization=False)Lift A mod m using rational reconstruction. Given a sparse matrix A over the integers and an integer m, this function uses rational reconstruction element-by-element to try and find a matrix B over the rational numbers that reduces to A modulo m. The entries of B will be uniquely determined by the condition that the numerator and denominator have absolute value at most sqrt(m/2). If no such B exists, this function raises a ValueError. INPUT: A -- SparseMatrix over the integers m -- an integer OUTPUT: B -- SparseMatrix over the rationals |
SparseMatrix_from_rows(X)INPUT: X -- nonempty list of SparseVector rows OUTPUT: Sparse_matrix with those rows. |
SparseMatrix_using_crt(X)Given Matrix_modint's X, this function uses the chinese remainder theorem to create a SparseMatrix over the integers. INPUT: X -- a list of sparse_matrix_pyx.Matrix_modint's modulo coprime moduli. OUTPUT: A single SparseMatrix with integer entries that reduces to all the X[i]. |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Fri Jun 24 17:58:46 2005 | http://epydoc.sf.net |