STK++ 0.9.13
Slicing Visitors

A slicing visitor is applied on each column/row of an Expression or Array by using global functions in the STK domain space. More...

Collaboration diagram for Slicing Visitors:

Classes

class  STK::VisitorByCol< Derived, Visitor >
 class allowing to apply a visitor on each columns of an expression. More...
 
class  STK::VisitorByRow< Derived, Visitor >
 class allowing to apply a visitor on each columns of an expression. More...
 
struct  STK::ApplyVisitor< Derived, Visitor >
 class allowing to apply a visitor on a vector or a point. More...
 

Functions

template<class Derived >
hidden::SliceVisitorSelector< Derived, hidden::MinVisitor, Arrays::by_col_ >::type_result STK::min (Derived const &A)
 If A is a row-vector or a column-vector then the function will return the usual minimal value of the vector.
 
template<class Derived >
hidden::SliceVisitorSelector< Derived, hidden::MaxVisitor, Arrays::by_col_ >::type_result STK::max (Derived const &A)
 If A is a row-vector or a column-vector then the function will return the usual maximal value of the vector.
 
template<class Derived >
hidden::SliceVisitorSelector< Derived, hidden::SumVisitor, Arrays::by_col_ >::type_result STK::sum (Derived const &A)
 If A is a row-vector or a column-vector then the function will return the usual sum value of the vector.
 
template<class Derived >
hidden::SliceVisitorSelector< Derived, hidden::MeanVisitor, Arrays::by_col_ >::type_result STK::mean (Derived const &A)
 If A is a row-vector or a column-vector then the function will return the usual mean value of the vector.
 
template<class Derived >
hidden::SliceVisitorSelector< Derived, hidden::CountVisitor, Arrays::by_col_ >::type_result STK::count (Derived const &A)
 If A is a row-vector or a column-vector then the function will return the usual count value of the vector.
 
template<class Derived >
hidden::SliceVisitorSelector< Derived, hidden::AllVisitor, Arrays::by_col_ >::type_result STK::all (Derived const &A)
 If A is a row-vector or a column-vector then the function will return the usual all value of the vector.
 
template<class Derived >
hidden::SliceVisitorSelector< Derived, hidden::AnyVisitor, Arrays::by_col_ >::type_result STK::any (Derived const &A)
 If A is a row-vector or a column-vector then the function will return the usual visitor value of the vector.
 
template<class Derived >
hidden::SliceVisitorSelector< Derived, hidden::MinSafeVisitor, Arrays::by_col_ >::type_result STK::minSafe (Derived const &A)
 If A is a row-vector or a column-vector then the function will return the usual minimal value of the vector.
 
template<class Derived >
hidden::SliceVisitorSelector< Derived, hidden::MaxSafeVisitor, Arrays::by_col_ >::type_result STK::maxSafe (Derived const &A)
 If A is a row-vector or a column-vector then the function will return the usual maximal value of the vector.
 
template<class Derived >
hidden::SliceVisitorSelector< Derived, hidden::MeanSafeVisitor, Arrays::by_col_ >::type_result STK::meanSafe (Derived const &A)
 If A is a row-vector or a column-vector then the function will return the usual mean value of the vector.
 

Detailed Description

A slicing visitor is applied on each column/row of an Expression or Array by using global functions in the STK domain space.

Example:Output:
#include "STKpp.h"
using namespace STK;
int main(int argc, char** argv)
{
CArray2X a(2,4);
a << 0, 1, 2, 3
, 4, 5, 6, 7;
stk_cout << "min(a) = " << min(a);
stk_cout << "minByRow(a) = " << minByRow(a);
stk_cout << "mean(a) = " << mean(a);
stk_cout << "count(a > 0)= " << count(a > 0);
stk_cout << "all(a > 0) = " << all(a > 0);
stk_cout << "any(a > 0) = " << any(a > 0);
a(1,1) = a(1,3) = Arithmetic<Real>::NA();
stk_cout << "count(a.isNA())= " << count(a.isNA());
stk_cout << "countByRow(a.isNA())= " << countByRow(a.isNA());
return 0;
}
#define stk_cout
Standard stk output stream.
This file include all the header files of the STK++ project.
A CArray is a two dimensional array with a continuous storage like a C-array.
Definition STK_CArray.h:130
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
The namespace STK is the main domain space of the Statistical ToolKit project.
Arithmetic properties of STK fundamental types.
int main(int argc, char **argv)
min(a)      = 0 1 2 3
minByRow(a) = 0
4
mean(a) = 2 3 4 5
count(a > 0)= 1 2 2 2
all(a > 0)  = 0 1 1 1
any(a > 0)  = 1 1 1 1
count(a.isNA())= 0 1 0 1
countByRow(a.isNA())= 0
2

