diff options
author | Christoph Hertzberg <chtz@informatik.uni-bremen.de> | 2016-08-08 17:26:48 +0200 |
---|---|---|
committer | Christoph Hertzberg <chtz@informatik.uni-bremen.de> | 2016-08-08 17:26:48 +0200 |
commit | 3e4a33d4bac400f857fc165c9b119901c1c7f5e5 (patch) | |
tree | 17718ad2d3f55bf53ebf4998b147ff80abd64de8 /Eigen/src/Core | |
parent | fe4b927e9c8e796a07c5864e58630e888979519e (diff) |
bug #1272: Let CommaInitializer work for more border cases (enhances fix of bug #1242).
The unit test tests all combinations of 2x2 block-sizes from 0 to 3.
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r-- | Eigen/src/Core/CommaInitializer.h | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/Eigen/src/Core/CommaInitializer.h b/Eigen/src/Core/CommaInitializer.h index 787743b8f..b39a661d0 100644 --- a/Eigen/src/Core/CommaInitializer.h +++ b/Eigen/src/Core/CommaInitializer.h @@ -80,12 +80,7 @@ struct CommaInitializer EIGEN_DEVICE_FUNC CommaInitializer& operator,(const DenseBase<OtherDerived>& other) { - if(other.rows()==0) - { - m_col += other.cols(); - return *this; - } - if (m_col==m_xpr.cols()) + if (m_col==m_xpr.cols() && (other.cols()!=0 || other.rows()!=m_currentBlockRows)) { m_row+=m_currentBlockRows; m_col = 0; @@ -93,15 +88,11 @@ struct CommaInitializer eigen_assert(m_row+m_currentBlockRows<=m_xpr.rows() && "Too many rows passed to comma initializer (operator<<)"); } - eigen_assert((m_col<m_xpr.cols() || (m_xpr.cols()==0 && m_col==0)) + eigen_assert((m_col + other.cols() <= m_xpr.cols()) && "Too many coefficients passed to comma initializer (operator<<)"); eigen_assert(m_currentBlockRows==other.rows()); - if (OtherDerived::SizeAtCompileTime != Dynamic) - m_xpr.template block<OtherDerived::RowsAtCompileTime != Dynamic ? OtherDerived::RowsAtCompileTime : 1, - OtherDerived::ColsAtCompileTime != Dynamic ? OtherDerived::ColsAtCompileTime : 1> - (m_row, m_col) = other; - else - m_xpr.block(m_row, m_col, other.rows(), other.cols()) = other; + m_xpr.template block<OtherDerived::RowsAtCompileTime, OtherDerived::ColsAtCompileTime> + (m_row, m_col, other.rows(), other.cols()) = other; m_col += other.cols(); return *this; } |