public double[] solve(double[] b) {
    if(b.length != m) {
      throw new IllegalArgumentException(ERR_MATRIX_DIMENSIONS);
    }
    if(!this.isNonsingular()) {
      throw new ArithmeticException(ERR_SINGULAR);
    }
    double[] bc = new double[piv.length];
    for(int i = 0; i < piv.length; i++) {
      bc[i] = b[piv[i]];
    }
    solveInplace(bc);
    return n < bc.length ? Arrays.copyOf(bc, n) : bc;
  }
public double [ ] solve ( double [ ] b ) { if ( b . length != m ) { throw new IllegalArgumentException ( ERR_MATRIX_DIMENSIONS ) ; } if ( ! this . isNonsingular ( ) ) { throw new ArithmeticException ( ERR_SINGULAR ) ; } double [ ] bc = new double [ piv . length ] ; for ( int i = 0 ; i < piv . length ; i ++ ) { bc [ i ] = b [ piv [ i ] ] ; } solveInplace ( bc ) ; return n < bc . length ? Arrays . copyOf ( bc , n ) : bc ; }
Solve A*X = b

@param b A column vector with as many rows as A
@return X so that L*U*X = b(piv)
@throws IllegalArgumentException Matrix row dimensions must agree.
@throws ArithmeticException Matrix is singular.