@Test
public void test2() {

  // Test matrix from Nicholas Higham's paper at http://eprints.ma.man.ac.uk/1199/01/covered/MIMS_ep2008_116.pdf
  double[][] values = new double[3][];
  values[0] = new double[]{1, -1, 1};
  values[1] = new double[]{-1, 1, -1};
  values[2] = new double[]{1, -1, 2};
  Matrix A = new DenseMatrix(values);
  // without pivoting
  CholeskyDecomposition cd = new CholeskyDecomposition(A, false);
  assertEquals(0, cd.getL().times(cd.getL().transpose()).minus(A).aggregate(Functions.PLUS, Functions.ABS), 1.0e-10);
  // with pivoting
  cd = new CholeskyDecomposition(A);
  assertEquals(0, cd.getL().times(cd.getL().transpose()).minus(A).aggregate(Functions.PLUS, Functions.ABS), 1.0e-10);
}