10 #ifndef EIGEN_SPARSE_DIAGONAL_PRODUCT_H 11 #define EIGEN_SPARSE_DIAGONAL_PRODUCT_H 29 template<
typename Lhs,
typename Rhs>
34 typedef typename _Lhs::Scalar
Scalar;
40 RowsAtCompileTime = _Lhs::RowsAtCompileTime,
41 ColsAtCompileTime = _Rhs::ColsAtCompileTime,
43 MaxRowsAtCompileTime = _Lhs::MaxRowsAtCompileTime,
44 MaxColsAtCompileTime = _Rhs::MaxColsAtCompileTime,
53 template<
typename Lhs,
typename Rhs,
typename SparseDiagonalProductType,
int RhsMode,
int LhsMode>
58 template<
typename Lhs,
typename Rhs>
85 class ReverseInnerIterator;
88 : m_lhs(lhs), m_rhs(rhs)
90 eigen_assert(lhs.cols() == rhs.rows() &&
"invalid sparse matrix * diagonal matrix product");
106 template<
typename Lhs,
typename Rhs,
typename SparseDiagonalProductType>
115 const SparseDiagonalProductType& expr, Index outer)
116 : Base(expr.rhs()*(expr.lhs().diagonal().coeff(outer)), outer)
120 template<
typename Lhs,
typename Rhs,
typename SparseDiagonalProductType>
124 scalar_product_op<typename Lhs::Scalar>,
125 const typename Rhs::ConstInnerVectorReturnType,
130 const typename Rhs::ConstInnerVectorReturnType,
136 const SparseDiagonalProductType& expr, Index outer)
137 : Base(expr.rhs().innerVector(outer) .cwiseProduct(expr.lhs().diagonal()), 0), m_outer(outer)
140 inline Index
outer()
const {
return m_outer; }
141 inline Index
col()
const {
return m_outer; }
144 template<
typename Lhs,
typename Rhs,
typename SparseDiagonalProductType>
153 const SparseDiagonalProductType& expr, Index outer)
154 : Base(expr.lhs()*expr.rhs().diagonal().coeff(outer), outer)
158 template<
typename Lhs,
typename Rhs,
typename SparseDiagonalProductType>
162 scalar_product_op<typename Rhs::Scalar>,
163 const typename Lhs::ConstInnerVectorReturnType,
164 const Transpose<const typename Rhs::DiagonalVectorType> >
::InnerIterator 168 const typename Lhs::ConstInnerVectorReturnType,
174 const SparseDiagonalProductType& expr, Index outer)
175 : Base(expr.lhs().innerVector(outer) .cwiseProduct(expr.rhs().diagonal().transpose()), 0), m_outer(outer)
178 inline Index
outer()
const {
return m_outer; }
179 inline Index
row()
const {
return m_outer; }
186 template<
typename Derived>
187 template<
typename OtherDerived>
196 #endif // EIGEN_SPARSE_DIAGONAL_PRODUCT_H const Derived & derived() const
const ScalarMultipleReturnType operator*(const Scalar &scalar) const
EIGEN_STRONG_INLINE SparseDiagonalProduct(const Lhs &lhs, const Rhs &rhs)
remove_all< Lhs >::type _Lhs
#define EIGEN_STRONG_INLINE
EIGEN_STRONG_INLINE const _LhsNested & lhs() const
EIGEN_STRONG_INLINE const _RhsNested & rhs() const
remove_all< Rhs >::type _Rhs
Expression of the transpose of a matrix.
EIGEN_STRONG_INLINE Index cols() const
CwiseUnaryOp< scalar_multiple_op< typename Rhs::Scalar >, const Lhs >::InnerIterator Base
sparse_diagonal_product_inner_iterator_selector(const SparseDiagonalProductType &expr, Index outer)
const unsigned int RowMajorBit
sparse_diagonal_product_inner_iterator_selector(const SparseDiagonalProductType &expr, Index outer)
sparse_diagonal_product_inner_iterator_selector(const SparseDiagonalProductType &expr, Index outer)
CwiseBinaryOp< scalar_product_op< typename Rhs::Scalar >, const typename Lhs::ConstInnerVectorReturnType, const Transpose< const typename Rhs::DiagonalVectorType > >::InnerIterator Base
Generic expression where a coefficient-wise binary operator is applied to two expressions.
#define EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
Base class of any sparse matrices or sparse expressions.
internal::sparse_diagonal_product_inner_iterator_selector< _LhsNested, _RhsNested, SparseDiagonalProduct, LhsMode, RhsMode > InnerIterator
sparse_diagonal_product_inner_iterator_selector(const SparseDiagonalProductType &expr, Index outer)
EIGEN_STRONG_INLINE Index rows() const
promote_index_type< typename traits< Lhs >::Index, typename traits< Rhs >::Index >::type Index
CwiseBinaryOp< scalar_product_op< typename Lhs::Scalar >, const typename Rhs::ConstInnerVectorReturnType, const typename Lhs::DiagonalVectorType >::InnerIterator Base
An InnerIterator allows to loop over the element of a sparse (or dense) matrix or expression...
internal::remove_all< RhsNested >::type _RhsNested
Generic expression where a coefficient-wise unary operator is applied to an expression.
internal::remove_all< LhsNested >::type _LhsNested
CwiseUnaryOp< scalar_multiple_op< typename Lhs::Scalar >, const Rhs >::InnerIterator Base