Skip to content

Commit

Permalink
Merge pull request #80 from jipolanco/fix-extradims
Browse files Browse the repository at this point in the history
Fix getindex with extra dims
  • Loading branch information
jipolanco authored May 12, 2023
2 parents 15fa3f9 + f6fbe52 commit 4f4b5f1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PencilArrays"
uuid = "0e08944d-e94e-41b1-9406-dcf66b6a9d2e"
authors = ["Juan Ignacio Polanco <[email protected]> and contributors"]
version = "0.17.11"
version = "0.17.12"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand Down
9 changes: 1 addition & 8 deletions src/arrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,7 @@ end
parent(x)[_genperm(x, I)...] = v

@inline function _genperm(x::PencilArray{T,N}, I::NTuple{N,Int}) where {T,N}
# Split "spatial" and "extra" indices.
M = ndims_space(x)
E = ndims_extra(x)
@assert M + E === N
J = ntuple(n -> @inbounds(I[n]), Val(M))
K = ntuple(n -> @inbounds(I[M + n]), Val(E))
perm = permutation(x)
((perm * J)..., K...)
permutation(x) * I
end

@inline _genperm(x::PencilArray, I::CartesianIndex) =
Expand Down

0 comments on commit 4f4b5f1

Please sign in to comment.