Skip to content

Commit 84ba238

Browse files
committed
Clean up and extend coverage for matmul tests
1 parent b7c163c commit 84ba238

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

src/testsuite/blas.jl

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
function test_blas(AT)
22
@testset "BLAS" begin
3-
@testset "matmul" begin
4-
@test compare(*, AT, rand(Float32, 5, 5), rand(Float32, 5, 5))
5-
@test compare(*, AT, rand(Float32, 5, 5), rand(Float32, 5))
6-
@test compare((a, b)-> a * transpose(b), AT, rand(Float32, 5, 5), rand(Float32, 5, 5))
7-
@test compare((c, a, b)-> mul!(c, a, transpose(b)), AT, rand(Float32, 10, 32), rand(Float32, 10, 60), rand(Float32, 32, 60))
8-
@test compare((a, b)-> transpose(a) * b, AT, rand(Float32, 5, 5), rand(Float32, 5, 5))
9-
@test compare((a, b)-> transpose(a) * transpose(b), AT, rand(Float32, 10, 15), rand(Float32, 1, 10))
10-
@test compare((a, b)-> transpose(a) * b, AT, rand(Float32, 10, 15), rand(Float32, 10))
11-
@test compare(mul!, AT, rand(Float32, 15), rand(Float32, 15, 10), rand(Float32, 10))
3+
@testset "matmul with element type $elty" for elty in (Float32, Float64, ComplexF32, ComplexF64)
4+
A = rand(elty, 5, 6)
5+
B = rand(elty, 6, 5)
6+
C = rand(elty, 5, 5)
7+
x = rand(elty, 5)
8+
y = rand(elty, 6)
9+
10+
@test compare(*, AT, A, y)
11+
@test compare(*, AT, transpose(A), x)
12+
@test compare(*, AT, adjoint(A), x)
13+
14+
@test compare(*, AT, A, B)
15+
@test compare(*, AT, transpose(A), C)
16+
@test compare(*, AT, C, transpose(B))
17+
@test compare(*, AT, transpose(A), transpose(B))
18+
@test compare(*, AT, adjoint(A), C)
19+
@test compare(*, AT, C, adjoint(B))
20+
@test compare(*, AT, adjoint(A), adjoint(B))
21+
@test compare(*, AT, transpose(A), adjoint(B))
22+
@test compare(*, AT, adjoint(A), transpose(B))
1223
end
1324

1425
for T in (ComplexF32, Float32)

0 commit comments

Comments
 (0)