So I have the system $M = RS = RQQ^{-1}S $ and I have $R$ and $S$ currently.

I impose some constraints on $R$ in the form of $r^T$$QQ^Tr = 1$ where $r$ and $r^T$ are rows of R and their transposes. This particular constraint ensures that all the rows of $Q$ have an unit norm.

Instead of trying to solve for $Q$ directly, I do $L=QQ^T$ and solve for $L$ linearly. This gives me a symmetric matrix $L$ and I've confirmed the values are all correct (just doing a simple check of $Ax=B$ with the $A$ matrix being the constraints, $x$ being the unknowns (6 in a 3x3 symmetric matrix) and $B$ just being a vector of 1s.

However the problem is that $L$ isn't always positive definite so I can't perform cholesky decomposition on it.

I read a paper here that finds the closest semi-definite matrix to $L$ but when I check the norms of $RQ$ after finding the $Q$ computed with this method their norms are all the same non-unit value. The method in short is

- Eigen decompose $L = UDU^T$
- Form a matrix $D_+$ by setting any negative values to e> 0,
- Compute $Q = UD_+^{1/2}$

Is there any other way to get $Q$? Or does this look sound and I've simply done something wrong?