42#include <pcl/console/print.h>
49template <
typename FloatVectorT>
inline float
81 PCL_ERROR (
"[pcl::selectNorm] For PF and K norms you have to explicitly call the method, as they need additional parameters\n");
87template <
typename FloatVectorT>
inline float
91 for (
int i = 0; i < dim; ++i)
92 norm += std::abs(a[i] - b[i]);
97template <
typename FloatVectorT>
inline float
101 for (
int i = 0; i < dim; ++i)
103 float diff = a[i] - b[i];
110template <
typename FloatVectorT>
inline float
117template <
typename FloatVectorT>
inline float
121 for (
int i = 0; i < dim; ++i)
122 norm = (std::max)(std::abs(a[i] - b[i]), norm);
127template <
typename FloatVectorT>
inline float
132 for (
int i = 0; i < dim; ++i)
133 norm += (std::sqrt (a[i]) - std::sqrt (b[i])) * (std::sqrt (a[i]) - std::sqrt (b[i]));
135 return std::sqrt (norm);
139template <
typename FloatVectorT>
inline float
144 for (
int i = 0; i < dim; ++i)
145 norm += std::sqrt (a[i] * b[i]);
148 result = -std::log (norm);
156template <
typename FloatVectorT>
inline float
161 for (
int i = 0; i < dim; ++i)
162 norm += std::sqrt (std::abs (a[i] - b[i]));
168template <
typename FloatVectorT>
inline float
173 for (
int i = 0; i < dim; ++i)
174 if ((a[i] + b[i]) != 0)
175 norm += (a[i] - b[i]) * (a[i] - b[i]) / (a[i] + b[i]);
182template <
typename FloatVectorT>
inline float
187 for (
int i = 0; i < dim; ++i)
188 if ((a[i] / b[i]) > 0)
189 norm += (a[i] - b[i]) * std::log (a[i] / b[i]);
196template <
typename FloatVectorT>
inline float
201 for (
int i = 0; i < dim; ++i)
202 norm += (
P1 * a[i] -
P2 * b[i]) * (
P1 * a[i] -
P2 * b[i]);
203 return std::sqrt (norm);
207template <
typename FloatVectorT>
inline float
212 for (
int i = 0; i < dim; ++i)
213 norm += std::abs (
P1 * a[i] -
P2 * b[i]);
218template <
typename FloatVectorT>
inline float
223 for (
int i = 0; i < dim; ++i)
224 if ( (b[i] != 0) && ((a[i] / b[i]) > 0) )
225 norm += a[i] * std::log (a[i] / b[i]);
232template <
typename FloatVectorT>
inline float
236 for (
int i = 0; i < dim; ++i)
237 norm += (std::min)(a[i], b[i]);
Iterator class for point clouds with or without given indices.
float selectNorm(FloatVectorT a, FloatVectorT b, int dim, NormType norm_type)
Method that calculates any norm type available, based on the norm_type variable.
float B_Norm(FloatVectorT a, FloatVectorT b, int dim)
Compute the B norm of the vector between two points.
float KL_Norm(FloatVectorT a, FloatVectorT b, int dim)
Compute the KL between two discrete probability density functions.
float JM_Norm(FloatVectorT a, FloatVectorT b, int dim)
Compute the JM norm of the vector between two points.
float K_Norm(FloatVectorT a, FloatVectorT b, int dim, float P1, float P2)
Compute the K norm of the vector between two points.
float L1_Norm(FloatVectorT a, FloatVectorT b, int dim)
Compute the L1 norm of the vector between two points.
float Linf_Norm(FloatVectorT a, FloatVectorT b, int dim)
Compute the L-infinity norm of the vector between two points.
float L2_Norm(FloatVectorT a, FloatVectorT b, int dim)
Compute the L2 norm of the vector between two points.
float CS_Norm(FloatVectorT a, FloatVectorT b, int dim)
Compute the CS norm of the vector between two points.
float HIK_Norm(FloatVectorT a, FloatVectorT b, int dim)
Compute the HIK norm of the vector between two points.
NormType
Enum that defines all the types of norms available.
float Sublinear_Norm(FloatVectorT a, FloatVectorT b, int dim)
Compute the sublinear norm of the vector between two points.
float Div_Norm(FloatVectorT a, FloatVectorT b, int dim)
Compute the div norm of the vector between two points.
float L2_Norm_SQR(FloatVectorT a, FloatVectorT b, int dim)
Compute the squared L2 norm of the vector between two points.
float PF_Norm(FloatVectorT a, FloatVectorT b, int dim, float P1, float P2)
Compute the PF norm of the vector between two points.
Define standard C methods to calculate different norms.
Defines all the PCL and non-PCL macros used.