aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/Product.h
diff options
context:
space:
mode:
authorGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2012-06-29 13:07:21 +0100
committerGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2012-06-29 13:07:21 +0100
commit069fd0e4be8620ed33b069267a60c4d1d17fddd9 (patch)
tree5fd9d7ec08b60e98541593041ee32ed29a1d6c0c /Eigen/src/Core/Product.h
parent9629ba361a5d7b806053372c46f18c49ee971a10 (diff)
Move (part of) evaluation of products to evaluator objects.
* Copy implementation from CoeffBasedProduct. * Copy implementation from GeneralProduct in InnerProduct case. * For GeneralProduct in other cases, call the evalTo() member function with expression objects in constructor of evaluator.
Diffstat (limited to 'Eigen/src/Core/Product.h')
-rw-r--r--Eigen/src/Core/Product.h21
1 files changed, 6 insertions, 15 deletions
diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h
index f7824aa80..6e66888c7 100644
--- a/Eigen/src/Core/Product.h
+++ b/Eigen/src/Core/Product.h
@@ -42,25 +42,16 @@ template<typename Lhs, typename Rhs, typename StorageKind> class ProductImpl;
*
*/
+// Use ProductReturnType to get correct traits, in particular vectorization flags
namespace internal {
template<typename Lhs, typename Rhs>
struct traits<Product<Lhs, Rhs> >
-{
- typedef MatrixXpr XprKind;
- typedef typename remove_all<Lhs>::type LhsCleaned;
- typedef typename remove_all<Rhs>::type RhsCleaned;
- typedef typename scalar_product_traits<typename traits<LhsCleaned>::Scalar, typename traits<RhsCleaned>::Scalar>::ReturnType Scalar;
- typedef typename promote_storage_type<typename traits<LhsCleaned>::StorageKind,
- typename traits<RhsCleaned>::StorageKind>::ret StorageKind;
- typedef typename promote_index_type<typename traits<LhsCleaned>::Index,
- typename traits<RhsCleaned>::Index>::type Index;
+ : traits<typename ProductReturnType<Lhs, Rhs>::Type>
+{
+ // We want A+B*C to be of type Product<Matrix, Sum> and not Product<Matrix, Matrix>
+ // TODO: This flag should eventually go in a separate evaluator traits class
enum {
- RowsAtCompileTime = LhsCleaned::RowsAtCompileTime,
- ColsAtCompileTime = RhsCleaned::ColsAtCompileTime,
- MaxRowsAtCompileTime = LhsCleaned::MaxRowsAtCompileTime,
- MaxColsAtCompileTime = RhsCleaned::MaxColsAtCompileTime,
- Flags = (MaxRowsAtCompileTime==1 ? RowMajorBit : 0), // TODO should be no storage order
- CoeffReadCost = 0 // TODO CoeffReadCost should not be part of the expression traits
+ Flags = traits<typename ProductReturnType<Lhs, Rhs>::Type>::Flags & ~EvalBeforeNestingBit
};
};
} // end namespace internal