Search in sources :

Example 1 with Procrustes

use of dr.math.Procrustes in project beast-mcmc by beast-dev.

the class ProcrustesTest method runTest.

private void runTest(double[][] X, double[][] Xstar, double[][] goldStandard, boolean allowTranslation, boolean allowDilation, double tolerance, String header) {
    RealMatrix rmX = new Array2DRowRealMatrix(X);
    RealMatrix rmXstar = new Array2DRowRealMatrix(Xstar);
    Procrustes procrustes = new Procrustes(rmX, rmXstar, allowTranslation, allowDilation);
    RealMatrix rmXnew = procrustes.procrustinate(rmX);
    System.out.println(header);
    System.out.print("Translation:\n" + new Matrix(procrustes.getTranslation().getData()));
    System.out.println("Dilation = " + procrustes.getDilation());
    System.out.println("Xnew:");
    System.out.println(new Matrix(rmXnew.getData()));
    assertEquals(rmXnew.getData(), goldStandard, tolerance);
}
Also used : RealMatrix(org.apache.commons.math.linear.RealMatrix) Array2DRowRealMatrix(org.apache.commons.math.linear.Array2DRowRealMatrix) Matrix(dr.math.matrixAlgebra.Matrix) RealMatrix(org.apache.commons.math.linear.RealMatrix) Array2DRowRealMatrix(org.apache.commons.math.linear.Array2DRowRealMatrix) Array2DRowRealMatrix(org.apache.commons.math.linear.Array2DRowRealMatrix) Procrustes(dr.math.Procrustes)

Aggregations

Procrustes (dr.math.Procrustes)1 Matrix (dr.math.matrixAlgebra.Matrix)1 Array2DRowRealMatrix (org.apache.commons.math.linear.Array2DRowRealMatrix)1 RealMatrix (org.apache.commons.math.linear.RealMatrix)1