2012年9月9日星期日

A handy completion of orthogonal matrix from a column vector

Given a vector $u=(u_1,u_2,\ldots,u_n)^\top$, we seek to construct an orthogonal matrix $Q$ whose last column points to the direction of $u$.

Provided that $u_n$ is not close to $\|u\|$, the Householder reflection $Q = I - 2\frac{vv^\top}{\|v\|^2}$ will do, where
$$
v = u - \|u\|\begin{bmatrix}0\\ \vdots\\0\\1\end{bmatrix}.
$$
Update: When $u_n\approx\|u\|$, how stable is this construction? Clearly, if $u=\pm(0,\ldots,0,1)^\top$, we can set $Q=\mathrm{diag}(1,\ldots,1,\pm1)$, but what if $u_n$ is much larger than other $u_i$s?

沒有留言: