> >> 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 significant >> 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, >Luc You are right, BlockRealMatrix is even more efficient : 4x faster than our implementation, and 6x faster than the Array2DRowRealMatrix for big Matrix... Yannick --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org