@@ -15,8 +15,21 @@ using StaticArrays, Test, LinearAlgebra
15
15
v = @SVector ones (4 )
16
16
@test_throws DimensionMismatch m1\ v
17
17
@test_throws DimensionMismatch m1\ m2
18
+
19
+ # Mixed static/dynamic arrays
20
+ # \ specializes for Diagonal, LowerTriangular, UpperTriangular, square, and non-square
21
+ # So try all of these
22
+ @testset " Mixed static/dynamic" begin
23
+ v = @SVector ([0.2 ,0.3 ])
24
+ for m in (@SMatrix ([1.0 0 ; 0 1.0 ]), @SMatrix ([1.0 0 ; 1.0 1.0 ]),
25
+ @SMatrix ([1.0 1.0 ; 0 1.0 ]), @SMatrix ([1.0 0.5 ; 0.25 1.0 ]))
26
+ # TODO : include @SMatrix([1.0 0.0 0.0; 1.0 2.0 0.5]), need qr methods
27
+ @test m \ v ≈ Array (m) \ v ≈ m \ Array (v) ≈ Array (m) \ Array (v)
28
+ end
29
+ end
18
30
end
19
31
32
+
20
33
@testset " Solving linear system (multiple RHS)" begin
21
34
@testset " Problem size: $n x $n . Matrix type: $m1 . Element type: $elty " for n in (1 ,2 ,3 ,4 ,5 ,8 ,15 ),
22
35
(m1, m2) in ((SMatrix{n,n}, SMatrix{n,2 }), (MMatrix{n,n}, MMatrix{n,2 })),
25
38
A = elty .(rand (- 99 : 2 : 99 , n, n))
26
39
b = A * elty .(rand (2 : 5 , n, 2 ))
27
40
@test m1 (A)\ m2 (b) ≈ A\ b
41
+
42
+ end
43
+
44
+ @testset " Mixed static/dynamic" begin
45
+ m2 = @SMatrix ([0.2 0.3 ; 0.0 0.1 ])
46
+ for m1 in (@SMatrix ([1.0 0 ; 0 1.0 ]), @SMatrix ([1.0 0 ; 1.0 1.0 ]),
47
+ @SMatrix ([1.0 1.0 ; 0 1.0 ]), @SMatrix ([1.0 0.5 ; 0.25 1.0 ]))
48
+ # TODO : include @SMatrix([1.0 0.0 0.0; 1.0 2.0 0.5]), need qr methods
49
+ @test m1 \ m2 ≈ Array (m1) \ m2 ≈ m1 \ Array (m2) ≈ Array (m1) \ Array (m2)
50
+ end
28
51
end
29
52
end
0 commit comments