### Question:
CholeskyDecompositionOpenGamma implements Decomposition<CholeskyDecompositionResult> { @Override public CholeskyDecompositionResult apply(DoubleMatrix x) { return evaluate(x, DEFAULT_SYMMETRY_THRESHOLD, DEFAULT_POSITIVITY_THRESHOLD); }  @Override CholeskyDecompositionResult apply(DoubleMatrix x); CholeskyDecompositionResult evaluate(DoubleMatrix matrix, double symmetryThreshold, double positivityThreshold); static final double DEFAULT_SYMMETRY_THRESHOLD; static final double DEFAULT_POSITIVITY_THRESHOLD; }### Answer:
@Test public void testNullObjectMatrix() { assertThatIllegalArgumentException() .isThrownBy(() -> CDOG.apply((DoubleMatrix) null)); }
@Test public void recoverOrginal() { final CholeskyDecompositionResult result = CDOG.apply(A3); final DoubleMatrix a = (DoubleMatrix) ALGEBRA.multiply(result.getL(), result.getLT()); checkEquals(A3, a); }
@Test public void solveVector() { final CholeskyDecompositionResult result = CDOG.apply(A5); double[] b = new double[] {1.0, 2.0, 3.0, 4.0, -1.0}; double[] x = result.solve(b); DoubleArray ax = (DoubleArray) ALGEBRA.multiply(A5, DoubleArray.copyOf(x)); assertThat(ax.toArray()).usingComparatorWithPrecision(1e-10).containsExactly(b); }
@Test public void solveMatrix() { final CholeskyDecompositionResult result = CDOG.apply(A5); double[][] b = new double[][] {{1.0, 2.0}, {2.0, 3.0}, {3.0, 4.0}, {4.0, -2.0}, {-1.0, -1.0}}; DoubleMatrix x = result.solve(DoubleMatrix.copyOf(b)); DoubleMatrix ax = (DoubleMatrix) ALGEBRA.multiply(A5, x); assertThat(ax.rowArray(0)).usingComparatorWithPrecision(1e-10).containsExactly(b[0]); assertThat(ax.rowArray(1)).usingComparatorWithPrecision(1e-10).containsExactly(b[1]); }
@Test public void compareCommon() { final CholeskyDecompositionResult resultOG = CDOG.apply(A3); final CholeskyDecompositionResult resultC = CDC.apply(A3); checkEquals(resultC.getL(), resultOG.getL()); checkEquals(ALGEBRA.getTranspose(resultC.getL()), resultOG.getLT()); assertThat(resultOG.getDeterminant()).isCloseTo(resultC.getDeterminant(), offset(1e-10)); }