use of org.ojalgo.type.context.NumberContext in project ojAlgo by optimatika.
the class BidiagonalTest method testComplexSquareCase.
@Test
public void testComplexSquareCase() {
final PhysicalStore<ComplexNumber> tmpOriginal = MatrixUtils.makeRandomComplexStore(4, 4);
final Bidiagonal<ComplexNumber> tmpDecomposition = Bidiagonal.COMPLEX.make();
tmpDecomposition.decompose(tmpOriginal);
final MatrixStore<ComplexNumber> tmpReconstructed = tmpDecomposition.reconstruct();
final MatrixStore<ComplexNumber> tmpQ1 = tmpDecomposition.getQ1();
final MatrixStore<ComplexNumber> tmpD = tmpDecomposition.getD();
final MatrixStore<ComplexNumber> tmpQ2 = tmpDecomposition.getQ2();
if (MatrixDecompositionTests.DEBUG) {
BasicLogger.debug();
BasicLogger.debug(tmpDecomposition.toString());
BasicLogger.debug("Original", tmpOriginal);
BasicLogger.debug("Q1", tmpQ1);
BasicLogger.debug("D", tmpD);
BasicLogger.debug("Q2", tmpQ2);
BasicLogger.debug("Reconstructed", tmpReconstructed);
BasicLogger.debug("Q1 orthogonal (left)", tmpQ1.conjugate().multiply(tmpQ1));
BasicLogger.debug("Q1 orthogonal (right)", tmpQ1.multiply(tmpQ1.conjugate()));
BasicLogger.debug("Q2 orthogonal (left)", tmpQ2.conjugate().multiply(tmpQ2));
BasicLogger.debug("Q2 orthogonal (right)", tmpQ2.multiply(tmpQ2.conjugate()));
}
TestUtils.assertEquals(tmpOriginal, tmpDecomposition, new NumberContext(7, 4));
TestUtils.assertEquals(tmpOriginal, tmpReconstructed, new NumberContext(7, 6));
}
use of org.ojalgo.type.context.NumberContext in project ojAlgo by optimatika.
the class LargerCholeskyCase method setUp.
@BeforeEach
@Override
public void setUp() {
DEFINITION = new NumberContext(7, 4);
EVALUATION = new NumberContext(7, 3);
myBigAB = LargerCholeskyCase.getOriginal();
final Cholesky<BigDecimal> tmpCholesky = Cholesky.BIG.make();
tmpCholesky.decompose(BigDenseStore.FACTORY.copy(myBigAB));
myBigAA = RationalMatrix.FACTORY.copy(tmpCholesky.getL());
myBigAX = myBigAA.transpose();
myBigI = BasicMatrixTest.getIdentity(myBigAA.countRows(), myBigAA.countColumns(), DEFINITION);
myBigSafe = BasicMatrixTest.getSafe(myBigAA.countRows(), myBigAA.countColumns(), DEFINITION);
super.setUp();
}
use of org.ojalgo.type.context.NumberContext in project ojAlgo by optimatika.
the class P20030422Case method setUp.
@BeforeEach
@Override
public void setUp() {
DEFINITION = new NumberContext(7, 6);
EVALUATION = new NumberContext(7, 3);
myBigAA = P20030422Case.getProblematic();
myBigAX = BasicMatrixTest.getIdentity(myBigAA.countColumns(), myBigAA.countColumns(), DEFINITION);
myBigAB = myBigAA;
myBigI = BasicMatrixTest.getIdentity(myBigAA.countRows(), myBigAA.countColumns(), DEFINITION);
myBigSafe = BasicMatrixTest.getSafe(myBigAA.countRows(), myBigAA.countColumns(), DEFINITION);
super.setUp();
}
use of org.ojalgo.type.context.NumberContext in project ojAlgo by optimatika.
the class P20061119Case method setUp.
@Override
@BeforeEach
public void setUp() {
DEFINITION = new NumberContext(7, 2);
EVALUATION = NumberContext.getGeneral(8).newPrecision(14);
myBigAA = P20061119Case.getProblematic();
myBigAX = BasicMatrixTest.getIdentity(myBigAA.countColumns(), myBigAA.countColumns(), DEFINITION);
myBigAB = myBigAA;
myBigI = BasicMatrixTest.getIdentity(myBigAA.countRows(), myBigAA.countColumns(), DEFINITION);
myBigSafe = BasicMatrixTest.getSafe(myBigAA.countRows(), myBigAA.countColumns(), DEFINITION);
super.setUp();
}
use of org.ojalgo.type.context.NumberContext in project ojAlgo by optimatika.
the class StandardType method wholePercentage.
public static NumberContext wholePercentage() {
final NumberContext retVal = NumberContext.getPercent(2, Locale.getDefault());
retVal.format(0.01);
return retVal;
}
Aggregations