Re: Sparse matrices in Common Lisp? (with 3 dimentions)



On 2007-06-09 04:31:10 -0400, "Alex Mizrahi" <udodenko@xxxxxxxxxxxxxxxxxxxxx> said:

hash-tables are designed to work with imperfect hash functions, each bucket
can contain more than one key, and implementation will compare keys with
EQUAL when finds appropriate bucket. i think that's quite OK until count of
non-zero entries in matrix is less or comparable with most-positive-fixnum.
dimension limit, as well as dimension count can be arbitrary.

As you say, it depends on how many non-zero's we have, but for a 3d array - which is what the OP asked about - if each dimension is most-positive-fixnum, a density of (/ (expt most-positive-fixnum 2)) - which is quite sparse indeed - already gives us most-positive fixnum non-zero entries.

.