householder(v)

Householder rotation.

vA column vector to be rotated to a multiple of the first canonical basis vector.
return valueThe vector that generates this rotation.

For a vector v, there is a rotation S of the form I-ww', where w is a column vector, such that the whole rotated vector Sv, except the first element, is zero. The function returns w.

v = [1;2;3;4] w = householder(v) (eye(numRows(v)) - w*w')*v