statcpp
C++17 Header-Only Statistics Library
Loading...
Searching...
No Matches
Namespaces | Functions
distance_metrics.hpp File Reference

Distance and similarity metrics. More...

#include <cmath>
#include <stdexcept>
#include <iterator>
#include <vector>
Include dependency graph for distance_metrics.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  statcpp
 

Functions

template<typename Iterator1 , typename Iterator2 >
double statcpp::euclidean_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2)
 Euclidean distance (L2 norm)
 
template<typename Iterator1 , typename Iterator2 , typename Proj1 , typename Proj2 >
double statcpp::euclidean_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, Proj1 proj1, Proj2 proj2)
 Euclidean distance with projection.
 
template<typename Iterator1 , typename Iterator2 >
double statcpp::manhattan_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2)
 Manhattan distance (L1 norm, taxicab distance)
 
template<typename Iterator1 , typename Iterator2 , typename Proj1 , typename Proj2 >
double statcpp::manhattan_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, Proj1 proj1, Proj2 proj2)
 Manhattan distance with projection.
 
template<typename Iterator1 , typename Iterator2 >
double statcpp::cosine_similarity (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2)
 Cosine similarity.
 
template<typename Iterator1 , typename Iterator2 , typename Proj1 , typename Proj2 >
double statcpp::cosine_similarity (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, Proj1 proj1, Proj2 proj2)
 Cosine similarity with projection.
 
template<typename Iterator1 , typename Iterator2 >
double statcpp::cosine_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2)
 Cosine distance.
 
template<typename Iterator1 , typename Iterator2 , typename Proj1 , typename Proj2 >
double statcpp::cosine_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, Proj1 proj1, Proj2 proj2)
 Cosine distance with projection.
 
double statcpp::mahalanobis_distance (const std::vector< double > &x, const std::vector< double > &mean, const std::vector< std::vector< double > > &cov_matrix)
 Mahalanobis distance.
 
template<typename Iterator1 , typename Iterator2 >
double statcpp::minkowski_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, double p)
 Minkowski distance (generalized Lp distance)
 
template<typename Iterator1 , typename Iterator2 , typename Proj1 , typename Proj2 >
double statcpp::minkowski_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, double p, Proj1 proj1, Proj2 proj2)
 Minkowski distance with projection.
 
template<typename Iterator1 , typename Iterator2 >
double statcpp::chebyshev_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2)
 Chebyshev distance (L∞ norm, maximum metric)
 
template<typename Iterator1 , typename Iterator2 , typename Proj1 , typename Proj2 >
double statcpp::chebyshev_distance (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, Proj1 proj1, Proj2 proj2)
 Chebyshev distance with projection.
 

Detailed Description

Distance and similarity metrics.

Definition in file distance_metrics.hpp.