@@ -967,18 +967,20 @@ end
967967end
968968
969969@testset " generalized dot product" begin
970- for i = 1 : 5
971- A = sprand (ComplexF64, 10 , 15 , 0.4 )
972- Av = view (A, :, :)
973- x = sprand (ComplexF64, 10 , 0.5 )
974- y = sprand (ComplexF64, 15 , 0.5 )
970+ A = sprand (ComplexF64, 10 , 15 , 1.0 )
971+ A15 = sprand (ComplexF64, 15 , 15 , 1.0 )
972+ Av = view (A, :, :)
973+ vx = sprand (ComplexF64, 10 , 0.5 )
974+ vy = sprand (ComplexF64, 15 , 0.5 )
975+ vy2 = sprand (ComplexF64, 15 , 0.5 )
976+ for (x, y, y2) in ((vx, vy, vy2), (Vector (vx), Vector (vy), Vector (vy2)))
975977 @test dot (x, A, y) ≈ dot (Vector (x), A, Vector (y)) ≈ (Vector (x)' * Matrix (A)) * Vector (y)
976978 @test dot (x, A, y) ≈ dot (x, Av, y)
977979 @test dot (x, collect (A), y) ≈ dot (x, A, y)
978980 @test dot (y, collect (A)' , x) ≈ dot (y, A' , x)
979981 @test dot (y, transpose (collect (A)), x) ≈ dot (y, transpose (A), x)
980- @test dot (y, Hermitian (collect (A) ' * collect (A)), y ) ≈ dot (y, Hermitian (A ' * A ), y )
981- @test dot (y, Symmetric (collect (A) ' * collect (A)), y ) ≈ dot (y, Symmetric (A ' * A ), y )
982+ @test dot (y, Hermitian (collect (A15)), y2 ) ≈ dot (y, Hermitian (A15 ), y2 )
983+ @test dot (y, Symmetric (collect (A15)), y2 ) ≈ dot (y, Symmetric (A15 ), y2 )
982984 B = BitMatrix (rand (Bool, 10 , 15 ))
983985 @test dot (x, A, y) ≈ dot (x, Matrix (A), y)
984986 @test_throws DimensionMismatch dot ([x, x], A, y)
990992 B = sprandn (T, 10 , 10 , 0.2 )
991993 x = sprandn (T, 10 , 0.4 )
992994 xd = Vector (x)
993- S = trans (B' B , uplo)
994- Sd = trans (Matrix (B' B ), uplo)
995+ S = trans (B, uplo)
996+ Sd = trans (Matrix (B), uplo)
995997 @test dot (x, S, x) ≈ dot (x, Sd, x) ≈ dot (xd, S, xd) ≈ dot (xd, Sd, xd)
996998 end
997999end
0 commit comments