4 double cs_house (
double *x,
double *beta,
int n)
8 if (!x || !beta)
return (-1) ;
9 for (i = 1 ; i < n ; i++) sigma += x [i] * x [i] ;
10 if ( fabs( sigma ) <= 3e-16 )
13 (*beta) = (x [0] <= 0) ? 2 : 0 ;
18 s =
sqrt (x [0] * x [0] + sigma) ;
19 x [0] = (x [0] <= 0) ? (x [0] - s) : (-sigma / (x [0] + s)) ;
20 (*beta) = -1. / (s * x [0]) ;
IntermediateState sqrt(const Expression &arg)
double cs_house(double *x, double *beta, int n)