11 #ifndef EIGEN_COEFFBASED_PRODUCT_H    12 #define EIGEN_COEFFBASED_PRODUCT_H    31 template<
int Traversal, 
int UnrollingIndex, 
typename Lhs, 
typename Rhs, 
typename RetScalar>
    34 template<
int StorageOrder, 
int UnrollingIndex, 
typename Lhs, 
typename Rhs, 
typename Packet, 
int LoadMode>
    37 template<
typename LhsNested, 
typename RhsNested, 
int NestingFlags>
    50       LhsCoeffReadCost = _LhsNested::CoeffReadCost,
    51       RhsCoeffReadCost = _RhsNested::CoeffReadCost,
    52       LhsFlags = _LhsNested::Flags,
    53       RhsFlags = _RhsNested::Flags,
    55       RowsAtCompileTime = _LhsNested::RowsAtCompileTime,
    56       ColsAtCompileTime = _RhsNested::ColsAtCompileTime,
    59       MaxRowsAtCompileTime = _LhsNested::MaxRowsAtCompileTime,
    60       MaxColsAtCompileTime = _RhsNested::MaxColsAtCompileTime,
    68                       && (ColsAtCompileTime == 
Dynamic    75                       && (RowsAtCompileTime == 
Dynamic    76                           || ( (RowsAtCompileTime % packet_traits<Scalar>::size) == 0
    81       EvalToRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1
    82                      : (MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0
    83                      : (RhsRowMajor && !CanVectorizeLhs),
    85       Flags = ((
unsigned int)(LhsFlags | RhsFlags) & 
HereditaryBits & ~RowMajorBit)
    86             | (EvalToRowMajor ? RowMajorBit : 0)
    90             | (SameType && (CanVectorizeLhs || CanVectorizeRhs) ? 
PacketAccessBit : 0),
   101       CanVectorizeInner =    SameType
   106                           && (InnerSize % packet_traits<Scalar>::size == 0)
   112 template<
typename LhsNested, 
typename RhsNested, 
int NestingFlags>
   115     public MatrixBase<CoeffBasedProduct<LhsNested, RhsNested, NestingFlags> >
   136                                    Unroll ? InnerSize-1 : 
Dynamic,
   144       : Base(), m_lhs(other.m_lhs), m_rhs(other.m_rhs)
   147     template<
typename Lhs, 
typename Rhs>
   149       : m_lhs(lhs), m_rhs(rhs)
   154         YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
   156         && 
"invalid matrix product"   157         && 
"if you wanted a coeff-wise or a dot product use the respective explicit functions");
   166       ScalarCoeffImpl::run(row, col, m_lhs, m_rhs, res);
   176       const Index 
row = RowsAtCompileTime == 1 ? 0 : index;
   177       const Index 
col = RowsAtCompileTime == 1 ? index : 0;
   178       ScalarCoeffImpl::run(row, col, m_lhs, m_rhs, res);
   182     template<
int LoadMode>
   187                               Unroll ? InnerSize-1 : 
Dynamic,
   189         ::run(row, col, m_lhs, m_rhs, res);
   196       m_result.lazyAssign(*
this);
   200     const _LhsNested& 
lhs()
 const { 
return m_lhs; }
   201     const _RhsNested& 
rhs()
 const { 
return m_rhs; }
   204     { 
return reinterpret_cast<const LazyCoeffBasedProductType&
>(*this); }
   206     template<
int DiagonalIndex>
   208     { 
return reinterpret_cast<const LazyCoeffBasedProductType&
>(*this); }
   211     { 
return reinterpret_cast<const LazyCoeffBasedProductType&
>(*this).diagonal(index); }
   224 template<
typename Lhs, 
typename Rhs, 
int N, 
typename PlainObject>
   227   typedef PlainObject 
const& 
type;
   238 template<
int UnrollingIndex, 
typename Lhs, 
typename Rhs, 
typename RetScalar>
   245     res += lhs.coeff(row, UnrollingIndex) * rhs.coeff(UnrollingIndex, col);
   249 template<
typename Lhs, 
typename Rhs, 
typename RetScalar>
   255     res = lhs.coeff(row, 0) * rhs.coeff(0, col);
   259 template<
typename Lhs, 
typename Rhs, 
typename RetScalar>
   265     eigen_assert(lhs.cols()>0 && 
"you are using a non initialized matrix");
   266     res = lhs.coeff(row, 0) * rhs.coeff(0, col);
   267       for(Index i = 1; i < lhs.cols(); ++i)
   268         res += lhs.coeff(row, i) * rhs.coeff(i, col);
   276 template<
int UnrollingIndex, 
typename Lhs, 
typename Rhs, 
typename Packet>
   284     pres = 
padd(pres, 
pmul( lhs.template packet<Aligned>(row, UnrollingIndex) , rhs.template packet<Aligned>(UnrollingIndex, col) ));
   288 template<
typename Lhs, 
typename Rhs, 
typename Packet>
   294     pres = 
pmul(lhs.template packet<Aligned>(row, 0) , rhs.template packet<Aligned>(0, col));
   298 template<
int UnrollingIndex, 
typename Lhs, 
typename Rhs, 
typename RetScalar>
   301   typedef typename Lhs::PacketScalar 
Packet;
   313 template<
typename Lhs, 
typename Rhs, 
int LhsRows = Lhs::RowsAtCompileTime, 
int RhsCols = Rhs::ColsAtCompileTime>
   319     res = lhs.row(row).transpose().cwiseProduct(rhs.col(col)).sum();
   325 template<
typename Lhs, 
typename Rhs, 
int RhsCols>
   331     res = lhs.transpose().cwiseProduct(rhs.col(col)).sum();
   335 template<
typename Lhs, 
typename Rhs, 
int LhsRows>
   341     res = lhs.row(row).transpose().cwiseProduct(rhs).sum();
   345 template<
typename Lhs, 
typename Rhs>
   351     res = lhs.transpose().cwiseProduct(rhs).sum();
   355 template<
typename Lhs, 
typename Rhs, 
typename RetScalar>
   369 template<
int UnrollingIndex, 
typename Lhs, 
typename Rhs, 
typename Packet, 
int LoadMode>
   376     res =  
pmadd(pset1<Packet>(lhs.coeff(row, UnrollingIndex)), rhs.template packet<LoadMode>(UnrollingIndex, col), res);
   380 template<
int UnrollingIndex, 
typename Lhs, 
typename Rhs, 
typename Packet, 
int LoadMode>
   387     res =  
pmadd(lhs.template packet<LoadMode>(row, UnrollingIndex), pset1<Packet>(rhs.coeff(UnrollingIndex, col)), res);
   391 template<
typename Lhs, 
typename Rhs, 
typename Packet, 
int LoadMode>
   397     res = 
pmul(pset1<Packet>(lhs.coeff(row, 0)),rhs.template packet<LoadMode>(0, col));
   401 template<
typename Lhs, 
typename Rhs, 
typename Packet, 
int LoadMode>
   407     res = 
pmul(lhs.template packet<LoadMode>(row, 0), pset1<Packet>(rhs.coeff(0, col)));
   411 template<
typename Lhs, 
typename Rhs, 
typename Packet, 
int LoadMode>
   417     eigen_assert(lhs.cols()>0 && 
"you are using a non initialized matrix");
   418     res = 
pmul(pset1<Packet>(lhs.coeff(row, 0)),rhs.template packet<LoadMode>(0, col));
   419       for(Index i = 1; i < lhs.cols(); ++i)
   420         res =  
pmadd(pset1<Packet>(lhs.coeff(row, i)), rhs.template packet<LoadMode>(i, col), res);
   424 template<
typename Lhs, 
typename Rhs, 
typename Packet, 
int LoadMode>
   430     eigen_assert(lhs.cols()>0 && 
"you are using a non initialized matrix");
   431     res = 
pmul(lhs.template packet<LoadMode>(row, 0), pset1<Packet>(rhs.coeff(0, col)));
   432       for(Index i = 1; i < lhs.cols(); ++i)
   433         res =  
pmadd(lhs.template packet<LoadMode>(row, i), pset1<Packet>(rhs.coeff(i, col)), res);
   441 #endif // EIGEN_COEFFBASED_PRODUCT_H 
CoeffBasedProduct(const CoeffBasedProduct &other)
promote_storage_type< typename traits< _LhsNested >::StorageKind, typename traits< _RhsNested >::StorageKind >::ret StorageKind
EIGEN_STRONG_INLINE Index cols() const 
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs &lhs, const Rhs &rhs, typename Lhs::Scalar &res)
EIGEN_STRONG_INLINE Index rows() const 
const unsigned int ActualPacketAccessBit
internal::add_const_on_value_type< RhsNested >::type m_rhs
internal::packet_traits< Scalar >::type PacketScalar
internal::product_coeff_impl< CanVectorizeInner?InnerVectorizedTraversal:DefaultTraversal, Unroll?InnerSize-1:Dynamic, _LhsNested, _RhsNested, Scalar > ScalarCoeffImpl
#define EIGEN_STRONG_INLINE
CoeffBasedProduct(const Lhs &lhs, const Rhs &rhs)
EIGEN_STRONG_INLINE const PacketScalar packet(Index row, Index col) const 
const _LhsNested & lhs() const 
const _RhsNested & rhs() const 
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs &lhs, const Rhs &rhs, typename Lhs::PacketScalar &pres)
static EIGEN_STRONG_INLINE void run(Index row, Index, const Lhs &lhs, const Rhs &rhs, typename Lhs::Scalar &res)
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs &lhs, const Rhs &rhs, Packet &res)
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs &lhs, const Rhs &rhs, RetScalar &res)
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs &lhs, const Rhs &rhs, typename Lhs::PacketScalar &pres)
iterative scaling algorithm to equilibrate rows and column norms in matrices 
MatrixBase< CoeffBasedProduct > Base
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs &lhs, const Rhs &rhs, RetScalar &res)
#define EIGEN_SIZE_MIN_PREFER_FIXED(a, b)
const unsigned int RowMajorBit
internal::add_const_on_value_type< LhsNested >::type m_lhs
const unsigned int PacketAccessBit
scalar_product_traits< typename _LhsNested::Scalar, typename _RhsNested::Scalar >::ReturnType Scalar
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs &lhs, const Rhs &rhs, Packet &res)
EIGEN_STRONG_INLINE const Scalar coeff(Index index) const 
EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const 
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs &lhs, const Rhs &rhs, Packet &res)
const unsigned int AlignedBit
const unsigned int HereditaryBits
promote_index_type< typename traits< _LhsNested >::Index, typename traits< _RhsNested >::Index >::type Index
remove_all< RhsNested >::type _RhsNested
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs &lhs, const Rhs &rhs, typename Lhs::Scalar &res)
static EIGEN_STRONG_INLINE void run(Index, Index col, const Lhs &lhs, const Rhs &rhs, typename Lhs::Scalar &res)
CoeffBasedProduct< LhsNested, RhsNested, NestByRefBit > LazyCoeffBasedProductType
remove_all< LhsNested >::type _LhsNested
unpacket_traits< Packet >::type predux(const Packet &a)
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs &lhs, const Rhs &rhs, Packet &res)
const unsigned int EvalBeforeAssigningBit
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs &lhs, const Rhs &rhs, Packet &res)
void rhs(const real_t *x, real_t *f)
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs &lhs, const Rhs &rhs, RetScalar &res)
static EIGEN_STRONG_INLINE void run(Index, Index, const Lhs &lhs, const Rhs &rhs, typename Lhs::Scalar &res)
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
EIGEN_STRONG_INLINE Packet4f pmadd(const Packet4f &a, const Packet4f &b, const Packet4f &c)
Packet pmul(const Packet &a, const Packet &b)
Expression of a diagonal/subdiagonal/superdiagonal in a matrix. 
const unsigned int EvalBeforeNestingBit
const Diagonal< const LazyCoeffBasedProductType, DiagonalIndex > diagonal() const 
const Diagonal< const LazyCoeffBasedProductType, 0 > diagonal() const 
Base class for all dense matrices, vectors, and expressions. 
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs &lhs, const Rhs &rhs, RetScalar &res)
Base::PlainObject PlainObject
Packet padd(const Packet &a, const Packet &b)
#define EIGEN_UNROLLING_LIMIT
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs &lhs, const Rhs &rhs, Packet &res)
const Diagonal< const LazyCoeffBasedProductType, Dynamic > diagonal(Index index) const