Skip to content

Commit 16fafb3

Browse files
committed
Add tests for inner products
1 parent 49d2fc4 commit 16fafb3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/linalg.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,16 @@ using StaticArrays, Base.Test
8686
@test @inferred(cross(SVector(UInt(1),UInt(2),UInt(3)), SVector(UInt(4),UInt(5),UInt(6)))) === SVector(-3, 6, -3)
8787
end
8888

89+
@testset "inner products" begin
90+
v1 = @SVector [2,4,6,8]
91+
v2 = @SVector [4,3,2,1]
92+
93+
@test @inferred(dot(v1, v2)) === 40
94+
@test @inferred(dot(v1, -v2)) === -40
95+
@test @inferred(dot(v1*im, v2*im)) === 40*im*conj(im)
96+
@test @inferred(StaticArrays.bilinear_vecdot(v1*im, v2*im)) === 40*im*im
97+
end
98+
8999
@testset "transpose() and conj()" begin
90100
@test @inferred(conj(SVector(1+im, 2+im))) === SVector(1-im, 2-im)
91101

0 commit comments

Comments
 (0)