GeoTools : Change from vecmath to EJML

Contact:

tyler

Tracker:

GEOT-22 - replace use of vecmath with an open alternative ( Reopened)

Tagline:

matrix magic
Branch:https://github.com/geotools/geotools/tree/matrix

Children:

Description

We have a long standing technical debt to Replace Vecmath (see link for technical and license reasons). The EJML has been suggested as a good alternative for the project. This task is a blocker for Publish to Maven Central Repository and will need to be resolved for GeoGig and uDig incubation with LocationTech.

We have two uses of vecmath:

  • As a data structure GeneralMatrix (which extends GMatrix) with the operations that are used are multiply, invert, negate, and transform.
  • Delegating to Matrix3d multiply and Matrix4d.muiltiply

References:

Status

This proposal is under construction.

Voting has not started yet:

Tasks

This section is used to make sure your proposal is complete (did you remember documentation?) and has enough paid or volunteer time lined up to be a success

 

no progress

(tick)

done

(error)

impeded

(warning)

lack mandate/funds/time

(question)

volunteer needed

  1. Bench mark reprojection performance
  2. Add dependency on EJML and use SimpleMatrix for the two cases where we need to delegate a 3D and 4D Matrix
  3. Change GeneralMatrix to delegate to DenseMatrix64F (using SimpleMatrix / BaseMatrix as a guide on how to do this).
    1. It is tempting to extend BaseMatrix, but it always creates a new matrix
  4. Implement the XMatrix and Matrix (for method compatibility) using the DenseMatrix64F delegate
  5. Benchmark again to ensure we do not have a performance regression
  6. No documentation changes are expected, but we should warn users in the update instructions

API Changes

GeneralMatrix

BEFORE:

public class GeneralMatrix extends GMatrix implements XMatrix {
    public GeneralMatrix(final int size) {
        super(size, size);
    }
    public GeneralMatrix(final int numRow, final int numCol) {
        super(numRow, numCol);
    }
    // public void invert() provided by superclass
}

AFTER:

public class GeneralMatrix implements XMatrix {
    DenseMatrix64F mat;
    public GeneralMatrix(final int size) {
        super(size, size);
    }
    public GeneralMatrix(final int numRow, final int numCol) {
        mat = new DenseMatrix64F( numRows, numCol);
    }
    // invert matrix in place (no copy)
    public void invert() {
        if( !CommonOps.invert(mat,mat) ) {
            throw new SingularMatrixException();
        }
   }
   ...
}

Documentation Changes

No documentation changes are expected.