Function Documentation

◆ all()

template<class Derived >
hidden::SliceVisitorSelector< Derived, hidden::AllVisitor, Arrays::by_col_ >::type_result STK::all ( Derived const A)

If A is a row-vector or a column-vector then the function will return the usual all value of the vector.

If A is a two-dimensional array, the function will return a STK::VisitorByCol or a STK::VisitorByRow structure with the alls values.

See also
STK::min, STK::max, STK::sum, STK::mean, STK::count, STK::any.

Definition at line 377 of file STK_SlicingVisitors.h.

Referenced by main().

◆ any()

template<class Derived >
hidden::SliceVisitorSelector< Derived, hidden::AnyVisitor, Arrays::by_col_ >::type_result STK::any ( Derived const A)

If A is a row-vector or a column-vector then the function will return the usual visitor value of the vector.

If A is a two-dimensional array, the function will return a STK::VisitorByCol or a STK::VisitorByRow structure with the any-s values.

See also
STK::min, STK::max, STK::sum, STK::mean, STK::count, STK::all.

Definition at line 385 of file STK_SlicingVisitors.h.

Referenced by main().

◆ count()

template<class Derived >
hidden::SliceVisitorSelector< Derived, hidden::CountVisitor, Arrays::by_col_ >::type_result STK::count ( Derived const A)

If A is a row-vector or a column-vector then the function will return the usual count value of the vector.

If A is a two-dimensional array, the function will return a STK::VisitorByCol or a STK::VisitorByRow structure with the counts.

See also
STK::min, STK::max, STK::sum, STK::mean, STK::all, STK::any.

Definition at line 369 of file STK_SlicingVisitors.h.

Referenced by main(), STK::CategoricalBridge< Id, Data >::safeValue(), and STK::PoissonBridge< Id, Data >::safeValue().

◆ max()

template<class Derived >
hidden::SliceVisitorSelector< Derived, hidden::MaxVisitor, Arrays::by_col_ >::type_result STK::max ( Derived const A)

If A is a row-vector or a column-vector then the function will return the usual maximal value of the vector.

If A is a two-dimensional array, the function will return a STK::VisitorByCol or a STK::VisitorByRow structure with the maximal values.

See also
STK::min, STK::sum, STK::mean, STK::count, STK::all, STK::any.

Definition at line 345 of file STK_SlicingVisitors.h.

Referenced by STK::IMixtureComposer::eStep(), STK::CategoricalBase< Derived >::initializeModelImpl(), and STK::IMixtureLearner::mapStep().

◆ maxSafe()

template<class Derived >
hidden::SliceVisitorSelector< Derived, hidden::MaxSafeVisitor, Arrays::by_col_ >::type_result STK::maxSafe ( Derived const A)

If A is a row-vector or a column-vector then the function will return the usual maximal value of the vector.

If A is a two-dimensional array, the function will return a STK::VisitorByCol or a STK::VisitorByRow structure with the maximal values.

See also
STK::min, STK::sum, STK::mean, STK::count, STK::all, STK::any.

Definition at line 402 of file STK_SlicingVisitors.h.

◆ mean()

template<class Derived >
hidden::SliceVisitorSelector< Derived, hidden::MeanVisitor, Arrays::by_col_ >::type_result STK::mean ( Derived const A)

If A is a row-vector or a column-vector then the function will return the usual mean value of the vector.

If A is a two-dimensional array, the function will return a STK::VisitorByCol or a STK::VisitorByRow structure with the means.

See also
STK::min, STK::max, STK::sum, STK::count, STK::all, STK::any,.

Definition at line 361 of file STK_SlicingVisitors.h.

