Search in sources :

Example 1 with SolverTask

use of org.ojalgo.matrix.task.SolverTask in project ojAlgo by optimatika.

the class DesignCase method testSolveIdentity.

@Test
public void testSolveIdentity() {
    final Access2D<?> tmpIdentity = MatrixStore.PRIMITIVE.makeIdentity(9).get();
    final Access2D<?> tmpRandom = PrimitiveDenseStore.FACTORY.makeFilled(9, 1, new Uniform());
    final List<MatrixDecomposition<Double>> tmpAllDecomps = MatrixDecompositionTests.getAllPrimitive();
    for (final MatrixDecomposition<Double> tmpDecomp : tmpAllDecomps) {
        if (tmpDecomp instanceof SolverTask) {
            final SolverTask<Double> tmpSolverTask = (SolverTask<Double>) tmpDecomp;
            try {
                TestUtils.assertEquals(tmpDecomp.getClass().toString(), tmpRandom, tmpSolverTask.solve(tmpIdentity, tmpRandom));
            } catch (final RecoverableCondition xcptn) {
                TestUtils.fail(tmpDecomp.getClass().toString() + " " + xcptn.getMessage());
            }
        }
    }
}
Also used : RecoverableCondition(org.ojalgo.RecoverableCondition) SolverTask(org.ojalgo.matrix.task.SolverTask) Uniform(org.ojalgo.random.Uniform) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 RecoverableCondition (org.ojalgo.RecoverableCondition)1 SolverTask (org.ojalgo.matrix.task.SolverTask)1 Uniform (org.ojalgo.random.Uniform)1