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

test: add MINRES test

parent 2733b4cb
No related branches found
No related tags found
No related merge requests found
Pipeline #15526 failed
#
# Copyright (c) 2014-2019 CNRS
# Copyright (c) 2018-2020 INRIA
# Copyright (c) 2018-2021 INRIA
#
MACRO(ADD_LIB_UNIT_TEST test)
......@@ -62,3 +62,6 @@ SET_TESTS_PROPERTIES("py-LLT" PROPERTIES DEPENDS ${PYWRAP})
ADD_PYTHON_UNIT_TEST("py-LDLT" "unittest/python/test_LDLT.py" "python/eigenpy;unittest")
SET_TESTS_PROPERTIES("py-LDLT" PROPERTIES DEPENDS ${PYWRAP})
ADD_PYTHON_UNIT_TEST("py-MINRES" "unittest/python/test_MINRES.py" "python/eigenpy;unittest")
SET_TESTS_PROPERTIES("py-MINRES" PROPERTIES DEPENDS ${PYWRAP})
import eigenpy
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))
minres = eigenpy.MINRES(A)
X = np.random.rand(dim,20)
B = A.dot(X)
X_est = minres.solve(B)
assert eigenpy.is_approx(X,X_est)
assert eigenpy.is_approx(A.dot(X_est),B)
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