| double m1[][] = {
{1,0,0,0},
{0,1,0,0},
{0,0,1,0},
{0,0,0,1} };
Matrix matrix1 = new Matrix(m1);
double m2[][] = {
{17,18,19,20},
{21,22,23,24},
{25,27,28,29},
{37,33,31,30} };
Matrix matrix2 = new Matrix(m2);
CholeskyDecomposition c = new CholeskyDecomposition(matrix1);
c.solve(matrix2);
Matrix mx = c.getL();
Assert.assertEquals(1.0, mx.get(0,0));
Assert.assertEquals(1.0, mx.get(1,1));
Assert.assertEquals(1.0, mx.get(2,2));
Assert.assertEquals(4, mx.getRows());
Assert.assertEquals(4, mx.getCols());
}
|