|
STK++ 1.0
|
Interface class for homogeneous 2D containers. More...
#include <STK_ITContainer2D.h>

Public Member Functions | |
| virtual | ~ITContainer2D () |
| virtual destructor. | |
| TYPE & | operator() (Integer const &i, const Integer j) |
| Operator () : access to one element. | |
| TYPE const & | operator() (Integer i, Integer j) const |
| Operator () : access to one constant element. | |
| TContainerVe | operator[] (Integer j) const |
| Operator [] : access to one column. | |
| TContainerVe | col (Integer j) const |
| access to one column. | |
| TContainerVe | operator() (Range const &I, Integer j) const |
| Operator () : access to many elements of a column. | |
| TContainerHo | operator() (Integer i) const |
| Operator () : access to one row. | |
| TContainerHo | row (Integer i) const |
| Operator () : access to one row. | |
| TContainerHo | operator() (Integer i, Range const &J) const |
| Operator () : access to many elements of a row. | |
| TContainer2D | operator() (Range const &I, Range const &J) const |
| Operator () : access to a sub-array. | |
| TContainer2D | operator() (Range const &I) const |
| Operator () : access to many rows. | |
| TContainer2D | operator[] (Range const &J) const |
| Operator [] : access to many columns. | |
| TYPE & | at (Integer i, Integer j) |
| return safely the element (i, j). | |
| TYPE const & | at (Integer i, Integer j) const |
| return safely the constant element (i, j). | |
| TContainer2D | at (Range const &I, Range const &J) const |
| STL compatibility : return a sub-Array. | |
| TContainerVe | at (Range const &I, Integer j) const |
| STL compatibility : return a part of the column j in the range I. | |
| TContainerHo | at (Integer i, Range const &J) const |
| STL compatibility : return a part of the row i in the range J. | |
| TContainerVe | atCol (Integer j) const |
| STL compatibility : return the column j. | |
| TContainer2D | atCol (Range const &J) const |
| STL compatibility : return the Container2D in column range J. | |
| TContainerHo | atRow (Integer i) const |
| STL compatibility : return the row i. | |
| TContainer2D | atRow (Range const &I) const |
| STL compatibility : return the Container2D in the row range I. | |
| template<class Container1D > | |
| void | pushBackCol (ITContainer1D< TYPE, Container1D > const &V) |
| push back a column to the container with value V. | |
Protected Member Functions | |
| ITContainer2D (Range const &I=Range(), Range const &J=Range()) | |
| Default constructor. | |
| ITContainer2D (const ITContainer2D &T) | |
| Copy constructor. | |
Interface class for homogeneous 2D containers.
Use the curious recursive template paradigm : the template parameter TContainer2D is the name of the class that implements the interface ITContainer2D. For example
template<class TYPE> class TContainer2D : public ITContainer2D< TYPE , TContainerHo , TContainerVe , TContainer2D<TYPE> > {...}
the pseudo virtual function defined in this interface have the following definition:
TContainerVe col( Range const& I, Integer j) const; TContainerHo row( Integer const& i, Range const& J) const; TContainer2D get2D( Range const& I, Range const& J) const;
A TContainerVe is a class that allow to access to (or a part of) a column of the TContainer2D class
A TContainerHo is a class that allow to access to (or a part of) a a row of the TContainer2D class.
Definition at line 84 of file STK_ITContainer2D.h.
| STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::ITContainer2D | ( | Range const & | I = Range(), |
| Range const & | J = Range() |
||
| ) | [inline, protected] |
Default constructor.
Default values are rangeHo=(1:0) and rangeVe=(1:0).
| I | the vertical range |
| J | the horizontal range |
Definition at line 91 of file STK_ITContainer2D.h.
: ITContainer2DBase<TYPE, TContainer2D>(I, J)
{ }
| STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::ITContainer2D | ( | const ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D > & | T | ) | [inline, protected] |
Copy constructor.
| T | the container to copy |
Definition at line 98 of file STK_ITContainer2D.h.
: ITContainer2DBase<TYPE, TContainer2D>(T) { }
| virtual STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::~ITContainer2D | ( | ) | [inline, virtual] |
| TYPE& STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::operator() | ( | Integer const & | i, |
| const Integer | j | ||
| ) | [inline] |
Operator () : access to one element.
| i | index of the row |
| j | index of the column |
Reimplemented from STK::ITContainer2DBase< TYPE, TContainer2D >.
Definition at line 111 of file STK_ITContainer2D.h.
{ return this->asLeaf().elt(i,j);}
| TYPE const& STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::operator() | ( | Integer | i, |
| Integer | j | ||
| ) | const [inline] |
Operator () : access to one constant element.
| i | index of the row |
| j | index of the column |
Reimplemented from STK::ITContainer2DBase< TYPE, TContainer2D >.
Definition at line 119 of file STK_ITContainer2D.h.
{ return this->asLeaf().elt(i,j);}
| TContainerVe STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::operator[] | ( | Integer | j | ) | const [inline] |
Operator [] : access to one column.
| j | index of the column |
j of the Container Definition at line 126 of file STK_ITContainer2D.h.
{ return this->asLeaf().col(j);}
| TContainerVe STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::col | ( | Integer | j | ) | const [inline] |
access to one column.
| j | index of the column |
j of the Container Reimplemented in STK::Array2D< Real >, STK::MatrixLowerTriangular, and STK::MatrixUpperTriangular.
Definition at line 133 of file STK_ITContainer2D.h.
Referenced by STK::GaussianStatModel::compCovariance(), STK::Gaussian2BlocksStatModel::compCovariance(), STK::GaussianStatModel::compMean(), STK::GaussianStatModel::compWeightedCovariance(), STK::Gaussian2BlocksStatModel::compWeightedCovariance(), STK::GaussianStatModel::compWeightedMean(), and STK::Stat::Multivariate< Real, TContainerHo, TContainerVe, TContainer2D >::run().
{ return this->asLeaf().col(j);}
| TContainerVe STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::operator() | ( | Range const & | I, |
| Integer | j | ||
| ) | const [inline] |
Operator () : access to many elements of a column.
| I | range of the index of the rows |
| j | index of the col |
j of the Container in the range I Definition at line 142 of file STK_ITContainer2D.h.
{ return this->asLeaf().col(I, j);}
| TContainerHo STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::operator() | ( | Integer | i | ) | const [inline] |
Operator () : access to one row.
| i | index of the row |
i of the Container Definition at line 149 of file STK_ITContainer2D.h.
{ return this->asLeaf().row(i);}
| TContainerHo STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::row | ( | Integer | i | ) | const [inline] |
Operator () : access to one row.
| i | index of the row |
i of the Container Reimplemented in STK::MatrixLowerTriangular, and STK::MatrixUpperTriangular.
Definition at line 156 of file STK_ITContainer2D.h.
Referenced by STK::ITStatModel< Real, Point, Vector, Matrix >::compLogLikelihood().
{ return this->asLeaf().row(i);}
| TContainerHo STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::operator() | ( | Integer | i, |
| Range const & | J | ||
| ) | const [inline] |
Operator () : access to many elements of a row.
| i | index of the row |
| J | index of the col |
i of the Container in the range J Definition at line 165 of file STK_ITContainer2D.h.
{ return this->asLeaf().row(i, J);}
| TContainer2D STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::operator() | ( | Range const & | I, |
| Range const & | J | ||
| ) | const [inline] |
Operator () : access to a sub-array.
| I | range of the index of the rows |
| J | range of the index of the cols |
I, J Definition at line 173 of file STK_ITContainer2D.h.
{ return this->asLeaf().get2D(I, J);}
| TContainer2D STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::operator() | ( | Range const & | I | ) | const [inline] |
Operator () : access to many rows.
| I | range of the index of the rows |
I Definition at line 181 of file STK_ITContainer2D.h.
| TContainer2D STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::operator[] | ( | Range const & | J | ) | const [inline] |
Operator [] : access to many columns.
| J | range of the index of the cols |
J Definition at line 189 of file STK_ITContainer2D.h.
| TYPE& STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::at | ( | Integer | i, |
| Integer | j | ||
| ) | [inline] |
return safely the element (i, j).
| i | index of the row |
| j | index of the col |
Reimplemented from STK::ITContainer2DBase< TYPE, TContainer2D >.
Definition at line 197 of file STK_ITContainer2D.h.
{
if (this->firstRow() > i)
{ throw std::out_of_range("ITContainer2DBase::at(i, j) "
"this->firstRow() > i");
}
if (this->lastRow() < i)
{ throw std::out_of_range("ITContainer2DBase::at(i, j) "
"this->lastRow() < i");
}
if (this->firstCol() > j)
{ throw std::out_of_range("ITContainer2DBase::at(i, j) "
"this->firstCol() > j");
}
if (this->lastCol() < j)
{ throw std::out_of_range("ITContainer2DBase::at(i, j) "
"this->lastCol() < j");
}
return this->asLeaf().elt(i, j);
}
| TYPE const& STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::at | ( | Integer | i, |
| Integer | j | ||
| ) | const [inline] |
return safely the constant element (i, j).
| i | index of the row |
| j | index of the col |
Reimplemented from STK::ITContainer2DBase< TYPE, TContainer2D >.
Definition at line 223 of file STK_ITContainer2D.h.
{
// check bounds
if (this->firstRow() > i)
{ throw std::out_of_range("ITContainer2DBase::at(i, j) "
"this->firstRow() > i");
}
if (this->lastRow() < i)
{ throw std::out_of_range("ITContainer2DBase::at(i, j) "
"this->lastRow() < i");
}
if (this->firstCol() > j)
{ throw std::out_of_range("ITContainer2DBase::at(i, j) "
"this->firstCol() > j");
}
if (this->lastCol() < j)
{ throw std::out_of_range("ITContainer2DBase::at(i, j) "
"this->lastCol() < j");
}
// return element
return this->asLeaf().elt(i, j);
}
| TContainer2D STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::at | ( | Range const & | I, |
| Range const & | J | ||
| ) | const [inline] |
STL compatibility : return a sub-Array.
| I | range of the index of the rows |
| J | range of the index of the cols |
Definition at line 250 of file STK_ITContainer2D.h.
{
if (this->firstRow() > I.first())
{ throw std::out_of_range("ITContainer2D::at(I, J) "
"this->firstRow() > I.first()");
}
if (this->lastRow() < I.last())
{ throw std::out_of_range("ITContainer2D::at(I, J) "
"this->lastRow() < I.last()");
}
if (this->firstCol() > J.first())
{ throw std::out_of_range("ITContainer2D::at(I, J) "
"this->firstCol() > J.first()");
}
if (this->lastCol() < J.last())
{ throw std::out_of_range("ITContainer2D::at(I, J) "
"this->lastCol() < J.last()");
}
return this->asLeaf().get2D(I, J);
}
| TContainerVe STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::at | ( | Range const & | I, |
| Integer | j | ||
| ) | const [inline] |
STL compatibility : return a part of the column j in the range I.
| I | range of the index of the rows |
| j | index of the col |
Definition at line 275 of file STK_ITContainer2D.h.
{
if (this->firstRow() > I.first())
{ throw std::out_of_range("TContainer2D::at(I, j) "
"this->firstRow() > I.first()");
}
if (this->lastRow() < I.last())
{ throw std::out_of_range("TContainer2D::at(I, j) "
"this->lastRow() < I.last()");
}
if (this->firstCol() > j)
{ throw std::out_of_range("TContainer2D::at(I, j) "
"this->firstCol() > j");
}
if (this->lastCol() < j)
{ throw std::out_of_range("TContainer2D::at(I, j) "
"this->lastCol() < j");
}
return this->asLeaf().col(I, j);
}
| TContainerHo STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::at | ( | Integer | i, |
| Range const & | J | ||
| ) | const [inline] |
STL compatibility : return a part of the row i in the range J.
| i | index of the row |
| J | range of the index of the cols |
Definition at line 300 of file STK_ITContainer2D.h.
{
if (this->firstRow() > i)
{ throw std::out_of_range("TContainer2D::at(i, J) "
"this->firstRow() > i");
}
if (this->lastRow() < i)
{ throw std::out_of_range("TContainer2D::at(i, J) "
"this->lastRow() < i");
}
if (this->firstCol() > J.first())
{ throw std::out_of_range("TContainer2D::at(i, J) "
"this->firstCol() > J.first()");
}
if (this->lastCol() < J.last())
{ throw std::out_of_range("TContainer2D::at(i, J) "
"this->lastCol() < J.last()");
}
return this->asLeaf().row(J, i);
}
| TContainerVe STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::atCol | ( | Integer | j | ) | const [inline] |
STL compatibility : return the column j.
| j | index of the col |
Definition at line 324 of file STK_ITContainer2D.h.
| TContainer2D STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::atCol | ( | Range const & | J | ) | const [inline] |
STL compatibility : return the Container2D in column range J.
| J | range of the index of the cols |
Definition at line 340 of file STK_ITContainer2D.h.
| TContainerHo STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::atRow | ( | Integer | i | ) | const [inline] |
STL compatibility : return the row i.
| i | the index of the row |
Definition at line 356 of file STK_ITContainer2D.h.
| TContainer2D STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::atRow | ( | Range const & | I | ) | const [inline] |
STL compatibility : return the Container2D in the row range I.
| I | range of the index of the rows |
Definition at line 372 of file STK_ITContainer2D.h.
| void STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::pushBackCol | ( | ITContainer1D< TYPE, Container1D > const & | V | ) | [inline] |
push back a column to the container with value V.
| V | the values to add to the end of the container |
Definition at line 389 of file STK_ITContainer2D.h.
{
const Integer firstRow = V.first(), lastRow = V.last();
// check if the container is empty
if (this->empty())
{
this->resize(V.range(), Range(1));
for (Integer i=firstRow; i<=lastRow; i++)
(*this)(i, 1) = V[i];
return;
}
#ifdef STK_BOUNDS_CHECK
if (V.range() != this->rangeVe())
{ throw std::runtime_error("TContainer2D::pushBackCol(V) "
"V.range() != this->rangeVe()");
}
#endif
// if the container is not empty we add a column and copy V inside
this->pushBackCols();
const Integer lastCol = this->lastCol();
for (Integer i=firstRow; i<=lastRow; i++)
(*this)(i, lastCol) = V[i];
}