Search in sources :

Example 6 with RowMajorMatrix

use of jmbench.matrix.RowMajorMatrix in project Java-Matrix-Benchmark by lessthanoptimal.

the class StabilityBenchmark method residualError.

public static double residualError(RowMajorMatrix foundA, RowMajorMatrix expectedA) {
    RowMajorMatrix r = new RowMajorMatrix(foundA.numRows, foundA.numCols);
    RowMajorOps.subtract(foundA, expectedA, r);
    double top = RowMajorOps.normF(r);
    double bottom = RowMajorOps.normF(expectedA);
    return top / bottom;
}
Also used : RowMajorMatrix(jmbench.matrix.RowMajorMatrix)

Example 7 with RowMajorMatrix

use of jmbench.matrix.RowMajorMatrix in project Java-Matrix-Benchmark by lessthanoptimal.

the class StabilityBenchmark method residualErrorMetric.

public static double residualErrorMetric(RowMajorMatrix A, RowMajorMatrix x, RowMajorMatrix b) {
    RowMajorMatrix y = new RowMajorMatrix(b.numRows, b.numCols);
    RowMajorOps.mult(A, x, y);
    return residualError(y, b);
}
Also used : RowMajorMatrix(jmbench.matrix.RowMajorMatrix)

Example 8 with RowMajorMatrix

use of jmbench.matrix.RowMajorMatrix in project Java-Matrix-Benchmark by lessthanoptimal.

the class InvSymmOverflow method checkResults.

@Override
protected boolean checkResults(RowMajorMatrix[] results) {
    RowMajorMatrix A_inv = results[0];
    RowMajorOps.mult(Ascaled, A_inv, I_found);
    double error = StabilityBenchmark.residualError(I_found, I);
    if (error > breakingPoint) {
        reason = OutputError.LARGE_ERROR;
        return false;
    }
    return true;
}
Also used : RowMajorMatrix(jmbench.matrix.RowMajorMatrix)

Example 9 with RowMajorMatrix

use of jmbench.matrix.RowMajorMatrix in project Java-Matrix-Benchmark by lessthanoptimal.

the class InvSymmOverflow method createMatrix.

@Override
protected void createMatrix(int m, int n) {
    A = RowMajorOps.createSymmPosDef(m, rand);
    Ascaled = new RowMajorMatrix(m, m);
    I_found = new RowMajorMatrix(m, m);
    I = RowMajorOps.identity(m);
}
Also used : RowMajorMatrix(jmbench.matrix.RowMajorMatrix)

Example 10 with RowMajorMatrix

use of jmbench.matrix.RowMajorMatrix in project Java-Matrix-Benchmark by lessthanoptimal.

the class SolverAccuracy method evaluateSolver.

private void evaluateSolver() {
    reason = OutputError.NO_ERROR;
    foundResult = Double.NaN;
    BenchmarkMatrix[] inputsB = new BenchmarkMatrix[2];
    BenchmarkMatrix[] outputB = new BenchmarkMatrix[1];
    inputsB[0] = factory.convertToLib(A);
    inputsB[1] = factory.convertToLib(b);
    MatrixProcessorInterface operation = createAlgorithm();
    if (operation == null) {
        reason = OutputError.NOT_SUPPORTED;
        return;
    }
    try {
        operation.process(inputsB, outputB, 1);
    } catch (DetectedException e) {
        reason = OutputError.DETECTED_FAILURE;
        return;
    } catch (Exception e) {
        addUnexpectedException(e);
        reason = OutputError.UNEXPECTED_EXCEPTION;
        return;
    }
    RowMajorMatrix[] results = new RowMajorMatrix[outputB.length];
    for (int i = 0; i < results.length; i++) results[i] = factory.convertToRowMajor(outputB[i]);
    RowMajorMatrix x = results[0];
    if (RowMajorOps.hasUncountable(x)) {
        reason = OutputError.UNCOUNTABLE;
        return;
    }
    foundResult = StabilityBenchmark.residualErrorMetric(A, x, b);
    if (Double.isNaN(foundResult) || Double.isInfinite(foundResult)) {
        reason = OutputError.LARGE_ERROR;
        return;
    }
}
Also used : DetectedException(jmbench.interfaces.DetectedException) MatrixProcessorInterface(jmbench.interfaces.MatrixProcessorInterface) RowMajorMatrix(jmbench.matrix.RowMajorMatrix) BenchmarkMatrix(jmbench.interfaces.BenchmarkMatrix) DetectedException(jmbench.interfaces.DetectedException)

Aggregations

RowMajorMatrix (jmbench.matrix.RowMajorMatrix)29 BenchmarkMatrix (jmbench.interfaces.BenchmarkMatrix)6 DetectedException (jmbench.interfaces.DetectedException)5 MatrixProcessorInterface (jmbench.interfaces.MatrixProcessorInterface)5 DenseMatrix (jeigen.DenseMatrix)1 DMatrixRMaj (org.ejml.data.DMatrixRMaj)1 SimpleMatrix (org.ejml.simple.SimpleMatrix)1