Sparse matrices support much of the same set of operations as dense matrices. The following functions are specific to sparse matrices.
Create a sparse matrix S of dimensions m x n such that S[I[k], J[k]] = V[k]. The combine function is used to combine duplicates. If m and n are not specified, they are set to max(I) and max(J) respectively. If the combine function is not supplied, duplicates are added by default.
Create a sparse matrix S of size m x 1 such that S[I[k]] = V[k]. Duplicates are combined using the combine function, which defaults to + if it is not provided. In julia, sparse vectors are really just sparse matrices with one column. Given Julia’s Compressed Sparse Columns (CSC) storage format, a sparse column matrix with one column is sparse, whereas a sparse row matrix with one row ends up being dense.
Create a sparse matrix of size m x 1 where the row values are keys from the dictionary, and the nonzero values are the values from the dictionary.
Returns true if S is sparse, and false otherwise.
Convert a dense matrix A into a sparse matrix.
Convert a dense vector A into a sparse matrix of size m x 1. In julia, sparse vectors are really just sparse matrices with one column.
Convert a sparse matrix S into a dense matrix.
Convert a sparse matrix S into a dense matrix.
Create an empty sparse matrix of size m x n.
Create a sparse identity matrix of specified type of size m x m. In case n is supplied, create a sparse identity matrix of size m x n.
Create a sparse matrix with the same structure as that of S, but with every nonzero element having the value 1.0.
Create a random sparse matrix with the specified density. Nonzeros are sampled from the distribution specified by rng. The uniform distribution is used in case rng is not specified.
Create a random sparse matrix of specified density with nonzeros sampled from the normal distribution.
Create a random sparse boolean matrix with the specified density.
Compute the elimination tree of a symmetric sparse matrix A from triu(A) and, optionally, its post-ordering permutation.