FloatSimilarity.cpp
Go to the documentation of this file.
1#include "FloatSimilarity.h"
2
3#include <cmath>
4
6
8{
9
10 double
13 Type t)
14 {
15 switch (t)
16 {
17 case Type::MAE:
18 return calculateMAE(f1, f2);
19 case Type::MSE:
20 return calculateMSE(f1, f2);
21 default:
22 ARMARX_INFO << "Trying to calculate similarity with unknown similarity type";
23 return -1;
24 }
25 }
26
27 double
29 {
30
31 return std::abs(f1->getValue() - f2->getValue());
32 }
33
34 double
36 {
37 return std::pow(f1->getValue() - f2->getValue(), 2);
38 }
39
40
41} // namespace armarx::aron::similarity
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
std::shared_ptr< Float > FloatPtr
double calculate_similarity(armarx::aron::data::FloatPtr f1, armarx::aron::data::FloatPtr f2, Type t)
double calculateMSE(armarx::aron::data::FloatPtr f1, armarx::aron::data::FloatPtr f2)
double calculateMAE(armarx::aron::data::FloatPtr f1, armarx::aron::data::FloatPtr f2)