JuliaCollections / JuliaCollections/DataStructures.jl

possible bug in fenwick.jl

Open
#813 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
745
Forks
261
PR merge metrics
No merged PRs in 30d

Description

There is a big discussion (https://discourse.julialang.org/t/offsetarrays-inbounds-and-confusion/81295) on discourse about why it is a bad idea to iterate over an AbstractVector, say a, using for i=1:length(a) (because this will fail if a is an OffsetArray). I checked the src file for DataStructures and found this style of code in fenwick.jl.

Update: this issue is also present in: append! for circular buffer and nextreme in heaps.jl,

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the iteration in src/fenwick.jl, then compare the related append! implementation for circular buffers and nextreme in heaps.jl. Use the linked discussion to understand the AbstractVector and OffsetArray concern, and consider the work complete when these operations no longer assume indices start at 1.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.