I have an array of matrices such that
for example. These 1000 [3x3] matrices must be orthonormal so I am attempting to project each one to the nearest orthonormal basis, using svd() and the approximation
This function is made to work on a single [3x3] matrix at a time however. A workaround could be using for loops like
[~,~,np] = size(A);
[U,~,V] = svd(A(:,:,i));
A(:,:,i) = U*V';
but this function will be called very often with high numbers of matrices so I am attempting to make efficient. Is there a better way to do this?