MCPcopy Create free account
hub / github.com/Derious/cuMPC / map_class_vector

Function map_class_vector

dependence/eigen-3.4.0/test/mapped_matrix.cpp:18–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16#define EIGEN_TESTMAP_MAX_SIZE 256
17
18template<typename VectorType> void map_class_vector(const VectorType& m)
19{
20 typedef typename VectorType::Scalar Scalar;
21
22 Index size = m.size();
23
24 Scalar* array1 = internal::aligned_new<Scalar>(size);
25 Scalar* array2 = internal::aligned_new<Scalar>(size);
26 Scalar* array3 = new Scalar[size+1];
27 Scalar* array3unaligned = (internal::UIntPtr(array3)%EIGEN_MAX_ALIGN_BYTES) == 0 ? array3+1 : array3;
28 Scalar array4[EIGEN_TESTMAP_MAX_SIZE];
29
30 Map<VectorType, AlignedMax>(array1, size) = VectorType::Random(size);
31 Map<VectorType, AlignedMax>(array2, size) = Map<VectorType,AlignedMax>(array1, size);
32 Map<VectorType>(array3unaligned, size) = Map<VectorType>(array1, size);
33 Map<VectorType>(array4, size) = Map<VectorType,AlignedMax>(array1, size);
34 VectorType ma1 = Map<VectorType, AlignedMax>(array1, size);
35 VectorType ma2 = Map<VectorType, AlignedMax>(array2, size);
36 VectorType ma3 = Map<VectorType>(array3unaligned, size);
37 VectorType ma4 = Map<VectorType>(array4, size);
38 VERIFY_IS_EQUAL(ma1, ma2);
39 VERIFY_IS_EQUAL(ma1, ma3);
40 VERIFY_IS_EQUAL(ma1, ma4);
41 #ifdef EIGEN_VECTORIZE
42 if(internal::packet_traits<Scalar>::Vectorizable && size>=AlignedMax)
43 VERIFY_RAISES_ASSERT((Map<VectorType,AlignedMax>(array3unaligned, size)))
44 #endif
45
46 internal::aligned_delete(array1, size);
47 internal::aligned_delete(array2, size);
48 delete[] array3;
49}
50
51template<typename MatrixType> void map_class_matrix(const MatrixType& m)
52{

Callers 1

EIGEN_DECLARE_TESTFunction · 0.70

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected