mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Add pinsertfirst function and implement pinsertlast for complex on SSE/AVX.
This commit is contained in:
@@ -16,6 +16,12 @@
|
||||
#endif
|
||||
// using namespace Eigen;
|
||||
|
||||
#ifdef EIGEN_VECTORIZE_SSE
|
||||
const bool g_vectorize_sse = true;
|
||||
#else
|
||||
const bool g_vectorize_sse = false;
|
||||
#endif
|
||||
|
||||
namespace Eigen {
|
||||
namespace internal {
|
||||
template<typename T> T negate(const T& x) { return -x; }
|
||||
@@ -290,7 +296,17 @@ template<typename Scalar> void packetmath()
|
||||
}
|
||||
}
|
||||
|
||||
if (PacketTraits::HasBlend) {
|
||||
if (PacketTraits::HasBlend || g_vectorize_sse) {
|
||||
// pinsertfirst
|
||||
for (int i=0; i<PacketSize; ++i)
|
||||
ref[i] = data1[i];
|
||||
Scalar s = internal::random<Scalar>();
|
||||
ref[0] = s;
|
||||
internal::pstore(data2, internal::pinsertfirst(internal::pload<Packet>(data1),s));
|
||||
VERIFY(areApprox(ref, data2, PacketSize) && "internal::pinsertfirst");
|
||||
}
|
||||
|
||||
if (PacketTraits::HasBlend || g_vectorize_sse) {
|
||||
// pinsertlast
|
||||
for (int i=0; i<PacketSize; ++i)
|
||||
ref[i] = data1[i];
|
||||
|
||||
Reference in New Issue
Block a user