commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luc Maisonobe <>
Subject Re: [math] Re: commons-math, matrix-toolkits-java and consolidation
Date Thu, 21 May 2009 16:03:23 GMT
Sam Halliday a ├ęcrit :
> Regarding the name of ArrayRealMatrix. Please don't forget to include the
> "2DRow" part to the name (indicating a 2D array which is Row ordered) to
> indicate the implementation type. Post 2.0 I'll convince you that a 1D Array
> approach is best as it will lead to more efficient use of BLAS and therefore
> reproducibility of reference algorithms from, e.g. the Templates project on
> netlib ;-)
> I've never seen a storage type like BlockRealMatrix before... I'm interested
> in seeing where it performs better than, say, a full 1D representation of a
> dense matrix. Breaking up the storage like this makes it very difficult to
> use BLAS/LAPACK internally.

This is a simple approach I tried based on cache considerations. It is a
compromise that works well when some algorithms are row oriented, others
are column oriented and still others are mixed (like multiplication). It
does improve multiplication time with respect to RealMatrixImpl for
example on matrices larger than 100x100, but it may need adapting block
size depending on target.

A more complex example is given in a paper by Siddhartha Chatterjee,
Alvin R. Lebeck, Praveen K. Patnala and Mithuna Thottethodi: Recursive
Array Layouts and Fast Matrix Multiplication
<>. I have tried this
approach too (using the Gray-Morton space-filling curve) but the gain
was not worth the pain. This attempt was not completed for this reason,
but it is still available in the experimental directory in the
repository, it is the RecursiveLayoutRealMatrix class. Maybe it can be
resurrected later, once completed and optimized.

> Luc Maisonobe wrote:
>>> - I discourage the use of the classes named *Impl. They will get very
>>> confusing when other implementations are added later! Instead, I
>>> recommend
>>> the names ArrayRealVector, Array2DRowRealMatrix (to indicate a 2D array
>>> backed implementation using row ordering). This allows a column-based or
>>> 1D
>>> implementation in the future without names getting very confusing. These
>>> implementations are hidden from users who just use the MatrixUtils help
>> Phil suggested to change RealMatrixImpl to ArrayRealMatrix (and
>> DenseRealMatrix to BlockRealMatrix). This sounds good to me.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message