You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.2 KiB

  1. // This file is part of Eigen, a lightweight C++ template library
  2. // for linear algebra. Eigen itself is part of the KDE project.
  3. //
  4. // Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
  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. void test_eigen2_commainitializer()
  11. {
  12. Matrix3d m3;
  13. Matrix4d m4;
  14. VERIFY_RAISES_ASSERT( (m3 << 1, 2, 3, 4, 5, 6, 7, 8) );
  15. #ifndef _MSC_VER
  16. VERIFY_RAISES_ASSERT( (m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) );
  17. #endif
  18. double data[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
  19. Matrix3d ref = Map<Matrix<double,3,3,RowMajor> >(data);
  20. m3 = Matrix3d::Random();
  21. m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9;
  22. VERIFY_IS_APPROX(m3, ref );
  23. Vector3d vec[3];
  24. vec[0] << 1, 4, 7;
  25. vec[1] << 2, 5, 8;
  26. vec[2] << 3, 6, 9;
  27. m3 = Matrix3d::Random();
  28. m3 << vec[0], vec[1], vec[2];
  29. VERIFY_IS_APPROX(m3, ref);
  30. vec[0] << 1, 2, 3;
  31. vec[1] << 4, 5, 6;
  32. vec[2] << 7, 8, 9;
  33. m3 = Matrix3d::Random();
  34. m3 << vec[0].transpose(),
  35. 4, 5, 6,
  36. vec[2].transpose();
  37. VERIFY_IS_APPROX(m3, ref);
  38. }