Example usage for org.apache.commons.math.linear DecompositionSolver getInverse

List of usage examples for org.apache.commons.math.linear DecompositionSolver getInverse

Introduction

In this page you can find the example usage for org.apache.commons.math.linear DecompositionSolver getInverse.

Prototype

RealMatrix getInverse() throws InvalidMatrixException;

Source Link

Document

Get the inverse (or pseudo-inverse) of the decomposed matrix.

Usage

From source file:com.stromberglabs.jopensurf.FastHessian.java

private double[] interpolateStep(int r, int c, ResponseLayer t, ResponseLayer m, ResponseLayer b) {
    double[] values = new double[3];

    RealMatrix partialDerivs = getPartialDerivativeMatrix(r, c, t, m, b);
    RealMatrix hessian3D = getHessian3DMatrix(r, c, t, m, b);

    DecompositionSolver solver = new LUDecompositionImpl(hessian3D).getSolver();
    RealMatrix X = solver.getInverse().multiply(partialDerivs);

    //      System.out.println("X = " + X.getColumnDimension() + " col x " + X.getRowDimension() + " rows");
    //      for ( int i = 0; i < X.getRowDimension(); i++ ){
    //         for ( int j = 0; j < X.getColumnDimension(); j++ ){
    //            System.out.print(X.getEntry(i,j) + (j != X.getColumnDimension()-1 ? " - " : ""));
    //         }/* w w  w .jav  a2  s .c om*/
    //         System.out.println();
    //      }
    //      System.out.println();
    //      
    //values of them are used
    //xi
    values[0] = -X.getEntry(2, 0);
    //xr
    values[1] = -X.getEntry(1, 0);
    //xc
    values[2] = -X.getEntry(0, 0);

    return values;
}