fix bugs in Block/DynBlock

This commit is contained in:
Benoit Jacob 2007-12-11 10:05:50 +00:00
parent fc924bc7d4
commit effaee9bc7
2 changed files with 5 additions and 4 deletions

View File

@ -42,7 +42,7 @@ template<typename MatrixType, int BlockRows, int BlockCols> class Block
: m_matrix(matrix), m_startRow(startRow), m_startCol(startCol) : m_matrix(matrix), m_startRow(startRow), m_startCol(startCol)
{ {
assert(startRow >= 0 && BlockRows >= 1 && startRow + BlockRows <= matrix.rows() assert(startRow >= 0 && BlockRows >= 1 && startRow + BlockRows <= matrix.rows()
&& startCol >= 0 && BlockCols >= 1 && startCol + BlockCols <= matrix.rows()); && startCol >= 0 && BlockCols >= 1 && startCol + BlockCols <= matrix.cols());
} }
Block(const Block& other) Block(const Block& other)

View File

@ -34,8 +34,9 @@ template<typename MatrixType> class DynBlock
typedef typename MatrixType::Ref MatRef; typedef typename MatrixType::Ref MatRef;
friend class MatrixBase<Scalar, DynBlock<MatrixType> >; friend class MatrixBase<Scalar, DynBlock<MatrixType> >;
static const int RowsAtCompileTime = Dynamic, static const int
ColsAtCompileTime = Dynamic; RowsAtCompileTime = MatrixType::RowsAtCompileTime == 1 ? 1 : Dynamic,
ColsAtCompileTime = MatrixType::ColsAtCompileTime == 1 ? 1 : Dynamic;
DynBlock(const MatRef& matrix, DynBlock(const MatRef& matrix,
int startRow, int startCol, int startRow, int startCol,
@ -44,7 +45,7 @@ template<typename MatrixType> class DynBlock
m_blockRows(blockRows), m_blockCols(blockCols) m_blockRows(blockRows), m_blockCols(blockCols)
{ {
assert(startRow >= 0 && blockRows >= 1 && startRow + blockRows <= matrix.rows() assert(startRow >= 0 && blockRows >= 1 && startRow + blockRows <= matrix.rows()
&& startCol >= 0 && blockCols >= 1 && startCol + blockCols <= matrix.rows()); && startCol >= 0 && blockCols >= 1 && startCol + blockCols <= matrix.cols());
} }
DynBlock(const DynBlock& other) DynBlock(const DynBlock& other)