S = speye(sz) returns a matrix with ones on
the main diagonal and zeros elsewhere. The size vector sz defines
size(S). For example, speye([2 3]) returns a 2-by-3
matrix.
Create a 1000-by-1000 square sparse identity matrix and view the sparsity pattern.
I = speye(1000);
spy(I)
The result is the same as sparse(eye(1000)), but this latter version requires temporary storage for the full representation before it is converted to sparse storage.