I have data in the form of a sparse array of lists. For example:
{{76, 17} -> {17803}, {24, 14} -> {18625, 311571, 440371, 818848,
2010244, 2317818}, {64, 99} -> {19421, 269349, 397997, 440343,
503977, 511172, 1600938, 1656131, 1849185, 1849187, 1974513,
2045184, 2065062, 2319929}}
The indices are pairs of integers in the range {0,...,S}^2
.
It seems as it is not possible to store this as a sparse array in Mathematica, as I get the error
SparseArray::valnl: "The value specified by the rule {76,17}->{17803} should not be a List. "
How would I create an object which provides:
- quick access to the list corresponding to an entry - for example something like
a[[i,j]]
(default is the empty list). - create a (dense) matrix with the largest list element (default 0)
- create a (dense) matrix with the largest list element not bigger than a given constant
Update: Example regarding the last point. If the constant would be 500000, than the entry for {76,17}
should be 17803
, for {24,14}
440371
, for {64,99}
440343
and for all other it should be 0.
Dispatch
it can be really fast. 2)and 3) are not clear to me. $\endgroup$