[email protected] a écrit : > Author: luc > Date: Fri Dec 19 15:59:38 2008 > New Revision: 728185 > > URL: http://svn.apache.org/viewvc?rev=728185&view=rev > Log: > added a new DenseRealMatrix class intended to replace RealMatrixImpl > this class is more cache-friendly as it stores data from squares blocks > in flattened arrays. This allows algorithms that need cross-direction > navigation like multiplication or transpose) to be more efficient on > modern processors. > > Added: > > commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseRealMatrix.java > (with props) > > commons/proper/math/trunk/src/test/org/apache/commons/math/linear/DenseRealMatrixTest.java > (with props) > Modified: > > commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixUtils.java > > commons/proper/math/trunk/src/test/org/apache/commons/math/linear/MatrixUtilsTest.java
This new class is part of the ongoing work to improve again the performances of the linear algebra package. It addresses an issue raised by Ted some weeks ago about the basic storage used by RealMatrixImpl, which is a simple double[][] with a direct mapping for for rows and columns (i.e. m(i, j) is stored in m.data[i][j]). The new DenseRealMatrix tries to be more cache-friendly. The matrix is split in square blocks (32x32 blocks currently) except the blocks on the right and bottom sides which may be smaller. Each block is flattened in row major order in an array. These arrays are therefore 1024 elements long for regular blocks, and smaller for border blocks. Most algorithms can be organized to process each block completely before needing to load the next block in memory. This is were the performance gain occurs. I have implemented only some of the basic algorithms yet (addition, subtraction, multiplication, transpose, extraction of submatrix). I will continue this work for most of the methods from the RealMatrix interface, and also for the various decomposition classes. If some of you want to have a look at this class, I'll appreciate any comments. Luc --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
