use of jmbench.matrix.RowMajorMatrix in project Java-Matrix-Benchmark by lessthanoptimal.
the class SvdAccuracy method createMatrix.
@Override
protected void createMatrix(int m, int n) {
int o = Math.min(m, n);
int numS = rand.nextInt(o);
while (numS == 0) {
numS = rand.nextInt(o);
}
// System.out.println("Matrix size = ("+m+" , "+n+" )");
RowMajorMatrix U = RowMajorOps.createOrthogonal(m, m, rand);
RowMajorMatrix V = RowMajorOps.createOrthogonal(n, n, rand);
// randomly generate singular values and put into ascending order
sv = new double[o];
for (int i = 0; i < numS; i++) sv[i] = -rand.nextDouble() * maxMag;
Arrays.sort(sv);
for (int i = 0; i < numS; i++) sv[i] = -sv[i];
A = SolverCommon.createMatrix(U, V, sv);
}
use of jmbench.matrix.RowMajorMatrix in project Java-Matrix-Benchmark by lessthanoptimal.
the class AccuracyTestBase method evaluateTestCase.
protected void evaluateTestCase() {
reason = OutputError.NO_ERROR;
foundResult = Double.NaN;
RowMajorMatrix[] inputs = createInputs();
BenchmarkMatrix[] inputsB = new BenchmarkMatrix[inputs.length];
BenchmarkMatrix[] outputB = new BenchmarkMatrix[getNumOutputs()];
for (int i = 0; i < inputs.length; i++) {
inputsB[i] = factory.convertToLib(inputs[i]);
}
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]);
processResults(inputs, results);
}
use of jmbench.matrix.RowMajorMatrix in project Java-Matrix-Benchmark by lessthanoptimal.
the class EigSymmAccuracy method processResults.
@Override
protected void processResults(RowMajorMatrix[] inputs, RowMajorMatrix[] results) {
RowMajorMatrix D = results[0];
RowMajorMatrix V = results[1];
if (RowMajorOps.hasUncountable(D) || RowMajorOps.hasUncountable(V)) {
reason = OutputError.UNCOUNTABLE;
return;
}
RowMajorOps.mult(A, V, L);
RowMajorOps.mult(V, D, R);
foundResult = StabilityBenchmark.residualError(L, R);
}
use of jmbench.matrix.RowMajorMatrix in project Java-Matrix-Benchmark by lessthanoptimal.
the class EigSymmAccuracy method createMatrix.
@Override
protected void createMatrix(int m, int n) {
A = RowMajorOps.createSymmetric(m, -1, 1, rand);
L = new RowMajorMatrix(m, m);
R = new RowMajorMatrix(m, m);
}
use of jmbench.matrix.RowMajorMatrix in project Java-Matrix-Benchmark by lessthanoptimal.
the class InvSymmAccuracy method createMatrix.
@Override
protected void createMatrix(int m, int n) {
A = RowMajorOps.createSymmPosDef(m, rand);
I_found = new RowMajorMatrix(m, m);
I = RowMajorOps.identity(m);
}
Aggregations