]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/qvm/test/mul_vm_test.cpp
update sources to v12.2.4
[ceph.git] / ceph / src / boost / libs / qvm / test / mul_vm_test.cpp
CommitLineData
3a9019d9
FG
1//Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.\r
2\r
3//Distributed under the Boost Software License, Version 1.0. (See accompanying\r
4//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
5\r
6#include <boost/qvm/vec_operations.hpp>\r
7#include <boost/qvm/mat_operations.hpp>\r
8#include <boost/qvm/vec_mat_operations.hpp>\r
9#include <boost/qvm/vec.hpp>\r
10#include "test_qvm_matrix.hpp"\r
11#include "test_qvm_vector.hpp"\r
12#include "gold.hpp"\r
13\r
14namespace\r
15 {\r
16 template <class T,class U>\r
17 struct same_type;\r
18\r
19 template <class T>\r
20 struct\r
21 same_type<T,T>\r
22 {\r
23 };\r
24\r
25 template <class T,class U>\r
26 void\r
27 check_same_type( T const &, U const & )\r
28 {\r
29 same_type<T,U>();\r
30 }\r
31\r
32 template <int M,int N>\r
33 void\r
34 test()\r
35 {\r
36 using namespace boost::qvm::sfinae;\r
37 using namespace boost::qvm;\r
38 test_qvm::vector<V1,M> const x(42,1);\r
39 test_qvm::matrix<M1,M,N> const y(42,1);\r
40 {\r
41 test_qvm::vector<V2,N> r=x*y;\r
42 test_qvm::multiply_vm(r.b,x.b,y.b);\r
43 BOOST_QVM_TEST_CLOSE(r.a,r.b,0.0000001f);\r
44 }\r
45 {\r
46 test_qvm::vector<V2,N> r=vref(x)*y;\r
47 test_qvm::multiply_vm(r.b,x.b,y.b);\r
48 BOOST_QVM_TEST_CLOSE(r.a,r.b,0.0000001f);\r
49 }\r
50 {\r
51 test_qvm::vector<V2,N> r=x*mref(y);\r
52 test_qvm::multiply_vm(r.b,x.b,y.b);\r
53 BOOST_QVM_TEST_CLOSE(r.a,r.b,0.0000001f);\r
54 }\r
55 check_same_type(x*y,boost::qvm::vec<float,N>());\r
56 }\r
57 }\r
58\r
59int\r
60main()\r
61 {\r
62 test<1,2>();\r
63 test<2,1>();\r
64 test<2,2>();\r
65 test<1,3>();\r
66 test<3,1>();\r
67 test<3,3>();\r
68 test<1,4>();\r
69 test<4,1>();\r
70 test<4,4>();\r
71 test<1,5>();\r
72 test<5,1>();\r
73 test<5,5>();\r
74 return boost::report_errors();\r
75 }\r