1 #ifndef BOOST_QVM_GEN_VEC_MAT_OPERATIONS2_HPP_INCLUDED
2 #define BOOST_QVM_GEN_VEC_MAT_OPERATIONS2_HPP_INCLUDED
3 
4 /// Copyright (c) 2008-2021 Emil Dotchevski and Reverge Studios, Inc.
5 
6 /// Distributed under the Boost Software License, Version 1.0. (See accompanying
7 /// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 
9 /// This file was generated by a program. Do not edit manually.
10 
11 #include <boost/qvm/deduce_vec.hpp>
12 #include <boost/qvm/enable_if.hpp>
13 #include <boost/qvm/inline.hpp>
14 #include <boost/qvm/mat_traits.hpp>
15 #include <boost/qvm/vec_traits.hpp>
16 
17 namespace boost { namespace qvm {
18 
19 template <class A,class B>
20 BOOST_QVM_INLINE_OPERATIONS
21 typename lazy_enable_if_c<
22     mat_traits<A>::rows==2 && mat_traits<A>::cols==2 &&
23     vec_traits<B>::dim==2,
24     deduce_vec2<A,B,2> >::type
operator *(A const & a,B const & b)25 operator*( A const & a, B const & b )
26     {
27     typedef typename mat_traits<A>::scalar_type Ta;
28     typedef typename vec_traits<B>::scalar_type Tb;
29     Ta const a00 = mat_traits<A>::template read_element<0,0>(a);
30     Ta const a01 = mat_traits<A>::template read_element<0,1>(a);
31     Ta const a10 = mat_traits<A>::template read_element<1,0>(a);
32     Ta const a11 = mat_traits<A>::template read_element<1,1>(a);
33     Tb const b0 = vec_traits<B>::template read_element<0>(b);
34     Tb const b1 = vec_traits<B>::template read_element<1>(b);
35     typedef typename deduce_vec2<A,B,2>::type R;
36     BOOST_QVM_STATIC_ASSERT(vec_traits<R>::dim==2);
37     R r;
38     vec_traits<R>::template write_element<0>(r)=a00*b0+a01*b1;
39     vec_traits<R>::template write_element<1>(r)=a10*b0+a11*b1;
40     return r;
41     }
42 
43 namespace
44 sfinae
45     {
46     using ::boost::qvm::operator*;
47     }
48 
49 namespace
50 qvm_detail
51     {
52     template <int R,int C>
53     struct mul_mv_defined;
54 
55     template <>
56     struct
57     mul_mv_defined<2,2>
58         {
59         static bool const value=true;
60         };
61     }
62 
63 template <class A,class B>
64 BOOST_QVM_INLINE_OPERATIONS
65 typename lazy_enable_if_c<
66     mat_traits<B>::rows==2 && mat_traits<B>::cols==2 &&
67     vec_traits<A>::dim==2,
68     deduce_vec2<A,B,2> >::type
operator *(A const & a,B const & b)69 operator*( A const & a, B const & b )
70     {
71     typedef typename vec_traits<A>::scalar_type Ta;
72     typedef typename mat_traits<B>::scalar_type Tb;
73     Ta const a0 = vec_traits<A>::template read_element<0>(a);
74     Ta const a1 = vec_traits<A>::template read_element<1>(a);
75     Tb const b00 = mat_traits<B>::template read_element<0,0>(b);
76     Tb const b01 = mat_traits<B>::template read_element<0,1>(b);
77     Tb const b10 = mat_traits<B>::template read_element<1,0>(b);
78     Tb const b11 = mat_traits<B>::template read_element<1,1>(b);
79     typedef typename deduce_vec2<A,B,2>::type R;
80     BOOST_QVM_STATIC_ASSERT(vec_traits<R>::dim==2);
81     R r;
82     vec_traits<R>::template write_element<0>(r)=a0*b00+a1*b10;
83     vec_traits<R>::template write_element<1>(r)=a0*b01+a1*b11;
84     return r;
85     }
86 
87 namespace
88 sfinae
89     {
90     using ::boost::qvm::operator*;
91     }
92 
93 namespace
94 qvm_detail
95     {
96     template <int R,int C>
97     struct mul_vm_defined;
98 
99     template <>
100     struct
101     mul_vm_defined<2,2>
102         {
103         static bool const value=true;
104         };
105     }
106 
107 } }
108 
109 #endif
110