Skip to content

Commit

Permalink
Don't specify namespace for imported names (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub committed Apr 7, 2024
1 parent 29e1822 commit 82fbfd9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/blockaxis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ first(b::BlockedUnitRange) = b.first
last(b::BlockedUnitRange)::Integer = isempty(blocklasts(b)) ? first(b)-1 : last(blocklasts(b))

# view and indexing are identical for a unitrange
Base.view(b::BlockedUnitRange, K::Block{1}) = b[K]
view(b::BlockedUnitRange, K::Block{1}) = b[K]

@propagate_inbounds function getindex(b::BlockedUnitRange, K::Block{1})
k = Integer(K)
Expand Down
8 changes: 4 additions & 4 deletions src/blockindices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ Tuple(index::Block) = Block.(index.n)


# Some views may be computed eagerly without the SubArray wrapper
Base.@propagate_inbounds Base.view(r::AbstractRange, B::Block{1}) = r[to_indices(r, (B,))...]
Base.@propagate_inbounds function Base.view(C::CartesianIndices{N}, b1::Block{1}, B::Block{1}...) where {N}
@propagate_inbounds view(r::AbstractRange, B::Block{1}) = r[to_indices(r, (B,))...]
@propagate_inbounds function view(C::CartesianIndices{N}, b1::Block{1}, B::Block{1}...) where {N}
blk = Block((b1, B...))
view(C, to_indices(C, (blk,))...)
end
Base.@propagate_inbounds function Base.view(C::CartesianIndices{N}, B::Block{N}) where {N}
@propagate_inbounds function view(C::CartesianIndices{N}, B::Block{N}) where {N}
view(C, to_indices(C, (B,))...)
end

Expand Down Expand Up @@ -280,7 +280,7 @@ _indices(B) = B
BlockSlice(S.block[_indices(k)], S.indices[_indices(k)])

# Avoid creating a SubArray wrapper in certain non-allocating cases
Base.@propagate_inbounds Base.view(C::CartesianIndices{N}, bs::Vararg{BlockSlice,N}) where {N} = view(C, map(x->x.indices, bs)...)
@propagate_inbounds view(C::CartesianIndices{N}, bs::Vararg{BlockSlice,N}) where {N} = view(C, map(x->x.indices, bs)...)

Block(bs::BlockSlice{<:BlockIndexRange}) = Block(bs.block)

Expand Down

0 comments on commit 82fbfd9

Please sign in to comment.