From 31a36aa9c407d736075de8dc06f5af0d0fe912d5 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 7 Jul 2010 19:49:09 +0200 Subject: [PATCH] support for real * complex matrix product - step 1 (works for some special cases) --- Eigen/src/Core/arch/SSE/Complex.h | 18 + .../Core/products/GeneralBlockPanelKernel.h | 408 +++++++++--------- Eigen/src/Core/products/GeneralMatrixMatrix.h | 98 +++-- .../Core/products/SelfadjointMatrixMatrix.h | 8 +- Eigen/src/Core/products/SelfadjointProduct.h | 6 +- .../Core/products/TriangularMatrixMatrix.h | 8 +- .../Core/products/TriangularSolverMatrix.h | 8 +- Eigen/src/Core/util/BlasUtil.h | 41 +- 8 files changed, 330 insertions(+), 265 deletions(-) diff --git a/Eigen/src/Core/arch/SSE/Complex.h b/Eigen/src/Core/arch/SSE/Complex.h index 4ecfc2f43..259aebe2c 100644 --- a/Eigen/src/Core/arch/SSE/Complex.h +++ b/Eigen/src/Core/arch/SSE/Complex.h @@ -194,6 +194,15 @@ template<> struct ei_conj_helper } }; +template<> struct ei_conj_helper +{ + EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet4f& x, const Packet2cf& y, const Packet2cf& c) const + { return ei_padd(c, pmul(x,y)); } + + EIGEN_STRONG_INLINE Packet2cf pmul(const Packet4f& x, const Packet2cf& y) const + { return Packet2cf(ei_pmul(x, y.v)); } +}; + template<> EIGEN_STRONG_INLINE Packet2cf ei_pdiv(const Packet2cf& a, const Packet2cf& b) { // TODO optimize it for SSE3 and 4 @@ -359,6 +368,15 @@ template<> struct ei_conj_helper } }; +template<> struct ei_conj_helper +{ + EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet2d& x, const Packet1cd& y, const Packet1cd& c) const + { return ei_padd(c, pmul(x,y)); } + + EIGEN_STRONG_INLINE Packet1cd pmul(const Packet2d& x, const Packet1cd& y) const + { return Packet1cd(ei_pmul(x, y.v)); } +}; + template<> EIGEN_STRONG_INLINE Packet1cd ei_pdiv(const Packet1cd& a, const Packet1cd& b) { // TODO optimize it for SSE3 and 4 diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index cf133f68f..3dae26eee 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -114,9 +114,9 @@ void computeProductBlockingSizes(std::ptrdiff_t& k, std::ptrdiff_t& m, std::ptrd std::ptrdiff_t l1, l2; enum { - kdiv = KcFactor * 2 * ei_product_blocking_traits::nr + kdiv = KcFactor * 2 * ei_product_blocking_traits::nr * ei_packet_traits::size * sizeof(RhsScalar), - mr = ei_product_blocking_traits::mr, + mr = ei_product_blocking_traits::mr, mr_mask = (0xffffffff/mr)*mr }; @@ -140,35 +140,50 @@ inline void computeProductBlockingSizes(std::ptrdiff_t& k, std::ptrdiff_t& m, st #endif // optimized GEneral packed Block * packed Panel product kernel -template +template struct ei_gebp_kernel { - void operator()(Scalar* res, Index resStride, const Scalar* blockA, const Scalar* blockB, Index rows, Index depth, Index cols, - Index strideA=-1, Index strideB=-1, Index offsetA=0, Index offsetB=0, Scalar* unpackedB = 0) + typedef typename ei_scalar_product_traits::ReturnType ResScalar; + + enum { + Vectorizable = ei_packet_traits::Vectorizable && ei_packet_traits::Vectorizable, + LhsPacketSize = Vectorizable ? ei_packet_traits::size : 1, + RhsPacketSize = Vectorizable ? ei_packet_traits::size : 1, + ResPacketSize = Vectorizable ? ei_packet_traits::size : 1 + }; + + typedef typename ei_packet_traits::type _LhsPacketType; + typedef typename ei_packet_traits::type _RhsPacketType; + typedef typename ei_packet_traits::type _ResPacketType; + + typedef typename ei_meta_if::ret LhsPacketType; + typedef typename ei_meta_if::ret RhsPacketType; + typedef typename ei_meta_if::ret ResPacketType; + + void operator()(ResScalar* res, Index resStride, const LhsScalar* blockA, const RhsScalar* blockB, Index rows, Index depth, Index cols, + Index strideA=-1, Index strideB=-1, Index offsetA=0, Index offsetB=0, RhsScalar* unpackedB = 0) { - typedef typename ei_packet_traits::type PacketType; - enum { PacketSize = ei_packet_traits::size }; if(strideA==-1) strideA = depth; if(strideB==-1) strideB = depth; - ei_conj_helper cj; - ei_conj_helper pcj; + ei_conj_helper cj; + ei_conj_helper pcj; Index packet_cols = (cols/nr) * nr; const Index peeled_mc = (rows/mr)*mr; - const Index peeled_mc2 = peeled_mc + (rows-peeled_mc >= PacketSize ? PacketSize : 0); + const Index peeled_mc2 = peeled_mc + (rows-peeled_mc >= LhsPacketSize ? LhsPacketSize : 0); const Index peeled_kc = (depth/4)*4; if(unpackedB==0) - unpackedB = const_cast(blockB - strideB * nr * PacketSize); + unpackedB = const_cast(blockB - strideB * nr * RhsPacketSize); // loops on each micro vertical panel of rhs (depth x nr) for(Index j2=0; j2=PacketSize) + if(rows-peeled_mc>=LhsPacketSize) { Index i = peeled_mc; - const Scalar* blA = &blockA[i*strideA+offsetA*PacketSize]; + const LhsScalar* blA = &blockA[i*strideA+offsetA*LhsPacketSize]; ei_prefetch(&blA[0]); // gets res block as register - PacketType C0, C1, C2, C3; + ResPacketType C0, C1, C2, C3; C0 = ei_ploadu(&res[(j2+0)*resStride + i]); C1 = ei_ploadu(&res[(j2+1)*resStride + i]); if(nr==4) C2 = ei_ploadu(&res[(j2+2)*resStride + i]); if(nr==4) C3 = ei_ploadu(&res[(j2+3)*resStride + i]); // performs "inner" product - const Scalar* blB = unpackedB; + const RhsScalar* blB = unpackedB; for(Index k=0; k=PacketSize) + if(rows-peeled_mc>=LhsPacketSize) { Index i = peeled_mc; - const Scalar* blA = &blockA[i*strideA+offsetA*PacketSize]; + const LhsScalar* blA = &blockA[i*strideA+offsetA*LhsPacketSize]; ei_prefetch(&blA[0]); - PacketType C0 = ei_ploadu(&res[(j2+0)*resStride + i]); + ResPacketType C0 = ei_ploadu(&res[(j2+0)*resStride + i]); - const Scalar* blB = unpackedB; + const RhsScalar* blB = unpackedB; for(Index k=0; k class ei_level3_blocking; /* Specialization for a row-major destination matrix => simple transposition of the product */ template< - typename Scalar, typename Index, - int LhsStorageOrder, bool ConjugateLhs, - int RhsStorageOrder, bool ConjugateRhs> -struct ei_general_matrix_matrix_product + typename Index, + typename LhsScalar, int LhsStorageOrder, bool ConjugateLhs, + typename RhsScalar, int RhsStorageOrder, bool ConjugateRhs> +struct ei_general_matrix_matrix_product { + typedef typename ei_scalar_product_traits::ReturnType ResScalar; static EIGEN_STRONG_INLINE void run( Index rows, Index cols, Index depth, - const Scalar* lhs, Index lhsStride, - const Scalar* rhs, Index rhsStride, - Scalar* res, Index resStride, - Scalar alpha, - ei_level3_blocking& blocking, + const LhsScalar* lhs, Index lhsStride, + const RhsScalar* rhs, Index rhsStride, + ResScalar* res, Index resStride, + ResScalar alpha, + ei_level3_blocking& blocking, GemmParallelInfo* info = 0) { // transpose the product such that the result is column major - ei_general_matrix_matrix_product ::run(cols,rows,depth,rhs,rhsStride,lhs,lhsStride,res,resStride,alpha,blocking,info); } @@ -57,24 +56,24 @@ struct ei_general_matrix_matrix_product Blocking algorithm following Goto's paper */ template< - typename Scalar, typename Index, - int LhsStorageOrder, bool ConjugateLhs, - int RhsStorageOrder, bool ConjugateRhs> -struct ei_general_matrix_matrix_product + typename Index, + typename LhsScalar, int LhsStorageOrder, bool ConjugateLhs, + typename RhsScalar, int RhsStorageOrder, bool ConjugateRhs> +struct ei_general_matrix_matrix_product { +typedef typename ei_scalar_product_traits::ReturnType ResScalar; static void run(Index rows, Index cols, Index depth, - const Scalar* _lhs, Index lhsStride, - const Scalar* _rhs, Index rhsStride, - Scalar* res, Index resStride, - Scalar alpha, - ei_level3_blocking& blocking, + const LhsScalar* _lhs, Index lhsStride, + const RhsScalar* _rhs, Index rhsStride, + ResScalar* res, Index resStride, + ResScalar alpha, + ei_level3_blocking& blocking, GemmParallelInfo* info = 0) { - ei_const_blas_data_mapper lhs(_lhs,lhsStride); - ei_const_blas_data_mapper rhs(_rhs,rhsStride); + ei_const_blas_data_mapper lhs(_lhs,lhsStride); + ei_const_blas_data_mapper rhs(_rhs,rhsStride); - typedef typename ei_packet_traits::type PacketType; - typedef ei_product_blocking_traits Blocking; + typedef ei_product_blocking_traits Blocking; Index kc = blocking.kc(); // cache block size along the K direction Index mc = std::min(rows,blocking.mc()); // cache block size along the M direction @@ -83,9 +82,9 @@ static void run(Index rows, Index cols, Index depth, // FIXME starting from SSE3, normal complex product cannot be optimized as well as // conjugate product, therefore it is better to conjugate during the copies. // With SSE2, this is the other way round. - ei_gemm_pack_lhs pack_lhs; - ei_gemm_pack_rhs pack_rhs; - ei_gebp_kernel gebp; + ei_gemm_pack_lhs pack_lhs; + ei_gemm_pack_rhs pack_rhs; + ei_gebp_kernel gebp; // if (ConjugateRhs) // alpha = ei_conj(alpha); @@ -173,10 +172,10 @@ static void run(Index rows, Index cols, Index depth, // this is the sequential version! std::size_t sizeA = kc*mc; std::size_t sizeB = kc*cols; - std::size_t sizeW = kc*Blocking::PacketSize*Blocking::nr; - Scalar *blockA = blocking.blockA()==0 ? ei_aligned_stack_new(Scalar, sizeA) : blocking.blockA(); - Scalar *blockB = blocking.blockB()==0 ? ei_aligned_stack_new(Scalar, sizeB) : blocking.blockB(); - Scalar *blockW = blocking.blockW()==0 ? ei_aligned_stack_new(Scalar, sizeW) : blocking.blockW(); + std::size_t sizeW = kc*ei_packet_traits::size*Blocking::nr; + LhsScalar *blockA = blocking.blockA()==0 ? ei_aligned_stack_new(LhsScalar, sizeA) : blocking.blockA(); + RhsScalar *blockB = blocking.blockB()==0 ? ei_aligned_stack_new(RhsScalar, sizeB) : blocking.blockB(); + RhsScalar *blockW = blocking.blockW()==0 ? ei_aligned_stack_new(RhsScalar, sizeW) : blocking.blockW(); // For each horizontal panel of the rhs, and corresponding panel of the lhs... // (==GEMM_VAR1) @@ -208,9 +207,9 @@ static void run(Index rows, Index cols, Index depth, } } - if(blocking.blockA()==0) ei_aligned_stack_delete(Scalar, blockA, kc*mc); - if(blocking.blockB()==0) ei_aligned_stack_delete(Scalar, blockB, sizeB); - if(blocking.blockW()==0) ei_aligned_stack_delete(Scalar, blockW, sizeW); + if(blocking.blockA()==0) ei_aligned_stack_delete(LhsScalar, blockA, kc*mc); + if(blocking.blockB()==0) ei_aligned_stack_delete(RhsScalar, blockB, sizeB); + if(blocking.blockW()==0) ei_aligned_stack_delete(RhsScalar, blockW, sizeW); } } @@ -245,8 +244,8 @@ struct ei_gemm_functor cols = m_rhs.cols(); Gemm::run(rows, cols, m_lhs.cols(), - (const Scalar*)&(m_lhs.const_cast_derived().coeffRef(row,0)), m_lhs.outerStride(), - (const Scalar*)&(m_rhs.const_cast_derived().coeffRef(0,col)), m_rhs.outerStride(), + /*(const Scalar*)*/&(m_lhs.const_cast_derived().coeffRef(row,0)), m_lhs.outerStride(), + /*(const Scalar*)*/&(m_rhs.const_cast_derived().coeffRef(0,col)), m_rhs.outerStride(), (Scalar*)&(m_dest.coeffRef(row,col)), m_dest.outerStride(), m_actualAlpha, m_blocking, info); } @@ -305,7 +304,7 @@ class ei_gemm_blocking_space::ret LhsScalar; typedef typename ei_meta_if::ret RhsScalar; - typedef ei_product_blocking_traits Blocking; + typedef ei_product_blocking_traits Blocking; enum { SizeA = ActualRows * MaxDepth, SizeB = ActualCols * MaxDepth, @@ -345,7 +344,7 @@ class ei_gemm_blocking_space::ret LhsScalar; typedef typename ei_meta_if::ret RhsScalar; - typedef ei_product_blocking_traits Blocking; + typedef ei_product_blocking_traits Blocking; DenseIndex m_sizeA; DenseIndex m_sizeB; @@ -410,10 +409,15 @@ class GeneralProduct GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs) { - EIGEN_STATIC_ASSERT((ei_is_same_type::ret), - YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) + // TODO add a weak static assert +// EIGEN_STATIC_ASSERT((ei_is_same_type::ret), +// YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) } + typedef typename Lhs::Scalar LhsScalar; + typedef typename Rhs::Scalar RhsScalar; + typedef Scalar ResScalar; + template void scaleAndAddTo(Dest& dst, Scalar alpha) const { ei_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols()); @@ -424,15 +428,15 @@ class GeneralProduct Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs) * RhsBlasTraits::extractScalarFactor(m_rhs); - typedef ei_gemm_blocking_space<(Dest::Flags&RowMajorBit) ? RowMajor : ColMajor,Scalar,Scalar, + typedef ei_gemm_blocking_space<(Dest::Flags&RowMajorBit) ? RowMajor : ColMajor,LhsScalar,RhsScalar, Dest::MaxRowsAtCompileTime,Dest::MaxColsAtCompileTime,MaxDepthAtCompileTime> BlockingType; typedef ei_gemm_functor< Scalar, Index, ei_general_matrix_matrix_product< - Scalar, Index, - (_ActualLhsType::Flags&RowMajorBit) ? RowMajor : ColMajor, bool(LhsBlasTraits::NeedToConjugate), - (_ActualRhsType::Flags&RowMajorBit) ? RowMajor : ColMajor, bool(RhsBlasTraits::NeedToConjugate), + Index, + LhsScalar, (_ActualLhsType::Flags&RowMajorBit) ? RowMajor : ColMajor, bool(LhsBlasTraits::NeedToConjugate), + RhsScalar, (_ActualRhsType::Flags&RowMajorBit) ? RowMajor : ColMajor, bool(RhsBlasTraits::NeedToConjugate), (Dest::Flags&RowMajorBit) ? RowMajor : ColMajor>, _ActualLhsType, _ActualRhsType, Dest, BlockingType> GemmFunctor; diff --git a/Eigen/src/Core/products/SelfadjointMatrixMatrix.h b/Eigen/src/Core/products/SelfadjointMatrixMatrix.h index d8fa1bd9c..3bedafb68 100644 --- a/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +++ b/Eigen/src/Core/products/SelfadjointMatrixMatrix.h @@ -256,7 +256,7 @@ struct ei_product_selfadjoint_matrix Blocking; + typedef ei_product_blocking_traits Blocking; Index kc = size; // cache block size along the K direction Index mc = rows; // cache block size along the M direction @@ -270,7 +270,7 @@ struct ei_product_selfadjoint_matrix gebp_kernel; + ei_gebp_kernel gebp_kernel; ei_symm_pack_lhs pack_lhs; ei_gemm_pack_rhs pack_rhs; ei_gemm_pack_lhs pack_lhs_transposed; @@ -341,7 +341,7 @@ struct ei_product_selfadjoint_matrix Blocking; + typedef ei_product_blocking_traits Blocking; Index kc = size; // cache block size along the K direction Index mc = rows; // cache block size along the M direction @@ -353,7 +353,7 @@ struct ei_product_selfadjoint_matrix gebp_kernel; + ei_gebp_kernel gebp_kernel; ei_gemm_pack_lhs pack_lhs; ei_symm_pack_rhs pack_rhs; diff --git a/Eigen/src/Core/products/SelfadjointProduct.h b/Eigen/src/Core/products/SelfadjointProduct.h index 40c0c9aac..c45a3bac7 100644 --- a/Eigen/src/Core/products/SelfadjointProduct.h +++ b/Eigen/src/Core/products/SelfadjointProduct.h @@ -68,7 +68,7 @@ struct ei_selfadjoint_product Blocking; + typedef ei_product_blocking_traits Blocking; Index kc = depth; // cache block size along the K direction Index mc = size; // cache block size along the M direction @@ -89,7 +89,7 @@ struct ei_selfadjoint_product::IsComplex && AAT }; - ei_gebp_kernel gebp_kernel; + ei_gebp_kernel gebp_kernel; ei_gemm_pack_rhs pack_rhs; ei_gemm_pack_lhs pack_lhs; ei_sybb_kernel sybb; @@ -175,7 +175,7 @@ struct ei_sybb_kernel }; void operator()(Scalar* res, Index resStride, const Scalar* blockA, const Scalar* blockB, Index size, Index depth, Scalar* workspace) { - ei_gebp_kernel gebp_kernel; + ei_gebp_kernel gebp_kernel; Matrix buffer; // let's process the block per panel of actual_mc x BlockSize, diff --git a/Eigen/src/Core/products/TriangularMatrixMatrix.h b/Eigen/src/Core/products/TriangularMatrixMatrix.h index be9362958..ce9a76654 100644 --- a/Eigen/src/Core/products/TriangularMatrixMatrix.h +++ b/Eigen/src/Core/products/TriangularMatrixMatrix.h @@ -108,7 +108,7 @@ struct ei_product_triangular_matrix_matrix Blocking; + typedef ei_product_blocking_traits Blocking; enum { SmallPanelWidth = EIGEN_PLAIN_ENUM_MAX(Blocking::mr,Blocking::nr), IsLower = (Mode&Lower) == Lower @@ -129,7 +129,7 @@ struct ei_product_triangular_matrix_matrix gebp_kernel; + ei_gebp_kernel gebp_kernel; ei_gemm_pack_lhs pack_lhs; ei_gemm_pack_rhs pack_rhs; @@ -234,7 +234,7 @@ struct ei_product_triangular_matrix_matrix Blocking; + typedef ei_product_blocking_traits Blocking; enum { SmallPanelWidth = EIGEN_PLAIN_ENUM_MAX(Blocking::mr,Blocking::nr), IsLower = (Mode&Lower) == Lower @@ -254,7 +254,7 @@ struct ei_product_triangular_matrix_matrix gebp_kernel; + ei_gebp_kernel gebp_kernel; ei_gemm_pack_lhs pack_lhs; ei_gemm_pack_rhs pack_rhs; ei_gemm_pack_rhs pack_rhs_panel; diff --git a/Eigen/src/Core/products/TriangularSolverMatrix.h b/Eigen/src/Core/products/TriangularSolverMatrix.h index 0fce7159e..d6ae2131d 100644 --- a/Eigen/src/Core/products/TriangularSolverMatrix.h +++ b/Eigen/src/Core/products/TriangularSolverMatrix.h @@ -57,7 +57,7 @@ struct ei_triangular_solve_matrix tri(_tri,triStride); ei_blas_data_mapper other(_other,otherStride); - typedef ei_product_blocking_traits Blocking; + typedef ei_product_blocking_traits Blocking; enum { SmallPanelWidth = EIGEN_PLAIN_ENUM_MAX(Blocking::mr,Blocking::nr), IsLower = (Mode&Lower) == Lower @@ -74,7 +74,7 @@ struct ei_triangular_solve_matrix conj; - ei_gebp_kernel gebp_kernel; + ei_gebp_kernel gebp_kernel; ei_gemm_pack_lhs pack_lhs; ei_gemm_pack_rhs pack_rhs; @@ -191,7 +191,7 @@ struct ei_triangular_solve_matrix rhs(_tri,triStride); ei_blas_data_mapper lhs(_other,otherStride); - typedef ei_product_blocking_traits Blocking; + typedef ei_product_blocking_traits Blocking; enum { RhsStorageOrder = TriStorageOrder, SmallPanelWidth = EIGEN_PLAIN_ENUM_MAX(Blocking::mr,Blocking::nr), @@ -212,7 +212,7 @@ struct ei_triangular_solve_matrix conj; - ei_gebp_kernel gebp_kernel; + ei_gebp_kernel gebp_kernel; ei_gemm_pack_rhs pack_rhs; ei_gemm_pack_rhs pack_rhs_panel; ei_gemm_pack_lhs pack_lhs_panel; diff --git a/Eigen/src/Core/util/BlasUtil.h b/Eigen/src/Core/util/BlasUtil.h index 38c86511c..1b7d03722 100644 --- a/Eigen/src/Core/util/BlasUtil.h +++ b/Eigen/src/Core/util/BlasUtil.h @@ -29,7 +29,7 @@ // implement and control fast level 2 and level 3 BLAS-like routines. // forward declarations -template +template struct ei_gebp_kernel; template @@ -39,9 +39,9 @@ template struct ei_general_matrix_matrix_product; @@ -89,6 +89,25 @@ template struct ei_conj_helper, st { return Scalar(ei_real(x)*ei_real(y) - ei_imag(x)*ei_imag(y), - ei_real(x)*ei_imag(y) - ei_imag(x)*ei_real(y)); } }; +template struct ei_conj_helper, RealScalar, false,false> +{ + typedef std::complex Scalar; + EIGEN_STRONG_INLINE Scalar pmadd(const Scalar& x, const RealScalar& y, const Scalar& c) const { return ei_padd(c, ei_pmul(x,y)); } + + EIGEN_STRONG_INLINE Scalar pmul(const Scalar& x, const RealScalar& y) const + { return ei_pmul(x,y); } +}; + +template struct ei_conj_helper, false,false> +{ + typedef std::complex Scalar; + EIGEN_STRONG_INLINE Scalar pmadd(const RealScalar& x, const Scalar& y, const Scalar& c) const { return ei_padd(c, pmul(x,y)); } + + EIGEN_STRONG_INLINE Scalar pmul(const RealScalar& x, const Scalar& y) const + { return x * y; } +}; + + // Lightweight helper class to access matrix coefficients. // Yes, this is somehow redundant with Map<>, but this version is much much lighter, // and so I hope better compilation performance (time and code quality). @@ -118,29 +137,29 @@ class ei_const_blas_data_mapper }; // Defines various constant controlling register blocking for matrix-matrix algorithms. -template +template struct ei_product_blocking_traits; + +template struct ei_product_blocking_traits { - typedef typename ei_packet_traits::type PacketType; enum { - PacketSize = sizeof(PacketType)/sizeof(Scalar), + LhsPacketSize = ei_packet_traits::size, NumberOfRegisters = EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS, // register block size along the N direction (must be either 2 or 4) nr = NumberOfRegisters/4, // register block size along the M direction (currently, this one cannot be modified) - mr = 2 * PacketSize + mr = 2 * LhsPacketSize }; }; template -struct ei_product_blocking_traits > +struct ei_product_blocking_traits, std::complex > { typedef std::complex Scalar; - typedef typename ei_packet_traits::type PacketType; enum { - PacketSize = sizeof(PacketType)/sizeof(Scalar), + PacketSize = ei_packet_traits::size, nr = 2, mr = 2 * PacketSize };