spZeros#

Purpose#

Creates a sparse matrix containing no non-zero values.

Format#

y = spZeros(r, c)#
Parameters:
  • r (scalar) – rows of output matrix.

  • c (scalar) – columns of output matrix.

Returns:

y (RxC sparse matrix) – sparse matrix containing no non-zero values.

Examples#

sparse matrix y;

// Create a 4x3 sparse matrix with all elements set to 0
y = spZeros(4, 3);

// Create a dense matrix with the same values as 'y'
d = spToDense(y);

The contents of d are equal to:

0 0 0
0 0 0
0 0 0
0 0 0

Remarks#

Since sparse matrices are strongly typed in GAUSS, y must be defined as a sparse matrix before the call to spZeros().

See also

Functions spOnes(), spEye()