Skip to content

Commit 873f46f

Browse files
kshyattJutho
andauthored
Update src/implementations/truncation.jl
Co-authored-by: Jutho <[email protected]>
1 parent a66e165 commit 873f46f

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 = accumulate((x,y)->(x + by(y)), reverse(view(values, I)); init=by(zero(eltype(values))))
100100
rank = length(values) - (findfirst((ϵᵖ), truncerrᵖ_array) - 1)
101101
return Base.OneTo(rank)
102102
end

0 commit comments

Comments
 (0)