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;
}
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);
}
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;
}
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);
}
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;
}
}
Aggregations