Navigation

Operators and Keywords

Function List:

C++ API

: sprand (m, n, d)
: sprand (m, n, d, rc)
: sprand (s)

Generate a sparse matrix with uniformly distributed random values.

The size of the matrix is mxn with a density of values d. d must be between 0 and 1. Values will be uniformly distributed on the interval (0, 1).

If called with a single matrix argument, a sparse matrix is generated with random values wherever the matrix s is nonzero.

If called with a scalar fourth argument rc, a random sparse matrix with reciprocal condition number rc is generated. If rc is a vector, then it specifies the first singular values of the generated matrix (length (rc) <= min (m, n)).

See also: sprandn, sprandsym, rand.

Package: octave