The following question is related to research I am doing on reinforcement learning on manifolds. I have a set of basis vectors $\boldsymbol{B} = \{\boldsymbol{b}_1,\dots,\boldsymbol{b}_k\}$ that span a $k$-dimensional linear subspace of $\mathbb{R}^n$ ($\boldsymbol{b}_i \in \mathbb{R}^n$ $\forall \ i \in (1,\dots,k)$ and $k<n$). The basis vectors can change. I want a map that converts the basis vectors to an orthonormal basis that spans the same subspace as the original basis vectors with the requirement that the map is smooth. I have considered the Gram–Schmidt process, but it seems to have problems. For example, consider two basis vectors in $\mathbb{R}^2$. Imagine the first vector points in the positive x-axis direction, and the second is a rotation of the first by a small angle of + or - $\epsilon$. Depending on the sign of the rotation, I will get a second orthonormal vector pointing in the direction of the either positive or negative y-axis. Therefore, slightly changing $\boldsymbol{B}$ can lead to very different orthonormal vectors. Are there other methods that don't have problems like this? EDIT: it is ok to assume that the basis vectors are always linearly independent and have nonzero magnitude.