| 16 | #define EIGEN_TESTMAP_MAX_SIZE 256 |
| 17 | |
| 18 | template<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 | |
| 52 | template<typename MatrixType> void map_class_matrix(const MatrixType& m) |
| 53 | { |