diff options
author | Gael Guennebaud <g.gael@free.fr> | 2010-07-11 23:57:23 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2010-07-11 23:57:23 +0200 |
commit | f8678272a4244babe25cc92bbb9298ed922330a4 (patch) | |
tree | 1c8241a1e3bfe345c53d105c8939966fe7ef83bf /Eigen/src/Core/util/BlasUtil.h | |
parent | 8e3c4283f52a14b64ce346dcdd9115871a481ab6 (diff) |
mixing types step 3:
- improve support of colmajor by vector and matrix - matrix
- now all configurations are well handled, but the perf are not always very good
Diffstat (limited to 'Eigen/src/Core/util/BlasUtil.h')
-rw-r--r-- | Eigen/src/Core/util/BlasUtil.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Eigen/src/Core/util/BlasUtil.h b/Eigen/src/Core/util/BlasUtil.h index 459446409..797f6b0c4 100644 --- a/Eigen/src/Core/util/BlasUtil.h +++ b/Eigen/src/Core/util/BlasUtil.h @@ -115,6 +115,13 @@ template<typename RealScalar,bool Conj> struct ei_conj_helper<RealScalar, std::c { return x*ei_conj_if<Conj>()(y); } }; +template<typename From,typename To> struct ei_get_factor { + EIGEN_STRONG_INLINE static To run(const From& x) { return x; } +}; + +template<typename Scalar> struct ei_get_factor<Scalar,typename NumTraits<Scalar>::Real> { + EIGEN_STRONG_INLINE static typename NumTraits<Scalar>::Real run(const Scalar& x) { return ei_real(x); } +}; // Lightweight helper class to access matrix coefficients. // Yes, this is somehow redundant with Map<>, but this version is much much lighter, @@ -151,7 +158,11 @@ template<typename LhsScalar, typename RhsScalar> struct ei_product_blocking_traits { enum { - LhsPacketSize = ei_packet_traits<LhsScalar>::size, + Vectorizable = ei_packet_traits<LhsScalar>::Vectorizable + && ei_packet_traits<RhsScalar>::Vectorizable + && (ei_is_same_type<LhsScalar,RhsScalar>::ret + || (NumTraits<LhsScalar>::IsComplex && !NumTraits<RhsScalar>::IsComplex)), + LhsPacketSize = Vectorizable ? ei_packet_traits<LhsScalar>::size : 1, NumberOfRegisters = EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS, // register block size along the N direction (must be either 2 or 4) @@ -167,6 +178,7 @@ struct ei_product_blocking_traits<std::complex<Real>, std::complex<Real> > { typedef std::complex<Real> Scalar; enum { + Vectorizable = ei_packet_traits<Scalar>::Vectorizable, PacketSize = ei_packet_traits<Scalar>::size, nr = 2, mr = 2 * PacketSize |