Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @@ -26,6 +26,8 @@
- #ifndef EIGEN_DIAGONAL_H
- #define EIGEN_DIAGONAL_H
- namespace Eigen {
- /** \class Diagonal
- * \ingroup Core_Module
- *
- @@ -54,16 +56,17 @@
- typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
- typedef typename MatrixType::StorageKind StorageKind;
- enum {
- - AbsDiagIndex = DiagIndex<0 ? -DiagIndex : DiagIndex, // only used if DiagIndex != Dynamic
- - // FIXME these computations are broken in the case where the matrix is rectangular and DiagIndex!=0
- RowsAtCompileTime = (int(DiagIndex) == Dynamic || int(MatrixType::SizeAtCompileTime) == Dynamic) ? Dynamic
- - : (EIGEN_SIZE_MIN_PREFER_DYNAMIC(MatrixType::RowsAtCompileTime,
- - MatrixType::ColsAtCompileTime) - AbsDiagIndex),
- + : (EIGEN_SIZE_MIN_PREFER_DYNAMIC(
- + MatrixType::RowsAtCompileTime - EIGEN_PLAIN_ENUM_MAX(-DiagIndex, 0),
- + MatrixType::ColsAtCompileTime - EIGEN_PLAIN_ENUM_MAX( DiagIndex, 0))),
- ColsAtCompileTime = 1,
- MaxRowsAtCompileTime = int(MatrixType::MaxSizeAtCompileTime) == Dynamic ? Dynamic
- : DiagIndex == Dynamic ? EIGEN_SIZE_MIN_PREFER_FIXED(MatrixType::MaxRowsAtCompileTime,
- MatrixType::MaxColsAtCompileTime)
- - : (EIGEN_SIZE_MIN_PREFER_FIXED(MatrixType::MaxRowsAtCompileTime, MatrixType::MaxColsAtCompileTime) - AbsDiagIndex),
- + : (EIGEN_SIZE_MIN_PREFER_FIXED(
- + MatrixType::MaxRowsAtCompileTime - EIGEN_PLAIN_ENUM_MAX(-DiagIndex, 0),
- + MatrixType::MaxColsAtCompileTime - EIGEN_PLAIN_ENUM_MAX( DiagIndex, 0))),
- MaxColsAtCompileTime = 1,
- MaskLvalueBit = is_lvalue<MatrixType>::value ? LvalueBit : 0,
- Flags = (unsigned int)_MatrixTypeNested::Flags & (HereditaryBits | LinearAccessBit | MaskLvalueBit | DirectAccessBit) & ~RowMajorBit,
- @@ -88,7 +91,11 @@
- EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Diagonal)
- inline Index rows() const
- - { return m_index.value()<0 ? (std::min)(m_matrix.cols(),m_matrix.rows()+m_index.value()) : (std::min)(m_matrix.rows(),m_matrix.cols()-m_index.value()); }
- + {
- + return std::min(
- + m_matrix.rows() - std::max(-m_index.value(), 0),
- + m_matrix.cols() - std::max( m_index.value(), 0));
- + }
- inline Index cols() const { return 1; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement