@@ -1206,7 +1206,7 @@ end
12061206# The following code defines `MyArray1/2/3` with different `BroadcastStyle`s.
12071207# 1. `MyArray1` and `MyArray1` have `similar` defined.
12081208# We use them to simulate `BroadcastStyle` overloading `Base.copyto!`.
1209- # 2. `MyArray3` has no `similar` defined.
1209+ # 2. `MyArray3` has no `similar` defined.
12101210# We use it to simulate `BroadcastStyle` overloading `Base.copy`.
12111211# 3. Their resolved style could be summaryized as (`-` means conflict)
12121212# | MyArray1 | MyArray2 | MyArray3 | Array
@@ -1302,7 +1302,7 @@ Base.BroadcastStyle(::Broadcast.ArrayStyle{MyArray2}, S::Broadcast.DefaultArrayS
13021302 f (s) = s .+ = 1
13031303 f (s)
13041304 @test (@allocated f (s)) == 0
1305-
1305+
13061306 # issue #185
13071307 A = StructArray (randn (ComplexF64, 3 , 3 ))
13081308 B = randn (ComplexF64, 3 , 3 )
@@ -1321,7 +1321,7 @@ Base.BroadcastStyle(::Broadcast.ArrayStyle{MyArray2}, S::Broadcast.DefaultArrayS
13211321
13221322 @testset " ambiguity check" begin
13231323 test_set = Any[StructArray ([1 ;2 + im]),
1324- 1 : 2 ,
1324+ 1 : 2 ,
13251325 (1 ,2 ),
13261326 StructArray (@SArray [1 ;1 + 2im ]),
13271327 (@SArray [1 2 ]),
@@ -1550,6 +1550,23 @@ end
15501550 @test Base. IteratorSize (S) == Base. IsInfinite ()
15511551end
15521552
1553+ @testset " LinearAlgebra" begin
1554+ @testset " matrix * matrix" begin
1555+ A = StructArray {ComplexF64} ((rand (10 ,10 ), rand (10 ,10 )))
1556+ B = StructArray {ComplexF64} ((rand (size (A)... ), rand (size (A)... )))
1557+ MA, MB = Matrix (A), Matrix (B)
1558+ @test A * B ≈ MA * MB
1559+ @test mul! (ones (ComplexF64,size (A)), A, B, 2.0 , 3.0 ) ≈ 2 * A * B .+ 3
1560+ end
1561+ @testset " matrix * vector" begin
1562+ A = StructArray {ComplexF64} ((rand (10 ,10 ), rand (10 ,10 )))
1563+ v = StructArray {ComplexF64} ((rand (size (A,2 )), rand (size (A,2 ))))
1564+ MA, Mv = Matrix (A), Vector (v)
1565+ @test A * v ≈ MA * Mv
1566+ @test mul! (ones (ComplexF64,size (v)), A, v, 2.0 , 3.0 ) ≈ 2 * A * v .+ 3
1567+ end
1568+ end
1569+
15531570@testset " project quality" begin
15541571 Aqua. test_all (StructArrays, ambiguities= (; broken= true ))
15551572end
0 commit comments