Chebyshev
Unit testing for scientific software
Loading...
Searching...
No Matches
chebyshev::prec::distance Namespace Reference

Distance functions for use in prec_context::equals() More...

Functions

template<typename Type = real_t>
prec_t absolute (Type a, Type b)
 Absolute distance between two values which have an ordering with respect to zero.
 
template<typename Vector >
prec_t euclidean (const Vector &v1, const Vector &v2)
 Euclidean distance between vectors (any type with a size() method and [] operator).
 
unsigned int hamming (const std::string &a, const std::string &b)
 Hamming distance between two strings, defined as the number of positions at which the corresponding characters are different.
 

Detailed Description

Distance functions for use in prec_context::equals()

Function Documentation

◆ euclidean()

template<typename Vector >
prec_t chebyshev::prec::distance::euclidean ( const Vector v1,
const Vector v2 
)
inline

Euclidean distance between vectors (any type with a size() method and [] operator).

If the size of the vectors is different, NaN is returned.