ShermanMorrisonMatrixUpdateFunction implements NewtonRootFinderMatrixUpdateFunction { @Override public DoubleMatrix2D getUpdatedMatrix(final Function1D<DoubleMatrix1D, DoubleMatrix2D> g, DoubleMatrix1D x, final DoubleMatrix1D deltaX, final DoubleMatrix1D deltaY, final DoubleMatrix2D matrix) { Validate.notNull(deltaX); Validate.notNull(deltaY); Validate.notNull(matrix); DoubleMatrix1D v1 = (DoubleMatrix1D) _algebra.multiply(deltaX, matrix); final double length = _algebra.getInnerProduct(v1, deltaY); if (length == 0) { return matrix; } v1 = (DoubleMatrix1D) _algebra.scale(v1, 1. / length); final DoubleMatrix1D v2 = (DoubleMatrix1D) _algebra.subtract(deltaX, _algebra.multiply(matrix, deltaY)); final DoubleMatrix2D m = _algebra.getOuterProduct(v2, v1); return (DoubleMatrix2D) _algebra.add(matrix, m); } ShermanMorrisonMatrixUpdateFunction(final MatrixAlgebra algebra); @Override DoubleMatrix2D getUpdatedMatrix(final Function1D<DoubleMatrix1D, DoubleMatrix2D> g, DoubleMatrix1D x, final DoubleMatrix1D deltaX, final DoubleMatrix1D deltaY, final DoubleMatrix2D matrix);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullDeltaX() { UPDATE.getUpdatedMatrix(J, V, null, V, M); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullDeltaY() { UPDATE.getUpdatedMatrix(J, V, V, null, M); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullMatrix() { UPDATE.getUpdatedMatrix(J, V, V, V, null); }