10 #ifndef EIGEN_PRODUCT_H
11 #define EIGEN_PRODUCT_H
13 template<
typename Lhs,
typename Rhs>
class Product;
14 template<
typename Lhs,
typename Rhs,
typename StorageKind>
class ProductImpl;
29 template<
typename Lhs,
typename Rhs>
30 struct traits<
Product<Lhs, Rhs> >
32 typedef MatrixXpr XprKind;
33 typedef typename remove_all<Lhs>::type LhsCleaned;
34 typedef typename remove_all<Rhs>::type RhsCleaned;
35 typedef typename scalar_product_traits<typename traits<LhsCleaned>::Scalar,
typename traits<RhsCleaned>::Scalar>::ReturnType Scalar;
36 typedef typename promote_storage_type<typename traits<LhsCleaned>::StorageKind,
37 typename traits<RhsCleaned>::StorageKind>::ret StorageKind;
38 typedef typename promote_index_type<typename traits<LhsCleaned>::Index,
39 typename traits<RhsCleaned>::Index>::type Index;
41 RowsAtCompileTime = LhsCleaned::RowsAtCompileTime,
42 ColsAtCompileTime = RhsCleaned::ColsAtCompileTime,
43 MaxRowsAtCompileTime = LhsCleaned::MaxRowsAtCompileTime,
44 MaxColsAtCompileTime = RhsCleaned::MaxColsAtCompileTime,
45 Flags = (MaxRowsAtCompileTime==1 ?
RowMajorBit : 0),
52 template<
typename Lhs,
typename Rhs>
53 class Product :
public ProductImpl<Lhs,Rhs,typename internal::promote_storage_type<typename internal::traits<Lhs>::StorageKind,
54 typename internal::traits<Rhs>::StorageKind>::ret>
58 typedef typename ProductImpl<
60 typename internal::promote_storage_type<
typename Lhs::StorageKind,
61 typename Rhs::StorageKind>::ret>::Base Base;
62 EIGEN_GENERIC_PUBLIC_INTERFACE(
Product)
64 typedef typename Lhs::Nested LhsNested;
65 typedef typename Rhs::Nested RhsNested;
66 typedef typename internal::remove_all<LhsNested>::type LhsNestedCleaned;
67 typedef typename internal::remove_all<RhsNested>::type RhsNestedCleaned;
69 Product(
const Lhs& lhs,
const Rhs& rhs) : m_lhs(lhs), m_rhs(rhs)
71 eigen_assert(lhs.cols() == rhs.rows()
72 &&
"invalid matrix product"
73 &&
"if you wanted a coeff-wise or a dot product use the respective explicit functions");
76 inline Index rows()
const {
return m_lhs.rows(); }
77 inline Index cols()
const {
return m_rhs.cols(); }
79 const LhsNestedCleaned& lhs()
const {
return m_lhs; }
80 const RhsNestedCleaned& rhs()
const {
return m_rhs; }
84 const LhsNested m_lhs;
85 const RhsNested m_rhs;
88 template<
typename Lhs,
typename Rhs>
89 class ProductImpl<Lhs,Rhs,Dense> :
public internal::dense_xpr_base<Product<Lhs,Rhs> >::type
94 typedef typename internal::dense_xpr_base<Product<Lhs, Rhs> >::type Base;
95 EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
98 #endif // EIGEN_PRODUCT_H