// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2013 Hauke Heibel // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include template void dense_storage_copy() { static const int Size = ((Rows==Dynamic || Cols==Dynamic) ? Dynamic : Rows*Cols); typedef DenseStorage DenseStorageType; const int rows = (Rows==Dynamic) ? 4 : Rows; const int cols = (Cols==Dynamic) ? 3 : Cols; const int size = rows*cols; DenseStorageType reference(size, rows, cols); T* raw_reference = reference.data(); for (int i=0; i(i); DenseStorageType copied_reference(reference); const T* raw_copied_reference = copied_reference.data(); for (int i=0; i void dense_storage_assignment() { static const int Size = ((Rows==Dynamic || Cols==Dynamic) ? Dynamic : Rows*Cols); typedef DenseStorage DenseStorageType; const int rows = (Rows==Dynamic) ? 4 : Rows; const int cols = (Cols==Dynamic) ? 3 : Cols; const int size = rows*cols; DenseStorageType reference(size, rows, cols); T* raw_reference = reference.data(); for (int i=0; i(i); DenseStorageType copied_reference; copied_reference = reference; const T* raw_copied_reference = copied_reference.data(); for (int i=0; i void dense_storage_alignment() { #if EIGEN_HAS_ALIGNAS struct alignas(Alignment) Empty1 {}; VERIFY_IS_EQUAL(std::alignment_of::value, Alignment); struct EIGEN_ALIGN_TO_BOUNDARY(Alignment) Empty2 {}; VERIFY_IS_EQUAL(std::alignment_of::value, Alignment); struct Nested1 { EIGEN_ALIGN_TO_BOUNDARY(Alignment) T data[Size]; }; VERIFY_IS_EQUAL(std::alignment_of::value, Alignment); VERIFY_IS_EQUAL( (std::alignment_of >::value), Alignment); const std::size_t default_alignment = internal::compute_default_alignment::value; VERIFY_IS_EQUAL( (std::alignment_of >::value), default_alignment); VERIFY_IS_EQUAL( (std::alignment_of >::value), default_alignment); struct Nested2 { Matrix mat; }; VERIFY_IS_EQUAL(std::alignment_of::value, default_alignment); #endif } EIGEN_DECLARE_TEST(dense_storage) { dense_storage_copy(); dense_storage_copy(); dense_storage_copy(); dense_storage_copy(); dense_storage_copy(); dense_storage_copy(); dense_storage_copy(); dense_storage_copy(); dense_storage_assignment(); dense_storage_assignment(); dense_storage_assignment(); dense_storage_assignment(); dense_storage_assignment(); dense_storage_assignment(); dense_storage_assignment(); dense_storage_assignment(); dense_storage_alignment(); dense_storage_alignment(); dense_storage_alignment(); dense_storage_alignment(); }