aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/Product.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2010-02-09 11:05:39 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2010-02-09 11:05:39 +0100
commit5686eca7b1017738a19a32ce0627249e56cfd3eb (patch)
treeeae2f93d90cb58c7625334c3cb754b9c528754fe /Eigen/src/Core/Product.h
parent0398e21198caaf7206851a9081033cddb0797d47 (diff)
* fix multiple temporary copies for coeff based products
* introduce a lazy product version of the coefficient based implementation => flagged is not used anymore => small outer product are now lazy by default (aliasing is really unlikely for outer products)
Diffstat (limited to 'Eigen/src/Core/Product.h')
-rw-r--r--Eigen/src/Core/Product.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h
index 5e531c467..e643b2ea7 100644
--- a/Eigen/src/Core/Product.h
+++ b/Eigen/src/Core/Product.h
@@ -87,12 +87,12 @@ public:
template<int Rows, int Cols> struct ei_product_type_selector<Rows, Cols, 1> { enum { ret = OuterProduct }; };
template<int Depth> struct ei_product_type_selector<1, 1, Depth> { enum { ret = InnerProduct }; };
template<> struct ei_product_type_selector<1, 1, 1> { enum { ret = InnerProduct }; };
-template<> struct ei_product_type_selector<Small,1, Small> { enum { ret = CoeffBasedProduct }; };
-template<> struct ei_product_type_selector<1, Small,Small> { enum { ret = CoeffBasedProduct }; };
-template<> struct ei_product_type_selector<Small,Small,Small> { enum { ret = CoeffBasedProduct }; };
-template<> struct ei_product_type_selector<Small, Small, 1> { enum { ret = CoeffBasedProduct }; };
-template<> struct ei_product_type_selector<Small, Large, 1> { enum { ret = CoeffBasedProduct }; };
-template<> struct ei_product_type_selector<Large, Small, 1> { enum { ret = CoeffBasedProduct }; };
+template<> struct ei_product_type_selector<Small,1, Small> { enum { ret = CoeffBasedProductMode }; };
+template<> struct ei_product_type_selector<1, Small,Small> { enum { ret = CoeffBasedProductMode }; };
+template<> struct ei_product_type_selector<Small,Small,Small> { enum { ret = CoeffBasedProductMode }; };
+template<> struct ei_product_type_selector<Small, Small, 1> { enum { ret = LazyCoeffBasedProductMode }; };
+template<> struct ei_product_type_selector<Small, Large, 1> { enum { ret = LazyCoeffBasedProductMode }; };
+template<> struct ei_product_type_selector<Large, Small, 1> { enum { ret = LazyCoeffBasedProductMode }; };
template<> struct ei_product_type_selector<1, Large,Small> { enum { ret = GemvProduct }; };
template<> struct ei_product_type_selector<1, Large,Large> { enum { ret = GemvProduct }; };
template<> struct ei_product_type_selector<1, Small,Large> { enum { ret = GemvProduct }; };
@@ -134,11 +134,19 @@ struct ProductReturnType
};
template<typename Lhs, typename Rhs>
-struct ProductReturnType<Lhs,Rhs,CoeffBasedProduct>
+struct ProductReturnType<Lhs,Rhs,CoeffBasedProductMode>
{
typedef typename ei_nested<Lhs, Rhs::ColsAtCompileTime, typename ei_plain_matrix_type<Lhs>::type >::type LhsNested;
typedef typename ei_nested<Rhs, Lhs::RowsAtCompileTime, typename ei_plain_matrix_type<Rhs>::type >::type RhsNested;
- typedef GeneralProduct<LhsNested, RhsNested, CoeffBasedProduct> Type;
+ typedef CoeffBasedProduct<LhsNested, RhsNested, EvalBeforeAssigningBit | EvalBeforeNestingBit> Type;
+};
+
+template<typename Lhs, typename Rhs>
+struct ProductReturnType<Lhs,Rhs,LazyCoeffBasedProductMode>
+{
+ typedef typename ei_nested<Lhs, Rhs::ColsAtCompileTime, typename ei_plain_matrix_type<Lhs>::type >::type LhsNested;
+ typedef typename ei_nested<Rhs, Lhs::RowsAtCompileTime, typename ei_plain_matrix_type<Rhs>::type >::type RhsNested;
+ typedef CoeffBasedProduct<LhsNested, RhsNested, 0> Type;
};