Skip to content

Commit

Permalink
transferred StaticArrays option
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed Apr 23, 2024
1 parent 0e8e38d commit af0b2e4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ julia = "1"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[targets]
test = ["Test"]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ The package also provides some concrete static vector types: `Values` which may
Mutable versions `Variables` are also exported, as well
as `FixedVector` for annotating standard `Vector`s with static size information.

If the environment variable `STATICJL` is set, then `StaticArrays` is loaded instead.

### Quick start

Add *StaticVectors* from the [Pkg REPL](https://docs.julialang.org/en/latest/stdlib/Pkg/#Getting-Started-1), i.e., `pkg> add StaticVectors`. Then:
Expand Down
7 changes: 7 additions & 0 deletions src/StaticVectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ export TupleVector, Values, Variables, FixedVector

import Base: @propagate_inbounds, @_inline_meta, @pure

if haskey(ENV,"STATICJL")
import StaticArrays: SVector, MVector, SizedVector, StaticVector, _diff
const Values,Variables,FixedVector,TupleVector = SVector,MVector,SizedVector,StaticVector
else

abstract type TupleVector{N,T} <: AbstractVector{T} end

# Being a member of TupleMatrixLike or TupleVectorLike implies that Val(A)
Expand Down Expand Up @@ -57,6 +62,8 @@ include("linalg.jl")

const SVector,MVector,SizedVector = Values,Variables,FixedVector

end

@pure countvalues(a::Int,b::Int) = Values{max(0,b-a+1),Int}(a:b...)
@pure evenvalues(a::Int,b::Int) = Values{((b-a)÷2)+1,Int}(a:2:b...)

Expand Down

2 comments on commit af0b2e4

@chakravala
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/105434

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.0.4 -m "<description of version>" af0b2e4c747a590544ebcfc2b1b445ae4fe47569
git push origin v1.0.4

Please sign in to comment.