A generalization of the function diag
.
Called with a single input argument, the nonzero diagonals d of A are extracted.
With two arguments the diagonals to extract are given by the vector d.
The other two forms of spdiags
modify the input matrix by replacing
the diagonals. They use the columns of v to replace the diagonals
represented by the vector d. If the sparse matrix A is
defined then the diagonals of this matrix are replaced. Otherwise a
matrix of m by n is created with the diagonals given by the
columns of v.
Negative values of d represent diagonals below the main diagonal, and positive values of d diagonals above the main diagonal.
For example:
spdiags (reshape (1:12, 4, 3), [-1 0 1], 5, 4) ⇒ 5 10 0 0 1 6 11 0 0 2 7 12 0 0 3 8 0 0 0 4
See also: diag.
Package: octave