Lines 185-235
class CoeffBasedProduct
Link Here
|
185 |
PacketScalar res; |
185 |
PacketScalar res; |
186 |
internal::product_packet_impl<Flags&RowMajorBit ? RowMajor : ColMajor, |
186 |
internal::product_packet_impl<Flags&RowMajorBit ? RowMajor : ColMajor, |
187 |
Unroll ? InnerSize-1 : Dynamic, |
187 |
Unroll ? InnerSize-1 : Dynamic, |
188 |
_LhsNested, _RhsNested, PacketScalar, LoadMode> |
188 |
_LhsNested, _RhsNested, PacketScalar, LoadMode> |
189 |
::run(row, col, m_lhs, m_rhs, res); |
189 |
::run(row, col, m_lhs, m_rhs, res); |
190 |
return res; |
190 |
return res; |
191 |
} |
191 |
} |
192 |
|
192 |
|
193 |
// Implicit conversion to the nested type (trigger the evaluation of the product) |
|
|
194 |
EIGEN_STRONG_INLINE operator const PlainObject& () const |
195 |
{ |
196 |
m_result.lazyAssign(*this); |
197 |
return m_result; |
198 |
} |
199 |
|
200 |
const _LhsNested& lhs() const { return m_lhs; } |
193 |
const _LhsNested& lhs() const { return m_lhs; } |
201 |
const _RhsNested& rhs() const { return m_rhs; } |
194 |
const _RhsNested& rhs() const { return m_rhs; } |
202 |
|
195 |
|
203 |
const Diagonal<const LazyCoeffBasedProductType,0> diagonal() const |
196 |
const Diagonal<const LazyCoeffBasedProductType,0> diagonal() const |
204 |
{ return reinterpret_cast<const LazyCoeffBasedProductType&>(*this); } |
197 |
{ return reinterpret_cast<const LazyCoeffBasedProductType&>(*this); } |
205 |
|
198 |
|
206 |
template<int DiagonalIndex> |
199 |
template<int DiagonalIndex> |
207 |
const Diagonal<const LazyCoeffBasedProductType,DiagonalIndex> diagonal() const |
200 |
const Diagonal<const LazyCoeffBasedProductType,DiagonalIndex> diagonal() const |
208 |
{ return reinterpret_cast<const LazyCoeffBasedProductType&>(*this); } |
201 |
{ return reinterpret_cast<const LazyCoeffBasedProductType&>(*this); } |
209 |
|
202 |
|
210 |
const Diagonal<const LazyCoeffBasedProductType,Dynamic> diagonal(Index index) const |
203 |
const Diagonal<const LazyCoeffBasedProductType,Dynamic> diagonal(Index index) const |
211 |
{ return reinterpret_cast<const LazyCoeffBasedProductType&>(*this).diagonal(index); } |
204 |
{ return reinterpret_cast<const LazyCoeffBasedProductType&>(*this).diagonal(index); } |
212 |
|
205 |
|
213 |
protected: |
206 |
protected: |
214 |
typename internal::add_const_on_value_type<LhsNested>::type m_lhs; |
207 |
typename internal::add_const_on_value_type<LhsNested>::type m_lhs; |
215 |
typename internal::add_const_on_value_type<RhsNested>::type m_rhs; |
208 |
typename internal::add_const_on_value_type<RhsNested>::type m_rhs; |
216 |
|
|
|
217 |
mutable PlainObject m_result; |
218 |
}; |
209 |
}; |
219 |
|
210 |
|
220 |
namespace internal { |
211 |
namespace internal { |
221 |
|
212 |
|
222 |
// here we need to overload the nested rule for products |
213 |
// here we need to overload the nested rule for products |
223 |
// such that the nested type is a const reference to a plain matrix |
214 |
// such that the nested type is a plain matrix storing the result of the product |
224 |
template<typename Lhs, typename Rhs, int N, typename PlainObject> |
215 |
template<typename Lhs, typename Rhs, int N, typename PlainObject> |
225 |
struct nested<CoeffBasedProduct<Lhs,Rhs,EvalBeforeNestingBit|EvalBeforeAssigningBit>, N, PlainObject> |
216 |
struct nested<CoeffBasedProduct<Lhs,Rhs,EvalBeforeNestingBit|EvalBeforeAssigningBit>, N, PlainObject> |
226 |
{ |
217 |
{ |
227 |
typedef PlainObject const& type; |
218 |
typedef PlainObject type; |
228 |
}; |
219 |
}; |
229 |
|
220 |
|
230 |
/*************************************************************************** |
221 |
/*************************************************************************** |
231 |
* Normal product .coeff() implementation (with meta-unrolling) |
222 |
* Normal product .coeff() implementation (with meta-unrolling) |
232 |
***************************************************************************/ |
223 |
***************************************************************************/ |
233 |
|
224 |
|
234 |
/************************************** |
225 |
/************************************** |
235 |
*** Scalar path - no vectorization *** |
226 |
*** Scalar path - no vectorization *** |