householder function fails with division by zero
Reported by adhefe
Description:
Scilab function householder fails to operate on vectors with just the first line positive and different of zero like [1;0;0]
Log: scilab returns division by zero for,
householder([1;0;0])
Reproduce the error simply defining vector x=[x1;x2;x3;.....;xn] with all xi=0 except x1>0 and try householder(x);
OTHER INFORMATION:
------------------
A possible solution.
Householder of a general vector x admits two possible solutions based on (x-|x|e1) and (x+|x|e1) where e1 is [1;0;0;.....;0]. If x = Const*e1, one of these two choices is zero, depending on x1 being positive or negative, thus rendering normalization impossible. A safe choice for this would be,
x + SIGN(x1) x1 e1.
Scilab implements only x-|x|e1 thus if x1 is positive and x=Const*e1 this vector is zero.
Thanks.