A library for working with phylogenetic and population genetic data.
v0.27.0
distance.hpp File Reference
#include "genesis/utils/core/algorithm.hpp"
#include "genesis/utils/containers/matrix.hpp"
#include "genesis/utils/math/common.hpp"
#include "genesis/utils/math/ranking.hpp"
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstddef>
#include <functional>
#include <limits>
#include <stdexcept>
#include <utility>
#include <vector>

Go to the source code of this file.

Namespaces

 genesis
 Container namespace for all symbols of genesis in order to keep them separate when used as a library.
 
 genesis::utils
 

Functions

template<class ForwardIterator >
double aitchison_norm (ForwardIterator first, ForwardIterator last)
 Calculate the Aitchison norm of a range of positive numbers. More...
 
double aitchison_norm (std::vector< double > const &vec)
 Calculate the Aitchison norm of a std::vector of double elements. More...
 
template<class ForwardIteratorA , class ForwardIteratorB >
double euclidean_distance (ForwardIteratorA first_a, ForwardIteratorA last_a, ForwardIteratorB first_b, ForwardIteratorB last_b)
 Calculate the Euclidean norm (L2 norm) distance between two (mathematical) vectors. More...
 
double euclidean_distance (std::vector< double > const &vec_a, std::vector< double > const &vec_b)
 Calculate the Euclidean norm (L2 norm) distance between two vectors of double elements. More...
 
Matrix< double > euclidean_distance_matrix (Matrix< double > const &data)
 Calculate the pairwise euclidean distance matrix between the rows of a given matrix. More...
 
template<class ForwardIterator >
double euclidean_norm (ForwardIterator first, ForwardIterator last)
 Calculate the Euclidean norm (L2 norm) of a range of numbers. More...
 
double euclidean_norm (std::vector< double > const &vec)
 Calculate the Euclidean norm (L2 norm) of a std::vector of double elements. More...
 
template<class ForwardIteratorA , class ForwardIteratorB >
double manhattan_distance (ForwardIteratorA first_a, ForwardIteratorA last_a, ForwardIteratorB first_b, ForwardIteratorB last_b)
 Calculate the Manhattan norm (L1 norm) distance between two (mathematical) vectors. More...
 
double manhattan_distance (std::vector< double > const &vec_a, std::vector< double > const &vec_b)
 Calculate the Manhattan norm (L1 norm) distance between two vectors of double elements. More...
 
Matrix< double > manhattan_distance_matrix (Matrix< double > const &data)
 Calculate the pairwise manhatten distance matrix between the rows of a given matrix. More...
 
template<class ForwardIterator >
double manhattan_norm (ForwardIterator first, ForwardIterator last)
 Calculate the Manhattan norm (L1 norm) of a range of numbers. More...
 
double manhattan_norm (std::vector< double > const &vec)
 Calculate the Manhattan norm (L1 norm) of a std::vector of double elements. More...
 
template<class ForwardIteratorA , class ForwardIteratorB >
double maximum_distance (ForwardIteratorA first_a, ForwardIteratorA last_a, ForwardIteratorB first_b, ForwardIteratorB last_b)
 Calculate the Maximum norm (infinity norm) distance between two (mathematical) vectors. More...
 
double maximum_distance (std::vector< double > const &vec_a, std::vector< double > const &vec_b)
 Calculate the Maximum norm (infinity norm) distance between two vectors of double elements. More...
 
Matrix< double > maximum_distance_matrix (Matrix< double > const &data)
 Calculate the pairwise maximum distance matrix between the rows of a given matrix. More...
 
template<class ForwardIterator >
double maximum_norm (ForwardIterator first, ForwardIterator last)
 Calculate the Maximum norm (infinity norm) of a range of numbers. More...
 
double maximum_norm (std::vector< double > const &vec)
 Calculate the Maximum norm (infinity norm) of a std::vector of double elements. More...
 
template<class ForwardIterator >
double p_norm (ForwardIterator first, ForwardIterator last, double p=2.0)
 Calculate the p-norm of a range of numbers. More...
 
double p_norm (std::vector< double > const &vec, double p=2.0)
 Calculate the p-norm of a std::vector of double elements. More...
 
template<class ForwardIteratorA , class ForwardIteratorB >
double p_norm_distance (ForwardIteratorA first_a, ForwardIteratorA last_a, ForwardIteratorB first_b, ForwardIteratorB last_b, double p=2.0)
 Calculate the p-norm distance between two (mathematical) vectors. More...
 
double p_norm_distance (std::vector< double > const &vec_a, std::vector< double > const &vec_b, double p=2.0)
 Calculate the p-norm distance between two vectors of double elements. More...
 
Matrix< double > p_norm_distance_matrix (Matrix< double > const &data, double p=2.0)
 Calculate the pairwise distance matrix between the rows of a given matrix. More...