This sort of operation should not be done using maps per se.  It should be
done using a sparse matrix implementation (which does, of course, have
operations similar to a map)

The major difference is that the overhead of storing elements must be much,
much lower than the overhead in storing elements in nested maps.

For instance, floating point values should be stored in large dense arrays
of floats or doubles (preferably doubles).  The indexing operations that are
used to find the particular elements can be done in a number of ways, but
one easy way is to keep an array of variable sized arrays of integers each
of which corresponds to the locations of values in the array of floats.  The
overhead of using generic collections usually runs about 40-100 bytes per
entry.  The overhead of a specialized data structure can be as little as 10
bytes or so in a simple implementation and possibly somewhat smaller for
specialized implementations.  This means that sparse matrices can be within
2-4x the size of a dense matrix that has the same number of elements as the
sparse matrix has non-zero elements.

Mahout contains some good, though very basic, matrix code that implements
these sorts of strategies.  See, for instance, SparseRowMatrix.

On Sun, Jul 13, 2008 at 9:39 AM, Robin Anil <[EMAIL PROTECTED]> wrote:

> Nope no difference with FastMap<K,V> i guess i will have to try with the
> primitive
>



-- 
ted

Reply via email to