18 #ifndef itkArithmeticOpsFunctors_h
19 #define itkArithmeticOpsFunctors_h
33 template<
typename TInput1,
typename TInput2 = TInput1,
typename TOutput = TInput1 >
34 class ITK_TEMPLATE_EXPORT
Add2
47 return !( *
this != other );
50 inline TOutput
operator()(
const TInput1 & A,
const TInput2 & B)
const
52 return static_cast< TOutput
>( A + B );
62 template<
typename TInput1,
typename TInput2,
typename TInput3,
typename TOutput >
63 class ITK_TEMPLATE_EXPORT
Add3
76 return !( *
this != other );
81 const TInput3 & C)
const
82 {
return static_cast<TOutput
>( A + B + C ); }
91 template<
typename TInput1,
typename TInput2 = TInput1,
typename TOutput = TInput1 >
92 class ITK_TEMPLATE_EXPORT
Sub2
105 return !( *
this != other );
108 inline TOutput
operator()(
const TInput1 & A,
const TInput2 & B)
const
109 {
return static_cast<TOutput
>( A - B ); }
118 template<
typename TInput1,
typename TInput2 = TInput1,
typename TOutput = TInput1 >
132 return !( *
this != other );
135 inline TOutput
operator()(
const TInput1 & A,
const TInput2 & B)
const
136 {
return static_cast<TOutput
>( A * B ); }
145 template<
typename TInput1,
typename TInput2,
typename TOutput >
146 class ITK_TEMPLATE_EXPORT
Div
159 return !( *
this != other );
162 inline TOutput
operator()(
const TInput1 & A,
const TInput2 & B)
const
166 return (TOutput)( A / B );
181 template<
typename TNumerator,
typename TDenominator=TNumerator,
typename TOutput=TNumerator >
196 return !(*
this == other);
206 inline TOutput
operator()(
const TNumerator & n,
const TDenominator & d )
const
208 if ( d < m_Threshold )
212 return static_cast< TOutput
>( n ) / static_cast< TOutput >( d );
223 template<
typename TInput1,
typename TInput2,
typename TOutput >
237 return !( *
this != other );
240 inline TOutput
operator()(
const TInput1 & A,
const TInput2 & B)
const
244 return static_cast< TOutput
>( A % B );
254 #if ! defined ( ITK_FUTURE_LEGACY_REMOVE )
263 template<
typename TInput,
typename TOutput >
282 return !( *
this != other );
287 auto result =
static_cast< TOutput
>( x % m_Dividend );
307 template<
class TInput1,
class TInput2,
class TOutput >
319 return !( *
this != other );
322 inline TOutput
operator()(
const TInput1 & A,
const TInput2 & B)
const
324 const double temp = std::floor(
double(A) /
double(B) );
336 return static_cast< TOutput
>(temp);
351 template<
class TInput1,
class TInput2,
class TOutput >
363 return !( *
this != other );
366 inline TOutput
operator()(
const TInput1 & A,
const TInput2 & B)
const
380 template<
class TInput1,
class TOutput = TInput1 >
394 return !( *
this != other );
398 {
return (TOutput)( -A ); }
TOutput operator()(const TInput1 &A, const TInput2 &B) const
bool operator!=(const Modulus &) const
bool operator==(const DivReal &other) const
bool operator==(const Add2 &other) const
TOutput operator()(const TNumerator &n, const TDenominator &d) const
Define numeric traits for std::vector.
bool operator!=(const Mult &) const
bool operator!=(const DivideOrZeroOut &other) const
bool operator!=(const UnaryMinus &) const
TOutput operator()(const TInput1 &A, const TInput2 &B, const TInput3 &C) const
bool operator==(const Modulus &other) const
bool operator==(const UnaryMinus &other) const
bool operator==(const Div &other) const
bool operator==(const DivideOrZeroOut &) const
bool operator==(const DivFloor &other) const
bool operator==(const Mult &other) const
bool operator!=(const DivFloor &) const
Promotes arguments to real type and performs division.
bool operator==(const Add3 &other) const
TOutput operator()(const TInput1 &A, const TInput2 &B) const
TOutput operator()(const TInput1 &A) const
TOutput operator()(const TInput1 &A, const TInput2 &B) const
bool operator!=(const Sub2 &) const
bool operator==(const Sub2 &other) const
Cast arguments to double, performs division then takes the floor.
TOutput operator()(const TInput1 &A, const TInput2 &B) const
static constexpr double e
The base of the natural logarithm or Euler's number
bool operator!=(const Add3 &) const
TOutput operator()(const TInput1 &A, const TInput2 &B) const
bool operator!=(const Add2 &) const
bool operator!=(const Div &) const
bool NotAlmostEquals(T1 x1, T2 x2)
Apply the unary minus operator.
bool operator!=(const DivReal &) const
TOutput operator()(const TInput1 &A, const TInput2 &B) const
TOutput operator()(const TInput1 &A, const TInput2 &B) const