Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alecjacobson/70556ef7ed90a86f148404d167a2016a to your computer and use it in GitHub Desktop.
Save alecjacobson/70556ef7ed90a86f148404d167a2016a to your computer and use it in GitHub Desktop.
% Random L matrix
rng(1);
L = randn(3,3);
% Initial guess of S
S = diag(sqrt(diag(L*L')));
for iter = 1:100
[U,Z,V] = svd(S*L);
% UZUᵀ = √ SLLᵀS
S = diag(sqrt(diag( U*Z*U' )));
R = U*V';
% At this point why don't we just improve S to optimal w.r.t. this R?
S = diag(diag(L*R'));
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment