|
| template<class RangeType , class T , class Fn = std::plus<T>> |
| JPL_INLINE constexpr T | Accumulate (RangeType &&range, T initialValue, Fn reduceOp={}) |
| | Just a wrapper for a range, to not have to type begin and end iterators.
|
| |
| template<class ContainerType > |
| JPL_INLINE constexpr void | NormalizeL1 (ContainerType &&data) |
| | Normalize so that the sum = 1.
|
| |
| template<class ContainerType > |
| JPL_INLINE constexpr void | NormalizeL2 (ContainerType &&data) |
| | Apply unit vector scaling, so that the magnitude of the vector = 1.
|
| |
| template<class ContainerType > |
| JPL_INLINE constexpr bool | IsNormalizedL1 (const ContainerType &data, float tolerance=JPL_FLOAT_EPS) |
| |
| template<class ContainerType > |
| JPL_INLINE constexpr bool | IsNormalizedL2 (const ContainerType &data, float tolerance=JPL_FLOAT_EPS) |
| |
template<std::random_access_iterator I, std::sentinel_for< I > S, class Gen >
requires std::permutable<I> && std::uniform_random_bit_generator<std::remove_reference_t<Gen>> |
| constexpr I | PartialShuffle (I first, S last, std::size_t count, Gen &&gen) |
| |
template<std::ranges::random_access_range R, class Gen >
requires std::permutable<std::ranges::iterator_t<R>> and std::uniform_random_bit_generator<std::remove_reference_t<Gen>> |
| JPL_INLINE constexpr std::ranges::borrowed_iterator_t< R > | PartialShuffle (R &&r, std::size_t count, Gen &&gen) |
| |
template<std::random_access_iterator I, std::sentinel_for< I > S, class Gen >
requires std::permutable<I> && std::uniform_random_bit_generator<std::remove_reference_t<Gen>>
| I JPL::Algo::PartialShuffle |
( |
I | first, |
|
|
S | last, |
|
|
std::size_t | count, |
|
|
Gen && | gen ) |
|
constexpr |
Shuffle 'count' number of elements in a given range. This is useful when you need to select X first elements from a range as if the entire range was shuffled, but much faster if X is < range size.
- Returns
- iterator to the end of the shuffled range