Skip to content

Commit

Permalink
Merge pull request #567 from willow-ahrens/wma/fix565
Browse files Browse the repository at this point in the history
Wma/fix565
  • Loading branch information
willow-ahrens authored May 21, 2024
2 parents 651e613 + d94a446 commit fb333c0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
authors = ["Willow Ahrens"]
name = "Finch"
uuid = "9177782c-1635-4eb9-9bfb-d9dfa25e6bce"
version = "0.6.29"
version = "0.6.30"

[compat]
AbstractTrees = "0.3.4, 0.4"
Expand Down
9 changes: 7 additions & 2 deletions docs/src/guides/interoperability.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,31 @@ julia> v = Vector([1, 0, 2, 3])
0
2
3
julia> obov = PlusOneVector(v)
4-element PlusOneVector{Int64}:
4-element PlusOneVector{Int64, Vector{Int64}}:
2
1
3
4
julia> obov[1] += 8
10
julia> obov
4-element PlusOneVector{Int64}:
4-element PlusOneVector{Int64, Vector{Int64}}:
10
1
3
4
julia> obov.data
4-element Vector{Int64}:
9
0
2
3
```

### `CIndex`
Expand Down
16 changes: 8 additions & 8 deletions src/util/vectors.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Base: @propagate_inbounds

struct PlusOneVector{T} <: AbstractVector{T}
data::AbstractVector{T}
struct PlusOneVector{T, A <: AbstractVector{T}} <: AbstractVector{T}
data::A
end

@propagate_inbounds function Base.getindex(vec::PlusOneVector{T},
Expand Down Expand Up @@ -36,11 +36,11 @@ function moveto(vec::PlusOneVector{T}, device) where {T}
return PlusOneVector{T}(data)
end

struct MinusEpsVector{T, S} <: AbstractVector{T}
data::AbstractVector{S}
struct MinusEpsVector{T, S, A <: AbstractVector{S}} <: AbstractVector{T}
data::A
end

MinusEpsVector(data::AbstractVector{T}) where {T} = MinusEpsVector{Limit{T}, T}(data)
MinusEpsVector(data::AbstractVector{T}) where {T} = MinusEpsVector{Limit{T}, T, typeof(data)}(data)

@propagate_inbounds function Base.getindex(vec::MinusEpsVector{T},
index::Int) where {T}
Expand Down Expand Up @@ -80,11 +80,11 @@ function moveto(vec::MinusEpsVector{T}, device) where {T}
return MinusEpsVector{T}(data)
end

struct PlusEpsVector{T, S} <: AbstractVector{T}
data::AbstractVector{S}
struct PlusEpsVector{T, S, A <:AbstractVector{S}} <: AbstractVector{T}
data::A
end

PlusEpsVector(data::AbstractVector{T}) where {T} = PlusEpsVector{Limit{T}, T}(data)
PlusEpsVector(data::AbstractVector{T}) where {T} = PlusEpsVector{Limit{T}, T, typeof(data)}(data)

@propagate_inbounds function Base.getindex(vec::PlusEpsVector{T},
index::Int) where {T}
Expand Down

2 comments on commit fb333c0

@willow-ahrens
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@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/107367

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 v0.6.30 -m "<description of version>" fb333c0ffd86eaa8199361faecadb955654fbc53
git push origin v0.6.30

Please sign in to comment.