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,
34 _Vectorizable = bool(
int(MatrixType::Flags)&
PacketAccessBit) && _SameTypes && (_ScalarAccessOnDiag || (bool(
int(DiagonalType::DiagonalVectorType::Flags)&
PacketAccessBit))),
35 _LinearAccessMask = (RowsAtCompileTime==1 || ColsAtCompileTime==1) ?
LinearAccessBit : 0,
43 template<
typename MatrixType,
typename DiagonalType,
int ProductOrder>
45 public MatrixBase<DiagonalProduct<MatrixType, DiagonalType, ProductOrder> >
53 : m_matrix(matrix), m_diagonal(diagonal)
55 eigen_assert(diagonal.diagonal().size() == (ProductOrder ==
OnTheLeft ? matrix.rows() : matrix.cols()));
63 return m_diagonal.diagonal().coeff(ProductOrder ==
OnTheLeft ? row : col) * m_matrix.coeff(row, col);
71 return coeff(
int(StorageOrder)==
ColMajor?idx:0,
int(StorageOrder)==
ColMajor?0:idx);
74 template<
int LoadMode>
86 template<
int LoadMode>
92 return packet<LoadMode>(int(StorageOrder)==
ColMajor?idx:0,int(StorageOrder)==
ColMajor?0:idx);
96 template<
int LoadMode>
99 return internal::pmul(m_matrix.template packet<LoadMode>(row, col),
100 internal::pset1<PacketScalar>(m_diagonal.diagonal().coeff(
id)));
103 template<
int LoadMode>
107 InnerSize = (MatrixType::Flags &
RowMajorBit) ? MatrixType::ColsAtCompileTime : MatrixType::RowsAtCompileTime,
108 DiagonalVectorPacketLoadMode = (LoadMode ==
Aligned && (((InnerSize%16) == 0) || (
int(DiagonalType::DiagonalVectorType::Flags)&
AlignedBit)==AlignedBit) ?
Aligned :
Unaligned)
110 return internal::pmul(m_matrix.template packet<LoadMode>(row, col),
111 m_diagonal.diagonal().template packet<DiagonalVectorPacketLoadMode>(id));
120 template<
typename Derived>
121 template<
typename DiagonalDerived>
130 #endif // EIGEN_DIAGONALPRODUCT_H
internal::packet_traits< Scalar >::type PacketScalar
#define EIGEN_STRONG_INLINE
internal::traits< Derived >::Index Index
The type of indices.
EIGEN_STRONG_INLINE PacketScalar packet_impl(Index row, Index col, Index id, internal::true_type) const
iterative scaling algorithm to equilibrate rows and column norms in matrices
EIGEN_STRONG_INLINE PacketScalar packet(Index idx) const
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
EIGEN_STRONG_INLINE PacketScalar packet(Index row, Index col) const
const unsigned int RowMajorBit
const unsigned int PacketAccessBit
MatrixBase< DiagonalProduct > Base
const unsigned int AlignedBit
const unsigned int HereditaryBits
EIGEN_STRONG_INLINE const Scalar coeff(Index idx) const
DiagonalType::Nested m_diagonal
EIGEN_STRONG_INLINE Index rows() const
EIGEN_STRONG_INLINE PacketScalar packet_impl(Index row, Index col, Index id, internal::false_type) const
EIGEN_STRONG_INLINE Index cols() const
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
Packet pmul(const Packet &a, const Packet &b)
const Derived & derived() const
scalar_product_traits< typename MatrixType::Scalar, typename DiagonalType::Scalar >::ReturnType Scalar
MatrixType::Nested m_matrix
Base class for all dense matrices, vectors, and expressions.
const unsigned int LinearAccessBit
EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const