Verified Commit 4349fafe authored by Justin Carpentier's avatar Justin Carpentier
Browse files

test: add test of Eigen::SelfAdjointEigenSolver

parent 101bc01a
......@@ -51,3 +51,6 @@ SET_TESTS_PROPERTIES("py-version" PROPERTIES DEPENDS ${PYWRAP})
ADD_PYTHON_UNIT_TEST("py-eigen-solver" "unittest/python/test_eigen_solver.py" "python/eigenpy")
SET_TESTS_PROPERTIES("py-eigen-solver" PROPERTIES DEPENDS ${PYWRAP})
ADD_PYTHON_UNIT_TEST("py-self-adjoint-eigen-solver" "unittest/python/test_self_adjoint_eigen_solver.py" "python/eigenpy")
SET_TESTS_PROPERTIES("py-self-adjoint-eigen-solver" PROPERTIES DEPENDS ${PYWRAP})
import eigenpy
eigenpy.switchToNumpyArray()
import numpy as np
import numpy.linalg as la
dim = 100
A = np.random.rand(dim,dim)
A = (A + A.T)*0.5
es = eigenpy.SelfAdjointEigenSolver(A)
V = es.eigenvectors()
D = es.eigenvalues()
assert eigenpy.is_approx(A.dot(V),V.dot(np.diag(D)))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment