STK++ 0.9.13
STK::hidden::MeanSafeVisitor< Type_ > Struct Template Reference

Visitor computing safely the mean of all the coefficients of the Array. More...

#include <STK_Visitors.h>

Public Types

typedef Type_ Type
 
typedef RemoveConst< Type >::Type TypeConst
 

Public Member Functions

 MeanSafeVisitor ()
 
void operator() (Type const &value, int i, int j)
 
void operator() (Type const &value, int i)
 
TypeConst result () const
 

Public Attributes

Type res_
 
int nb_
 

Detailed Description

template<typename Type_>
struct STK::hidden::MeanSafeVisitor< Type_ >

Visitor computing safely the mean of all the coefficients of the Array.

See also
ExprBase::mean()

Definition at line 261 of file STK_Visitors.h.

Member Typedef Documentation

◆ Type

template<typename Type_ >
typedef Type_ STK::hidden::MeanSafeVisitor< Type_ >::Type

Definition at line 263 of file STK_Visitors.h.

◆ TypeConst

template<typename Type_ >
typedef RemoveConst<Type>::Type STK::hidden::MeanSafeVisitor< Type_ >::TypeConst

Definition at line 264 of file STK_Visitors.h.

Constructor & Destructor Documentation

◆ MeanSafeVisitor()

template<typename Type_ >
STK::hidden::MeanSafeVisitor< Type_ >::MeanSafeVisitor ( )
inline

Member Function Documentation

◆ operator()() [1/2]

template<typename Type_ >
void STK::hidden::MeanSafeVisitor< Type_ >::operator() ( Type const value,
int  i 
)
inline

Definition at line 273 of file STK_Visitors.h.

274 {
276 { res_ += value; nb_++;}
277 }
static bool isFinite(Type const &x)

References STK::hidden::MeanSafeVisitor< Type_ >::nb_, and STK::hidden::MeanSafeVisitor< Type_ >::res_.

◆ operator()() [2/2]

template<typename Type_ >
void STK::hidden::MeanSafeVisitor< Type_ >::operator() ( Type const value,
int  i,
int  j 
)
inline

Definition at line 268 of file STK_Visitors.h.

269 {
271 { res_ += value; nb_++;}
272 }

References STK::hidden::MeanSafeVisitor< Type_ >::nb_, and STK::hidden::MeanSafeVisitor< Type_ >::res_.

◆ result()

template<typename Type_ >
TypeConst STK::hidden::MeanSafeVisitor< Type_ >::result ( ) const
inline

Definition at line 278 of file STK_Visitors.h.

278{ return nb_ == 0 ? Arithmetic<Type>::NA() : res_/nb_;}
static Type NA()
Adding a Non Available (NA) special number.

References STK::Arithmetic< Type >::NA(), STK::hidden::MeanSafeVisitor< Type_ >::nb_, and STK::hidden::MeanSafeVisitor< Type_ >::res_.

Member Data Documentation

◆ nb_

◆ res_


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