Qurak

Linear algebra sparse arrays sparsearray data format

Tutorial 2 steps, run in order in one session. Every step was executed against the engine and the output below is what it produced.

Step 1
sp = SparseArray[{{1, 1} -> a11, {1, 3} -> a13, {2, 1} -> a21,
	{2, 4} -> a24, {3, 2} -> a32, {3, 3} -> a33}, {3, 4}];
sp//MatrixForm
Output
MatrixForm[SparseArray[Automatic, {3, 4}, 0, {1, {{0, 2, 4, 6}, {{1}, {3}, {1}, {4}, {2}, {3}}}, {a11, a13, a21, a24, a32, a33}}]]
Step 2
sp//InputForm
Output
InputForm[SparseArray[Automatic, {3, 4}, 0, {1, {{0, 2, 4, 6}, {{1}, {3}, {1}, {4}, {2}, {3}}}, {a11, a13, a21, a24, a32, a33}}]]

Functions used

Related recipes

All recipes · Function reference · Use this from an MCP client