@Test public void getL() throws Exception { Matrix luDecompositionL = new LUDecomposition(testMatrix).getL(); assertEquals("Unexpected row size.", testL.rowSize(), luDecompositionL.rowSize()); assertEquals("Unexpected column size.", testL.columnSize(), luDecompositionL.columnSize()); for (int i = 0; i < testL.rowSize(); i++) for (int j = 0; j < testL.columnSize(); j++) assertEquals("Unexpected value at (" + i + "," + j + ").", testL.getX(i, j), luDecompositionL.getX(i, j), 0.0000001d); luDecompositionL.destroy(); }
public Matrix getL() { if ((cachedL == null) && !singular) { final int m = pivot.size(); cachedL = like(matrix); cachedL.assign(0.0); for (int i = 0; i < m; ++i) { for (int j = 0; j < i; ++j) cachedL.setX(i, j, lu.getX(i, j)); cachedL.setX(i, i, 1.0); } } return cachedL; }
LUDecomposition implements AutoCloseable { public Matrix getL() { if ((cachedL == null) && !singular) { final int m = pivot.size(); cachedL = like(matrix); cachedL.assign(0.0); for (int i = 0; i < m; ++i) { for (int j = 0; j < i; ++j) cachedL.setX(i, j, lu.getX(i, j)); cachedL.setX(i, i, 1.0); } } return cachedL; } }
LUDecomposition implements AutoCloseable { public Matrix getL() { if ((cachedL == null) && !singular) { final int m = pivot.size(); cachedL = like(matrix); cachedL.assign(0.0); for (int i = 0; i < m; ++i) { for (int j = 0; j < i; ++j) cachedL.setX(i, j, lu.getX(i, j)); cachedL.setX(i, i, 1.0); } } return cachedL; } LUDecomposition(Matrix matrix);  LUDecomposition(Matrix matrix, double singularityThreshold); }
LUDecomposition implements AutoCloseable { public Matrix getL() { if ((cachedL == null) && !singular) { final int m = pivot.size(); cachedL = like(matrix); cachedL.assign(0.0); for (int i = 0; i < m; ++i) { for (int j = 0; j < i; ++j) cachedL.setX(i, j, lu.getX(i, j)); cachedL.setX(i, i, 1.0); } } return cachedL; } LUDecomposition(Matrix matrix);  LUDecomposition(Matrix matrix, double singularityThreshold); @Override void close(); Matrix getL(); Matrix getU(); Matrix getP(); Vector getPivot(); double determinant(); Vector solve(Vector b); Matrix solve(Matrix b); }
LUDecomposition implements AutoCloseable { public Matrix getL() { if ((cachedL == null) && !singular) { final int m = pivot.size(); cachedL = like(matrix); cachedL.assign(0.0); for (int i = 0; i < m; ++i) { for (int j = 0; j < i; ++j) cachedL.setX(i, j, lu.getX(i, j)); cachedL.setX(i, i, 1.0); } } return cachedL; } LUDecomposition(Matrix matrix);  LUDecomposition(Matrix matrix, double singularityThreshold); @Override void close(); Matrix getL(); Matrix getU(); Matrix getP(); Vector getPivot(); double determinant(); Vector solve(Vector b); Matrix solve(Matrix b);  }