Cv2.eigen function calculates wrong eigenvalues

Hi.

Below is my python code, which calculates eigenvectors and values.

import cv2
import numpy as np

#mat=np.array([-6,3,4,5],np.float32).reshape((2,2))
mat = np.array([[-6, 3],
                [ 4, 5]], np.float32)


ret,eVals,eVecs=cv2.eigen(mat, True)
print("Eigenvectors:\n",eVecs)
print("Eigenvalues:\n", eVals)

It prints:
Eigenvectors: [[ 0.24708746 0.9689932 ] [ 0.9689932 -0.24708746]]
Eigenvalues: [[ 5.764982] [-6.764982]]

Eigenvalues are wrong, it should be 6 and -7.
Matlab also calculates 6 and -7.
So, my question is, what’s wrong with this function?

Thanks.

Note
Use cv::eigenNonSymmetric for calculation of real eigenvalues and eigenvectors of non-symmetric matrix.

>>> cv2.eigenNonSymmetric(mat)
(array([[ 6.],
       [-7.]], dtype=float32), array([[-0.24325, -0.97301],
       [-0.94868,  0.31623]], dtype=float32))

looks better. don’t ask me why eigen() doesn’t check for symmetry and reject, or why it has this restriction in the first place.

Nice. It works as expected. Thank you.