dummy-link

SortedVectors

Lightweight wrapper to declare that a vector is sorted.

Readme

SortedVectors

Lifecycle Build Status codecov.io

A very lightweight Julia package to declare that a vector is sorted.

Installation

Type ] to enter pkg mode, and install with

pkg> add SortedVectors

How to use

Standard constructor

The only exported symbol is SortedVector. Use

SortedVector([lt=isless], xs)

to sort xs and save the result in a vector. xs can be any <: AbstractVector. For immutable types (eg StaticArrays.SVector or UnitRange), setindex! will not work.

Special constructors for checking or skipping sorting

If your code emits sorted vectors, use the

SortedVector(SortedVectors.AssumeSorted(), lt, sorted_contents)

constructor. This will skip checks.

If your API accepts sorted vectors, and you want to check them, use the

SortedVector(SortedVectors.CheckSorted(), lt, sorted_contents)

constructor.

In either case, you are responsible for ensuring that the argument vector is not modified later on. copy if you are unsure.

Supported interfaces

AbstractVector

setindex! verifies that sorting is maintained.

First Commit

11/20/2018

Last Touched

5 months ago

Commits

15 commits

Used By: