test_Accelerate.py
Go to the documentation of this file.
1 import numpy as np
2 from scipy.sparse import csc_matrix
3 
4 import eigenpy
5 
6 rng = np.random.default_rng()
7 
8 
9 def test(SolverType: type):
10  dim = 100
11  A = rng.random((dim, dim))
12  A = (A + A.T) * 0.5 + np.diag(10.0 + rng.random(dim))
13 
14  A = csc_matrix(A)
15 
16  llt = SolverType(A)
17 
18  assert llt.info() == eigenpy.ComputationInfo.Success
19 
20  X = rng.random((dim, 20))
21  B = A.dot(X)
22  X_est = llt.solve(B)
23  # import pdb; pdb.set_trace()
24  assert eigenpy.is_approx(X, X_est)
25  assert eigenpy.is_approx(A.dot(X_est), B)
26 
27  llt.analyzePattern(A)
28  llt.factorize(A)
29 
30 
31 test(eigenpy.AccelerateLLT)
32 test(eigenpy.AccelerateLDLT)
33 test(eigenpy.AccelerateLDLTUnpivoted)
34 test(eigenpy.AccelerateLDLTSBK)
35 test(eigenpy.AccelerateLDLTTPP)
36 test(eigenpy.AccelerateQR)
37 # test(eigenpy.AccelerateCholeskyAtA) # This test is not passing. Seems there is a bug in Eigen with the support of Accelerate.
test_Accelerate.test
def test(type SolverType)
Definition: test_Accelerate.py:9
eigenpy::is_approx
EIGEN_DONT_INLINE bool is_approx(const Eigen::SparseMatrixBase< MatrixType1 > &mat1, const Eigen::SparseMatrixBase< MatrixType2 > &mat2)
Definition: is-approx.hpp:36


eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Sat Nov 2 2024 02:14:45