Theoretica
Mathematical Library
|
Distances and norms of generic vectors, with real or complex elements. More...
#include "./vec.h"
#include "./algebra.h"
#include "../core/constants.h"
#include "../core/core_traits.h"
#include "../core/real_analysis.h"
#include "../complex/complex_analysis.h"
Go to the source code of this file.
Namespaces | |
namespace | theoretica |
Main namespace of the library which contains all functions and objects. | |
namespace | theoretica::algebra |
Linear algebra routines. | |
Functions | |
template<typename Vector > | |
real | theoretica::algebra::lp_norm (const Vector &v, unsigned int p) |
Norms. | |
template<typename Vector > | |
real | theoretica::algebra::l1_norm (const Vector &v) |
Compute the l1 norm of a vector: \(\mathcal{l}^1(\vec v) = \Sigma_i \ |v_i|\). | |
template<typename Vector > | |
real | theoretica::algebra::l2_norm (const Vector &v) |
Compute the l2 norm of a vector: \(\mathcal{l}^2(\vec v) = \sqrt{\Sigma_i \ v_i^2}\). | |
template<typename Vector > | |
real | theoretica::algebra::linf_norm (const Vector &v) |
Compute the linf norm of a vector: \(\mathcal{l}^{\infty}(\vec v) = max(|v_i|)\). | |
template<typename Vector > | |
real | theoretica::algebra::euclidean_distance (const Vector &v1, const Vector &v2) |
Distances. | |
template<typename Vector > | |
real | theoretica::algebra::distance (const Vector &v1, const Vector &v2) |
Compute the Euclidean distance between two vectors: \(d(\vec v_1, \vec v_2) = \mathcal{l}^2(\vec v_1 - \vec v_2)\). | |
real | theoretica::algebra::euclidean_distance (real a, real b) |
Compute the Euclidian distance between two real values: \(d(a, b) = |a - b|\). | |
template<typename T > | |
real | theoretica::algebra::euclidean_distance (complex< T > z1, complex< T > z2) |
Compute the Euclidean distance between two complex numbers: \(d(z_1, z_2) = |z_1 - z_2|\). | |
real | theoretica::algebra::distance (real a, real b) |
Compute the Euclidian distance between two values: \(d(a, b) = |a - b|\). | |
template<typename T > | |
real | theoretica::algebra::distance (complex< T > z1, complex< T > z2) |
Compute the Euclidean distance between two complex numbers: \(d(z_1, z_2) = |z_1 - z_2|\). | |
template<typename Vector > | |
real | theoretica::algebra::minkowski_distance (const Vector &v1, const Vector &v2, unsigned int p) |
Compute the Minkowski distance between two vectors: \(d(\vec v_1, \vec v_2) = \mathcal{l}^p(\vec v_1 - \vec v_2)\). | |
real | theoretica::algebra::minkowski_distance (real a, real b, unsigned int p) |
Compute the Minkowski distance between two real values: \(d(a, b) = \mathcal{l}^p(a - b)\). | |
template<typename T > | |
real | theoretica::algebra::minkowski_distance (complex< T > z1, complex< T > z2, unsigned int p) |
Compute the Minkowski distance between two complex values: \(d(z_1, z_2) = \mathcal{l}^p(z_1 - z_2)\). | |
template<typename Vector > | |
real | theoretica::algebra::manhattan_distance (const Vector &v1, const Vector &v2) |
Compute the Manhattan distance between two vectors: \(d(\vec v_1, \vec v_2) = \mathcal{l}^1(\vec v_1 - \vec v_2)\). | |
template<typename Vector > | |
real | theoretica::algebra::chebyshev_distance (const Vector &v1, const Vector &v2) |
Compute the Chebyshev distance between two vectors: \(d(\vec v_1, \vec v_2) = \mathcal{l}^{\infty}(\vec v_1 - \vec v_2)\). | |
template<typename Vector > | |
real | theoretica::algebra::discrete_distance (const Vector &v1, const Vector &v2, real tolerance=MACH_EPSILON) |
Compute the discrete distance between two vectors. | |
template<typename Vector > | |
real | theoretica::algebra::canberra_distance (const Vector &v1, const Vector &v2) |
Compute the Canberra distance between two vectors. | |
template<typename Vector > | |
real | theoretica::algebra::cosine_distance (const Vector &v1, const Vector &v2) |
Compute the cosine distance between two vectors. | |
template<typename Vector > | |
real | theoretica::algebra::hamming_distance (const Vector &v1, const Vector &v2, real tolerance=MACH_EPSILON) |
Compute the Hamming distance between two vectors. | |
Distances and norms of generic vectors, with real or complex elements.
The element type of the vectors needs to have a function abs() which returns a real number.