Utopia 2
Framework for studying models of complex & adaptive systems.
Loading...
Searching...
No Matches
Namespaces | Functions | Variables
utils.hh File Reference
#include <cmath>
#include <random>
#include <numeric>
#include <vector>
#include <limits>
#include <armadillo>
#include <spdlog/spdlog.h>
#include <utopia/core/types.hh>
Include dependency graph for utils.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  Utopia
 
namespace  Utopia::Models
 
namespace  Utopia::Models::SimpleFlocking
 

Functions

template<class RNG , class T = double>
Utopia::Models::SimpleFlocking::random_angle (const std::shared_ptr< RNG > &rng)
 Returns a uniformly random angle value in [-π, +π)
 
template<class T >
Utopia::Models::SimpleFlocking::constrain_angle (T angle)
 Constrains an angle value to interval [-π, +π)
 
template<class Container >
void Utopia::Models::SimpleFlocking::constrain_angles (Container &angles)
 In-place constrains all angles in a container to interval [-π, +π)
 
template<class Container >
double Utopia::Models::SimpleFlocking::absolute_group_velocity (const Container &velocities)
 Computes the absolute group velocity from a container of velocity vectors.
 
template<class Container >
auto Utopia::Models::SimpleFlocking::_circular_sin_cos_sum (const Container &angles)
 Compute sum of sine and cosine values from angles in a container.
 
template<class Container = std::vector<double>>
auto Utopia::Models::SimpleFlocking::circular_mean (const Container &angles)
 Computes the circular mean from a sample of (constrained) angles.
 
template<class Container = std::vector<double>>
auto Utopia::Models::SimpleFlocking::circular_mean_and_std (const Container &angles)
 Computes the circular mean and std from a sample of (constrained) angles.
 

Variables

constexpr double Utopia::Models::SimpleFlocking::TAU = 2*M_PI
 
constexpr double Utopia::Models::SimpleFlocking::NaN = std::numeric_limits<double>::quiet_NaN()