mul_mm_test.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
  2. //Distributed under the Boost Software License, Version 1.0. (See accompanying
  3. //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. #include <boost/qvm/mat_operations.hpp>
  5. #include <boost/qvm/mat.hpp>
  6. #include "test_qvm_matrix.hpp"
  7. #include "gold.hpp"
  8. namespace
  9. {
  10. template <int R,int CR,int C>
  11. void
  12. test()
  13. {
  14. using namespace boost::qvm::sfinae;
  15. test_qvm::matrix<M1,R,CR> const x(42,1);
  16. test_qvm::matrix<M2,CR,C> const y(42,1);
  17. {
  18. test_qvm::matrix<M3,R,C> r=x*y;
  19. test_qvm::multiply_m(r.b,x.b,y.b);
  20. BOOST_QVM_TEST_CLOSE(r.a,r.b,0.0000001f);
  21. }
  22. {
  23. test_qvm::matrix<M3,R,C> r=mref(x)*y;
  24. test_qvm::multiply_m(r.b,x.b,y.b);
  25. BOOST_QVM_TEST_CLOSE(r.a,r.b,0.0000001f);
  26. }
  27. {
  28. test_qvm::matrix<M3,R,C> r=x*mref(y);
  29. test_qvm::multiply_m(r.b,x.b,y.b);
  30. BOOST_QVM_TEST_CLOSE(r.a,r.b,0.0000001f);
  31. }
  32. }
  33. }
  34. int
  35. main()
  36. {
  37. test<1,2,2>();
  38. test<2,2,1>();
  39. test<2,2,2>();
  40. test<1,3,3>();
  41. test<3,3,1>();
  42. test<3,3,3>();
  43. test<1,4,4>();
  44. test<4,4,1>();
  45. test<4,4,4>();
  46. test<1,5,5>();
  47. test<5,5,1>();
  48. test<5,5,5>();
  49. test<2,3,4>();
  50. return boost::report_errors();
  51. }