Skip to content

array_ module

Utilities for working with arrays.


get_ranges_arr function

get_ranges_arr(
    starts,
    ends
)

Build array from start and end indices.

Based on https://stackoverflow.com/a/37626057


insert_argsort_nb function

insert_argsort_nb(
    A,
    I
)

Perform argsort using insertion sort.

In-memory and without recursion -> very fast for smaller arrays.


is_sorted function

is_sorted(
    a
)

Checks if array is sorted.


is_sorted_nb function

is_sorted_nb(
    a
)

Numba-compiled version of is_sorted().


max_rel_rescale function

max_rel_rescale(
    a,
    to_range
)

Rescale elements in a relatively to maximum.


min_rel_rescale function

min_rel_rescale(
    a,
    to_range
)

Rescale elements in a relatively to minimum.


renormalize function

renormalize(
    a,
    from_range,
    to_range
)

Renormalize a from one range to another.


renormalize_nb function

renormalize(
    a,
    from_range,
    to_range
)

Renormalize a from one range to another.


rescale_float_to_int_nb function

rescale_float_to_int_nb(
    floats,
    int_range,
    total
)

Rescale a float array into an int array.


uniform_summing_to_one_nb function

uniform_summing_to_one_nb(
    n
)

Generate random floats summing to one.

See # https://stackoverflow.com/a/2640067/8141780