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