private ColumnVector backSubstitution ( ColumnVector y ) throws MatrixException { ColumnVector x = new ColumnVector ( nRows ) ; // Do back substitution. for ( int r = nRows - 1 ; r >= 0 ; -- r ) { int pr = permutation [ r ] ; // permuted row index double dot = 0 ; for ( int c = r + 1 ; c < nRows ; ++ c ) { dot += LU . at ( pr , c ) * x . at ( c ) ; } x . set ( r , ( y . at ( r ) - dot ) / LU . at ( pr , r ) ) ; } return x ; }
Solve Ux = y for x by back substitution .