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