00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef EIGEN_GENERIC_PACKET_MATH_H
00027 #define EIGEN_GENERIC_PACKET_MATH_H
00028
00038 template<typename Packet> inline Packet
00039 ei_padd(const Packet& a,
00040 const Packet& b) { return a+b; }
00041
00043 template<typename Packet> inline Packet
00044 ei_psub(const Packet& a,
00045 const Packet& b) { return a-b; }
00046
00048 template<typename Packet> inline Packet
00049 ei_pmul(const Packet& a,
00050 const Packet& b) { return a*b; }
00051
00053 template<typename Packet> inline Packet
00054 ei_pdiv(const Packet& a,
00055 const Packet& b) { return a/b; }
00056
00058 template<typename Packet> inline Packet
00059 ei_pmin(const Packet& a,
00060 const Packet& b) { return std::min(a, b); }
00061
00063 template<typename Packet> inline Packet
00064 ei_pmax(const Packet& a,
00065 const Packet& b) { return std::max(a, b); }
00066
00068 template<typename Scalar> inline typename ei_packet_traits<Scalar>::type
00069 ei_pload(const Scalar* from) { return *from; }
00070
00072 template<typename Scalar> inline typename ei_packet_traits<Scalar>::type
00073 ei_ploadu(const Scalar* from) { return *from; }
00074
00076 template<typename Scalar> inline typename ei_packet_traits<Scalar>::type
00077 ei_pset1(const Scalar& a) { return a; }
00078
00080 template<typename Scalar, typename Packet> inline void ei_pstore(Scalar* to, const Packet& from)
00081 { (*to) = from; }
00082
00084 template<typename Scalar, typename Packet> inline void ei_pstoreu(Scalar* to, const Packet& from)
00085 { (*to) = from; }
00086
00088 template<typename Packet> inline typename ei_unpacket_traits<Packet>::type ei_pfirst(const Packet& a)
00089 { return a; }
00090
00092 template<typename Packet> inline Packet
00093 ei_preduxp(const Packet* vecs) { return vecs[0]; }
00094
00096 template<typename Packet> inline typename ei_unpacket_traits<Packet>::type ei_predux(const Packet& a)
00097 { return a; }
00098
00099
00100
00101
00102
00103
00105 template<typename Packet> inline Packet
00106 ei_pmadd(const Packet& a,
00107 const Packet& b,
00108 const Packet& c)
00109 { return ei_padd(ei_pmul(a, b),c); }
00110
00113 template<typename Scalar, int LoadMode>
00114 inline typename ei_packet_traits<Scalar>::type ei_ploadt(const Scalar* from)
00115 {
00116 if(LoadMode == Aligned)
00117 return ei_pload(from);
00118 else
00119 return ei_ploadu(from);
00120 }
00121
00124 template<typename Scalar, typename Packet, int LoadMode>
00125 inline void ei_pstoret(Scalar* to, const Packet& from)
00126 {
00127 if(LoadMode == Aligned)
00128 ei_pstore(to, from);
00129 else
00130 ei_pstoreu(to, from);
00131 }
00132
00134 template<int Offset,typename PacketType>
00135 struct ei_palign_impl
00136 {
00137
00138 inline static void run(PacketType&, const PacketType&) {}
00139 };
00140
00143 template<int Offset,typename PacketType>
00144 inline void ei_palign(PacketType& first, const PacketType& second)
00145 {
00146 ei_palign_impl<Offset,PacketType>::run(first,second);
00147 }
00148
00149 #endif // EIGEN_GENERIC_PACKET_MATH_H
00150