40#ifndef STK_ITCONTAINER_H
41#define STK_ITCONTAINER_H
103template <
class Derived>
179#ifdef STK_BOUNDS_CHECK
193#ifdef STK_BOUNDS_CHECK
207#ifdef STK_BOUNDS_CHECK
218#ifdef STK_BOUNDS_CHECK
230 TypeConst
at(
int i,
int j)
const
277#ifdef STK_BOUNDS_CHECK
283 return this->
elt(i,
j);
290 #ifdef STK_BOUNDS_CHECK
304#ifdef STK_BOUNDS_CHECK
316#ifdef STK_BOUNDS_CHECK
340template < class Derived, int Structure_ = hidden::Traits<Derived>::structure_ >
345template <
class Derived>
374template <
class Derived>
404 inline int begin()
const {
return range().begin();}
406 inline int end()
const {
return range().end();}
408 inline int size()
const {
return range().size();}
412 inline int firstIdx()
const {
return this->beginRows();}
414 inline int lastIdx()
const {
return this->endRows()-1;}
419 for (
int k = begin(); k< end(); k++)
sum += this->elt(k, k);
426template <
class Derived>
457 {
return Range(
icol, this->lastIdxRows(), 0);}
462 {
return Range(this->beginCols(), std::min(
irow, this->lastIdxCols()), 0);}
472 return (
j>
i) ?
Type() : this->asDerived().elt2Impl(
i,
j);
486 return this->asDerived().elt2Impl(
i,
j);
492template <
class Derived>
523 {
return Range(
irow, this->lastIdxCols(), 0);}
528 {
return Range(this->beginRows(), std::min(
icol, this->lastIdxRows()), 0);}
538 return (
i>
j) ?
Type() : this->asDerived().elt2Impl(
i,
j);
552 return this->asDerived().elt2Impl(
i,
j);
557template <
class Derived>
587 inline int begin()
const {
return range().begin();}
589 inline int end()
const {
return range().end();}
591 inline int size()
const {
return range().size();}
595 inline int firstIdx()
const {
return this->beginRows();}
597 inline int lastIdx()
const {
return this->endRows()-1;}
602 for (
int k = begin(); k< end(); k++)
sum += this->elt(k, k);
609template <
class Derived>
640 inline int begin()
const {
return range().begin();}
642 inline int end()
const {
return range().end();}
644 inline int size()
const {
return range().size();}
648 inline int firstIdx()
const {
return this->beginRows();}
650 inline int lastIdx()
const {
return this->endRows()-1;}
655 for (
int k = begin(); k< end(); k++)
sum += this->elt(k, k);
664 return (
i<
j) ? this->asDerived().elt2Impl(
j,
i) : this->asDerived().elt2Impl(
i,
j);
677 return this->asDerived().elt2Impl(
i,
j);
683template <
class Derived>
713 inline int begin()
const {
return range().begin();}
715 inline int end()
const {
return range().end();}
717 inline int size()
const {
return range().size();}
721 inline int firstIdx()
const {
return this->beginRows();}
723 inline int lastIdx()
const {
return this->endRows()-1;}
728 for (
int k = begin(); k< end(); k++)
sum += this->elt(k, k);
740 return (
i>
j) ?this->asDerived().elt2Impl(
j,
i) : this->asDerived().elt2Impl(
i,
j);
753 return this->asDerived().elt2Impl(
i,
j);
759template <
class Derived>
789 inline int begin()
const {
return range().begin();}
791 inline int end()
const {
return range().end();}
793 inline int size()
const {
return range().size();}
814 inline Type&
back() {
return this->elt(lastIdx());}
825 return (
i==
j) ? this->asDerived().elt2Impl(
i,
j) :
Type();
834 return this->asDerived().elt1Impl(
i);
849 return this->asDerived().elt2Impl(
i,
j);
860 return this->asDerived().elt1Impl(
i);
866template <
class Derived>
896 inline int begin()
const {
return range().begin();}
898 inline int end()
const {
return range().end();}
900 inline int size()
const {
return range().size();}
909 inline int colIdx()
const {
return this->beginCols();}
919 inline Type&
back() {
return this->elt(lastIdx());}
924template <
class Derived>
954 inline int begin()
const {
return range().begin();}
956 inline int end()
const {
return range().end();}
958 inline int size()
const {
return range().size();}
961 inline int rowIdx()
const {
return this->beginRows();}
977 inline Type&
back() {
return this->elt(lastIdx());}
981template <
class Derived>
1011 inline int begin()
const {
return range().begin();}
1013 inline int end()
const {
return range().end();}
1015 inline int size()
const {
return 1;}
1017 operator TypeConst const()
const {
return this->asDerived().elt0Impl();}
#define STKOUT_OF_RANGE_1ARG(Where, Arg, Error)
#define STKOUT_OF_RANGE_2ARG(Where, Arg1, Arg2, Error)
#define STK_STATIC_ASSERT_ONE_DIMENSION_ONLY(EXPR)
#define STK_STATIC_ASSERT_ZERO_DIMENSION_ONLY(EXPR)
Interface base class for all classes implementing the curious recursive template paradigm.
Derived & asDerived()
static cast : return a reference of this with a cast to the derived class.
Interface base class for 2D containers.
TypeConst at(int i, int j) const
TypeConst operator()(int i, int j) const
ColRange const & rangeColsInRow(int) const
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
IRecursiveTemplate< Derived > Base
TypeConst operator[](int i) const
TypeConst operator()() const
ITContainerBase()
Default constructor.
TypeConst at(int i) const
TypeConst elt(int i) const
hidden::Traits< Derived >::Type Type
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
hidden::Traits< Derived >::TypeConst TypeConst
~ITContainerBase()
destructor.
ColRange const & cols() const
Type & operator()(int i, int j)
RowRange const & rangeRowsInCol(int) const
TypeConst elt(int i, int j) const
RowRange const & rows() const
hidden::Traits< Derived >::Type Type
hidden::Traits< Derived >::TypeConst TypeConst
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
ITContainerBase< Derived > Base
ITContainer()
default constructor.
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
~ITContainer()
destructor.
Type at(int i, int j) const
Range rangeColsInRow(int pos) const
hidden::Traits< Derived >::TypeConst TypeConst
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
hidden::Traits< Derived >::Type Type
TypeConst at(int i) const
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
~ITContainer()
destructor.
ITContainerBase< Derived > Base
RowRange const & range() const
Range rangeRowsInCol(int pos) const
ITContainer()
default constructor.
~ITContainer()
destructor.
ITContainerBase< Derived > Base
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
hidden::Traits< Derived >::TypeConst TypeConst
RowRange const & range() const
ITContainer()
default constructor.
hidden::Traits< Derived >::Type Type
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
TypeConst at(int i, int j) const
ITContainerBase< Derived > Base
hidden::Traits< Derived >::Type Type
ITContainer()
default constructor.
Range rangeColsInRow(int irow) const
compute the range of the effectively stored elements in the row irow.
~ITContainer()
destructor.
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
hidden::Traits< Derived >::TypeConst TypeConst
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
Type at(int i, int j) const
Range rangeRowsInCol(int icol) const
ColRange const & range() const
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
hidden::Traits< Derived >::TypeConst TypeConst
ITContainer()
default constructor.
~ITContainer()
destructor.
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
ITContainerBase< Derived > Base
hidden::Traits< Derived >::Type Type
hidden::Traits< Derived >::TypeConst TypeConst
ITContainer()
default constructor.
ITContainerBase< Derived > Base
hidden::Traits< Derived >::Type Type
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
ColRange const & range() const
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
~ITContainer()
destructor.
hidden::Traits< Derived >::TypeConst TypeConst
~ITContainer()
destructor.
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
hidden::Traits< Derived >::Type Type
RowRange const & range() const
ITContainerBase< Derived > Base
ITContainer()
default constructor.
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
hidden::Traits< Derived >::TypeConst TypeConst
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
ITContainer()
default constructor.
~ITContainer()
destructor.
ITContainerBase< Derived > Base
hidden::Traits< Derived >::Type Type
RowRange const & range() const
RowRange const & range() const
hidden::Traits< Derived >::Type Type
ITContainer()
default constructor.
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
ITContainerBase< Derived > Base
~ITContainer()
destructor.
TypeConst at(int i, int j) const
hidden::Traits< Derived >::TypeConst TypeConst
Range rangeColsInRow(int irow) const
hidden::Traits< Derived >::Type Type
Type at(int i, int j) const
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
~ITContainer()
destructor.
ITContainerBase< Derived > Base
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
ITContainer()
default constructor.
hidden::Traits< Derived >::TypeConst TypeConst
Range rangeRowsInCol(int icol) const
compute the range of the effectively stored elements in column icol.
~ITContainer()
destructor.
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
hidden::Traits< Derived >::Type Type
RowRange const & range() const
hidden::Traits< Derived >::TypeConst TypeConst
ITContainer()
default constructor.
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
ITContainerBase< Derived > Base
Specialized interface class for all arrays (can be either 2D arrays or 1D arrays).
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
int begin() const
get the first index of the TRange.
Index sub-vector region: Specialization when the size is unknown.
int end() const
get the ending index of the TRange.
int size() const
get the size of the TRange (the number of elements).
classes inheriting NoAssignOperator should not generate a default operator=.
NoAssignOperator & operator=(const NoAssignOperator &)
Arrays::SumOp< Lhs, Rhs >::result_type sum(Lhs const &lhs, Rhs const &rhs)
convenience function for summing two arrays
The namespace STK is the main domain space of the Statistical ToolKit project.
TRange< UnknownSize > Range