Crate indxvec

source ·
Expand description

Vecs indexing, ranking, sorting, merging, searching, reversing, intersecting, printing, etc.

Modules

Implementation of trait Indices for &[usize]
Implementation of trait Mutops for &mut[T]
Utilities for serializing, writing and printing (optionally in colours) generic vectors.
Stand-alone search functions
Implementation of trait Vecops for &[T]

Macros

Macro here!() gives &str with the file:line path::function-name of where it was called from.

Structs

struct for minimum value, its index, maximum value, its index

Traits

Methods to manipulate indices of Vec<usize> type.
Mutable Operators on &mut[T]
Trait to serialize slices of generic items &[T] (vectors) and slices of Vecs of generic items &[Vec<T>] (matrices). All are converted into printable strings and optionally coloured. Also, methods to serialize and render the resulting string in bold ANSI terminal colours.
Search algoritms implemented on Range
Methods to manipulate generic Vecs and slices of type &[T]

Functions

Partial cmp that does not require T to be an iterator
General Binary Search with fast method for finding all the matches.
Search within the specified Range index, which is always ascending.
The (indexing) range values can be of any generic type T satisfying the listed bounds. Typically usize for indexing efficiently in-memory, u128 for searching whole disks or internet, f64 for solving equations which might not converge using secant and other methods.
Closure samples the (sorted) data source.
Target is the value to be found.
The sort order of the data can be either ascending or descending (increasing/decreasing) and is automatically detected.
When the target is in order before self.start, empty self self.start..self.start range is returned. When the target is in order after self.end, self.end..self.end is returned. When target is not found, then an empty range with its start (and end) equal to the sort position is returned. Otherwise returns the range of all the consecutive values PartiallyEqual to the target.