Skip to content

Commit

Permalink
vec fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod committed Oct 11, 2021
1 parent fe45818 commit 25f85c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "StrideArraysCore"
uuid = "7792a7ef-975c-4747-a70f-980b88e8d1da"
authors = ["Chris Elrod <[email protected]> and contributors"]
version = "0.2.4"
version = "0.2.5"

[deps]
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
Expand Down
6 changes: 5 additions & 1 deletion src/views.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,13 @@ end
end
@inline Base.SubArray(A::AbstractStrideArray, i::Tuple{Vararg{<:Union{Integer,AbstractRange,Colon},K}}) where {K} = view(A, i...)

@inline Base.vec(A::PtrArray{S,D,T,1,C,0}) where {S,D,T,C} = A
@inline function Base.vec(A::PtrArray{S,D,T,N,C,0}) where {S,D,T,N,C}
@assert all(D) "All dimensions must be dense for a vec view. Try `vec(copy(A))` instead."
sp = StridedPointer(pointer(A), (static_sizeof(T),), (One(),))
si = StrideIndex{1,(1,),1}((static_sizeof(T),), (One(),))
sp = stridedpointer(pointer(A), si)
PtrArray(sp, (static_length(A),), Val((true,)))
end
@inline Base.vec(A::StaticStrideArray{S,D,T,1}) where {S,D,T} = A
@inline Base.vec(A::StaticStrideArray{S,D,T,N}) where {S,D,T,N} = StrideArray(vec(PtrArray(A)), A)

2 comments on commit 25f85c3

@chriselrod
Copy link
Member 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/46559

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.2.5 -m "<description of version>" 25f85c376a6d1d1f8309295d39cce5ae53342b12
git push origin v0.2.5

Please sign in to comment.