Given two matrices $U_1, U_2$, we can use QR factorization to find orthogonal basis for the subspace spanned by (columns of) $\begin{bmatrix}U_1,U_2\end{bmatrix}$.

Now this generally makes no use of the fact that columns of $U_1, U_2$ might already be orthogonal bases themselves (i.e., unit length, orthogonal).

What is the fastest (or at least fast) way to construct orthogonal basis $U$ such that $\text{span}(U)=\text{span}(\begin{bmatrix}U_1,U_2\end{bmatrix})$, if we know that $U_1$ and $U_2$ are already orthogonal bases themselves?

And as a bonus question ;) -- can such algorithm be expressed on top of BLAS routines over $U_1, U_2$, or do we have to get our hands dirty in explicit loops?

EDIT: consistently adding the word "orthogonal" :-)

orthogonalbases themselves (i.e., unit length, orthogonal) -> might already beorthonormalbases themselves (i.e., unit length, orthogonal) ? – robin girard Jul 26 '10 at 12:08