Conversion to and from Dense Matrices#

The following functions convert between sparse matrices and normal (dense-representation) matrices.

Matrix(A): MtrxSprs -> Mtrx#

Given a sparse matrix \(A\), return the normal (dense-representation) matrix equal to \(A\). This function should only be used if the size of \(A\) is reasonably small since otherwise the amount of memory needed to represent the dense-representation matrix may be huge. Printing the result of this operation is a convenient way to display \(A\) as a normal (dense) matrix if \(A\) is small.

SparseMatrix(A): Mtrx -> MtrxSprs#

Given a normal (dense-representation) matrix \(A\), return the sparse matrix equal to \(A\). Note that if there is a fast algorithm available for the sparse matrix type, there is no need to convert a dense-representation matrix to the sparse matrix type first and then to use that algorithm, since Magma does this automatically.