test_LLT.py
Go to the documentation of this file.
1 import numpy as np
2 
3 import eigenpy
4 
5 dim = 100
6 rng = np.random.default_rng()
7 
8 A = rng.random((dim, dim))
9 A = (A + A.T) * 0.5 + np.diag(10.0 + rng.random(dim))
10 
11 llt = eigenpy.LLT(A)
12 
13 L = llt.matrixL()
14 assert eigenpy.is_approx(L.dot(np.transpose(L)), A)
15 
16 X = rng.random((dim, 20))
17 B = A.dot(X)
18 X_est = llt.solve(B)
19 assert eigenpy.is_approx(X, X_est)
20 assert eigenpy.is_approx(A.dot(X_est), B)
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 Fri Jun 14 2024 02:15:58