/// <summary> /// Tests solve Ax = b from A and b. /// </summary> public virtual void solveVector() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final CholeskyDecompositionResult result = CDOG.apply(A5); 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)); ArrayAsserts.assertArrayEquals("Cholesky decomposition OpenGamma - solve", b, ax.toArray(), 1.0E-10); }
/// <summary> /// Tests solve AX = B from A and B. /// </summary> public virtual void solveMatrix() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final CholeskyDecompositionResult result = CDOG.apply(A5); CholeskyDecompositionResult result = CDOG.apply(A5); double[][] b = new double[][] { new double[] { 1.0, 2.0 }, new double[] { 2.0, 3.0 }, new double[] { 3.0, 4.0 }, new double[] { 4.0, -2.0 }, new double[] { -1.0, -1.0 } }; DoubleMatrix x = result.solve(DoubleMatrix.copyOf(b)); DoubleMatrix ax = (DoubleMatrix)ALGEBRA.multiply(A5, x); ArrayAsserts.assertArrayEquals("Cholesky decomposition OpenGamma - solve", b[0], ax.rowArray(0), 1.0E-10); ArrayAsserts.assertArrayEquals("Cholesky decomposition OpenGamma - solve", b[1], ax.rowArray(1), 1.0E-10); }