STK++ 0.9.13
STK::SafeInverseOp< Type > Struct Template Reference

Template functor which compute safely the inverse of a number. More...

#include <STK_Functors.h>

Public Types

enum  { NbParam_ = 1 }
 
typedef Type result_type
 
typedef hidden::RemoveConst< Type >::Type param1_type
 

Public Member Functions

 SafeInverseOp (Type const &tol=Arithmetic< Type >::epsilon())
 
 SafeInverseOp (SafeInverseOp const &value)
 
result_type operator() (param1_type const &a) const
 

Private Attributes

Type const tol_
 

Detailed Description

template<typename Type>
struct STK::SafeInverseOp< Type >

Template functor which compute safely the inverse of a number.

If the number is 0, return 0.

Definition at line 811 of file STK_Functors.h.

Member Typedef Documentation

◆ param1_type

template<typename Type >
typedef hidden::RemoveConst<Type>::Type STK::SafeInverseOp< Type >::param1_type

Definition at line 815 of file STK_Functors.h.

◆ result_type

template<typename Type >
typedef Type STK::SafeInverseOp< Type >::result_type

Definition at line 814 of file STK_Functors.h.

Member Enumeration Documentation

◆ anonymous enum

template<typename Type >
anonymous enum
Enumerator
NbParam_ 

Definition at line 813 of file STK_Functors.h.

813{ NbParam_ = 1 };

Constructor & Destructor Documentation

◆ SafeInverseOp() [1/2]

template<typename Type >
STK::SafeInverseOp< Type >::SafeInverseOp ( Type const tol = Arithmetic<Type>::epsilon())
inline

Definition at line 817 of file STK_Functors.h.

817: tol_(tol) {}

◆ SafeInverseOp() [2/2]

template<typename Type >
STK::SafeInverseOp< Type >::SafeInverseOp ( SafeInverseOp< Type > const value)
inline

Definition at line 818 of file STK_Functors.h.

818: tol_(value.tol_) {}

Member Function Documentation

◆ operator()()

template<typename Type >
result_type STK::SafeInverseOp< Type >::operator() ( param1_type const a) const
inline

Definition at line 820 of file STK_Functors.h.

821 { return (std::abs(a)>tol_) ? Type(1)/a: Type(0);}

References STK::SafeInverseOp< Type >::tol_.

Member Data Documentation

◆ tol_

template<typename Type >
Type const STK::SafeInverseOp< Type >::tol_
private

Definition at line 823 of file STK_Functors.h.

Referenced by STK::SafeInverseOp< Type >::operator()().


The documentation for this struct was generated from the following file: