Eigen  3.3.3
TypeCasting.h
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2015 Benoit Steiner <benoit.steiner.goog@gmail.com>
00005 //
00006 // This Source Code Form is subject to the terms of the Mozilla
00007 // Public License v. 2.0. If a copy of the MPL was not distributed
00008 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
00009 
00010 #ifndef EIGEN_TYPE_CASTING_AVX_H
00011 #define EIGEN_TYPE_CASTING_AVX_H
00012 
00013 namespace Eigen {
00014 
00015 namespace internal {
00016 
00017 // For now we use SSE to handle integers, so we can't use AVX instructions to cast
00018 // from int to float
00019 template <>
00020 struct type_casting_traits<float, int> {
00021   enum {
00022     VectorizedCast = 0,
00023     SrcCoeffRatio = 1,
00024     TgtCoeffRatio = 1
00025   };
00026 };
00027 
00028 template <>
00029 struct type_casting_traits<int, float> {
00030   enum {
00031     VectorizedCast = 0,
00032     SrcCoeffRatio = 1,
00033     TgtCoeffRatio = 1
00034   };
00035 };
00036 
00037 
00038 
00039 template<> EIGEN_STRONG_INLINE Packet8i pcast<Packet8f, Packet8i>(const Packet8f& a) {
00040   return _mm256_cvtps_epi32(a);
00041 }
00042 
00043 template<> EIGEN_STRONG_INLINE Packet8f pcast<Packet8i, Packet8f>(const Packet8i& a) {
00044   return _mm256_cvtepi32_ps(a);
00045 }
00046 
00047 } // end namespace internal
00048 
00049 } // end namespace Eigen
00050 
00051 #endif // EIGEN_TYPE_CASTING_AVX_H
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends