MCPcopy Create free account
hub / github.com/PX4/eigen / map_class_vector

Function map_class_vector

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

Callers 1

test_mapped_matrixFunction · 0.70

Calls 1

sizeMethod · 0.45

Tested by 1

test_mapped_matrixFunction · 0.56