IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
MathUtils.h
Go to the documentation of this file.
1 // MathUtils.h:
3 // ------------
4 //
14 
15 #ifndef __IPSDKMATH_MATHUTILS_H__
16 #define __IPSDKMATH_MATHUTILS_H__
17 
19 #include <IPSDKMath/Constants.h>
20 #include <boost/type_traits.hpp>
21 #include <vector>
22 
23 namespace ipsdk {
24 namespace math {
25 
28 
32 template <typename T>
33 IPSDKMATH_API void
34 sort(const T& x1, const T& x2, const T& x3, T& y1, T& y2, T& y3);
35 
37 template <typename OutputType, typename InputType>
38 IPSDKMATH_API OutputType
39 round(const InputType value);
40 
43 template <typename OutputType, typename InputType>
44 IPSDKMATH_API OutputType
45 saturatedRound(const InputType value);
46 
49 template <typename T>
50 IPSDKMATH_API typename boost::enable_if<typename boost::is_arithmetic<T>::type, bool>::type
51 compare(const T val1, const T val2,
52  const T tolerance = NumericLimits<T>::sqrt_epsilon());
53 
58 template <typename T>
59 IPSDKMATH_API typename boost::enable_if<typename boost::is_arithmetic<T>::type, bool>::type
60 compare(const std::vector<T>& vec1, const std::vector<T>& vec2,
61  const T tolerance = NumericLimits<T>::sqrt_epsilon());
62 
67 template <typename T>
68 IPSDKMATH_API typename boost::enable_if<typename boost::is_arithmetic<T>::type, bool>::type
69 compareRelative(const T val1, const T val2,
70  const T tolerance = NumericLimits<T>::sqrt_epsilon());
71 
77 template <typename T>
78 IPSDKMATH_API typename boost::enable_if<typename boost::is_arithmetic<T>::type, bool>::type
79 compareRelative(const std::vector<T>& vec1, const std::vector<T>& vec2,
80  const T tolerance = NumericLimits<T>::sqrt_epsilon());
81 
84 
85 } // end of namespace math
86 } // end of namespace ipsdk
87 
88 #endif // __IPSDKMATH_MATHUTILS_H__
Definition of import/export macro for library.
bool compare(const boost::numeric::ublas::matrix< ipReal64, boost::numeric::ublas::row_major, ArrayType1 > &mat1, const boost::numeric::ublas::matrix< ipReal64, boost::numeric::ublas::row_major, ArrayType2 > &mat2, const ipReal64 epsilonValue=NumericLimits< ipReal64 >::sqrt_epsilon())
matrix comparison with tolerance on frobenius norm of difference
Definition: LinearAlgebraUtils.h:148
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
IPSDKMATH_API OutputType saturatedRound(const InputType value)
function allowing to round number from a type to an other with overflow management ...
Predefined constants for ipsdk math library.
IPSDKMATH_API void sort(const T &x1, const T &x2, const T &x3, T &y1, T &y2, T &y3)
function allowing to sort 3 numbers in ascending order
Definition: MathUtils.cpp:52
#define IPSDKMATH_API
Import/Export macro for library IPSDKMath.
Definition: IPSDKMathExports.h:27
IPSDKMATH_API OutputType round(const InputType value)
function allowing to round number from a type to an other
bool compareRelative(const boost::numeric::ublas::matrix< ipReal64, boost::numeric::ublas::row_major, ArrayType1 > &mat1, const boost::numeric::ublas::matrix< ipReal64, boost::numeric::ublas::row_major, ArrayType2 > &mat2, const ipReal64 epsilonValue=NumericLimits< ipReal64 >::sqrt_epsilon())
Definition: LinearAlgebraUtils.h:161