FieldLUDecomposition { public FieldMatrix<T> getL() { if ((cachedL == null) && !singular) { final int m = pivot.length; cachedL = new Array2DRowFieldMatrix<T>(field, m, m); for (int i = 0; i < m; ++i) { final T[] luI = lu[i]; for (int j = 0; j < i; ++j) { cachedL.setEntry(i, j, luI[j]); } cachedL.setEntry(i, i, field.getOne()); } } return cachedL; } FieldLUDecomposition(FieldMatrix<T> matrix); FieldMatrix<T> getL(); FieldMatrix<T> getU(); FieldMatrix<T> getP(); int[] getPivot(); T getDeterminant(); FieldDecompositionSolver<T> getSolver();  }
@Test public void testLLowerTriangular() { FieldMatrix<Fraction> matrix = new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(), testData); FieldMatrix<Fraction> l = new FieldLUDecomposition<Fraction>(matrix).getL(); for (int i = 0; i < l.getRowDimension(); i++) { Assert.assertEquals(Fraction.ONE, l.getEntry(i, i)); for (int j = i + 1; j < l.getColumnDimension(); j++) { Assert.assertEquals(Fraction.ZERO, l.getEntry(i, j)); } } }