File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed
python/decompositions/sparse Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -172,4 +172,10 @@ if(BUILD_TESTING_SCIPY)
172172 "python" )
173173
174174 endif (BUILD_WITH_CHOLMOD_SUPPORT)
175+
176+ if (BUILD_WITH_ACCELERATE_SUPPORT)
177+ add_python_unit_test(
178+ "py-Accelerate"
179+ "unittest/python/decompositions/sparse/test_Accelerate.py" "python" )
180+ endif (BUILD_WITH_ACCELERATE_SUPPORT)
175181endif ()
Original file line number Diff line number Diff line change 1+ import eigenpy
2+
3+ import numpy as np
4+ from scipy .sparse import csc_matrix
5+
6+
7+ def test (SolverType : type ):
8+ dim = 100
9+ A = np .random .rand (dim , dim )
10+ A = (A + A .T ) * 0.5 + np .diag (10.0 + np .random .rand (dim ))
11+
12+ A = csc_matrix (A )
13+
14+ llt = SolverType (A )
15+
16+ assert llt .info () == eigenpy .ComputationInfo .Success
17+
18+ X = np .random .rand (dim , 20 )
19+ B = A .dot (X )
20+ X_est = llt .solve (B )
21+ # import pdb; pdb.set_trace()
22+ assert eigenpy .is_approx (X , X_est )
23+ assert eigenpy .is_approx (A .dot (X_est ), B )
24+
25+ llt .analyzePattern (A )
26+ llt .factorize (A )
27+
28+
29+ test (eigenpy .AccelerateLLT )
30+ test (eigenpy .AccelerateLDLT )
31+ test (eigenpy .AccelerateLDLTUnpivoted )
32+ test (eigenpy .AccelerateLDLTSBK )
33+ test (eigenpy .AccelerateLDLTTPP )
34+ test (eigenpy .AccelerateQR )
35+ # test(eigenpy.AccelerateCholeskyAtA)
You can’t perform that action at this time.
0 commit comments