Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

speye - Sparse identity matrix

Syntax

S = speye(m,n)
S = speye(n)

Description

S = speye(m,n) forms an m-by-n sparse matrix with 1s on the main diagonal.

S = speye(n) abbreviates speye(n,n).

Examples

I = speye(1000) forms the sparse representation of the 1000-by-1000 identity matrix, which requires only about 16 kilobytes of storage. This is the same final result as I = sparse(eye(1000,1000)), but the latter requires eight megabytes for temporary storage for the full representation.

See Also

spalloc, spones, spdiags, sprand, sprandn

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS