public static double computeHouseholder ( double [ ] x , int xStart , int xEnd , double max , DScalar gamma ) { double tau = 0 ; for ( int i = xStart ; i < xEnd ; i ++ ) { double val = x [ i ] /= max ; tau += val * val ; } tau = Math . sqrt ( tau ) ; if ( x [ xStart ] < 0 ) { tau = - tau ; } double u_0 = x [ xStart ] + tau ; gamma . value = u_0 / tau ; x [ xStart ] = 1 ; for ( int i = xStart + 1 ; i < xEnd ; i ++ ) { x [ i ] /= u_0 ; } return - tau * max ; }
Creates a householder reflection .