@@ -15,28 +15,21 @@ using Test
15
15
prob2 = LinearProblem (A2, b2; u0= x2)
16
16
prob3 = LinearProblem (A3, b3; u0= x3)
17
17
18
- for alg in (
19
- :LUFactorization ,
20
- :QRFactorization ,
21
- :SVDFactorization ,
22
-
23
- # :DefaultLinSolve,
18
+ function test_interface (alg, kwargs, prob1, prob2, prob3)
19
+ A1 = prob1. A; b1 = prob1. b; x1 = prob1. u0
20
+ A2 = prob2. A; b2 = prob2. b; x2 = prob2. u0
21
+ A3 = prob3. A; b3 = prob3. b; x3 = prob3. u0
24
22
25
- :KrylovJL , :KrylovJL_CG , :KrylovJL_GMRES , :KrylovJL_BICGSTAB ,
26
- :KrylovJL_MINRES ,
27
- :IterativeSolversJL , :IterativeSolversJL_GMRES ,
28
- :IterativeSolversJL_BICGSTAB , :IterativeSolversJL_MINRES
29
- )
30
23
@eval begin
31
- y = solve ($ prob1, $ alg ())
24
+ y = solve ($ prob1, $ alg ($ kwargs ... ))
32
25
@test $ A1 * y ≈ $ b1 # out of place
33
26
@test $ A1 * $ x1 ≈ $ b1 # in place
34
27
35
- y = $ alg ()($ x2, $ A2, $ b2) # alg is callable
28
+ y = $ alg ($ kwargs ... )($ x2, $ A2, $ b2) # alg is callable
36
29
@test $ A2 * y ≈ $ b2
37
30
@test $ A2 * $ x2 ≈ $ b2
38
31
39
- cache = SciMLBase. init ($ prob1, $ alg ()) # initialize cache
32
+ cache = SciMLBase. init ($ prob1, $ alg ($ kwargs ... )) # initialize cache
40
33
y = cache ($ x3, $ A1, $ b1) # cache is callable
41
34
@test $ A1 * y ≈ $ b1
42
35
@test $ A1 * $ x3 ≈ $ b1
@@ -49,6 +42,42 @@ using Test
49
42
@test $ A2 * y ≈ $ b3 # same old cache
50
43
@test $ A2 * $ x3 ≈ $ b3
51
44
end
45
+
46
+ return
47
+ end
48
+
49
+ # Factorizations
50
+ kwargs = :()
51
+ for alg in (
52
+ :LUFactorization ,
53
+ :QRFactorization ,
54
+ :SVDFactorization ,
55
+ )
56
+ test_interface (alg, kwargs, prob1, prob2, prob3)
57
+ end
58
+
59
+ # KrylovJL
60
+ kwargs = :(verbose= 1 , abstol= 1e-1 , reltol= 1e-1 , maxiters= 3 , restart= 5 )
61
+ for alg in (
62
+ :KrylovJL ,
63
+ :KrylovJL_CG ,
64
+ :KrylovJL_GMRES ,
65
+ :KrylovJL_BICGSTAB ,
66
+ :KrylovJL_MINRES ,
67
+ )
68
+ test_interface (alg, kwargs, prob1, prob2, prob3)
69
+ end
70
+
71
+ # IterativeSolversJL
72
+ kwargs = :(abstol= 1e-1 , reltol= 1e-1 , maxiters= 3 , restart= 5 )
73
+ for alg in (
74
+ :IterativeSolversJL ,
75
+ :IterativeSolversJL_CG ,
76
+ :IterativeSolversJL_GMRES ,
77
+ :IterativeSolversJL_BICGSTAB ,
78
+ :IterativeSolversJL_MINRES ,
79
+ )
80
+ test_interface (alg, kwargs, prob1, prob2, prob3)
52
81
end
53
82
54
83
end
0 commit comments