36#ifndef STK_SLICINGACCESSORS_H
37#define STK_SLICINGACCESSORS_H
41template<
typename Array>
class RowAccessor;
42template<
typename Array>
class ColAccessor;
44template<
typename Array,
int Size_>
class SubVectorAccessor;
46template<
typename Array,
int SizeRows_,
int SizeCols_>
class SubAccessor;
61 orient_ =
Lhs::orient_,
63 sizeCols_ =
Lhs::sizeCols_,
64 storage_ =
Lhs::storage_
66 typedef typename Lhs::Type
Type;
86template<
typename Lhs>
107 inline RowAccessor(
Lhs& lhs,
int i):
Base(), lhs_(lhs), i_(
i), rows_(i_, 1), cols_(lhs_.rangeColsInRow(i_)) {}
116 inline Lhs const&
lhs()
const {
return lhs_;}
122#ifdef STK_BOUNDS_CHECK
125 return (lhs().elt(i_,
j));
139#ifdef STK_BOUNDS_CHECK
142 return (lhs().elt(i_,
j));
148 {
return (lhs().elt(i_,
j));}
165template<
typename Lhs>
170 structure_ = ( Lhs::structure_ !=
int(Arrays::point_) && Lhs::structure_ !=
int(Arrays::number_) )
171 ? Arrays::vector_ : Arrays::number_,
173 sizeRows_ =
Lhs::sizeRows_,
175 storage_ =
Lhs::storage_
177 typedef typename Lhs::Type
Type;
198template<
typename Lhs>
220 :
Base(), lhs_(lhs), j_(
j), rows_(lhs_.rangeRowsInCol(j_)), cols_(j_,1) {}
230 inline Lhs const&
lhs()
const {
return lhs_; }
236#ifdef STK_BOUNDS_CHECK
239 return (lhs_.elt(
i, j_));
253#ifdef STK_BOUNDS_CHECK
256 return (lhs_.elt(
i, j_));
278template<
typename Lhs,
int Size_>
283 structure_ = Lhs::structure_,
284 orient_ = Lhs::orient_,
285 sizeRows_ = (structure_ ==
int(Arrays::point_)) ? 1 :
Size_,
286 sizeCols_ = (structure_ ==
int(Arrays::vector_)) ? 1 :
Size_,
287 storage_ =
Lhs::storage_
291 typedef typename Lhs::Type
Type;
298template<
typename Lhs,
int Size_,
int Structure_>
316template<
typename Lhs,
int Size_>
318 , hidden::Traits< SubVectorAccessor<Lhs, Size_> >::structure_
343 inline Lhs const&
lhs()
const {
return lhs_;}
375template<
typename Lhs,
int Size_>
405template<
typename Lhs,
int Size_>
435template<
typename Lhs,
int Size_>
468template<
typename Lhs,
int SizeRows_,
int SizeCols_>
473 structure_ = Lhs::structure_,
474 orient_ = Lhs::orient_,
477 storage_ = Lhs::storage_
479 typedef typename Lhs::Type
Type;
500template<
typename Lhs,
int SizeRows_,
int SizeCols_>
524 :
Base(), lhs_(lhs), rows_(
I), cols_(
J) {}
530 inline Lhs const&
lhs()
const {
return lhs_;}
#define STKRUNTIME_ERROR_2ARG(Where, Arg1, Arg2, Error)
Generic expression when the column of an expression is accessed.
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
Type & elt2Impl(int i, int j)
hidden::Traits< ColAccessor< Lhs > >::TypeConst TypeConst
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
RowRange const & rowsImpl() const
ExprBase< ColAccessor< Lhs > > Base
ColRange const & colsImpl() const
TypeConst elt1Impl(int i) const
TypeConst elt0Impl() const
access to the element
TypeConst elt2Impl(int i, int j) const
ColAccessor(Lhs &lhs, int j)
constructor
hidden::Traits< ColAccessor< Lhs > >::Type Type
Type & elt0Impl()
access to the element
base class for template evaluation expressions and visitors.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
Generic expression when the row of an expression is accessed.
hidden::Traits< RowAccessor< Lhs > >::Type Type
TypeConst elt1Impl(int j) const
RowRange const & rowsImpl() const
ColRange const & colsImpl() const
Type & elt0Impl()
accesses to the element
ExprBase< RowAccessor< Lhs > > Base
TypeConst elt0Impl() const
accesses to the element
hidden::Traits< RowAccessor< Lhs > >::TypeConst TypeConst
Type & elt2Impl(int i, int j)
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
RowAccessor(Lhs &lhs, int i)
constructor
TypeConst elt2Impl(int i, int j) const
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
Generic expression when the sub-part of an expression is accessed.
RowRange const & rowsImpl() const
ExprBase< SubAccessor< Lhs, SizeRows_, SizeCols_ > > Base
TypeConst elt0Impl() const
accesses to the element
hidden::Traits< SubAccessor< Lhs, SizeRows_, SizeCols_ > >::Type Type
ColRange const & colsImpl() const
TypeConst elt2Impl(int i, int j) const
Type & elt2Impl(int i, int j)
TypeConst elt1Impl(int i) const
Type & elt0Impl()
accesses to the element
SubAccessor(Lhs &lhs, RowRange const &I, ColRange const &J)
constructor
hidden::Traits< SubAccessor< Lhs, SizeRows_, SizeCols_ > >::TypeConst TypeConst
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
SubVectorAccessor< Lhs, Size_ > Derived
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
RowRange const & rowsImpl() const
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
ColRange const & colsImpl() const
SubVectorAccessorBase(RowRange const &I)
constructor
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
SubVectorAccessor< Lhs, Size_ > Derived
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
RowRange const & rowsImpl() const
ColRange const & colsImpl() const
SubVectorAccessorBase(ColRange const &J)
constructor
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
ColRange const & colsImpl() const
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
RowRange const & rowsImpl() const
SubVectorAccessorBase(RowRange const &I)
constructor
SubVectorAccessor< Lhs, Size_ > Derived
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
Type & elt2Impl(int i, int j)
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
TypeConst elt1Impl(int i) const
Type & elt0Impl()
accesses to the element
TypeConst elt2Impl(int i, int j) const
SubVectorAccessor(Lhs &lhs, TRange< Size_ > const &I)
constructor
hidden::Traits< SubVectorAccessor< Lhs, Size_ > >::Type Type
hidden::Traits< SubVectorAccessor< Lhs, Size_ > >::TypeConst TypeConst
TypeConst elt0Impl() const
accesses to the element
SubVectorOperatorBase< Lhs, Size_, structure_ > Base
@ 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.
Base class for all referencing containers.
ColOperator< SubVectorOperator< Lhs, Size_ > > Col
RowOperator< SubVectorOperator< Lhs, Size_ > > Row