I want to solve the folowing problem **B*M=V**, where **B** is the unknown of size *3x3*, **M** of size *3xN* and **V** of size *3xN*. The difficulty is, that **B** has to be unitary.

*N* is in the range of 500. All matrices are real.

Solving the problem by multiplying from right with the pseudoinverse of **M** gives a solution that is close to being unitary.

Does somebody have a hint how to solve it? Best would be a solution by aid of Matlab or a C++ library like Eigen.