Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-231

User-extendable Abstract RealMatrix implementation

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Labels:
      None
    • Environment:

      Any

      Description

      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
      <-- (AbstractRealMatrixImpl)

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                luc Luc Maisonobe
                Reporter:
                sujitpal Sujit Pal
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: