FreeMat: SPARSE Construct a Sparse Matrix

FreeMat

- Main Page
- Related Pages

SPARSE Construct a Sparse Matrix

Section: Sparse Matrix Support

# Usage

Creates a sparse matrix using one of several formats. The first creates a sparse matrix from a full matrix

       y = sparse(x).

The second form creates a sparse matrix containing all zeros that is of the specified size (the sparse equivalent of `zeros`).

       y = sparse(m,n)

where `m` and `n` are integers. Just like the `zeros` function, the sparse matrix returned is of type `float`. The third form constructs a sparse matrix from the IJV syntax. It has two forms. The first version autosizes the sparse matrix

       y = sparse(i,j,v)

while the second version uses an explicit size specification

       y = sparse(i,j,v,m,n)