commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tanguy Yannick" <>
Subject RE: [math] Adding a new class to handle Matrix with 3 columns/rows
Date Tue, 02 Aug 2011 09:00:02 GMT
>> For very big matrix (ie : beyond 500 or 1000 rows/columns), the 
>> computation is faster if you transpose the second matrix and then 
>> multiply. The two inner loops are inversed and it allows a
>> gain for very big matrix (about 40% compared to Commons Math for 
>> 1000x1000 matrix, and 50% compared to the classical triple loop). I 
>> guess that it's faster for the JVM to access the matrix coefficients 
>> in the computer's memory.
>For large matrices, did you compare with BlockRealMatrix ? It was
specially designed to improve caching. This is the >>reason why when you
build a matrix using the various factory methods
MatrixUtils.createRealMatrix (or createFieldMatrix), there is a test
about the dimension and either an Array2DRowRealMatrix or a
BlockRealMatrix is created. The current threshold has been set to 4096
elements, but this was an almost arbitrary choice.

>best regards,

You are right, BlockRealMatrix is even more efficient : 4x faster than
our implementation, and 6x faster than the Array2DRowRealMatrix for big


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

View raw message