Referenced by STK::JointGaussianModel< Array, WColVector >::computeParameters(), STK::ModelGamma_aj_bj< Data_, WColVector_ >::computeParameters(), STK::ModelGamma_aj_bj< Data_, WColVector_ >::computeParameters(), STK::GaussianAAModel< Array >::computeProjectedLnLikelihood(), STK::DiagGaussianBase< Derived >::getParameters(), STK::HDGaussianBase< Derived >::getParameters(), STK::DiagGaussianBase< Derived >::impute(), STK::HDGaussianBase< Derived >::impute(), STK::DiagGaussianBase< Derived >::lnComponentProbability(), main(), STK::GammaBase< Derived >::moments(), STK::Gamma_a_bjk< Array >::randomInit(), STK::Gamma_a_bk< Array >::randomInit(), STK::Gamma_aj_bjk< Array >::randomInit(), STK::Gamma_aj_bk< Array >::randomInit(), STK::Gamma_ajk_b< Array >::randomInit(), STK::Gamma_ajk_bj< Array >::randomInit(), STK::Gamma_ajk_bjk< Array >::randomInit(), STK::Gamma_ajk_bk< Array >::randomInit(), STK::Gamma_ak_b< Array >::randomInit(), STK::Gamma_ak_bj< Array >::randomInit(), STK::Gamma_ak_bjk< Array >::randomInit(), STK::Gamma_ak_bk< Array >::randomInit(), STK::Gamma_a_bjk< Array >::run(), STK::Gamma_a_bk< Array >::run(), STK::Gamma_aj_bjk< Array >::run(), STK::Gamma_aj_bk< Array >::run(), STK::Gamma_ak_b< Array >::run(), STK::Gamma_ak_bj< Array >::run(), STK::Gamma_ak_bjk< Array >::run(), STK::ModelParameters< Clust::Gaussian_sjsk_ >::setParameters(), STK::ModelParameters< Clust::Poisson_ljlk_ >::setParameters(), STK::ExprBase< Derived >::variance(), STK::ExprBase< Derived >::variance(), STK::ExprBase< Derived >::varianceSafe(), STK::DiagGaussianBase< Derived >::writeParameters(), STK::HDGaussianBase< Derived >::writeParameters(), STK::ModelDiagGaussian_muj_sj< Data_, WColVector_ >::writeParametersImpl(), STK::ExprBase< Derived >::wvariance(), STK::ExprBase< Derived >::wvariance(), STK::ExprBase< Derived >::wvarianceSafe(), and STK::ExprBase< Derived >::wvarianceSafe().

◆ meanSafe()

template<class Derived >
hidden::SliceVisitorSelector< Derived, hidden::MeanSafeVisitor, Arrays::by_col_ >::type_result STK::meanSafe ( Derived const A)

If A is a row-vector or a column-vector then the function will return the usual mean value of the vector.

If A is a two-dimensional array, the function will return a STK::VisitorByCol or a STK::VisitorByRow structure with the means.

See also
STK::min, STK::max, STK::sum, STK::count, STK::all, STK::any,.

Definition at line 410 of file STK_SlicingVisitors.h.

Referenced by STK::ExprBase< Derived >::varianceSafe().

◆ min()

template<class Derived >
hidden::SliceVisitorSelector< Derived, hidden::MinVisitor, Arrays::by_col_ >::type_result STK::min ( Derived const A)

If A is a row-vector or a column-vector then the function will return the usual minimal value of the vector.

If A is a two-dimensional array, the function will return a STK::VisitorByCol or a STK::VisitorByRow structure with the minimal values.

See also
STK::max, STK::sum, STK::mean, STK::count, STK::all, STK::any.

Definition at line 337 of file STK_SlicingVisitors.h.

Referenced by STK::CategoricalBase< Derived >::initializeModelImpl(), and main().

◆ minSafe()

template<class Derived >
hidden::SliceVisitorSelector< Derived, hidden::MinSafeVisitor, Arrays::by_col_ >::type_result STK::minSafe ( Derived const A)

If A is a row-vector or a column-vector then the function will return the usual minimal value of the vector.

If A is a two-dimensional array, the function will return a STK::VisitorByCol or a STK::VisitorByRow structure with the minimal values.

See also
STK::max, STK::sum, STK::mean, STK::count, STK::all, STK::any.

Definition at line 394 of file STK_SlicingVisitors.h.

◆ sum()

template<class Derived >
hidden::SliceVisitorSelector< Derived, hidden::SumVisitor, Arrays::by_col_ >::type_result STK::sum ( Derived const A)

If A is a row-vector or a column-vector then the function will return the usual sum value of the vector.

If A is a two-dimensional array, the function will return a STK::VisitorByCol or a STK::VisitorByRow structure with the sums.

See also
STK::min, STK::max, STK::mean, STK::count, STK::all, STK::any.

Definition at line 353 of file STK_SlicingVisitors.h.