FloatSimilarity.cpp
Go to the documentation of this file.
1 #include "FloatSimilarity.h"
2 #include <cmath>
4 
6 
8 {
9  switch (t) {
10  case Type::MAE:
11  return calculateMAE(f1, f2);
12  case Type::MSE:
13  return calculateMSE(f1, f2);
14  default:
15  ARMARX_INFO << "Trying to calculate similarity with unknown similarity type";
16  return -1;
17  }
18 }
19 
21 {
22 
23  return std::abs(f1->getValue() - f2->getValue());
24 }
25 
27 {
28  return std::pow(f1->getValue() - f2->getValue(), 2);
29 }
30 
31 
32 
33 }
armarx::aron::similarity
Definition: cosine.cpp:6
armarx::aron::similarity::FloatSimilarity::calculateMSE
double calculateMSE(armarx::aron::data::FloatPtr f1, armarx::aron::data::FloatPtr f2)
Definition: FloatSimilarity.cpp:26
FloatSimilarity.h
armarx::abs
std::vector< T > abs(const std::vector< T > &v)
Definition: VectorHelpers.h:253
armarx::aron::similarity::FloatSimilarity::MAE
@ MAE
Definition: FloatSimilarity.h:10
armarx::aron::similarity::FloatSimilarity::Type
Type
The Type enum.
Definition: FloatSimilarity.h:8
armarx::aron::similarity::FloatSimilarity::MSE
@ MSE
Definition: FloatSimilarity.h:9
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
armarx::aron::data::FloatPtr
std::shared_ptr< Float > FloatPtr
Definition: forward_declarations.h:29
armarx::aron::similarity::FloatSimilarity::calculate_similarity
double calculate_similarity(armarx::aron::data::FloatPtr f1, armarx::aron::data::FloatPtr f2, Type t)
Definition: FloatSimilarity.cpp:7
Logging.h
armarx::aron::similarity::FloatSimilarity::calculateMAE
double calculateMAE(armarx::aron::data::FloatPtr f1, armarx::aron::data::FloatPtr f2)
Definition: FloatSimilarity.cpp:20