The function PositiveSemidefiniteMatrixQ
is used to decide whether the given matrix is positive semidefinite or not. A matrix $M$ is said to be positive semidefinite if $x^{\dagger}Mx\ge 0$ for all $x\in \mathbb{C} ^n$. Here $x^{\dagger}$ means conjugate transpose of the vector $x$. However, the function PositiveSemidefiniteMatrixQ
in Mathematica documentation seems to only check whether the real part of $x^{\dagger}Mx$ is positive, namely,
$$
\mathrm{Re}\left[ x^{\dagger}Mx \right] \ge 0.
$$
I understand the reason to do this is that the function PositiveSemidefiniteMatrixQ
works also for numerical value which might cause the imaginary part of $x^{\dagger}Mx$ nonzero. But a better method, in my opinion, is to decide whether the matrix $M$ is Hermitian or not first since a positive semidefinite matrix is also Hermitian and $x^{\dagger}Mx$ is always real for a Hermitian matrix $M$. After thi operation, the problem I just mentioned disappeared.
Furthermore, the current implementation of PositiveSemidefiniteMatrixQ
will have a bug(I think it's a bug?) that the matrix $\left( \begin{matrix}
1& 1\\
0& 1\\
\end{matrix} \right) $ will be recognized to be positive semidefinite.
m = ( {
{1, 1},
{0, 1}
} );
PositiveDefiniteMatrixQ@m
(*True*)
Is my understanding correct, or have I overlooked something?
bugs
tag prior to confirmation from other members. This is just a good housekeeping policy :-) $\endgroup$m
is a real matrix so you don't check it's Hermitian. It is positive semidefinite. All it's eigenvalues are greater than or equal to zero.Eigenvalues[m]
is{1,1}
, or equivalentlySolve[Det[m - λ IdentityMatrix[2]] == 0, λ]
gives{{λ -> 1}, {λ -> 1}}
. A matrix that is Positive Definite is also Positive Semidefinite. There are no solutions in:FindInstance[ConjugateTranspose[x] . m . x < 0, x ∈ Vectors[2]]
. $\endgroup$m
is not Hermitian, it is only Positive definite in the Real sense. I think you'd have to doPositiveDefiniteMatrixQ[m] && HermitianMatrixQ[m]
if you wanted it like that. This seems to be an implementation choice by Wolfram, as a lot of the time in optimization problems you are not dealing with complex matrices. $\endgroup$