@Test public void testLU() {
// we are testing that PA = LU
AMatrix a=Matrixx.create(new double[][] {{4,3},{6,3}});
ILUPResult ms=SimpleLUP.decompose(a);
AMatrix lu=ms.getL().innerProduct(ms.getU());
assertEquals(ms.getP().innerProduct(a),lu);
//assertEquals(Matrixx.create(new double[][] {{1,0},{1.5,1}}),lu[0]);
//assertEquals(Matrixx.create(new double[][] {{4,3},{0,-1.5}}),lu[1]);
a=Matrixx.createRandomSquareMatrix(4);
ms=SimpleLUP.decompose(a);
lu=ms.getL().innerProduct(ms.getU());
assertTrue(ms.getP().innerProduct(a).epsilonEquals(lu));
a=PermutationMatrix.create(0, 2,1,3);
ms=SimpleLUP.decompose(a);
lu=ms.getL().innerProduct(ms.getU());
assertTrue(ms.getP().innerProduct(a).epsilonEquals(lu));
assertEquals(IdentityMatrix.create(4),ms.getL());
assertEquals(IdentityMatrix.create(4),ms.getU());
assertEquals(a,ms.getP().inverse());
}