docs: public Matrix solve (Matrix B) throws SingularityException {
        if (B.getRowCount() != m) {
           throw new IllegalArgumentException("Matrix row dimensions must agree.");
        }
        if (!this.isNonsingular()) {
           throw new SingularityException("Matrix is singular.");
        }
  
        // Copy right hand side with pivoting
        int nx = B.getColumnCount();
        double[][] X = new double[piv.length][nx];
  		for (int i=0; i<piv.length; i++) {
  			for (int j=0; j<nx; j++) {
  				X[i][j]=B.getQuick(piv[i], j);
  			}
  		}
  
        // Solve L*Y = B(piv,:)
        for (int k = 0; k < n; k++) {
           for (int i = k+1; i < n; i++) {
              for (int j = 0; j < nx; j++) {
                 X[i][j] -= X[k][j]*LU[i][k];
              }
           }
        }
        // Solve U*X = Y;
        for (int k = n-1; k >= 0; k--) {
           for (int j = 0; j < nx; j++) {
              X[k][j] /= LU[k][k];
           }
           for (int i = 0; i < k; i++) {
              for (int j = 0; j < nx; j++) {
                 X[i][j] -= X[k][j]*LU[i][k];
              }
           }
        }
        return MatrixFactory.createMatrix(X);
     }