35#ifndef STK_EXPRBASEFUNCTORS_H
36#define STK_EXPRBASEFUNCTORS_H
45template<
typename Derived,
typename Functor>
struct ApplyFunctorByCol;
46template<
typename Derived,
typename Functor>
struct ApplyFunctorByRow;
47template<
typename Derived,
typename Functor>
struct ApplyFunctor;
48template<
typename Derived,
typename Functor>
struct ApplyWeightedFunctorByCol;
49template<
typename Derived,
typename Functor>
struct ApplyWeightedFunctorByRow;
50template<
typename Derived,
typename Functor>
struct ApplyWeightedFunctor;
60template<
typename Derived,
template<
class>
class Functor,
bool isVector_>
68template<
class Derived,
template<
class>
class Functor>
88template<
class Derived,
template<
class>
class Functor>
105template<
typename Derived,
template<
class>
class Functor>
121 typedef typename ColOp::Row
Row;
122 typedef typename RowOp::Col
Col;
130template<
typename Derived,
typename Functor>
133 typedef typename Derived::Type
Type;
143 :
lhs_(lhs.asDerived())
149 for (
int j=
lhs_.beginCols();
j <
lhs_.endCols(); ++
j)
156 for (
int j=
lhs_.beginCols();
j <
lhs_.endCols(); ++
j)
161 template<
class OtherRow>
164#ifdef STK_BOUNDS_CHECK
165 if (
lhs_.cols() != value.range())
168 for (
int j=
lhs_.beginCols();
j <
lhs_.endCols(); ++
j)
169 {
res_[
j] = Functor(
lhs_.col(
j))(value[
j], option);}
181template<
typename Derived,
typename Functor>
184 typedef typename Derived::Type
Type;
194 :
lhs_(lhs.asDerived())
197 template<
class Weights>
200 for (
int j=
lhs_.beginCols();
j <
lhs_.endCols(); ++
j)
204 template<
class Weights>
207 for (
int j=
lhs_.beginCols();
j <
lhs_.endCols(); ++
j)
211 template<
class Weights>
214 for (
int j=
lhs_.beginCols();
j <
lhs_.endCols(); ++
j)
218 template<
class Weights,
typename OtherRow>
221#ifdef STK_BOUNDS_CHECK
222 if (
lhs_.cols() != value.range())
225 for (
int j=
lhs_.beginCols();
j <
lhs_.endCols(); ++
j)
237template<
typename Derived,
typename Functor>
240 typedef typename Derived::Type
Type;
250 :
lhs_(lhs.asDerived())
255 for (
int i=
lhs_.beginRows();
i <
lhs_.endRows(); ++
i)
261 for (
int j=
lhs_.beginRows();
j <
lhs_.endRows(); ++
j)
265 template<
class OtherCol>
268#ifdef STK_BOUNDS_CHECK
271 for (
int j=
lhs_.beginRows();
j <
lhs_.endRows(); ++
j)
272 {
res_[
j] = Functor(
lhs_.row(
j))(value[
j], option);}
283template<
typename Derived,
typename Functor>
286 typedef typename Derived::Type
Type;
296 :
lhs_(lhs.asDerived())
299 template<
typename Weights>
302 for (
int i=
lhs_.beginRows();
i <
lhs_.endRows(); ++
i)
306 template<
typename Weights>
309 for (
int j=
lhs_.beginRows();
j <
lhs_.endRows(); ++
j)
313 template<
typename Weights,
typename OtherCol>
316#ifdef STK_BOUNDS_CHECK
319 for (
int j=
lhs_.beginRows();
j <
lhs_.endRows(); ++
j)
331template<
typename Derived,
typename Functor>
334 typedef typename Derived::Type
Type;
346 {
return Functor(
lhs_)(value, option);}
355template<
typename Derived,
typename Functor>
358 typedef typename Derived::Type
Type;
365 template<
typename Weights>
368 template<
typename Weights>
370 {
return Functor(
lhs_)(
w, option);}
372 template<
typename Weights>
374 {
return Functor(
lhs_)(
w, value, option);}
In this file we implement the final class CArrayPoint.
In this file we implement the final class CArrayVector.
#define STKRUNTIME_ERROR_NO_ARG(Where, Error)
#define STK_STATIC_ASSERT_POINT_OR_VECTOR_ONLY(EXPR)
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
@ number_
(1,1) matrix/vector/array/expression (like a number)
@ point_
row oriented vector/array/expression
@ vector_
column oriented vector/array/expression
The namespace STK is the main domain space of the Statistical ToolKit project.
class allowing to apply the Functor Functor on each columns of an expression.
CArrayPoint< Type, sizeCols_ > Row
ApplyFunctorByCol(ExprBase< Derived > const &lhs)
constructor
Row operator()(bool option)
Row operator()(OtherRow const &value, bool option)
class allowing to apply the Functor Functor on each rows of an expression.
Col operator()(OtherCol const &value, bool option)
Col operator()(bool option)
CArrayVector< Type, sizeRows_ > Col
ApplyFunctorByRow(ExprBase< Derived > const &lhs)
constructor
class allowing applying the functor Functor on a vector or row-vector
Type operator()()
apply without argument
Type operator()(Type const &value, bool option)
apply with a value and an option argument
ApplyFunctor(ExprBase< Derived > const &lhs)
constructor
Type operator()(bool option)
apply with an option argument
class allowing to apply the weighted Functor Functor on each columns of an expression.
Row operator()(ExprBase< Weights > const &w, Type const &value)
ApplyWeightedFunctorByCol(ExprBase< Derived > const &lhs)
constructor
Row operator()(ExprBase< Weights > const &w)
Row operator()(ExprBase< Weights > const &w, bool option)
Row operator()(ExprBase< Weights > const &w, ExprBase< OtherRow > const &value, bool option)
CArrayPoint< Type, sizeCols_ > Row
class allowing to apply the Functor Functor on each rows of an expression.
Col operator()(ExprBase< Weights > const &w, bool option)
Col operator()(ExprBase< Weights > const &w, ExprBase< OtherCol > const &value, bool option)
Col operator()(ExprBase< Weights > const &w)
ApplyWeightedFunctorByRow(ExprBase< Derived > const &lhs)
constructor
CArrayVector< Type, sizeRows_ > Col
class allowing applying the weighted functor Functor on a vector or row-vector
ApplyWeightedFunctor(ExprBase< Derived > const &lhs)
constructor
Type operator()(ExprBase< Weights > const &w, Type const &value, bool option)
apply with weight, a value and an option argument
Type operator()(ExprBase< Weights > const &w, bool option)
apply with weight and an option argument
Type operator()(ExprBase< Weights > const &w)
apply with weights
ApplyWeightedFunctorByRow< Derived, ByRowFunctor > RowWeightedOp
Functor< Row > ByRowFunctor
ApplyWeightedFunctorByCol< Derived, ByColFunctor > ColWeightedOp
hidden::Traits< Derived >::Row Row
hidden::Traits< Derived >::Col Col
ApplyFunctorByCol< Derived, ByColFunctor > ColOp
Functor< Col > ByColFunctor
ApplyFunctorByRow< Derived, ByRowFunctor > RowOp
ApplyWeightedFunctor< Derived, ByColFunctor > ColWeightedOp
Functor< Derived > ByRowFunctor
Functor< Derived > ByColFunctor
ApplyWeightedFunctor< Derived, ByRowFunctor > RowWeightedOp
ApplyFunctor< Derived, ByColFunctor > ColOp
ApplyFunctor< Derived, ByRowFunctor > RowOp
, Utility class that will select the type of operator to apply.
FunctorSelector< Derived, Functor,(bool) isVector_ >::RowWeightedOp RowWeightedOp
FunctorSelector< Derived, Functor,(bool) isVector_ >::ColOp ColOp
FunctorSelector< Derived, Functor,(bool) isVector_ >::RowOp RowOp
FunctorSelector< Derived, Functor,(bool) isVector_ >::ColWeightedOp ColWeightedOp