Given an invertible and PSD matrix $A$, I am looking to find $Q$ such that: $$ QAQ^\top = I $$ What is a/the right/efficient way to do this?
Here is what I did: SVD gives $$ A \approx U S V^\top $$ Then to make things to the form of $$ A \approx U \hat{S} U^\top $$ by $$ \hat{S} = S ( U ^{-1} V )^\top $$ We can rewrite : $$ A \approx U \hat{S} U^\top = \left( U \sqrt{\hat{S}} \right) I \left( U \sqrt{\hat{S}} \right) ^\top $$ To find $Q$, set $Q = \left( U \sqrt{\hat{S}} \right)^{-1}$.
Is there any better/more efficient(computationally) way to do this?
Here is my code in MATLAB. I first find the SVD, and use an inversion to find $Q$. I wonder if there is a way to skip the inversion and find $Q$ directly.
AA = rand(10,1);
A = AA*AA'; % random positive definite matrix
[U S V]=svd(A);
d=diag(U'*A*U);
S_hat=S*spdiags(sign(d.*diag(S)),0,size(U,2),size(U,2));
UU = U * (diag(diag(S_hat)))^(0.5);
Areconstruct1 = U*S_hat*U';
Areconstruct2 = UU*eye(size(U,2))*UU';
% Check
norm(Areconstruct1-Areconstruct2)
norm(Areconstruct1-A)/norm(A)
norm(Areconstruct2-A)/norm(A)
Q = UU^(-1);
Q*A*Q';