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