I'm using SingularValueDecomposition to find the unitary matrices that diagonalize a given matrix (that I have). This decomposition is unique, up to multiplication for an arbitrary phase of each column of the left and right unitary matrices. Is there a way to find out how Mathematica chooses this phase, or can I set some condition when using SingularValueDecomposition, for example, to impose that the first column of the left matrix must be real?
1 Answer
I can tell just from experiments: Apparently, the first row of U
is always real:
n = 12;
A = RandomComplex[{-1 - I, 1 + I}, {n, n}];
{U, S, V} = SingularValueDecomposition[A];
Im[U[[1]]]
{0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}
As AccidentalFourierTransform pointed out, that means that each left singular value of A
is normalized to have its first entry being real.
You can also achieve that the first row of V
(hence the first entry of each right singular vector) is real by apply the following unitary transformation W
:
W = DiagonalMatrix[Exp[-I Arg[V[[1, All]]]]];
Unew = U.W;
Vnew = V.W;
Max@Abs[Unew.S.ConjugateTranspose[Vnew] - A]
Chop[Im[Vnew[[1]]]]
1.9004*10^-15
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
Analogously, you can manage to have only real numbers for either all the $i$-th entries of the left singular vectors or all the $j$-th entries of each the right singular vectors.
What probably puzzles you is that Mathematica uses the convention
U.S.ConjugateTranspose[V] == A
instead of
ConjugateTranspose[U].S.V == A
the latter being prefered in many textbooks because the column vectors of U
and V
are then the singular vectors.
-
$\begingroup$ Ok, but this still does not help me: I need the conditions on the columns because those are basically the eigenvectors of the original matrix, and I need to impose some phase conditions on them $\endgroup$– AlessioJul 3, 2019 at 16:31
-
2$\begingroup$ @Alessio Isn't Henrik's answer basically telling you that the convention is that the first component of each eigenvector is taken to be real? $\endgroup$ Aug 2, 2019 at 13:06