I have an issue with a decomposition of a matrix $B$ that is positive semidefinite and that depends on a parameter $x$. Writing $\lambda_i\geq0$ the eigenvalues and $\psi_i$ the corresponding orthonormal eigenvectors, I have $B = \sum_i \lambda_i \psi_i \psi_i^\dagger$. Then I would like to rewrite $B$ as $B = \sum_i \phi_i \phi_i^\dagger$, with $\phi_i = \sqrt{\lambda_i}\psi_i$.
Concerning the Mathematica code: the matrix $B$ is defined as the tensor product of the following matrix $A$:
A = {{1, 0, 0, 1 - 2x}, {0, 0, 0, 0}, {0, 0, 0,
0}, {1 - 2x, 0, 0, 1}};
B = KroneckerProduct[A, A, A];
Once having defined matrix $B$, I compute the normalized eigenvectors and eigenvalues of it:
EigenVec = Map[Normalize, Eigenvectors[B]];
EigenVal = Eigenvalues[B];
Then, I define
phi[i_] := Sqrt[EigenVal[[i]]] EigenVec[[i]];
and I should be done. Yet, when checking if the rewriting of $B$ is working, I find that it is not, indeed
FullSimplify[Sum[KroneckerProduct[phi[i],Conjugate[Transpose[phi[i]]]], {i, 1, 64}] - B] // MatrixForm
output a non-zero matrix that has some dependency on the parameter $x$. I checked that there were no crossings between the eigenvalues and eigenvectors, as well as other consistency checks, without managing to understand what is wrong with that...
Any help would be appreciated.
Eigensystem
, ordering in not guaranteed to match if you useEigenvectors
andEigenvalues
separately $\endgroup$Eigensystem
, but I had the same kind of issue. I don't think it is coming from orderings of the eigenvectors and eigenvalues. $\endgroup$