]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/qvm/test/mul_mv_test.cpp
update sources to v12.2.4
[ceph.git] / ceph / src / boost / libs / qvm / test / mul_mv_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_mat_operations.hpp>
7 #include <boost/qvm/mat_operations.hpp>
8 #include <boost/qvm/vec_operations.hpp>
9 #include <boost/qvm/mat.hpp>
10 #include <boost/qvm/vec.hpp>
11 #include "test_qvm_matrix.hpp"
12 #include "test_qvm_vector.hpp"
13 #include "gold.hpp"
14
15 namespace
16 {
17 template <class T,class U>
18 struct same_type;
19
20 template <class T>
21 struct
22 same_type<T,T>
23 {
24 };
25
26 template <class T,class U>
27 void
28 check_same_type( T const &, U const & )
29 {
30 same_type<T,U>();
31 }
32
33 template <int M,int N>
34 void
35 test()
36 {
37 using namespace boost::qvm::sfinae;
38 test_qvm::matrix<M1,M,N> const x(42,1);
39 test_qvm::vector<V1,N> const y(42,1);
40 {
41 test_qvm::vector<V2,M> r=x*y;
42 test_qvm::multiply_mv(r.b,x.b,y.b);
43 BOOST_QVM_TEST_CLOSE(r.a,r.b,0.0000001f);
44 }
45 {
46 test_qvm::vector<V2,M> r=mref(x)*y;
47 test_qvm::multiply_mv(r.b,x.b,y.b);
48 BOOST_QVM_TEST_CLOSE(r.a,r.b,0.0000001f);
49 }
50 {
51 test_qvm::vector<V2,M> r=x*vref(y);
52 test_qvm::multiply_mv(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,M>());
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 }