JPL Spatial
Sound spatialization and propagation library
Loading...
Searching...
No Matches
Algorithm.h File Reference
#include "JPLSpatial/Core.h"
#include "JPLSpatial/Math/Math.h"
#include <iterator>
#include <type_traits>
#include <utility>
#include <functional>
#include <numeric>
#include <algorithm>
#include <ranges>
#include <random>

Go to the source code of this file.

Classes

struct  JPL::Algo::AccPow2< T >
 functor for std::accumulate (and similar) to accumulate sum of value squares More...
 
struct  JPL::Algo::AccAbs< T >
 functor for std::accumulate (and similar) to accumulate absolute values More...
 
class  JPL::Algo::Multiply< T >
 functor for for_each (and similar) to multiply elements by a multiplier More...
 

Namespaces

namespace  JPL
 
namespace  JPL::Algo
 
namespace  JPL::Algo::Internal
 

Typedefs

template<class ContainerType >
using JPL::Algo::Internal::ElementTypeOf = std::remove_cvref_t< decltype(*std::declval< ContainerType >().begin())>
 

Functions

template<class RangeType , class T , class Fn = std::plus<T>>
JPL_INLINE constexprJPL::Algo::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 JPL::Algo::NormalizeL1 (ContainerType &&data)
 Normalize so that the sum = 1.
 
template<class ContainerType >
JPL_INLINE constexpr void JPL::Algo::NormalizeL2 (ContainerType &&data)
 Apply unit vector scaling, so that the magnitude of the vector = 1.
 
template<class ContainerType >
JPL_INLINE constexpr bool JPL::Algo::IsNormalizedL1 (const ContainerType &data, float tolerance=JPL_FLOAT_EPS)
 
template<class ContainerType >
JPL_INLINE constexpr bool JPL::Algo::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 JPL::Algo::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< RJPL::Algo::PartialShuffle (R &&r, std::size_t count, Gen &&gen)