Next: , Previous: spprod, Up: Function Reference


22.6.0.40 sprand

— Function File: sprand (m, n, d)
— Function File: sprand (s)

Generate a random sparse matrix. The size of the matrix will be m by n, with a density of values given by d. d should be between 0 and 1. Values will be uniformly distributed between 0 and 1.

Note: sometimes the actual density may be a bit smaller than d. This is unlikely to happen for large really sparse matrices.

If called with a single matrix argument, a random sparse matrix is generated wherever the matrix S is non-zero.

     
     
See also: sprandn.