creativity
v1.3.0
Agent-based model of creativity and piracy
|
Miscellaneous utility functions for dealing with data. More...
#include <limits>
#include <string>
#include <sstream>
#include <vector>
#include <Eigen/Core>
Go to the source code of this file.
Namespaces | |
creativity | |
Primary namespace for all Creativity library code. | |
creativity::data | |
Namespace for classes related to generating and processing simulation data. | |
Enumerations | |
enum | creativity::data::OverlapReducer { creativity::data::OverlapReducer::None, creativity::data::OverlapReducer::Prefix, creativity::data::OverlapReducer::Suffix, creativity::data::OverlapReducer::Equalize, creativity::data::OverlapReducer::Disequalize } |
enum of the different strategies for dealing with prefix/suffix overlap in common_ends(). More... | |
Functions | |
std::string | creativity::data::double_str (double d, unsigned precision=std::numeric_limits< double >::max_digits10) |
Converts a double value to a string, use as much precision is required (but no more). More... | |
template<typename RAIter , typename = typename std::enable_if< std::is_same< std::random_access_iterator_tag, typename std::iterator_traits<RAIter>::iterator_category >::value and std::is_arithmetic<typename std::iterator_traits<RAIter>::value_type>::value>::type> | |
double | creativity::data::quantile (RAIter begin, RAIter end, double prob) |
Returns a sample quantile from a pair of random access iterators over the range of sorted values [begin, end) . More... | |
double | creativity::data::quantile (const std::vector< double > &vals, double prob) |
Shortcut for quantile(vals.begin(), vals.end(), prob) | |
double | creativity::data::quantile (const Eigen::Ref< const Eigen::VectorXd > &vals, double prob) |
Works like quantile(begin,end,prob), but but operates on an Eigen vector-like object. More... | |
double | creativity::data::variance (const std::vector< double > &vals, double mean=std::numeric_limits< double >::quiet_NaN()) |
Calculates and returns the sample variance of the given vector of values. More... | |
template<typename InputIt > | |
std::enable_if< std::is_base_of< std::input_iterator_tag, typename std::iterator_traits< InputIt >::iterator_category >::value and std::is_base_of< std::bidirectional_iterator_tag, typename std::iterator_traits< typename InputIt::value_type::iterator >::iterator_category >::value, std::pair< size_t, size_t >>::type | creativity::data::common_ends (InputIt it, InputIt last, bool prefix=true, bool suffix=true, OverlapReducer reducer=OverlapReducer::Disequalize) |
Determines the number of equal (by ==) front and/or back elements in a range of random-access iterable objects. More... | |
Miscellaneous utility functions for dealing with data.