commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raviv Granot <>
Subject Re: [MATH] Sparse Matrix - visiting all entries
Date Tue, 17 Aug 2010 16:13:18 GMT
Thanks for the info. I will definitely check the Mahout option.

One more comment about the commons.math library. I noticed that the
implementation for
Sparse Vecotr (OpenMapRealVecotr) provides a method "sparseIteration()",
is what I'm looking for in the Matrix implementation. Changing my design a
little bit,
I can work with a map/list of sparse vectors instead of a matrix. However,
it seems there's
still one important functionality that is missing. How can you iterate over
the non-zero
indices efficiently? sparseIteration() iterates over the elements, but can
you know which
index each element belongs to?
I know I can use the "getData()" method to get a double array where every
index maps to an element, but then again, it's the same problem of being
very inefficient.

Any ideas would be very appreciated.


On Tue, Aug 17, 2010 at 9:24 AM, Ted Dunning <> wrote:

> Apache Mahout also has a matrix package with sparse matrix support.  In
> particular, iterateNonZero is supported and there are multiple sparse
> vector/matrix formats that provide different performance trade-offs.
> Our purpose is not necessarily to be a general purpose math package and the
> system is still somewhat in flux so there is a good chance that Mahout Math
> isn't what you need.  On the other hand, because Mahout is much less
> mature,
> changes are much easier to push through.  Commons Math has a fairly strict
> back compatibility policy that means that changes such as you want can take
> a very long time even for trunk.
> On Tue, Aug 17, 2010 at 5:49 AM, Raviv Granot <>
>  wrote:
> > Hi,
> > I see 2 implementations of sparse matrix in the math.commons.linear
> > library.
> >
> > 1. OpenMapRealMatrix
> > 2. SparseFieldMatrix
> > Both are documented as "Sparse matrix implementation based on an open
> > addressed map".
> > Does anyone know what are the differences between the two? also, which
> > method should I use to iterate only
> > over the non zero elements? it seems that the WalkInRawOrder method runs
> > over the entire row-length x col-length,
> > the same as for RealMatrix.
> >
> > Thanks in advance!
> >
> > Raviv
> >

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message