]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/qvm/test/mul_mv_test.cpp
bump version to 18.2.2-pve1
[ceph.git] / ceph / src / boost / libs / qvm / test / mul_mv_test.cpp
1 // Copyright 2008-2022 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 #ifdef BOOST_QVM_TEST_SINGLE_HEADER
7 # include BOOST_QVM_TEST_SINGLE_HEADER
8 #else
9 # include <boost/qvm/vec_mat_operations.hpp>
10 # include <boost/qvm/mat_operations.hpp>
11 # include <boost/qvm/vec_operations.hpp>
12 # include <boost/qvm/mat.hpp>
13 # include <boost/qvm/vec.hpp>
14 #endif
15
16 #include "test_qvm_matrix.hpp"
17 #include "test_qvm_vector.hpp"
18 #include "gold.hpp"
19
20 namespace
21 {
22 template <class T,class U>
23 struct same_type;
24
25 template <class T>
26 struct
27 same_type<T,T>
28 {
29 };
30
31 template <class T,class U>
32 void
33 check_same_type( T const &, U const & )
34 {
35 same_type<T,U>();
36 }
37
38 template <int M,int N>
39 void
40 test()
41 {
42 using namespace boost::qvm::sfinae;
43 test_qvm::matrix<M1,M,N> const x(42,1);
44 test_qvm::vector<V1,N> const y(42,1);
45 {
46 test_qvm::vector<V2,M> r=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=mref(x)*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 {
56 test_qvm::vector<V2,M> r=x*vref(y);
57 test_qvm::multiply_mv(r.b,x.b,y.b);
58 BOOST_QVM_TEST_CLOSE(r.a,r.b,0.0000001f);
59 }
60 check_same_type(x*y,boost::qvm::vec<float,M>());
61 }
62 }
63
64 int
65 main()
66 {
67 test<1,2>();
68 test<2,1>();
69 test<2,2>();
70 test<1,3>();
71 test<3,1>();
72 test<3,3>();
73 test<1,4>();
74 test<4,1>();
75 test<4,4>();
76 test<1,5>();
77 test<5,1>();
78 test<5,5>();
79 return boost::report_errors();
80 }