-
Notifications
You must be signed in to change notification settings - Fork 30
/
distance.h
36 lines (31 loc) · 869 Bytes
/
distance.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* @file distance.h
* @author hutusi ([email protected])
* @brief
* @date 2019-08-29
*
* https://en.wikipedia.org/wiki/Category:Similarity_and_distance_measures
*
* @copyright Copyright (c) 2019, hutusi.com
*
*/
#ifndef RETHINK_C_DISTANCE_H
#define RETHINK_C_DISTANCE_H
#include "vector.h"
/**
* @brief Calculate the Euclidiean distance between two vectors.
*
* @param v1 Vector 1.
* @param v2 Vector 2.
* @return double The Euclidiean distance.
*/
double euclidiean_distance(const Vector *v1, const Vector *v2);
/**
* @brief Calculate the Manhattan distance (city block) between two vectors.
*
* @param v1 Vector 1.
* @param v2 Vector 2.
* @return double The Manhattan distance.
*/
double manhattan_distance(const Vector *v1, const Vector *v2);
#endif /* #ifndef RETHINK_C_DISTANCE_H */