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 );
261 template<
typename TInput,
typename TOutput >
280 return !( *
this != other );
285 TOutput result =
static_cast< TOutput
>( x % m_Dividend );
303 template<
class TInput1,
class TInput2,
class TOutput >
315 return !( *
this != other );
318 inline TOutput
operator()(
const TInput1 & A,
const TInput2 & B)
const
320 const double temp =
std::floor(
double(A) /
double(B) );
332 return static_cast< TOutput
>(temp);
347 template<
class TInput1,
class TInput2,
class TOutput >
359 return !( *
this != other );
362 inline TOutput
operator()(
const TInput1 & A,
const TInput2 & B)
const
376 template<
class TInput1,
class TOutput = TInput1 >
390 return !( *
this != other );
394 {
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
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 isinf(const T value)
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
static ITK_CONSTEXPR_FUNC T max(const T &)
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.
static ITK_CONSTEXPR_FUNC T NonpositiveMin()
TOutput operator()(const TInput1 &A, const TInput2 &B) const
bool operator!=(const Add3 &) const
TOutput operator()(const TInput1 &A, const TInput2 &B) const
bool operator!=(const Add2 &) const
Define additional traits for native types such as int or float.
bool operator!=(const Div &) const
bool NotAlmostEquals(T1 x1, T2 x2)
Apply the unary minus operator.
static ITK_CONSTEXPR_VAR double e
The base of the natural logarithm or Euler's number
bool operator!=(const DivReal &) const
TOutput operator()(const TInput1 &A, const TInput2 &B) const
TOutput operator()(const TInput1 &A, const TInput2 &B) const