FloatSimilarity.cpp
Go to the documentation of this file.
1
#include "
FloatSimilarity.h
"
2
#include <cmath>
3
#include "
ArmarXCore/core/logging/Logging.h
"
4
5
namespace
armarx::aron::similarity
{
6
7
double
FloatSimilarity::calculate_similarity
(
armarx::aron::data::FloatPtr
f1,
armarx::aron::data::FloatPtr
f2,
Type
t)
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
20
double
FloatSimilarity::calculateMAE
(
armarx::aron::data::FloatPtr
f1,
armarx::aron::data::FloatPtr
f2)
21
{
22
23
return
std::abs
(f1->getValue() - f2->getValue());
24
}
25
26
double
FloatSimilarity::calculateMSE
(
armarx::aron::data::FloatPtr
f1,
armarx::aron::data::FloatPtr
f2)
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
RobotAPI
libraries
aron
similarity
data
image
FloatSimilarity.cpp
Generated on Sat Oct 12 2024 09:14:10 for armarx_documentation by
1.8.17