Skip to content

Commit b4ce751

Browse files
committed
Use cumsum in a slightly better way
1 parent 5a488a5 commit b4ce751

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/implementations/truncation.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function _truncerr_impl(values::AbstractVector, I; atol::Real = 0, rtol::Real =
9696
# fast path to avoid checking all values
9797
ϵᵖ Nᵖ && return Base.OneTo(0)
9898

99-
truncerrᵖ_array = cumsum(map(by, values[reverse(I)]))
99+
truncerrᵖ_array = cumsum(map(by, view(values, reverse(I))))
100100
rank = length(values) - (findfirst((ϵᵖ), truncerrᵖ_array) - 1)
101101
return Base.OneTo(rank)
102102
end

0 commit comments

Comments
 (0)