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;
    }
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.

(I-gamma*v*v')*x = tau*e1

<p>NOTE: Same as cs_house in csparse</p>
@param x (Input) Vector x (Output) Vector v. Modified.
@param xStart First index in X that is to be processed
@param xEnd Last + 1 index in x that is to be processed.
@param gamma (Output) Storage for computed gamma
@return variable tau