Skip to content

O(1) searchsorted for Ranges satisfying RangeStepRegular #30501

@kcajf

Description

@kcajf

RangeStepStyle is defined here:
https://github.com/JuliaLang/julia/blob/master/base/traits.jl#L55

Presumably, the implication of this is that searchsorted on a RangeStepRegular Range should be constant-time: just subtract the start, divide by the step, and round it (of course, handling all the edge-cases)? Is this something that could/should be implemented somewhere central? If so, I can't really work out how to write a method that dispatches specifically on Ranges that implement RangeStepRegular.

Metadata

Metadata

Assignees

No one assigned

    Labels

    search & findThe find* family of functions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions