@@ -676,23 +676,24 @@ end
676676 @test dot (Z, Z) == convert (elty, 34.0 )
677677end
678678
679- dot1 (x, y) = invoke (dot, Tuple{Any,Any}, x, y)
680- dot2 (x, y) = invoke (dot, Tuple{AbstractArray,AbstractArray}, x, y)
681679@testset " generic dot" begin
680+ dot1 (x, y) = invoke (dot, Tuple{Any,Any}, x, y)
681+ dot2 (x, y) = invoke (dot, Tuple{AbstractArray,AbstractArray}, x, y)
682682 AA = [1 + 2im 3 + 4im ; 5 + 6im 7 + 8im ]
683683 BB = [2 + 7im 4 + 1im ; 3 + 8im 6 + 5im ]
684684 for A in (copy (AA), view (AA, 1 : 2 , 1 : 2 )), B in (copy (BB), view (BB, 1 : 2 , 1 : 2 ))
685685 @test dot (A, B) == dot (vec (A), vec (B)) == dot1 (A, B) == dot2 (A, B) == dot (float .(A), float .(B))
686- @test dot (Int[], Int[]) == 0 == dot1 (Int[], Int[]) == dot2 (Int[], Int[])
687- @test_throws MethodError dot (Any[], Any[])
688- @test_throws MethodError dot1 (Any[], Any[])
689- @test_throws MethodError dot2 (Any[], Any[])
690- for n1 = 0 : 2 , n2 = 0 : 2 , d in (dot, dot1, dot2)
691- if n1 != n2
692- @test_throws DimensionMismatch d (1 : n1, 1 : n2)
693- else
694- @test d (1 : n1, 1 : n2) ≈ norm (1 : n1)^ 2
695- end
686+ end
687+ @test dot (Int[], Int[]) == 0 == dot1 (Int[], Int[]) == dot2 (Int[], Int[])
688+ @test dot (ComplexF64[], Float64[]) === dot (ComplexF64[;;], Float64[;;]) === zero (ComplexF64)
689+ @test_throws MethodError dot (Any[], Any[])
690+ @test_throws MethodError dot1 (Any[], Any[])
691+ @test_throws MethodError dot2 (Any[], Any[])
692+ for n1 = 0 : 2 , n2 = 0 : 2 , d in (dot, dot1, dot2)
693+ if n1 != n2
694+ @test_throws DimensionMismatch d (1 : n1, 1 : n2)
695+ else
696+ @test d (1 : n1, 1 : n2) ≈ norm (1 : n1)^ 2
696697 end
697698 end
698699end
0 commit comments