cxx11_tensor_empty.cpp 999 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // This file is part of Eigen, a lightweight C++ template library
  2. // for linear algebra.
  3. //
  4. // Copyright (C) 2015 Benoit Steiner <benoit.steiner.goog@gmail.com>
  5. //
  6. // This Source Code Form is subject to the terms of the Mozilla
  7. // Public License v. 2.0. If a copy of the MPL was not distributed
  8. // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
  9. #include "main.h"
  10. #include <Eigen/CXX11/Tensor>
  11. static void test_empty_tensor()
  12. {
  13. Tensor<float, 2> source;
  14. Tensor<float, 2> tgt1 = source;
  15. Tensor<float, 2> tgt2(source);
  16. Tensor<float, 2> tgt3;
  17. tgt3 = tgt1;
  18. tgt3 = tgt2;
  19. }
  20. static void test_empty_fixed_size_tensor()
  21. {
  22. TensorFixedSize<float, Sizes<0> > source;
  23. TensorFixedSize<float, Sizes<0> > tgt1 = source;
  24. TensorFixedSize<float, Sizes<0> > tgt2(source);
  25. TensorFixedSize<float, Sizes<0> > tgt3;
  26. tgt3 = tgt1;
  27. tgt3 = tgt2;
  28. }
  29. EIGEN_DECLARE_TEST(cxx11_tensor_empty)
  30. {
  31. CALL_SUBTEST(test_empty_tensor());
  32. CALL_SUBTEST(test_empty_fixed_size_tensor());
  33. }