|
1 | 1 | function test_blas(AT)
|
2 | 2 | @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((t,s) -> transpose(t)*s, AT, A, x) |
| 12 | + @test compare((t,s) -> adjoint(t)*s , AT, A, x) |
| 13 | + |
| 14 | + @test compare(*, AT, A, B) |
| 15 | + @test compare((t,s) -> transpose(t)*s , AT, A, C) |
| 16 | + @test compare((t,s) -> t*transpose(s) , AT, C, B) |
| 17 | + @test compare((t,s) -> transpose(t)*transpose(s), AT, A, B) |
| 18 | + @test compare((t,s) -> adjoint(t)*s , AT, A, C) |
| 19 | + @test compare((t,s) -> t*adjoint(s) , AT, C, B) |
| 20 | + @test compare((t,s) -> adjoint(t)*adjoint(s) , AT, A, B) |
| 21 | + @test compare((t,s) -> transpose(t)*adjoint(s) , AT, A, B) |
| 22 | + @test compare((t,s) -> adjoint(t)*transpose(s) , AT, A, B) |
12 | 23 | end
|
13 | 24 |
|
14 | 25 | for T in (ComplexF32, Float32)
|
|
0 commit comments