10 #ifdef EIGEN_TEST_PART_1 11 #define EIGEN_UNALIGNED_VECTORIZE 1 14 #ifdef EIGEN_TEST_PART_2 15 #define EIGEN_UNALIGNED_VECTORIZE 0 18 #ifdef EIGEN_DEFAULT_TO_ROW_MAJOR 19 #undef EIGEN_DEFAULT_TO_ROW_MAJOR 21 #define EIGEN_DEBUG_ASSIGN 29 #if EIGEN_GNUC_AT_LEAST(6,0) 30 #pragma GCC diagnostic ignored "-Wignored-attributes" 33 using internal::demangle_flags;
34 using internal::demangle_traversal;
35 using internal::demangle_unrolling;
37 template<
typename Dst,
typename Src>
38 bool test_assign(
const Dst&,
const Src&,
int traversal,
int unrolling)
41 typedef internal::copy_using_evaluator_traits<internal::evaluator<Dst>,internal::evaluator<Src>, internal::assign_op<typename Dst::Scalar,typename Src::Scalar> > traits;
42 bool res = traits::Traversal==traversal;
46 res = res &&
int(traits::Unrolling)==unrolling;
49 std::cerr <<
"Src: " << demangle_flags(Src::Flags) << std::endl;
50 std::cerr <<
" " << demangle_flags(internal::evaluator<Src>::Flags) << std::endl;
51 std::cerr <<
"Dst: " << demangle_flags(Dst::Flags) << std::endl;
52 std::cerr <<
" " << demangle_flags(internal::evaluator<Dst>::Flags) << std::endl;
54 std::cerr <<
" Expected Traversal == " << demangle_traversal(traversal)
55 <<
" got " << demangle_traversal(traits::Traversal) <<
"\n";
56 std::cerr <<
" Expected Unrolling == " << demangle_unrolling(unrolling)
57 <<
" got " << demangle_unrolling(traits::Unrolling) <<
"\n";
62 template<
typename Dst,
typename Src>
66 typedef internal::copy_using_evaluator_traits<internal::evaluator<Dst>,internal::evaluator<Src>, internal::assign_op<typename Dst::Scalar,typename Src::Scalar> > traits;
67 bool res = traits::Traversal==traversal && traits::Unrolling==unrolling;
70 std::cerr <<
"Src: " << demangle_flags(Src::Flags) << std::endl;
71 std::cerr <<
" " << demangle_flags(internal::evaluator<Src>::Flags) << std::endl;
72 std::cerr <<
"Dst: " << demangle_flags(Dst::Flags) << std::endl;
73 std::cerr <<
" " << demangle_flags(internal::evaluator<Dst>::Flags) << std::endl;
75 std::cerr <<
" Expected Traversal == " << demangle_traversal(traversal)
76 <<
" got " << demangle_traversal(traits::Traversal) <<
"\n";
77 std::cerr <<
" Expected Unrolling == " << demangle_unrolling(unrolling)
78 <<
" got " << demangle_unrolling(traits::Unrolling) <<
"\n";
83 template<
typename Xpr>
84 bool test_redux(
const Xpr&,
int traversal,
int unrolling)
87 typedef internal::redux_traits<internal::scalar_sum_op<Scalar,Scalar>,internal::redux_evaluator<Xpr> > traits;
89 bool res = traits::Traversal==traversal && traits::Unrolling==unrolling;
92 std::cerr << demangle_flags(Xpr::Flags) << std::endl;
93 std::cerr << demangle_flags(internal::evaluator<Xpr>::Flags) << std::endl;
96 std::cerr <<
" Expected Traversal == " << demangle_traversal(traversal)
97 <<
" got " << demangle_traversal(traits::Traversal) <<
"\n";
98 std::cerr <<
" Expected Unrolling == " << demangle_unrolling(unrolling)
99 <<
" got " << demangle_unrolling(traits::Unrolling) <<
"\n";
104 template<typename Scalar, bool Enable = internal::packet_traits<Scalar>::Vectorizable>
129 (
PacketSize==16 ? 8 : PacketSize==8 ? 4 : PacketSize==4 ? 2 : PacketSize==2 ? 1 : 1),
130 (PacketSize==16 ? 2 : PacketSize==8 ? 2 : PacketSize==4 ? 2 : PacketSize==2 ? 2 : 1)
134 (PacketSize==16 ? 8 : PacketSize==8 ? 4 : PacketSize==4 ? 2 : PacketSize==2 ? 1 : 1),
135 (PacketSize==16 ? 2 : PacketSize==8 ? 2 : PacketSize==4 ? 2 : PacketSize==2 ? 2 : 1),
140 (PacketSize==16 ? 4 : PacketSize==8 ? 4 : PacketSize==4 ? 6 : PacketSize==2 ? ((Matrix11::Flags&
RowMajorBit)?2:3) : 1),
141 (PacketSize==16 ? 12 : PacketSize==8 ? 6 : PacketSize==4 ? 2 : PacketSize==2 ? ((Matrix11::Flags&
RowMajorBit)?3:2) : 3)
144 #if !EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 189 LinearVectorizedTraversal,CompleteUnrolling));
200 VERIFY(
test_assign(Matrix11(),
Matrix<Scalar,21,21>().
template block<PacketSize,PacketSize>(2,3)+
Matrix<Scalar,21,21>().
template block<PacketSize,PacketSize>(3,2),
226 LinearVectorizedTraversal,NoUnrolling));
229 VERIFY(
test_redux(Matrix44().
template block<(Matrix1::Flags&RowMajorBit)?4:PacketSize,(Matrix1::Flags&RowMajorBit)?PacketSize:4>(1,2),
232 VERIFY(
test_redux(Matrix44().
template block<(Matrix1::Flags&RowMajorBit)?2:PacketSize,(Matrix1::Flags&RowMajorBit)?PacketSize:2>(1,2),
260 LinearVectorizedTraversal,NoUnrolling));
288 (
PacketSize==16 ? 8 : PacketSize==8 ? 4 : PacketSize==4 ? 2 : PacketSize==2 ? 1 : 1),
289 (PacketSize==16 ? 2 : PacketSize==8 ? 2 : PacketSize==4 ? 2 : PacketSize==2 ? 2 : 1)
293 (PacketSize==16 ? 8 : PacketSize==8 ? 4 : PacketSize==4 ? 2 : PacketSize==2 ? 1 : 1),
294 (PacketSize==16 ? 2 : PacketSize==8 ? 2 : PacketSize==4 ? 2 : PacketSize==2 ? 2 : 1),
299 (PacketSize==16 ? 4 : PacketSize==8 ? 4 : PacketSize==4 ? 6 : PacketSize==2 ? ((Matrix11::Flags&
RowMajorBit)?2:3) : 1),
300 (PacketSize==16 ? 12 : PacketSize==8 ? 6 : PacketSize==4 ? 2 : PacketSize==2 ? ((Matrix11::Flags&
RowMajorBit)?3:2) : 3)
303 #if !EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 340 PacketTraits::HasDiv ? LinearVectorizedTraversal : LinearTraversal,CompleteUnrolling));
346 VERIFY(
test_assign(Matrix11(),
Matrix<Scalar,17,17>().
template block<PacketSize,PacketSize>(2,3)+
Matrix<Scalar,17,17>().
template block<PacketSize,PacketSize>(8,4),
369 VERIFY(
test_redux(Matrix57().
template block<PacketSize==1?2:PacketSize,3>(1,0),
396 #ifdef EIGEN_VECTORIZE 410 if(internal::packet_traits<float>::Vectorizable)
419 if(internal::packet_traits<double>::Vectorizable)
427 #endif // EIGEN_VECTORIZE
internal::packet_traits< Scalar >::type PacketType
internal::packet_traits< Scalar > PacketTraits
m m block(1, 0, 2, 2)<< 4
Eigen::Matrix< double, 1, 1 > Vector1
A matrix or vector expression mapping an existing array of data.
Matrix< Scalar, Dynamic, 1 > VectorX
#define EIGEN_PLAIN_ENUM_MAX(a, b)
const unsigned int RowMajorBit
internal::unpacket_traits< typename internal::packet_traits< Scalar >::type >::half PacketType
static constexpr bool debug
Eigen::Matrix< double, 1, 1 > Matrix1
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Convenience specialization of Stride to specify only an inner stride See class Map for some examples...
internal::unpacket_traits< PacketType >::half HalfPacketType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp< internal::scalar_quotient_op< Scalar >, const Derived, const OtherDerived > cwiseQuotient(const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
bool test_assign(const Dst &, const Src &, int traversal, int unrolling)
#define CALL_SUBTEST(FUNC)
#define EIGEN_PLAIN_ENUM_MIN(a, b)
The matrix class, also used for vectors and row-vectors.
bool test_redux(const Xpr &, int traversal, int unrolling)
Convenience specialization of Stride to specify only an outer stride See class Map for some examples...
EIGEN_DECLARE_TEST(vectorization_logic)
internal::packet_traits< Scalar > PacketTraits
#define EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(TYPE0, TYPE1)