Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/StaticArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ include("FieldArray.jl")
include("SArray.jl")
include("SMatrix.jl")
include("SVector.jl")
include("vectorModules.jl")
include("Scalar.jl")
include("MArray.jl")
include("MVector.jl")
Expand Down
10 changes: 10 additions & 0 deletions src/vectorModules.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module Float64Vectors

using StaticArrays

export Vector2D, Vector3D

const Vector3D = SVector{3, Float64}
const Vector2D = SVector{2, Float64}

end
1 change: 1 addition & 0 deletions test/SVector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,5 @@
@test @inferred(convert(SVector, c)) == SVector{2,Int}([1, 2])
@test @inferred(convert(SVector{2}, c)) == SVector{2,Int}([1, 2])
end

end
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ include("flatten.jl")
include("io.jl")
include("svd.jl")
include("deprecated.jl")

include("vectorModules.jl")
20 changes: 20 additions & 0 deletions test/vectorModules.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using StaticArrays.Float64Vectors

@testset "Float64Vectors" begin
@test Vector3D == SArray{Tuple{3},Float64,1,3}
@test Vector2D == SArray{Tuple{2},Float64,1,2}

v3 = Vector3D(1, 2, 3)
@test typeof(v3) == SArray{Tuple{3},Float64,1,3}
@test v3[1] == 1.0
@test v3[2] == 2.0
@test v3[3] == 3.0

v2 = Vector2D(10, 20)
@test typeof(v2) == SArray{Tuple{2},Float64,1,2}
@test v2[1] == 10.0
@test v2[2] == 20.0

@test Vector3D(1,2,3) == Vector3D(1.0, 2.0, 3.0)
@test Vector2D(10,20) == Vector2D(10.0, 20.0)
end