speye
Sparse identity matrix.
📝Syntax
S = speye()
S = speye(n)
S = speye(n, m)
S = speye(sz)
📥Input Arguments
Parameter Description
n, m dimension sizes: nonnegative integer scalar.
sz dimension sizes: two-element row vector.
📤Output Arguments
Parameter Description
S a sparse matrix.
📄Description

S = speye() returns a sparse scalar 1.

S = speye(n) returns a sparse n-by-n identity matrix, with ones on the main diagonal.

S = speye(n, m) returns a sparse n-by-m matrix, with ones on the main diagonal.

S = speye(sz) returns a matrix with ones on the main diagonal.

💡Examples
tic();S = speye(5000, 5000);toc()
tic();S = sparse(eye(5000, 5000));toc()
    
🔗See Also
sparse
🕔Version History
Version Description
1.0.0 initial version
Edit this page on GitHub