Next: , Previous: spdiags, Up: Function Reference


22.6.0.28 speye

— Function File: y = speye (m)
— Function File: y = speye (m, n)
— Function File: y = speye (sz)

Returns a sparse identity matrix. This is significantly more efficient than sparse (eye (m)) as the full matrix is not constructed.

Called with a single argument a square matrix of size m by m is created. Otherwise a matrix of m by n is created. If called with a single vector argument, this argument is taken to be the size of the matrix to create.