Skip to content

Commit

Permalink
Deprecate linearindices in favor of LinearIndices (#26775)
Browse files Browse the repository at this point in the history
* Deprecate linearindices in favor of LinearIndices

LinearIndices is strictly more powerful than linearindices: these two functions
return arrays holding the same elements, but the former also preserves the shape
and indices of the original array.

Also improve docstrings.

* Add efficient LinearIndices iteration

* Work around invalidation and minor LinearIndices simplifications

* Alternative fix using eachindex + adjust failing test

* Fix accumulate/cumsum performance regression by adding getindex(::LinearIndices, ::AbstractRange)

Plus two small fixes.
  • Loading branch information
nalimilan authored and mbauman committed May 8, 2018
1 parent 561489d commit eee4af3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/statistics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function centralize_sumabs2!(R::AbstractArray{S}, A::AbstractArray, means::Abstr

if has_fast_linear_indexing(A) && lsiz > 16
nslices = div(_length(A), lsiz)
ibase = first(linearindices(A))-1
ibase = first(LinearIndices(A))-1
for i = 1:nslices
@inbounds R[i] = centralize_sumabs2(A, means[i], ibase+1, ibase+lsiz)
ibase += lsiz
Expand Down

0 comments on commit eee4af3

Please sign in to comment.