51#ifndef STK_SLICEVISITORS_H
52#define STK_SLICEVISITORS_H
54#define STK_SLICEVISITORS(VISITOR, FUNC) \
55template< class Derived> \
56typename hidden::SliceVisitorSelector<Derived, hidden::VISITOR, Arrays::by_col_>::type_result \
57FUNC(Derived const& A) \
58{ return typename hidden::SliceVisitorSelector<Derived, hidden::VISITOR , Arrays::by_col_>::VisitorOp(A);} \
59template< class Derived> \
60typename hidden::SliceVisitorSelector<Derived, hidden::VISITOR, Arrays::by_col_>::type_result \
61FUNC##ByCol(Derived const& A) \
62{ return typename hidden::SliceVisitorSelector<Derived, hidden::VISITOR, Arrays::by_col_>::VisitorOp(A);} \
63template< class Derived> \
64typename hidden::SliceVisitorSelector<Derived, hidden::VISITOR, Arrays::by_row_>::type_result \
65FUNC##ByRow(Derived const& A) \
66{ return typename hidden::SliceVisitorSelector<Derived, hidden::VISITOR, Arrays::by_row_>::VisitorOp(A);}
72template<
typename Derived,
template<
class>
class Visitor>
81template<
typename Derived,
template<
class>
class Visitor>
92 typedef typename Derived::Type
Type_;
94 typedef typename VisitorType::Type
Type;
103template<
typename Derived,
template<
class>
class Visitor>
110template<
typename Derived,
template<
class>
class Visitor>
136 for (
int j=
lhs_.beginCols(); j <
lhs_.endCols(); ++j)
139 result_.elt(j) = lhs_.col(j).visit(visit);
148 inline Derived
const&
lhs()
const {
return lhs_; }
167template<
typename Derived,
template<
class>
class Visitor>
176template<
typename Derived,
template<
class>
class Visitor>
187 typedef typename Derived::Type
Type_;
189 typedef typename VisitorType::Type
Type;
201template<
typename Derived,
template<
class>
class Visitor>
229 for (
int i=
lhs_.beginRows(); i <
lhs_.endRows(); ++i)
232 result_.elt(i) = lhs_.row(i).visit(visit);
241 inline Derived
const&
lhs()
const {
return lhs_; }
262template<
typename Derived,
template<
class>
class Visitor>
265 typedef typename Derived::Type
Type_;
266 typedef typename Visitor<Type_>::Type
Type;
272 Visitor<Type_> visit;
291template<
typename Derived,
template<
class>
class Visitor,
bool byCol>
297template<
typename Derived,
template<
class>
class Visitor>
300 typedef typename Derived::Type
Type;
314template<
typename Derived,
template<
class>
class Visitor>
317 typedef typename Derived::Type
Type;
414#undef STK_SLICEVISITORS
#define STK_SLICEVISITORS(VISITOR, FUNC)
Allocator for dense Array classes.
base class for template evaluation expressions and visitors.
Index sub-vector region with fixed size.
class allowing to apply a visitor on each columns of an expression.
Allocator const & result() const
hidden::Traits< VisitorByCol< Derived, Visitor > >::VisitorType VisitorType
hidden::Traits< VisitorByCol< Derived, Visitor > >::TypeConst TypeConst
RowRange const & rowsImpl() const
VisitorByCol(Derived const &lhs)
constructor
hidden::Traits< VisitorByCol< Derived, Visitor > >::Allocator Allocator
ColRange const & colsImpl() const
Type const & elt2Impl(int i, int j) const
access to the element (i,j)
Derived const & lhs() const
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
hidden::Traits< VisitorByCol< Derived, Visitor > >::Type Type
Type const & elt0Impl() const
access to the element
Type const & elt1Impl(int i) const
access to the element i
class allowing to apply a visitor on each columns of an expression.
hidden::Traits< VisitorByRow< Derived, Visitor > >::TypeConst TypeConst
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
hidden::Traits< VisitorByRow< Derived, Visitor > >::VisitorType VisitorType
hidden::Traits< VisitorByRow< Derived, Visitor > >::Type Type
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
hidden::Traits< VisitorByRow< Derived, Visitor > >::Allocator Allocator
RowRange const & rowsImpl() const
Type const & elt0Impl() const
access to the element
Derived const & lhs() const
Allocator const & result() const
VisitorByRow(Derived const &lhs)
constructor
Type const & elt1Impl(int i) const
access to the element i
Type const & elt2Impl(int i, int j) const
access to the element (i,j)
ColRange const & colsImpl() const
Arrays::SumOp< Lhs, Rhs >::result_type sum(Lhs const &lhs, Rhs const &rhs)
convenience function for summing two arrays
@ dense_
dense matrix/vector/array/expression
@ number_
(1,1) matrix/vector/array/expression (like a number)
@ point_
row oriented vector/array/expression
@ vector_
column oriented vector/array/expression
@ by_col_
storage by column
hidden::SliceVisitorSelector< Derived, hidden::MinSafeVisitor, Arrays::by_col_ >::type_result 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 ...
hidden::SliceVisitorSelector< Derived, hidden::CountVisitor, Arrays::by_col_ >::type_result 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 ve...
hidden::SliceVisitorSelector< Derived, hidden::MeanSafeVisitor, Arrays::by_col_ >::type_result 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 vec...
hidden::SliceVisitorSelector< Derived, hidden::MinVisitor, Arrays::by_col_ >::type_result 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 ...
hidden::SliceVisitorSelector< Derived, hidden::MaxSafeVisitor, Arrays::by_col_ >::type_result 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 ...
hidden::SliceVisitorSelector< Derived, hidden::AnyVisitor, Arrays::by_col_ >::type_result 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 ...
hidden::SliceVisitorSelector< Derived, hidden::MaxVisitor, Arrays::by_col_ >::type_result 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 ...
hidden::SliceVisitorSelector< Derived, hidden::AllVisitor, Arrays::by_col_ >::type_result 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 vect...
The hidden namespace enclose the classes and methods which are used internally by the STK++ classes.
The namespace STK is the main domain space of the Statistical ToolKit project.
PointX const & mean() const
class allowing to apply a visitor on a vector or a point.
Visitor< Type_ >::Type Type
ApplyVisitor(ExprBase< Derived > const &lhs)
constructor
Base class for all referencing containers.
Select a type at compile time.
If<(bool) isPoint_, ApplyVisitor< Derived, Visitor >, VisitorByRow< Derived, Visitor > >::Result VisitorOp
VisitorOp::Result type_result
VisitorOp::Result type_result
If<(bool) isVector_, ApplyVisitor< Derived, Visitor >, VisitorByCol< Derived, Visitor > >::Result VisitorOp
Utility class that will select the type of operator to apply.
Visitor< Type_ > VisitorType
VisitorType::TypeConst TypeConst
CAllocator< Type, sizeRows_, sizeCols_, orient_ > Allocator
CAllocator< Type, sizeRows_, sizeCols_, orient_ > Allocator
Visitor< Type_ > VisitorType
VisitorType::TypeConst TypeConst