41 typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
42 typedef typename MatrixType::StorageKind StorageKind;
45 : (EIGEN_PLAIN_ENUM_MIN(MatrixType::RowsAtCompileTime - EIGEN_PLAIN_ENUM_MAX(-DiagIndex, 0),
46 MatrixType::ColsAtCompileTime - EIGEN_PLAIN_ENUM_MAX( DiagIndex, 0))),
47 ColsAtCompileTime = 1,
48 MaxRowsAtCompileTime =
int(MatrixType::MaxSizeAtCompileTime) ==
Dynamic ?
Dynamic
49 : DiagIndex ==
DynamicIndex ? EIGEN_SIZE_MIN_PREFER_FIXED(MatrixType::MaxRowsAtCompileTime,
50 MatrixType::MaxColsAtCompileTime)
51 : (EIGEN_PLAIN_ENUM_MIN(MatrixType::MaxRowsAtCompileTime - EIGEN_PLAIN_ENUM_MAX(-DiagIndex, 0),
52 MatrixType::MaxColsAtCompileTime - EIGEN_PLAIN_ENUM_MAX( DiagIndex, 0))),
53 MaxColsAtCompileTime = 1,
57 InnerStrideAtCompileTime = MatrixTypeOuterStride ==
Dynamic ?
Dynamic : MatrixTypeOuterStride+1,
58 OuterStrideAtCompileTime = 0
63template<
typename MatrixType,
int _DiagIndex>
class Diagonal
70 EIGEN_DENSE_PUBLIC_INTERFACE(
Diagonal)
75 eigen_assert(
a_index <= m_matrix.cols() && -
a_index <= m_matrix.rows() );
78 EIGEN_INHERIT_ASSIGNMENT_OPERATORS(
Diagonal)
81 inline Index rows()
const
83 return m_index.
value()<0 ? numext::mini<Index>(m_matrix.cols(),m_matrix.rows()+m_index.
value())
84 : numext::mini<Index>(m_matrix.rows(),m_matrix.cols()-m_index.
value());
87 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
88 inline Index cols()
const EIGEN_NOEXCEPT {
return 1; }
90 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
91 inline Index innerStride()
const EIGEN_NOEXCEPT {
92 return m_matrix.outerStride() + 1;
95 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
96 inline Index outerStride()
const EIGEN_NOEXCEPT {
return 0; }
107 inline const Scalar* data()
const {
return &(m_matrix.coeffRef(rowOffset(), colOffset())); }
112 EIGEN_STATIC_ASSERT_LVALUE(MatrixType)
113 return m_matrix.coeffRef(row+rowOffset(), row+colOffset());
117 inline const Scalar& coeffRef(
Index row,
Index)
const
119 return m_matrix.coeffRef(row+rowOffset(), row+colOffset());
123 inline CoeffReturnType coeff(
Index row,
Index)
const
125 return m_matrix.coeff(row+rowOffset(), row+colOffset());
129 inline Scalar& coeffRef(
Index idx)
131 EIGEN_STATIC_ASSERT_LVALUE(MatrixType)
132 return m_matrix.coeffRef(idx+rowOffset(), idx+colOffset());
136 inline const Scalar& coeffRef(
Index idx)
const
138 return m_matrix.coeffRef(idx+rowOffset(), idx+colOffset());
142 inline CoeffReturnType coeff(
Index idx)
const
144 return m_matrix.coeff(idx+rowOffset(), idx+colOffset());
148 inline const typename internal::remove_all<typename MatrixType::Nested>::type&
149 nestedExpression()
const
155 inline Index index()
const
157 return m_index.
value();
166 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
167 Index absDiagIndex()
const EIGEN_NOEXCEPT {
return m_index.value()>0 ? m_index.value() : -m_index.value(); }
168 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
169 Index rowOffset()
const EIGEN_NOEXCEPT {
return m_index.value()>0 ? 0 : -m_index.value(); }
170 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
171 Index colOffset()
const EIGEN_NOEXCEPT {
return m_index.value()>0 ? m_index.value() : 0; }
173 template<
int LoadMode>
typename MatrixType::PacketReturnType packet(
Index)
const;
174 template<
int LoadMode>
typename MatrixType::PacketReturnType packet(
Index,
Index)
const;
const unsigned int DirectAccessBit
Means that the underlying array of coefficients can be directly accessed as a plain strided array.
Definition Constants.h:155
const unsigned int LvalueBit
Means the expression has a coeffRef() method, i.e.
Definition Constants.h:144
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition Constants.h:66
const int DynamicIndex
This value means that a signed quantity (e.g., a signed index) is not known at compile-time,...
Definition Constants.h:27
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time,...
Definition Constants.h:22