10 #ifndef EIGEN_SPARSE_DIAGONAL_PRODUCT_H 11 #define EIGEN_SPARSE_DIAGONAL_PRODUCT_H 34 template<
typename SparseXprType,
typename DiagonalCoeffType,
int SDP_Tag>
37 template<
typename Lhs,
typename Rhs,
int ProductTag>
48 template<
typename Lhs,
typename Rhs,
int ProductTag>
56 explicit product_evaluator(
const XprType& xpr) : Base(xpr.lhs(), xpr.rhs().diagonal().transpose()) {}
59 template<
typename SparseXprType,
typename DiagonalCoeffType>
64 typedef typename SparseXprType::Scalar
Scalar;
71 : SparseXprInnerIterator(xprEval.m_sparseXprImpl, outer),
72 m_coeff(xprEval.m_diagCoeffImpl.coeff(outer))
77 typename DiagonalCoeffType::Scalar
m_coeff;
81 : m_sparseXprImpl(sparseXpr), m_diagCoeffImpl(diagCoeff)
92 template<
typename SparseXprType,
typename DiagCoeffType>
95 typedef typename SparseXprType::Scalar
Scalar;
98 typedef typename nested_eval<DiagCoeffType,SparseXprType::IsRowMajor ? SparseXprType::RowsAtCompileTime
106 : m_sparseIter(xprEval.m_sparseXprEval, outer), m_diagCoeffNested(xprEval.m_diagCoeffNested)
109 inline Scalar
value()
const {
return m_sparseIter.value() * m_diagCoeffNested.coeff(index()); }
110 inline StorageIndex
index()
const {
return m_sparseIter.index(); }
112 inline Index col()
const {
return SparseXprType::IsRowMajor ? m_sparseIter.index() : m_sparseIter.outer(); }
113 inline Index row()
const {
return SparseXprType::IsRowMajor ? m_sparseIter.outer() : m_sparseIter.index(); }
116 inline operator bool()
const {
return m_sparseIter; }
124 : m_sparseXprEval(sparseXpr), m_diagCoeffNested(diagCoeff)
138 #endif // EIGEN_SPARSE_DIAGONAL_PRODUCT_H Index nonZerosEstimate() const
InnerIterator(const sparse_diagonal_product_evaluator &xprEval, Index outer)
#define EIGEN_STRONG_INLINE
DiagCoeffNested m_diagCoeffNested
evaluator< SparseXprType >::InnerIterator SparseXprInnerIterator
Expression of the product of two arbitrary matrices or vectors.
nested_eval< DiagCoeffType, SparseXprType::IsRowMajor?SparseXprType::RowsAtCompileTime:SparseXprType::ColsAtCompileTime >::type DiagCoeffNested
InnerIterator(const sparse_diagonal_product_evaluator &xprEval, Index outer)
evaluator< SparseXprType > m_sparseXprImpl
Index nonZerosEstimate() const
DiagCoeffNested m_diagCoeffNested
EIGEN_STRONG_INLINE InnerIterator & operator++()
sparse_diagonal_product_evaluator(const SparseXprType &sparseXpr, const DiagonalCoeffType &diagCoeff)
const unsigned int RowMajorBit
SparseXprType::Scalar Scalar
evaluator< DiagonalCoeffType > m_diagCoeffImpl
Product< Lhs, Rhs, DefaultProduct > XprType
evaluator< SparseXprType >::InnerIterator SparseXprIter
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
SparseXprType::Scalar Scalar
evaluator< SparseXprType > m_sparseXprEval
Product< Lhs, Rhs, DefaultProduct > XprType
SparseXprType::StorageIndex StorageIndex
sparse_diagonal_product_evaluator(const SparseXprType &sparseXpr, const DiagCoeffType &diagCoeff)
product_evaluator(const XprType &xpr)
product_evaluator(const XprType &xpr)
EIGEN_STRONG_INLINE Scalar value() const
sparse_diagonal_product_evaluator< Rhs, typename Lhs::DiagonalVectorType, Rhs::Flags &RowMajorBit?SDP_AsScalarProduct:SDP_AsCwiseProduct > Base
DiagonalCoeffType::Scalar m_coeff
StorageIndex index() const
SparseXprIter m_sparseIter
sparse_diagonal_product_evaluator< Lhs, Transpose< const typename Rhs::DiagonalVectorType >, Lhs::Flags &RowMajorBit?SDP_AsCwiseProduct:SDP_AsScalarProduct > Base
An InnerIterator allows to loop over the element of any matrix expression.