11 #ifndef EIGEN_DIAGONALPRODUCT_H 12 #define EIGEN_DIAGONALPRODUCT_H 17 template<
typename MatrixType,
typename DiagonalType,
int ProductOrder>
23 RowsAtCompileTime = MatrixType::RowsAtCompileTime,
24 ColsAtCompileTime = MatrixType::ColsAtCompileTime,
25 MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
26 MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
29 _ScalarAccessOnDiag = !((int(_StorageOrder) ==
ColMajor && int(ProductOrder) ==
OnTheLeft)
34 _Vectorizable = bool(
int(MatrixType::Flags)&
PacketAccessBit) && _SameTypes && (_ScalarAccessOnDiag || (bool(
int(DiagonalType::DiagonalVectorType::Flags)&PacketAccessBit))),
35 _LinearAccessMask = (RowsAtCompileTime==1 || ColsAtCompileTime==1) ?
LinearAccessBit : 0,
37 Flags = ((HereditaryBits|_LinearAccessMask|
AlignedBit) & (
unsigned int)(MatrixType::Flags)) | (_Vectorizable ? PacketAccessBit : 0),
39 CoeffReadCost = EIGEN_ADD_COST(Cost0,DiagonalType::DiagonalVectorType::CoeffReadCost)
44 template<
typename MatrixType,
typename DiagonalType,
int ProductOrder>
46 public MatrixBase<DiagonalProduct<MatrixType, DiagonalType, ProductOrder> >
54 : m_matrix(matrix), m_diagonal(diagonal)
56 eigen_assert(diagonal.diagonal().size() == (ProductOrder ==
OnTheLeft ? matrix.rows() : matrix.cols()));
59 EIGEN_STRONG_INLINE
Index rows()
const {
return m_matrix.rows(); }
60 EIGEN_STRONG_INLINE
Index cols()
const {
return m_matrix.cols(); }
62 EIGEN_STRONG_INLINE
const Scalar coeff(
Index row,
Index col)
const 64 return m_diagonal.diagonal().coeff(ProductOrder ==
OnTheLeft ? row : col) * m_matrix.coeff(row, col);
67 EIGEN_STRONG_INLINE
const Scalar coeff(
Index idx)
const 72 return coeff(
int(StorageOrder)==
ColMajor?idx:0,
int(StorageOrder)==
ColMajor?0:idx);
75 template<
int LoadMode>
81 const Index indexInDiagonalVector = ProductOrder ==
OnTheLeft ? row : col;
87 template<
int LoadMode>
93 return packet<LoadMode>(int(StorageOrder)==
ColMajor?idx:0,int(StorageOrder)==
ColMajor?0:idx);
97 template<
int LoadMode>
100 return internal::pmul(m_matrix.template packet<LoadMode>(row, col),
101 internal::pset1<PacketScalar>(m_diagonal.diagonal().coeff(
id)));
104 template<
int LoadMode>
108 InnerSize = (MatrixType::Flags &
RowMajorBit) ? MatrixType::ColsAtCompileTime : MatrixType::RowsAtCompileTime,
109 DiagonalVectorPacketLoadMode = (LoadMode ==
Aligned && (((InnerSize%16) == 0) || (
int(DiagonalType::DiagonalVectorType::Flags)&
AlignedBit)==AlignedBit) ?
Aligned :
Unaligned)
111 return internal::pmul(m_matrix.template packet<LoadMode>(row, col),
112 m_diagonal.diagonal().template packet<DiagonalVectorPacketLoadMode>(id));
115 typename MatrixType::Nested m_matrix;
116 typename DiagonalType::Nested m_diagonal;
121 template<
typename Derived>
122 template<
typename DiagonalDerived>
131 #endif // EIGEN_DIAGONALPRODUCT_H Object is not correctly aligned for vectorization.
Definition: Constants.h:192
Apply transformation on the right.
Definition: Constants.h:279
internal::traits< Derived >::Index Index
The type of indices.
Definition: DenseBase.h:60
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: TestIMU_Common.h:87
Holds information about the various numeric (i.e.
Definition: NumTraits.h:88
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition: Constants.h:53
Object is aligned for vectorization.
Definition: Constants.h:194
Definition: XprHelper.h:32
const unsigned int PacketAccessBit
Short version: means the expression might be vectorized.
Definition: Constants.h:81
const unsigned int AlignedBit
means the first coefficient packet is guaranteed to be aligned
Definition: Constants.h:147
Storage order is column major (see TopicStorageOrders).
Definition: Constants.h:264
Definition: XprHelper.h:371
Definition: DiagonalProduct.h:45
Definition: BandTriangularSolver.h:13
Storage order is row major (see TopicStorageOrders).
Definition: Constants.h:266
Definition: DiagonalMatrix.h:18
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
Apply transformation on the left.
Definition: Constants.h:277
double Scalar
Common scalar type.
Definition: FlexibleKalmanBase.h:48