STK++ 0.9.13
STK::Stat::MaxSafeOp< Derived > Struct Template Reference

Compute safely the maximal value of the variable V. More...

#include <STK_Stat_Functors.h>

Public Types

typedef Derived::Type Type
 

Public Member Functions

 MaxSafeOp (ExprBase< Derived > const &V)
 constructor
 
Type const operator() () const
 
template<class Weights >
Type const operator() (ExprBase< Weights > const &w) const
 

Protected Attributes

Derived constV_
 

Detailed Description

template<class Derived>
struct STK::Stat::MaxSafeOp< Derived >

Compute safely the maximal value of the variable V.

Definition at line 185 of file STK_Stat_Functors.h.

Member Typedef Documentation

◆ Type

template<class Derived >
typedef Derived::Type STK::Stat::MaxSafeOp< Derived >::Type

Definition at line 187 of file STK_Stat_Functors.h.

Constructor & Destructor Documentation

◆ MaxSafeOp()

template<class Derived >
STK::Stat::MaxSafeOp< Derived >::MaxSafeOp ( ExprBase< Derived > const V)
inline

constructor

Definition at line 189 of file STK_Stat_Functors.h.

189 : V_(V.asDerived())
#define STK_STATIC_ASSERT_ONE_DIMENSION_ONLY(EXPR)

References STK_STATIC_ASSERT_ONE_DIMENSION_ONLY.

Member Function Documentation

◆ operator()() [1/2]

template<class Derived >
Type const STK::Stat::MaxSafeOp< Derived >::operator() ( ) const
inline
Returns
the safely computed maximal value of the variable V

Definition at line 192 of file STK_Stat_Functors.h.

193 {
194 Type max = -Arithmetic<Type>::max();
195 for (int i=V_.begin(); i<V_.end(); i++)
196 { if (!Arithmetic<Type>::isNA(V_[i])) max = std::max(max, V_[i]);}
197 return max;
198 }
hidden::FunctorTraits< Derived, MaxOp >::Row max(Derived const &A)
Compute the maximal(s) value(s) of A.
static bool isNA(Type const &x)

References STK::Stat::max(), and STK::Stat::MaxSafeOp< Derived >::V_.

◆ operator()() [2/2]

template<class Derived >
template<class Weights >
Type const STK::Stat::MaxSafeOp< Derived >::operator() ( ExprBase< Weights > const w) const
inline
Returns
the safely computed weighted maximal value of the variable V
Parameters
wthe weights

Definition at line 203 of file STK_Stat_Functors.h.

204 {
206 Type max = -Arithmetic<Type>::max();
207 for (int i=V_.begin(); i<V_.end(); i++)
208 { if (!Arithmetic<Type>::isNA(V_[i])) max = std::max(max, w[i]*V_[i]);}
209 return max;
210 }

References STK::Stat::max(), STK_STATIC_ASSERT_ONE_DIMENSION_ONLY, and STK::Stat::MaxSafeOp< Derived >::V_.

Member Data Documentation

◆ V_

template<class Derived >
Derived const& STK::Stat::MaxSafeOp< Derived >::V_
protected

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