Included definitions for rowRange() and colRange() member functions of DenseBase

This commit is contained in:
Manoj Rajagopalan 2010-06-26 17:37:17 -04:00
parent 4b474fdb34
commit 464fc297cf
2 changed files with 117 additions and 1 deletions

View File

@ -679,9 +679,62 @@ DenseBase<Derived>::bottomRows() const
/** \returns a block consisting of a range of rows of *this.
*
* \param startRow the index of the first row in the block
* \param numRows the number of rows in the block
*
* Example: \include MatrixBase_rowRange_int.cpp
* Output: \verbinclude MatrixBase_rowRange_int.out
*
* \sa class Block, block(Index,Index,Index,Index)
*/
template<typename Derived>
inline typename DenseBase<Derived>::RowsBlockXpr DenseBase<Derived>
::rowRange(Index startRow, Index numRows)
{
return RowsBlockXpr(derived(), startRow, 0, numRows, cols());
}
/** This is the const version of rowRange(Index,Index).*/
template<typename Derived>
inline const typename DenseBase<Derived>::RowsBlockXpr
DenseBase<Derived>::rowRange(Index startRow, Index numRows) const
{
return RowsBlockXpr(derived(), startRow, 0, numRows, cols());
}
/** \returns a block consisting of a range of rows of *this.
*
* \param N the number of rows in the block
* \param startRow the index of the first row in the block
*
* Example: \include MatrixBase_template_int_rowRange.cpp
* Output: \verbinclude MatrixBase_template_int_rowRange.out
*
* \sa class Block, block(Index,Index,Index,Index)
*/
template<typename Derived>
template<int N>
inline typename DenseBase<Derived>::template NRowsBlockXpr<N>::Type
DenseBase<Derived>::rowRange(Index startRow)
{
return typename DenseBase<Derived>::template NRowsBlockXpr<N>::Type(derived(), startRow, 0, N, cols());
}
/** This is the const version of rowRange<int>().*/
template<typename Derived>
template<int N>
inline const typename DenseBase<Derived>::template NRowsBlockXpr<N>::Type
DenseBase<Derived>::rowRange(Index startRow) const
{
return typename DenseBase<Derived>::template NRowsBlockXpr<N>::Type(derived(), startRow, 0, N, cols());
}
/** \returns a block consisting of the top columns of *this.
/** \returns a block consisting of the left columns of *this.
* *
* \param n the number of columns in the block * \param n the number of columns in the block
* *
@ -788,6 +841,61 @@ DenseBase<Derived>::rightCols() const
/** \returns a block consisting of a range of columns of *this.
*
* \param startCol the index of the first column in the block
* \param numCols the number of columns in the block
*
* Example: \include MatrixBase_colRange_int.cpp
* Output: \verbinclude MatrixBase_colRange_int.out
*
* \sa class Block, block(Index,Index,Index,Index)
*/
template<typename Derived>
inline typename DenseBase<Derived>::ColsBlockXpr DenseBase<Derived>
::colRange(Index startCol, Index numCols)
{
return ColsBlockXpr(derived(), 0, startCol, rows(), numCols);
}
/** This is the const version of colRange(Index,Index).*/
template<typename Derived>
inline const typename DenseBase<Derived>::ColsBlockXpr
DenseBase<Derived>::colRange(Index startCol, Index numCols) const
{
return ColsBlockXpr(derived(), 0, startCol, rows(), numCols);
}
/** \returns a block consisting of a range of columns of *this.
*
* \param N the number of columns in the block
* \param startCol the index of the first column in the block
*
* Example: \include MatrixBase_template_int_colRange.cpp
* Output: \verbinclude MatrixBase_template_int_colRange.out
*
* \sa class Block, block(Index,Index,Index,Index)
*/
template<typename Derived>
template<int N>
inline typename DenseBase<Derived>::template NColsBlockXpr<N>::Type
DenseBase<Derived>::colRange(Index startCol)
{
return typename NColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), N);
}
/** This is the const version of colRange<int>().*/
template<typename Derived>
template<int N>
inline const typename DenseBase<Derived>::template NColsBlockXpr<N>::Type
DenseBase<Derived>::colRange(Index startCol) const
{
return typename NColsBlockXpr<N>::Type(derived(), 0, startCol, rows(), N);
}
/** \returns a fixed-size expression of a block in *this. /** \returns a fixed-size expression of a block in *this.
* *

View File

@ -327,10 +327,14 @@ template<typename Derived> class DenseBase
const RowsBlockXpr topRows(Index n) const; const RowsBlockXpr topRows(Index n) const;
RowsBlockXpr bottomRows(Index n); RowsBlockXpr bottomRows(Index n);
const RowsBlockXpr bottomRows(Index n) const; const RowsBlockXpr bottomRows(Index n) const;
RowsBlockXpr rowRange(Index startRow, Index numRows);
const RowsBlockXpr rowRange(Index startRow, Index numRows) const;
ColsBlockXpr leftCols(Index n); ColsBlockXpr leftCols(Index n);
const ColsBlockXpr leftCols(Index n) const; const ColsBlockXpr leftCols(Index n) const;
ColsBlockXpr rightCols(Index n); ColsBlockXpr rightCols(Index n);
const ColsBlockXpr rightCols(Index n) const; const ColsBlockXpr rightCols(Index n) const;
ColsBlockXpr colRange(Index startCol, Index numCols);
const ColsBlockXpr colRange(Index startCol, Index numCols) const;
template<int CRows, int CCols> Block<Derived, CRows, CCols> topLeftCorner(); template<int CRows, int CCols> Block<Derived, CRows, CCols> topLeftCorner();
template<int CRows, int CCols> const Block<Derived, CRows, CCols> topLeftCorner() const; template<int CRows, int CCols> const Block<Derived, CRows, CCols> topLeftCorner() const;
@ -345,10 +349,14 @@ template<typename Derived> class DenseBase
template<int NRows> const typename NRowsBlockXpr<NRows>::Type topRows() const; template<int NRows> const typename NRowsBlockXpr<NRows>::Type topRows() const;
template<int NRows> typename NRowsBlockXpr<NRows>::Type bottomRows(); template<int NRows> typename NRowsBlockXpr<NRows>::Type bottomRows();
template<int NRows> const typename NRowsBlockXpr<NRows>::Type bottomRows() const; template<int NRows> const typename NRowsBlockXpr<NRows>::Type bottomRows() const;
template<int NRows> typename NRowsBlockXpr<NRows>::Type rowRange(Index startRow);
template<int NRows> const typename NRowsBlockXpr<NRows>::Type rowRange(Index startRow) const;
template<int NCols> typename NColsBlockXpr<NCols>::Type leftCols(); template<int NCols> typename NColsBlockXpr<NCols>::Type leftCols();
template<int NCols> const typename NColsBlockXpr<NCols>::Type leftCols() const; template<int NCols> const typename NColsBlockXpr<NCols>::Type leftCols() const;
template<int NCols> typename NColsBlockXpr<NCols>::Type rightCols(); template<int NCols> typename NColsBlockXpr<NCols>::Type rightCols();
template<int NCols> const typename NColsBlockXpr<NCols>::Type rightCols() const; template<int NCols> const typename NColsBlockXpr<NCols>::Type rightCols() const;
template<int NCols> typename NColsBlockXpr<NCols>::Type colRange(Index startCol);
template<int NCols> const typename NColsBlockXpr<NCols>::Type colRange(Index startCol) const;
template<int BlockRows, int BlockCols> template<int BlockRows, int BlockCols>
Block<Derived, BlockRows, BlockCols> block(Index startRow, Index startCol); Block<Derived, BlockRows, BlockCols> block(Index startRow, Index startCol);