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

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

#include <STK_Stat_Functors.h>

Public Types

typedef Derived::Type Type
 

Public Member Functions

 MinSafeOp (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::MinSafeOp< Derived >

Compute safely the minimal value of the variable V.

Definition at line 114 of file STK_Stat_Functors.h.

Member Typedef Documentation

◆ Type

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

Definition at line 116 of file STK_Stat_Functors.h.

Constructor & Destructor Documentation

◆ MinSafeOp()

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

constructor

Definition at line 118 of file STK_Stat_Functors.h.

118 : 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::MinSafeOp< Derived >::operator() ( ) const
inline
Returns
the safely computed minimal value of the variable V

Definition at line 121 of file STK_Stat_Functors.h.

122 {
123 Type min = Arithmetic<Type>::max();
124 for (int i=V_.begin(); i<V_.end(); i++)
125 { if (Arithmetic<Type>::isFinite(V_[i])) min = std::min(min, V_[i]);}
126 return min;
127 }
hidden::FunctorTraits< Derived, MinOp >::Row min(Derived const &A)
Compute the minimal(s) value(s) of A.
static bool isFinite(Type const &x)

References STK::Stat::min(), and STK::Stat::MinSafeOp< Derived >::V_.

◆ operator()() [2/2]

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

Definition at line 132 of file STK_Stat_Functors.h.

133 {
135 Type min = Arithmetic<Type>::max();
136 for (int i=V_.begin(); i<V_.end(); i++)
137 { if (!Arithmetic<Type>::isNA(V_[i])) min = std::min(min, w[i]*V_[i]);}
138 return min;
139 }
static bool isNA(Type const &x)

References STK::Stat::min(), STK_STATIC_ASSERT_ONE_DIMENSION_ONLY, and STK::Stat::MinSafeOp< Derived >::V_.

Member Data Documentation

◆ V_

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

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