@@ -62,36 +62,27 @@ function test_linalg(AT)
62
62
end
63
63
64
64
@testset " matrix multiplication" begin
65
- a = rand (Int8, 3 , 3 )
66
- b = rand (Int8, 3 , 3 )
67
- d_a = AT {Int8} (a)
68
- d_b = AT {Int8} (b)
69
- d_c = d_a* d_b
70
- @test collect (d_c) == a* b
71
- a = rand (Complex{Int8}, 3 , 3 )
72
- b = rand (Complex{Int8}, 3 , 3 )
73
- d_a = AT {Complex{Int8}} (a)
74
- d_b = AT {Complex{Int8}} (b)
75
- d_c = d_a' * d_b
76
- @test collect (d_c) == a' * b
77
- d_c = d_a* d_b'
78
- @test collect (d_c) == a* b'
79
- d_c = d_a' * d_b'
80
- @test collect (d_c) == a' * b'
81
- d_c = transpose (d_a)* d_b'
82
- @test collect (d_c) == transpose (a)* b'
83
- d_c = d_a' * transpose (d_b)
84
- @test collect (d_c) == a' * transpose (b)
85
- d_c = transpose (d_a)* d_b
86
- @test collect (d_c) == transpose (a)* b
87
- d_c = d_a* transpose (d_b)
88
- @test collect (d_c) == a* transpose (b)
89
- d_c = transpose (d_a)* transpose (d_b)
90
- @test collect (d_c) == transpose (a)* transpose (b)
91
- d_c = rmul! (copy (d_a), Complex {Int8} (2 , 2 ))
92
- @test collect (d_c) == a* Complex {Int8} (2 , 2 )
93
- d_c = lmul! (Complex {Int8} (2 , 2 ), copy (d_a))
94
- @test collect (d_c) == Complex {Int8} (2 , 2 )* a
65
+ for (a,b) in [((3 ,4 ),(4 ,3 )), ((3 ,), (1 ,3 )), ((1 ,3 ), (3 ))], T in supported_eltypes ()
66
+ @test compare (* , AT, rand (T, a), rand (T, b))
67
+
68
+ if length (a) > 1
69
+ @test compare (* , AT, transpose (rand (T, reverse (a))), rand (T, b))
70
+ @test compare (* , AT, adjoint (rand (T, reverse (a))), rand (T, b))
71
+ end
72
+
73
+ if length (b) > 1
74
+ @test compare (* , AT, rand (T, a), transpose (rand (T, reverse (b))))
75
+ @test compare (* , AT, rand (T, a), adjoint (rand (T, reverse (b))))
76
+ end
77
+
78
+ if length (a) > 1 && length (b) > 1
79
+ @test compare (* , AT, transpose (rand (T, reverse (a))), transpose (rand (T, reverse (b))))
80
+ @test compare (* , AT, adjoint (rand (T, reverse (a))), adjoint (rand (T, reverse (b))))
81
+ end
82
+
83
+ @test compare (rmul!, AT, rand (T, a), Ref (rand (T)))
84
+ @test compare (lmul!, AT, Ref (rand (T)), rand (T, b))
85
+ end
95
86
end
96
87
end
97
88
end
0 commit comments