From effaee9bc7bf48a8703c75c8279279e2f1055766 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Tue, 11 Dec 2007 10:05:50 +0000 Subject: [PATCH] fix bugs in Block/DynBlock --- src/Core/Block.h | 2 +- src/Core/DynBlock.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Core/Block.h b/src/Core/Block.h index 72f291034..c5ab18884 100644 --- a/src/Core/Block.h +++ b/src/Core/Block.h @@ -42,7 +42,7 @@ template class Block : m_matrix(matrix), m_startRow(startRow), m_startCol(startCol) { 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) diff --git a/src/Core/DynBlock.h b/src/Core/DynBlock.h index 8a52b4c58..efe16abc4 100644 --- a/src/Core/DynBlock.h +++ b/src/Core/DynBlock.h @@ -34,8 +34,9 @@ template class DynBlock typedef typename MatrixType::Ref MatRef; friend class MatrixBase >; - static const int RowsAtCompileTime = Dynamic, - ColsAtCompileTime = Dynamic; + static const int + RowsAtCompileTime = MatrixType::RowsAtCompileTime == 1 ? 1 : Dynamic, + ColsAtCompileTime = MatrixType::ColsAtCompileTime == 1 ? 1 : Dynamic; DynBlock(const MatRef& matrix, int startRow, int startCol, @@ -44,7 +45,7 @@ template class DynBlock m_blockRows(blockRows), m_blockCols(blockCols) { 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)