Skip to content
Snippets Groups Projects
Verified Commit 21f4ebf8 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

test: add test for Eigen::LDLT

parent 775a1b70
No related branches found
No related tags found
No related merge requests found
......@@ -57,3 +57,6 @@ SET_TESTS_PROPERTIES("py-self-adjoint-eigen-solver" PROPERTIES DEPENDS ${PYWRAP}
ADD_PYTHON_UNIT_TEST("py-LLT" "unittest/python/test_LLT.py" "python/eigenpy")
SET_TESTS_PROPERTIES("py-LLT" PROPERTIES DEPENDS ${PYWRAP})
ADD_PYTHON_UNIT_TEST("py-LDLT" "unittest/python/test_LDLT.py" "python/eigenpy")
SET_TESTS_PROPERTIES("py-LDLT" 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 + np.diag(10. + np.random.rand(dim))
ldlt = eigenpy.LDLT(A)
L = ldlt.matrixL()
D = ldlt.vectorD()
P = ldlt.transpositionsP()
assert eigenpy.is_approx(np.transpose(P).dot(L.dot(np.diag(D).dot(np.transpose(L).dot(P)))),A)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment