diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index 151639993..a4ece7f0d 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -50,8 +50,8 @@ class GeneralProduct; template struct ei_product_type_selector; enum { - Large = Dynamic, - Small = -Dynamic + Large = Dynamic, + Small = Dynamic/2 }; enum { OuterProduct, InnerProduct, UnrolledProduct, GemvProduct, GemmProduct }; @@ -63,9 +63,9 @@ template struct ei_product_type Cols = Rhs::ColsAtCompileTime, Depth = EIGEN_ENUM_MIN(Lhs::ColsAtCompileTime,Rhs::RowsAtCompileTime), - value = ei_product_type_selector<(Rows>8 ? Large : Rows==1 ? 1 : Small), - (Cols>8 ? Large : Cols==1 ? 1 : Small), - (Depth>8 ? Large : Depth==1 ? 1 : Small)>::ret + value = ei_product_type_selector<(Rows>8 ? Large : (Rows==1 ? 1 : Small)), + (Cols>8 ? Large : (Cols==1 ? 1 : Small)), + (Depth>8 ? Large : (Depth==1 ? 1 : Small))>::ret }; }; @@ -199,6 +199,7 @@ class GeneralProduct /*********************************************************************** * Implementation of Outer Vector Vector Product ***********************************************************************/ +template struct ei_outer_product_selector; template struct ei_traits > @@ -214,12 +215,32 @@ class GeneralProduct GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs) {} - template void addTo(Dest& dst, Scalar alpha) const + template void addTo(Dest& dest, Scalar alpha) const { - // TODO + ei_outer_product_selector::run(*this, dest, alpha); } }; +template<> struct ei_outer_product_selector { + template + static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) { + // FIXME make sure lhs is sequentially stored + const int cols = dest.cols(); + for (int j=0; j struct ei_outer_product_selector { + template + static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) { + // FIXME make sure rhs is sequentially stored + const int rows = dest.rows(); + for (int i=0; i