test_CholmodSimplicialLLT.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 dim = 100
7 rng = np.random.default_rng()
8 
9 A = rng.random((dim, dim))
10 A = (A + A.T) * 0.5 + np.diag(10.0 + rng.random(dim))
11 
12 A = csc_matrix(A)
13 
14 llt = eigenpy.CholmodSimplicialLLT(A)
15 
16 assert llt.info() == eigenpy.ComputationInfo.Success
17 
18 X = rng.random((dim, 20))
19 B = A.dot(X)
20 X_est = llt.solve(B)
21 assert eigenpy.is_approx(X, X_est)
22 assert eigenpy.is_approx(A.dot(X_est), B)
23 
24 llt.analyzePattern(A)
25 llt.factorize(A)
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