public ColumnVector solve ( final ColumnVector b , final boolean improve ) throws MatrixException { // Validate b's size. if ( b . m_nRows != m_nRows ) { throw new MatrixException ( MatrixException . INVALID_DIMENSIONS ) ; } decompose ( ) ; // Solve Ly = b for y by forward substitution. // Solve Ux = y for x by back substitution. final ColumnVector y = _forwardSubstitution ( b ) ; final ColumnVector x = _backSubstitution ( y ) ; // Improve and return x. if ( improve ) _improve ( b , x ) ; return x ; }
Solve Ax = b for x using the Gaussian elimination algorithm .