The following functions access basic properties of sparse matrices.
Given a sparse matrix A with entries lying in a ring R, return R.
Given an m x n sparse matrix A, return m, the number of rows of A.
Given an m x n sparse matrix A, return n, the number of columns of A.
Given a sparse matrix A over the ring R having m rows and n columns, return the entries of A as a sequence of all tuples of the form <i, j, x> such that the [i, j]-th entry of A equals x and x is non-zero. It is always true that SparseMatrix(Nrows(A), Ncols(A), Eltseq(A)) equals A.
Given a sparse matrix A, return the number of non-zero entries in A.
Given a sparse matrix A, return the density of A as a real number, which is the number of non-zero entries in A divided by the product of the number of rows of A and the number of columns of A (or zero if A has zero rows or columns).
Given a sparse matrix A having r rows, and an integer i such that 1≤i≤r, return the support of row i of A; i.e., the column numbers of the non-zero entries of row i of A.
Given a sparse matrix A, return the sequence of all pairs <i, j> such that the [i, j]-th entry of A is non-zero.
Given a sparse matrix A with m rows and an integer i such that 1≤i≤m, return the weight (number of non-zero entries) of the i-th row of A.
Given a sparse matrix A with m rows, return the length m sequence of integers whose i-th entry is the weight of the i-th row of A.
Given a sparse matrix A with n columns and an integer j such that 1≤j≤n, return the weight (number of non-zero entries) of the j-th column of A.
Given a sparse matrix A with n columns, return the length n sequence of integers whose j-th entry is the weight of the j-th column of A.