Type: New Feature
Affects Version/s: 2.0
Fix Version/s: 2.0
Many algorithms are described using Matrices. In some situations, the Matrices for applications are too large to fit into memory, so it makes sense to use custom implementations that are backed by a sparse map or list, or backed by Lucene indexes or database tables, etc. This allows the algorithm implementations (in the application) to be clean and mimic the algorithm itself, making it easy to understand and debug.
However, the only way to make a custom implementation currently is to implement RealMatrix, and to implement all its methods, or to extend and override methods in RealMatrixImpl. The former involves a knowledge of matrix operations, which is not guaranteed for people who are business programmers (which may be the reason they are using commons-math in the first place). The latter involves looking at the existing code and making the overrides where needed, again something that is not expected from a commons-math user. A simpler way would be to have something generic mostly built, except the getEntry() and setEntry() methods which would be declared abstract and hence meant to be overriden, and all the other methods to be pre-built based on getEntry() and setEntry().
This would make the creation of custom matrices very flexible, and would also remove the burden of providing "common matrix impls" from the commons-math project, since clients can very simply create custom versions of their own.
I suggest the following:
<<RealMatrix.java>> <-- RealMatrixImpl
The SparseRealMatrixImpl I contributed in
MATH-230 could be a user-defined custom subclass of AbstractRealMatrixImpl and not have to belong to the commons-math project at all. Or it could be included as an example if there is enough need.