0
$\begingroup$

I can store the zero matrix (=module morphism) $R^2\overset{a}{\leftarrow} R^3$ as a=SparseArray[{},{2,3}]. But

  • $R^0\overset{a}{\leftarrow} R^3$ stored as a=SparseArray[{},{0,3}],
  • $R^2\overset{a}{\leftarrow} R^0$ stored as a=SparseArray[{},{2,0}],
  • $R^0\overset{a}{\leftarrow} R^0$ stored as a=SparseArray[{},{0,0}],

is no longer a SparseArray and contains no info about the dimensions of $a$. How can I remedy this?

$\endgroup$
  • $\begingroup$ Is there no other way than to store the dimensions in a separate list? $\endgroup$ – Leo Sep 4 '18 at 16:36
  • 2
    $\begingroup$ Mathematica represents tensors as nested lists. This means that representing zero-dimensional ones is not possible. 1x0 would be {{}} but 0x1 or similar is not possible (when a result would be this it usually gives us {}, a length-0 1-index tensor). While this applies to non-sparse arrays, it seems that it's SparseArray data structure stays consistent with this. $\endgroup$ – Szabolcs Sep 4 '18 at 16:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.