@@ -15,9 +15,19 @@ x1 = zero(b);
15
15
A2 = A / 2 ;
16
16
b2 = rand (n);
17
17
x2 = zero (b);
18
+ # Test system with complex numbers
19
+ A3 = A .+ rand (n) .* im;
20
+ b3 = rand (n);
21
+ x3 = zero (b);
22
+ # Test system with mixed types
23
+ A4 = (A / 4 ) .| > Float32;
24
+ b4 = rand (n) .| > Float32;
25
+ x4 = zero (b) .| > Float32;
18
26
19
27
prob1 = LinearProblem (A1, b1; u0 = x1)
20
28
prob2 = LinearProblem (A2, b2; u0 = x2)
29
+ prob3 = LinearProblem (A3, b3; u0 = x3)
30
+ prob4 = LinearProblem (A4, b4; u0 = x4)
21
31
22
32
cache_kwargs = (; verbose = true , abstol = 1e-8 , reltol = 1e-8 , maxiter = 30 )
23
33
@@ -28,6 +38,10 @@ function test_interface(alg, prob1, prob2)
28
38
A2 = prob2. A
29
39
b2 = prob2. b
30
40
x2 = prob2. u0
41
+ A3 = prob3. A
42
+ b3 = prob3. b
43
+ A4 = prob4. A
44
+ b4 = prob4. b
31
45
32
46
sol = solve (prob1, alg; cache_kwargs... )
33
47
@test A1 * sol. u ≈ b1
@@ -44,6 +58,22 @@ function test_interface(alg, prob1, prob2)
44
58
sol = solve! (cache; cache_kwargs... )
45
59
@test A2 * sol. u ≈ b2
46
60
61
+ # Test complex numbers via cache interface
62
+ cache. A = A3
63
+ cache. b = b3
64
+ sol = solve! (cache; cache_kwargs... )
65
+ @test A3 * sol. u ≈ b3
66
+
67
+ # Test mixed types via cache interface
68
+ cache. A = A4
69
+ cache. b = b4
70
+ sol = solve! (cache; cache_kwargs... )
71
+ @test A4 * sol. u ≈ b4
72
+
73
+ # Test mixed types from scratch
74
+ sol = solve (prob4, alg; cache_kwargs... )
75
+ @test A4 * sol. u ≈ b4
76
+
47
77
return
48
78
end
49
79
0 commit comments