Skip to main content

Module vec_utils

Module vec_utils 

Source
Expand description

Various utility functions for vectors: flattening them, min-max values, cumulative sums and scaling them.

Functionsยง

array_max
Get the maximum value of an array
array_max_min
Get the maximum and minimum value of an array
array_min
Get the minimum value of an array
cumsum
Calculate the cumulative sum over a vector
flatten_vector
Flatten a nested vector
min_max_scale
Min-max scale a vector to the range [0, 1].
rank_normalise
Rank-normalise a vector by ranking values and dividing by n.
robust_scale
Robust-scale a vector using median and MAD.
split_vector_randomly
Split a vector randomly into two chunks
thread_chunks
Split 0..n into one contiguous range per rayon worker.
unique
Get unique elements from a slice of any hashable, equatable numeric type.
zscore_normalise
Z-score normalise a vector (zero mean, unit variance).