11 #ifndef EIGEN_DIAGONAL_H 12 #define EIGEN_DIAGONAL_H 36 template<
typename MatrixType,
int DiagIndex>
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,
56 CoeffReadCost = _MatrixTypeNested::CoeffReadCost,
58 InnerStrideAtCompileTime = MatrixTypeOuterStride ==
Dynamic ?
Dynamic : MatrixTypeOuterStride+1,
59 OuterStrideAtCompileTime = 0
64 template<
typename MatrixType,
int _DiagIndex>
class Diagonal 69 enum { DiagIndex = _DiagIndex };
71 EIGEN_DENSE_PUBLIC_INTERFACE(
Diagonal)
73 inline Diagonal(
MatrixType& matrix, Index a_index = DiagIndex) : m_matrix(matrix), m_index(a_index) {}
75 EIGEN_INHERIT_ASSIGNMENT_OPERATORS(
Diagonal)
77 inline Index rows()
const 78 {
return m_index.value()<0 ? (std::min<Index>)(m_matrix.cols(),m_matrix.rows()+m_index.value()) : (std::min<Index>)(m_matrix.rows(),m_matrix.cols()-m_index.value()); }
80 inline Index cols()
const {
return 1; }
82 inline Index innerStride()
const 84 return m_matrix.outerStride() + 1;
87 inline Index outerStride()
const 98 inline ScalarWithConstIfNotLvalue* data() {
return &(m_matrix.const_cast_derived().coeffRef(rowOffset(), colOffset())); }
99 inline const Scalar* data()
const {
return &(m_matrix.const_cast_derived().coeffRef(rowOffset(), colOffset())); }
101 inline Scalar& coeffRef(Index row, Index)
104 return m_matrix.const_cast_derived().coeffRef(row+rowOffset(), row+colOffset());
107 inline const Scalar& coeffRef(Index row, Index)
const 109 return m_matrix.const_cast_derived().coeffRef(row+rowOffset(), row+colOffset());
112 inline CoeffReturnType coeff(Index row, Index)
const 114 return m_matrix.coeff(row+rowOffset(), row+colOffset());
117 inline Scalar& coeffRef(Index idx)
120 return m_matrix.const_cast_derived().coeffRef(idx+rowOffset(), idx+colOffset());
123 inline const Scalar& coeffRef(Index idx)
const 125 return m_matrix.const_cast_derived().coeffRef(idx+rowOffset(), idx+colOffset());
128 inline CoeffReturnType coeff(Index idx)
const 130 return m_matrix.coeff(idx+rowOffset(), idx+colOffset());
134 nestedExpression()
const 141 return m_index.value();
145 typename MatrixType::Nested m_matrix;
150 EIGEN_STRONG_INLINE Index absDiagIndex()
const {
return m_index.value()>0 ? m_index.value() : -m_index.value(); }
151 EIGEN_STRONG_INLINE Index rowOffset()
const {
return m_index.value()>0 ? 0 : -m_index.value(); }
152 EIGEN_STRONG_INLINE Index colOffset()
const {
return m_index.value()>0 ? m_index.value() : 0; }
154 template<
int LoadMode>
typename MatrixType::PacketReturnType packet(Index)
const;
155 template<
int LoadMode>
typename MatrixType::PacketReturnType packet(Index,Index)
const;
166 template<
typename Derived>
174 template<
typename Derived>
192 template<
typename Derived>
200 template<
typename Derived>
218 template<
typename Derived>
227 template<
typename Derived>
237 #endif // EIGEN_DIAGONAL_H Definition: gtest_unittest.cc:5031
internal::traits< Derived >::Index Index
The type of indices.
Definition: DenseBase.h:60
Expression of the transpose of a matrix.
Definition: Transpose.h:57
const unsigned int DirectAccessBit
Means that the underlying array of coefficients can be directly accessed as a plain strided array...
Definition: Constants.h:142
DiagonalReturnType diagonal()
Definition: Diagonal.h:168
const unsigned int LvalueBit
Means the expression has a coeffRef() method, i.e.
Definition: Constants.h:131
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: TestIMU_Common.h:87
const int DynamicIndex
This value means that a signed quantity (e.g., a signed index) is not known at compile-time, and that instead its value has to be specified at runtime.
Definition: Constants.h:26
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition: Constants.h:53
Definition: XprHelper.h:350
Definition: BandTriangularSolver.h:13
Definition: DenseCoeffsBase.h:739
Expression of a diagonal/subdiagonal/superdiagonal in a matrix.
Definition: Diagonal.h:64
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time, and that instead the value is stored in some runtime variable.
Definition: Constants.h:21
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
const unsigned int LinearAccessBit
Short version: means the expression can be seen as 1D vector.
Definition: Constants.h:117
Definition: ForwardDeclarations.h:17
Definition: XprHelper.h:459
double Scalar
Common scalar type.
Definition: FlexibleKalmanBase.h:48