Skip to content

Commit

Permalink
Make has_fast_linear_indexing based on IndexStyle and ndims
Browse files Browse the repository at this point in the history
  • Loading branch information
N5N3 committed Mar 24, 2023
1 parent 8ca8ef3 commit 3a9950a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions base/reducedim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,8 @@ end

## generic (map)reduction

has_fast_linear_indexing(a::AbstractArrayOrBroadcasted) = false
has_fast_linear_indexing(a::Array) = true
has_fast_linear_indexing(::Union{Number,Ref,AbstractChar}) = true # 0d objects, for Broadcasted
has_fast_linear_indexing(bc::Broadcast.Broadcasted) =
all(has_fast_linear_indexing, bc.args)
has_fast_linear_indexing(a::AbstractArrayOrBroadcasted) = IndexStyle(a) === IndexLinear()
has_fast_linear_indexing(a::AbstractVector) = true

function check_reducedims(R, A)
# Check whether R has compatible dimensions w.r.t. A for reduction
Expand Down

0 comments on commit 3a9950a

Please sign in to comment.