If I have a matrix:
row 1)1 0 0 4
row 2)0 0 0 0
row 3)5 1 0 0
row 4)0 5 0 0
row 5)0 0 0 9
How would I put it in a sparse matrix format:
a(0)(0) = ? a(0)(1) = ? a(0)(2) = ?
a(1)(0) = ? a(1)(1) = ? a(1)(2) = ?
a(2)(0) = ? a(2)(1) = ? a(2)(2) = ?
a(3)(0) = ? a(3)(1) = ? a(3)(2) = ?
a(4)(0) = ? a(4)(1) = ? a(4)(2) = ?
a(5)(0) = ? a(5)(1) = ? a(5)(2) = ?
I've tried looking on the internet but I couldn't find any help telling me how to do it.
SparseArray[]
to your original matrix to get the sparse form, e.g.SparseArray[IdentityMatrix[4]]
. $\endgroup$