code: public Matrix[] lu() {
  		if (isSquare()) {
  			GMatrix m = (GMatrix) matrix.clone();
  			GMatrix lu = (GMatrix) matrix.clone();
  			GVector piv = new GVector(matrix.getNumCol());
  			m.LUD(lu, piv);
  			Matrix l = new VecMathDenseDoubleMatrix2D(lu).tril(Ret.NEW, 0);
  			for (int i = (int) l.getRowCount() - 1; i != -1; i--) {
  				l.setAsDouble(1, i, i);
  			}
  			Matrix u = new VecMathDenseDoubleMatrix2D(lu).triu(Ret.NEW, 0);
  			VecMathDenseDoubleMatrix2D p = new VecMathDenseDoubleMatrix2D(MathUtil.longToInt(getRowCount()),
  					MathUtil.longToInt(getColumnCount()));
  			for (int i = piv.getSize() - 1; i != -1; i--) {
  				p.setDouble(1, i, (int) piv.getElement(i));
  			}
  			return new Matrix[] { l, u, p };
  		} else {
  			throw new RuntimeException("only allowed for square matrices");
  		}
  	}
docs: non-singular matrices only