mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Add postream for ostream-ing packets more reliably.
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
02d9e1138a
commit
b860042263
@@ -1,24 +0,0 @@
|
||||
#ifndef TEST_PACKET_OSTREAM
|
||||
#define TEST_PACKET_OSTREAM
|
||||
|
||||
#include <type_traits>
|
||||
#include <ostream>
|
||||
|
||||
// Include this header to be able to print Packets while debugging.
|
||||
|
||||
template <typename Packet,
|
||||
typename EnableIf = std::enable_if_t<(Eigen::internal::unpacket_traits<Packet>::vectorizable ||
|
||||
Eigen::internal::unpacket_traits<Packet>::size > 1)> >
|
||||
std::ostream& operator<<(std::ostream& os, const Packet& packet) {
|
||||
using Scalar = typename Eigen::internal::unpacket_traits<Packet>::type;
|
||||
Scalar v[Eigen::internal::unpacket_traits<Packet>::size];
|
||||
Eigen::internal::pstoreu(v, packet);
|
||||
os << "{" << v[0];
|
||||
for (int i = 1; i < Eigen::internal::unpacket_traits<Packet>::size; ++i) {
|
||||
os << "," << v[i];
|
||||
}
|
||||
os << "}";
|
||||
return os;
|
||||
}
|
||||
|
||||
#endif // TEST_PACKET_OSTREAM
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#include "packetmath_test_shared.h"
|
||||
#include "random_without_cast_overflow.h"
|
||||
#include "packet_ostream.h"
|
||||
|
||||
template <typename T>
|
||||
inline T REF_ADD(const T& a, const T& b) {
|
||||
@@ -630,6 +629,7 @@ void packetmath() {
|
||||
negate_test<Scalar, Packet>(data1, data2, ref, PacketSize);
|
||||
CHECK_CWISE1_IF(PacketTraits::HasReciprocal, REF_RECIPROCAL, internal::preciprocal);
|
||||
CHECK_CWISE1(numext::conj, internal::pconj);
|
||||
|
||||
CHECK_CWISE1_IF(PacketTraits::HasSign, numext::sign, internal::psign);
|
||||
|
||||
for (int offset = 0; offset < 3; ++offset) {
|
||||
|
||||
Reference in New Issue
Block a user