]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/qvm/test/deduce_scalar_mv_test.cpp
1 // Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc.
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)
6 #ifdef BOOST_QVM_TEST_SINGLE_HEADER
7 # include BOOST_QVM_TEST_SINGLE_HEADER
9 # include <boost/qvm/deduce_scalar.hpp>
10 # include <boost/qvm/mat.hpp>
11 # include <boost/qvm/mat_operations.hpp>
12 # include <boost/qvm/vec.hpp>
13 # include <boost/qvm/vec_mat_operations3.hpp>
16 #include <boost/core/lightweight_test.hpp>
24 explicit wrap(T t
):t(t
) { }
27 template <class S
, class T
>
29 operator*(S s
, wrap
<T
> w
)
31 return wrap
<T
>(s
* w
.t
);
35 wrap
<T
> operator+(wrap
<T
> a
, wrap
<T
> b
)
37 return wrap
<T
>(a
.t
+ b
.t
);
50 static bool const value
=true;
52 template <class S
, class T
>
54 deduce_scalar
<S
, wrap
<T
> >
56 typedef wrap
<typename deduce_scalar
<S
, T
>::type
> type
;
64 using namespace boost::qvm
;
65 mat
<double, 3, 3> m
= rotz_mat
<3>(3.14159);
66 vec
<wrap
<double>, 3> v
;
67 v
.a
[0] = wrap
<double>(1.0);
68 v
.a
[1] = wrap
<double>(0);
69 v
.a
[2] = wrap
<double>(0);
70 vec
<wrap
<double>, 3> r
= m
* v
;
71 BOOST_TEST_LT(fabs(r
.a
[0].t
+1), 0.0001);
72 BOOST_TEST_LT(fabs(r
.a
[1].t
), 0.0001);
73 BOOST_TEST_LT(fabs(r
.a
[2].t
), 0.0001);
74 return boost::report_errors();