]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | #ifndef BOOST_QVM_GEN_MAT_OPERATIONS4_HPP_INCLUDED |
2 | #define BOOST_QVM_GEN_MAT_OPERATIONS4_HPP_INCLUDED | |
92f5a8d4 | 3 | |
1e59de90 | 4 | // Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. |
92f5a8d4 | 5 | |
1e59de90 TL |
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) | |
92f5a8d4 | 8 | |
1e59de90 | 9 | // This file was generated by a program. Do not edit manually. |
92f5a8d4 TL |
10 | |
11 | #include <boost/qvm/assert.hpp> | |
12 | #include <boost/qvm/deduce_mat.hpp> | |
13 | #include <boost/qvm/deduce_vec.hpp> | |
14 | #include <boost/qvm/error.hpp> | |
15 | #include <boost/qvm/gen/mat_assign4.hpp> | |
16 | #include <boost/qvm/quat_traits.hpp> | |
17 | #include <boost/qvm/scalar_traits.hpp> | |
18 | #include <boost/qvm/throw_exception.hpp> | |
19 | ||
1e59de90 TL |
20 | namespace boost { namespace qvm { |
21 | ||
22 | template <class A,class B> | |
23 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
24 | typename lazy_enable_if_c< | |
25 | mat_traits<A>::rows==4 && mat_traits<B>::rows==4 && | |
26 | mat_traits<A>::cols==4 && mat_traits<B>::cols==4, | |
27 | deduce_mat2<A,B,4,4> >::type | |
28 | operator+( A const & a, B const & b ) | |
29 | { | |
30 | typedef typename deduce_mat2<A,B,4,4>::type R; | |
31 | BOOST_QVM_STATIC_ASSERT(mat_traits<R>::rows==4); | |
32 | BOOST_QVM_STATIC_ASSERT(mat_traits<R>::cols==4); | |
33 | R r; | |
34 | mat_traits<R>::template write_element<0,0>(r)=mat_traits<A>::template read_element<0,0>(a)+mat_traits<B>::template read_element<0,0>(b); | |
35 | mat_traits<R>::template write_element<0,1>(r)=mat_traits<A>::template read_element<0,1>(a)+mat_traits<B>::template read_element<0,1>(b); | |
36 | mat_traits<R>::template write_element<0,2>(r)=mat_traits<A>::template read_element<0,2>(a)+mat_traits<B>::template read_element<0,2>(b); | |
37 | mat_traits<R>::template write_element<0,3>(r)=mat_traits<A>::template read_element<0,3>(a)+mat_traits<B>::template read_element<0,3>(b); | |
38 | mat_traits<R>::template write_element<1,0>(r)=mat_traits<A>::template read_element<1,0>(a)+mat_traits<B>::template read_element<1,0>(b); | |
39 | mat_traits<R>::template write_element<1,1>(r)=mat_traits<A>::template read_element<1,1>(a)+mat_traits<B>::template read_element<1,1>(b); | |
40 | mat_traits<R>::template write_element<1,2>(r)=mat_traits<A>::template read_element<1,2>(a)+mat_traits<B>::template read_element<1,2>(b); | |
41 | mat_traits<R>::template write_element<1,3>(r)=mat_traits<A>::template read_element<1,3>(a)+mat_traits<B>::template read_element<1,3>(b); | |
42 | mat_traits<R>::template write_element<2,0>(r)=mat_traits<A>::template read_element<2,0>(a)+mat_traits<B>::template read_element<2,0>(b); | |
43 | mat_traits<R>::template write_element<2,1>(r)=mat_traits<A>::template read_element<2,1>(a)+mat_traits<B>::template read_element<2,1>(b); | |
44 | mat_traits<R>::template write_element<2,2>(r)=mat_traits<A>::template read_element<2,2>(a)+mat_traits<B>::template read_element<2,2>(b); | |
45 | mat_traits<R>::template write_element<2,3>(r)=mat_traits<A>::template read_element<2,3>(a)+mat_traits<B>::template read_element<2,3>(b); | |
46 | mat_traits<R>::template write_element<3,0>(r)=mat_traits<A>::template read_element<3,0>(a)+mat_traits<B>::template read_element<3,0>(b); | |
47 | mat_traits<R>::template write_element<3,1>(r)=mat_traits<A>::template read_element<3,1>(a)+mat_traits<B>::template read_element<3,1>(b); | |
48 | mat_traits<R>::template write_element<3,2>(r)=mat_traits<A>::template read_element<3,2>(a)+mat_traits<B>::template read_element<3,2>(b); | |
49 | mat_traits<R>::template write_element<3,3>(r)=mat_traits<A>::template read_element<3,3>(a)+mat_traits<B>::template read_element<3,3>(b); | |
50 | return r; | |
51 | } | |
52 | ||
53 | namespace | |
54 | sfinae | |
55 | { | |
56 | using ::boost::qvm::operator+; | |
57 | } | |
58 | ||
59 | namespace | |
60 | qvm_detail | |
61 | { | |
62 | template <int R,int C> | |
63 | struct plus_mm_defined; | |
64 | ||
65 | template <> | |
66 | struct | |
67 | plus_mm_defined<4,4> | |
68 | { | |
69 | static bool const value=true; | |
70 | }; | |
71 | } | |
72 | ||
73 | template <class A,class B> | |
74 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
75 | typename lazy_enable_if_c< | |
76 | mat_traits<A>::rows==4 && mat_traits<B>::rows==4 && | |
77 | mat_traits<A>::cols==1 && mat_traits<B>::cols==1, | |
78 | deduce_mat2<A,B,4,1> >::type | |
79 | operator+( A const & a, B const & b ) | |
80 | { | |
81 | typedef typename deduce_mat2<A,B,4,1>::type R; | |
82 | BOOST_QVM_STATIC_ASSERT(mat_traits<R>::rows==4); | |
83 | BOOST_QVM_STATIC_ASSERT(mat_traits<R>::cols==1); | |
84 | R r; | |
85 | mat_traits<R>::template write_element<0,0>(r)=mat_traits<A>::template read_element<0,0>(a)+mat_traits<B>::template read_element<0,0>(b); | |
86 | mat_traits<R>::template write_element<1,0>(r)=mat_traits<A>::template read_element<1,0>(a)+mat_traits<B>::template read_element<1,0>(b); | |
87 | mat_traits<R>::template write_element<2,0>(r)=mat_traits<A>::template read_element<2,0>(a)+mat_traits<B>::template read_element<2,0>(b); | |
88 | mat_traits<R>::template write_element<3,0>(r)=mat_traits<A>::template read_element<3,0>(a)+mat_traits<B>::template read_element<3,0>(b); | |
89 | return r; | |
90 | } | |
91 | ||
92 | namespace | |
93 | sfinae | |
94 | { | |
95 | using ::boost::qvm::operator+; | |
96 | } | |
97 | ||
98 | namespace | |
99 | qvm_detail | |
100 | { | |
101 | template <int R,int C> | |
102 | struct plus_mm_defined; | |
103 | ||
104 | template <> | |
105 | struct | |
106 | plus_mm_defined<4,1> | |
107 | { | |
108 | static bool const value=true; | |
109 | }; | |
110 | } | |
111 | ||
112 | template <class A,class B> | |
113 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
114 | typename lazy_enable_if_c< | |
115 | mat_traits<A>::rows==1 && mat_traits<B>::rows==1 && | |
116 | mat_traits<A>::cols==4 && mat_traits<B>::cols==4, | |
117 | deduce_mat2<A,B,1,4> >::type | |
118 | operator+( A const & a, B const & b ) | |
119 | { | |
120 | typedef typename deduce_mat2<A,B,1,4>::type R; | |
121 | BOOST_QVM_STATIC_ASSERT(mat_traits<R>::rows==1); | |
122 | BOOST_QVM_STATIC_ASSERT(mat_traits<R>::cols==4); | |
123 | R r; | |
124 | mat_traits<R>::template write_element<0,0>(r)=mat_traits<A>::template read_element<0,0>(a)+mat_traits<B>::template read_element<0,0>(b); | |
125 | mat_traits<R>::template write_element<0,1>(r)=mat_traits<A>::template read_element<0,1>(a)+mat_traits<B>::template read_element<0,1>(b); | |
126 | mat_traits<R>::template write_element<0,2>(r)=mat_traits<A>::template read_element<0,2>(a)+mat_traits<B>::template read_element<0,2>(b); | |
127 | mat_traits<R>::template write_element<0,3>(r)=mat_traits<A>::template read_element<0,3>(a)+mat_traits<B>::template read_element<0,3>(b); | |
128 | return r; | |
129 | } | |
130 | ||
131 | namespace | |
132 | sfinae | |
133 | { | |
134 | using ::boost::qvm::operator+; | |
135 | } | |
136 | ||
137 | namespace | |
138 | qvm_detail | |
139 | { | |
140 | template <int R,int C> | |
141 | struct plus_mm_defined; | |
142 | ||
143 | template <> | |
144 | struct | |
145 | plus_mm_defined<1,4> | |
146 | { | |
147 | static bool const value=true; | |
148 | }; | |
149 | } | |
150 | ||
151 | template <class A,class B> | |
152 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
153 | typename lazy_enable_if_c< | |
154 | mat_traits<A>::rows==4 && mat_traits<B>::rows==4 && | |
155 | mat_traits<A>::cols==4 && mat_traits<B>::cols==4, | |
156 | deduce_mat2<A,B,4,4> >::type | |
157 | operator-( A const & a, B const & b ) | |
158 | { | |
159 | typedef typename deduce_mat2<A,B,4,4>::type R; | |
160 | BOOST_QVM_STATIC_ASSERT(mat_traits<R>::rows==4); | |
161 | BOOST_QVM_STATIC_ASSERT(mat_traits<R>::cols==4); | |
162 | R r; | |
163 | mat_traits<R>::template write_element<0,0>(r)=mat_traits<A>::template read_element<0,0>(a)-mat_traits<B>::template read_element<0,0>(b); | |
164 | mat_traits<R>::template write_element<0,1>(r)=mat_traits<A>::template read_element<0,1>(a)-mat_traits<B>::template read_element<0,1>(b); | |
165 | mat_traits<R>::template write_element<0,2>(r)=mat_traits<A>::template read_element<0,2>(a)-mat_traits<B>::template read_element<0,2>(b); | |
166 | mat_traits<R>::template write_element<0,3>(r)=mat_traits<A>::template read_element<0,3>(a)-mat_traits<B>::template read_element<0,3>(b); | |
167 | mat_traits<R>::template write_element<1,0>(r)=mat_traits<A>::template read_element<1,0>(a)-mat_traits<B>::template read_element<1,0>(b); | |
168 | mat_traits<R>::template write_element<1,1>(r)=mat_traits<A>::template read_element<1,1>(a)-mat_traits<B>::template read_element<1,1>(b); | |
169 | mat_traits<R>::template write_element<1,2>(r)=mat_traits<A>::template read_element<1,2>(a)-mat_traits<B>::template read_element<1,2>(b); | |
170 | mat_traits<R>::template write_element<1,3>(r)=mat_traits<A>::template read_element<1,3>(a)-mat_traits<B>::template read_element<1,3>(b); | |
171 | mat_traits<R>::template write_element<2,0>(r)=mat_traits<A>::template read_element<2,0>(a)-mat_traits<B>::template read_element<2,0>(b); | |
172 | mat_traits<R>::template write_element<2,1>(r)=mat_traits<A>::template read_element<2,1>(a)-mat_traits<B>::template read_element<2,1>(b); | |
173 | mat_traits<R>::template write_element<2,2>(r)=mat_traits<A>::template read_element<2,2>(a)-mat_traits<B>::template read_element<2,2>(b); | |
174 | mat_traits<R>::template write_element<2,3>(r)=mat_traits<A>::template read_element<2,3>(a)-mat_traits<B>::template read_element<2,3>(b); | |
175 | mat_traits<R>::template write_element<3,0>(r)=mat_traits<A>::template read_element<3,0>(a)-mat_traits<B>::template read_element<3,0>(b); | |
176 | mat_traits<R>::template write_element<3,1>(r)=mat_traits<A>::template read_element<3,1>(a)-mat_traits<B>::template read_element<3,1>(b); | |
177 | mat_traits<R>::template write_element<3,2>(r)=mat_traits<A>::template read_element<3,2>(a)-mat_traits<B>::template read_element<3,2>(b); | |
178 | mat_traits<R>::template write_element<3,3>(r)=mat_traits<A>::template read_element<3,3>(a)-mat_traits<B>::template read_element<3,3>(b); | |
179 | return r; | |
180 | } | |
181 | ||
182 | namespace | |
183 | sfinae | |
184 | { | |
185 | using ::boost::qvm::operator-; | |
186 | } | |
187 | ||
188 | namespace | |
189 | qvm_detail | |
190 | { | |
191 | template <int R,int C> | |
192 | struct minus_mm_defined; | |
193 | ||
194 | template <> | |
195 | struct | |
196 | minus_mm_defined<4,4> | |
197 | { | |
198 | static bool const value=true; | |
199 | }; | |
200 | } | |
201 | ||
202 | template <class A,class B> | |
203 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
204 | typename lazy_enable_if_c< | |
205 | mat_traits<A>::rows==4 && mat_traits<B>::rows==4 && | |
206 | mat_traits<A>::cols==1 && mat_traits<B>::cols==1, | |
207 | deduce_mat2<A,B,4,1> >::type | |
208 | operator-( A const & a, B const & b ) | |
209 | { | |
210 | typedef typename deduce_mat2<A,B,4,1>::type R; | |
211 | BOOST_QVM_STATIC_ASSERT(mat_traits<R>::rows==4); | |
212 | BOOST_QVM_STATIC_ASSERT(mat_traits<R>::cols==1); | |
213 | R r; | |
214 | mat_traits<R>::template write_element<0,0>(r)=mat_traits<A>::template read_element<0,0>(a)-mat_traits<B>::template read_element<0,0>(b); | |
215 | mat_traits<R>::template write_element<1,0>(r)=mat_traits<A>::template read_element<1,0>(a)-mat_traits<B>::template read_element<1,0>(b); | |
216 | mat_traits<R>::template write_element<2,0>(r)=mat_traits<A>::template read_element<2,0>(a)-mat_traits<B>::template read_element<2,0>(b); | |
217 | mat_traits<R>::template write_element<3,0>(r)=mat_traits<A>::template read_element<3,0>(a)-mat_traits<B>::template read_element<3,0>(b); | |
218 | return r; | |
219 | } | |
220 | ||
221 | namespace | |
222 | sfinae | |
223 | { | |
224 | using ::boost::qvm::operator-; | |
225 | } | |
226 | ||
227 | namespace | |
228 | qvm_detail | |
229 | { | |
230 | template <int R,int C> | |
231 | struct minus_mm_defined; | |
232 | ||
233 | template <> | |
234 | struct | |
235 | minus_mm_defined<4,1> | |
236 | { | |
237 | static bool const value=true; | |
238 | }; | |
239 | } | |
240 | ||
241 | template <class A,class B> | |
242 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
243 | typename lazy_enable_if_c< | |
244 | mat_traits<A>::rows==1 && mat_traits<B>::rows==1 && | |
245 | mat_traits<A>::cols==4 && mat_traits<B>::cols==4, | |
246 | deduce_mat2<A,B,1,4> >::type | |
247 | operator-( A const & a, B const & b ) | |
248 | { | |
249 | typedef typename deduce_mat2<A,B,1,4>::type R; | |
250 | BOOST_QVM_STATIC_ASSERT(mat_traits<R>::rows==1); | |
251 | BOOST_QVM_STATIC_ASSERT(mat_traits<R>::cols==4); | |
252 | R r; | |
253 | mat_traits<R>::template write_element<0,0>(r)=mat_traits<A>::template read_element<0,0>(a)-mat_traits<B>::template read_element<0,0>(b); | |
254 | mat_traits<R>::template write_element<0,1>(r)=mat_traits<A>::template read_element<0,1>(a)-mat_traits<B>::template read_element<0,1>(b); | |
255 | mat_traits<R>::template write_element<0,2>(r)=mat_traits<A>::template read_element<0,2>(a)-mat_traits<B>::template read_element<0,2>(b); | |
256 | mat_traits<R>::template write_element<0,3>(r)=mat_traits<A>::template read_element<0,3>(a)-mat_traits<B>::template read_element<0,3>(b); | |
257 | return r; | |
258 | } | |
259 | ||
260 | namespace | |
261 | sfinae | |
262 | { | |
263 | using ::boost::qvm::operator-; | |
264 | } | |
265 | ||
266 | namespace | |
267 | qvm_detail | |
268 | { | |
269 | template <int R,int C> | |
270 | struct minus_mm_defined; | |
271 | ||
272 | template <> | |
273 | struct | |
274 | minus_mm_defined<1,4> | |
275 | { | |
276 | static bool const value=true; | |
277 | }; | |
278 | } | |
279 | ||
280 | template <class A,class B> | |
281 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
282 | typename enable_if_c< | |
283 | mat_traits<A>::rows==4 && mat_traits<B>::rows==4 && | |
284 | mat_traits<A>::cols==4 && mat_traits<B>::cols==4, | |
285 | A &>::type | |
286 | operator+=( A & a, B const & b ) | |
287 | { | |
288 | mat_traits<A>::template write_element<0,0>(a)+=mat_traits<B>::template read_element<0,0>(b); | |
289 | mat_traits<A>::template write_element<0,1>(a)+=mat_traits<B>::template read_element<0,1>(b); | |
290 | mat_traits<A>::template write_element<0,2>(a)+=mat_traits<B>::template read_element<0,2>(b); | |
291 | mat_traits<A>::template write_element<0,3>(a)+=mat_traits<B>::template read_element<0,3>(b); | |
292 | mat_traits<A>::template write_element<1,0>(a)+=mat_traits<B>::template read_element<1,0>(b); | |
293 | mat_traits<A>::template write_element<1,1>(a)+=mat_traits<B>::template read_element<1,1>(b); | |
294 | mat_traits<A>::template write_element<1,2>(a)+=mat_traits<B>::template read_element<1,2>(b); | |
295 | mat_traits<A>::template write_element<1,3>(a)+=mat_traits<B>::template read_element<1,3>(b); | |
296 | mat_traits<A>::template write_element<2,0>(a)+=mat_traits<B>::template read_element<2,0>(b); | |
297 | mat_traits<A>::template write_element<2,1>(a)+=mat_traits<B>::template read_element<2,1>(b); | |
298 | mat_traits<A>::template write_element<2,2>(a)+=mat_traits<B>::template read_element<2,2>(b); | |
299 | mat_traits<A>::template write_element<2,3>(a)+=mat_traits<B>::template read_element<2,3>(b); | |
300 | mat_traits<A>::template write_element<3,0>(a)+=mat_traits<B>::template read_element<3,0>(b); | |
301 | mat_traits<A>::template write_element<3,1>(a)+=mat_traits<B>::template read_element<3,1>(b); | |
302 | mat_traits<A>::template write_element<3,2>(a)+=mat_traits<B>::template read_element<3,2>(b); | |
303 | mat_traits<A>::template write_element<3,3>(a)+=mat_traits<B>::template read_element<3,3>(b); | |
304 | return a; | |
305 | } | |
306 | ||
307 | namespace | |
308 | sfinae | |
309 | { | |
310 | using ::boost::qvm::operator+=; | |
311 | } | |
312 | ||
313 | namespace | |
314 | qvm_detail | |
315 | { | |
316 | template <int R,int C> | |
317 | struct plus_eq_mm_defined; | |
318 | ||
319 | template <> | |
320 | struct | |
321 | plus_eq_mm_defined<4,4> | |
322 | { | |
323 | static bool const value=true; | |
324 | }; | |
325 | } | |
326 | ||
327 | template <class A,class B> | |
328 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
329 | typename enable_if_c< | |
330 | mat_traits<A>::rows==4 && mat_traits<B>::rows==4 && | |
331 | mat_traits<A>::cols==1 && mat_traits<B>::cols==1, | |
332 | A &>::type | |
333 | operator+=( A & a, B const & b ) | |
334 | { | |
335 | mat_traits<A>::template write_element<0,0>(a)+=mat_traits<B>::template read_element<0,0>(b); | |
336 | mat_traits<A>::template write_element<1,0>(a)+=mat_traits<B>::template read_element<1,0>(b); | |
337 | mat_traits<A>::template write_element<2,0>(a)+=mat_traits<B>::template read_element<2,0>(b); | |
338 | mat_traits<A>::template write_element<3,0>(a)+=mat_traits<B>::template read_element<3,0>(b); | |
339 | return a; | |
340 | } | |
341 | ||
342 | namespace | |
343 | sfinae | |
344 | { | |
345 | using ::boost::qvm::operator+=; | |
346 | } | |
347 | ||
348 | namespace | |
349 | qvm_detail | |
350 | { | |
351 | template <int R,int C> | |
352 | struct plus_eq_mm_defined; | |
353 | ||
354 | template <> | |
355 | struct | |
356 | plus_eq_mm_defined<4,1> | |
357 | { | |
358 | static bool const value=true; | |
359 | }; | |
360 | } | |
361 | ||
362 | template <class A,class B> | |
363 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
364 | typename enable_if_c< | |
365 | mat_traits<A>::rows==1 && mat_traits<B>::rows==1 && | |
366 | mat_traits<A>::cols==4 && mat_traits<B>::cols==4, | |
367 | A &>::type | |
368 | operator+=( A & a, B const & b ) | |
369 | { | |
370 | mat_traits<A>::template write_element<0,0>(a)+=mat_traits<B>::template read_element<0,0>(b); | |
371 | mat_traits<A>::template write_element<0,1>(a)+=mat_traits<B>::template read_element<0,1>(b); | |
372 | mat_traits<A>::template write_element<0,2>(a)+=mat_traits<B>::template read_element<0,2>(b); | |
373 | mat_traits<A>::template write_element<0,3>(a)+=mat_traits<B>::template read_element<0,3>(b); | |
374 | return a; | |
375 | } | |
376 | ||
377 | namespace | |
378 | sfinae | |
379 | { | |
380 | using ::boost::qvm::operator+=; | |
381 | } | |
382 | ||
383 | namespace | |
384 | qvm_detail | |
385 | { | |
386 | template <int R,int C> | |
387 | struct plus_eq_mm_defined; | |
388 | ||
389 | template <> | |
390 | struct | |
391 | plus_eq_mm_defined<1,4> | |
392 | { | |
393 | static bool const value=true; | |
394 | }; | |
395 | } | |
396 | ||
397 | template <class A,class B> | |
398 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
399 | typename enable_if_c< | |
400 | mat_traits<A>::rows==4 && mat_traits<B>::rows==4 && | |
401 | mat_traits<A>::cols==4 && mat_traits<B>::cols==4, | |
402 | A &>::type | |
403 | operator-=( A & a, B const & b ) | |
404 | { | |
405 | mat_traits<A>::template write_element<0,0>(a)-=mat_traits<B>::template read_element<0,0>(b); | |
406 | mat_traits<A>::template write_element<0,1>(a)-=mat_traits<B>::template read_element<0,1>(b); | |
407 | mat_traits<A>::template write_element<0,2>(a)-=mat_traits<B>::template read_element<0,2>(b); | |
408 | mat_traits<A>::template write_element<0,3>(a)-=mat_traits<B>::template read_element<0,3>(b); | |
409 | mat_traits<A>::template write_element<1,0>(a)-=mat_traits<B>::template read_element<1,0>(b); | |
410 | mat_traits<A>::template write_element<1,1>(a)-=mat_traits<B>::template read_element<1,1>(b); | |
411 | mat_traits<A>::template write_element<1,2>(a)-=mat_traits<B>::template read_element<1,2>(b); | |
412 | mat_traits<A>::template write_element<1,3>(a)-=mat_traits<B>::template read_element<1,3>(b); | |
413 | mat_traits<A>::template write_element<2,0>(a)-=mat_traits<B>::template read_element<2,0>(b); | |
414 | mat_traits<A>::template write_element<2,1>(a)-=mat_traits<B>::template read_element<2,1>(b); | |
415 | mat_traits<A>::template write_element<2,2>(a)-=mat_traits<B>::template read_element<2,2>(b); | |
416 | mat_traits<A>::template write_element<2,3>(a)-=mat_traits<B>::template read_element<2,3>(b); | |
417 | mat_traits<A>::template write_element<3,0>(a)-=mat_traits<B>::template read_element<3,0>(b); | |
418 | mat_traits<A>::template write_element<3,1>(a)-=mat_traits<B>::template read_element<3,1>(b); | |
419 | mat_traits<A>::template write_element<3,2>(a)-=mat_traits<B>::template read_element<3,2>(b); | |
420 | mat_traits<A>::template write_element<3,3>(a)-=mat_traits<B>::template read_element<3,3>(b); | |
421 | return a; | |
422 | } | |
423 | ||
424 | namespace | |
425 | sfinae | |
426 | { | |
427 | using ::boost::qvm::operator-=; | |
428 | } | |
429 | ||
430 | namespace | |
431 | qvm_detail | |
432 | { | |
433 | template <int R,int C> | |
434 | struct minus_eq_mm_defined; | |
435 | ||
436 | template <> | |
437 | struct | |
438 | minus_eq_mm_defined<4,4> | |
439 | { | |
440 | static bool const value=true; | |
441 | }; | |
442 | } | |
443 | ||
444 | template <class A,class B> | |
445 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
446 | typename enable_if_c< | |
447 | mat_traits<A>::rows==4 && mat_traits<B>::rows==4 && | |
448 | mat_traits<A>::cols==1 && mat_traits<B>::cols==1, | |
449 | A &>::type | |
450 | operator-=( A & a, B const & b ) | |
451 | { | |
452 | mat_traits<A>::template write_element<0,0>(a)-=mat_traits<B>::template read_element<0,0>(b); | |
453 | mat_traits<A>::template write_element<1,0>(a)-=mat_traits<B>::template read_element<1,0>(b); | |
454 | mat_traits<A>::template write_element<2,0>(a)-=mat_traits<B>::template read_element<2,0>(b); | |
455 | mat_traits<A>::template write_element<3,0>(a)-=mat_traits<B>::template read_element<3,0>(b); | |
456 | return a; | |
457 | } | |
458 | ||
459 | namespace | |
460 | sfinae | |
461 | { | |
462 | using ::boost::qvm::operator-=; | |
463 | } | |
464 | ||
465 | namespace | |
466 | qvm_detail | |
467 | { | |
468 | template <int R,int C> | |
469 | struct minus_eq_mm_defined; | |
470 | ||
471 | template <> | |
472 | struct | |
473 | minus_eq_mm_defined<4,1> | |
474 | { | |
475 | static bool const value=true; | |
476 | }; | |
477 | } | |
478 | ||
479 | template <class A,class B> | |
480 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
481 | typename enable_if_c< | |
482 | mat_traits<A>::rows==1 && mat_traits<B>::rows==1 && | |
483 | mat_traits<A>::cols==4 && mat_traits<B>::cols==4, | |
484 | A &>::type | |
485 | operator-=( A & a, B const & b ) | |
486 | { | |
487 | mat_traits<A>::template write_element<0,0>(a)-=mat_traits<B>::template read_element<0,0>(b); | |
488 | mat_traits<A>::template write_element<0,1>(a)-=mat_traits<B>::template read_element<0,1>(b); | |
489 | mat_traits<A>::template write_element<0,2>(a)-=mat_traits<B>::template read_element<0,2>(b); | |
490 | mat_traits<A>::template write_element<0,3>(a)-=mat_traits<B>::template read_element<0,3>(b); | |
491 | return a; | |
492 | } | |
493 | ||
494 | namespace | |
495 | sfinae | |
496 | { | |
497 | using ::boost::qvm::operator-=; | |
498 | } | |
499 | ||
500 | namespace | |
501 | qvm_detail | |
502 | { | |
503 | template <int R,int C> | |
504 | struct minus_eq_mm_defined; | |
505 | ||
506 | template <> | |
507 | struct | |
508 | minus_eq_mm_defined<1,4> | |
509 | { | |
510 | static bool const value=true; | |
511 | }; | |
512 | } | |
513 | ||
514 | template <class A,class B> | |
515 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
516 | typename lazy_enable_if_c< | |
517 | mat_traits<A>::rows==4 && mat_traits<A>::cols==4 && is_scalar<B>::value, | |
518 | deduce_mat2<A,B,mat_traits<A>::rows,mat_traits<A>::cols> >::type | |
519 | operator*( A const & a, B b ) | |
520 | { | |
521 | typedef typename deduce_mat2<A,B,mat_traits<A>::rows,mat_traits<A>::cols>::type R; | |
522 | R r; | |
523 | mat_traits<R>::template write_element<0,0>(r)=mat_traits<A>::template read_element<0,0>(a)*b; | |
524 | mat_traits<R>::template write_element<0,1>(r)=mat_traits<A>::template read_element<0,1>(a)*b; | |
525 | mat_traits<R>::template write_element<0,2>(r)=mat_traits<A>::template read_element<0,2>(a)*b; | |
526 | mat_traits<R>::template write_element<0,3>(r)=mat_traits<A>::template read_element<0,3>(a)*b; | |
527 | mat_traits<R>::template write_element<1,0>(r)=mat_traits<A>::template read_element<1,0>(a)*b; | |
528 | mat_traits<R>::template write_element<1,1>(r)=mat_traits<A>::template read_element<1,1>(a)*b; | |
529 | mat_traits<R>::template write_element<1,2>(r)=mat_traits<A>::template read_element<1,2>(a)*b; | |
530 | mat_traits<R>::template write_element<1,3>(r)=mat_traits<A>::template read_element<1,3>(a)*b; | |
531 | mat_traits<R>::template write_element<2,0>(r)=mat_traits<A>::template read_element<2,0>(a)*b; | |
532 | mat_traits<R>::template write_element<2,1>(r)=mat_traits<A>::template read_element<2,1>(a)*b; | |
533 | mat_traits<R>::template write_element<2,2>(r)=mat_traits<A>::template read_element<2,2>(a)*b; | |
534 | mat_traits<R>::template write_element<2,3>(r)=mat_traits<A>::template read_element<2,3>(a)*b; | |
535 | mat_traits<R>::template write_element<3,0>(r)=mat_traits<A>::template read_element<3,0>(a)*b; | |
536 | mat_traits<R>::template write_element<3,1>(r)=mat_traits<A>::template read_element<3,1>(a)*b; | |
537 | mat_traits<R>::template write_element<3,2>(r)=mat_traits<A>::template read_element<3,2>(a)*b; | |
538 | mat_traits<R>::template write_element<3,3>(r)=mat_traits<A>::template read_element<3,3>(a)*b; | |
539 | return r; | |
540 | } | |
541 | ||
542 | namespace | |
543 | sfinae | |
544 | { | |
545 | using ::boost::qvm::operator*; | |
546 | } | |
547 | ||
548 | namespace | |
549 | qvm_detail | |
550 | { | |
551 | template <int R,int C> | |
552 | struct mul_ms_defined; | |
553 | ||
554 | template <> | |
555 | struct | |
556 | mul_ms_defined<4,4> | |
557 | { | |
558 | static bool const value=true; | |
559 | }; | |
560 | } | |
561 | ||
562 | template <class A,class B> | |
563 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
564 | typename lazy_enable_if_c< | |
565 | is_scalar<A>::value && mat_traits<B>::rows==4 && mat_traits<B>::cols==4, | |
566 | deduce_mat2<A,B,mat_traits<B>::rows,mat_traits<B>::cols> >::type | |
567 | operator*( A a, B const & b ) | |
568 | { | |
569 | typedef typename deduce_mat2<A,B,mat_traits<B>::rows,mat_traits<B>::cols>::type R; | |
570 | R r; | |
571 | mat_traits<R>::template write_element<0,0>(r)=a*mat_traits<B>::template read_element<0,0>(b); | |
572 | mat_traits<R>::template write_element<0,1>(r)=a*mat_traits<B>::template read_element<0,1>(b); | |
573 | mat_traits<R>::template write_element<0,2>(r)=a*mat_traits<B>::template read_element<0,2>(b); | |
574 | mat_traits<R>::template write_element<0,3>(r)=a*mat_traits<B>::template read_element<0,3>(b); | |
575 | mat_traits<R>::template write_element<1,0>(r)=a*mat_traits<B>::template read_element<1,0>(b); | |
576 | mat_traits<R>::template write_element<1,1>(r)=a*mat_traits<B>::template read_element<1,1>(b); | |
577 | mat_traits<R>::template write_element<1,2>(r)=a*mat_traits<B>::template read_element<1,2>(b); | |
578 | mat_traits<R>::template write_element<1,3>(r)=a*mat_traits<B>::template read_element<1,3>(b); | |
579 | mat_traits<R>::template write_element<2,0>(r)=a*mat_traits<B>::template read_element<2,0>(b); | |
580 | mat_traits<R>::template write_element<2,1>(r)=a*mat_traits<B>::template read_element<2,1>(b); | |
581 | mat_traits<R>::template write_element<2,2>(r)=a*mat_traits<B>::template read_element<2,2>(b); | |
582 | mat_traits<R>::template write_element<2,3>(r)=a*mat_traits<B>::template read_element<2,3>(b); | |
583 | mat_traits<R>::template write_element<3,0>(r)=a*mat_traits<B>::template read_element<3,0>(b); | |
584 | mat_traits<R>::template write_element<3,1>(r)=a*mat_traits<B>::template read_element<3,1>(b); | |
585 | mat_traits<R>::template write_element<3,2>(r)=a*mat_traits<B>::template read_element<3,2>(b); | |
586 | mat_traits<R>::template write_element<3,3>(r)=a*mat_traits<B>::template read_element<3,3>(b); | |
587 | return r; | |
588 | } | |
589 | ||
590 | namespace | |
591 | sfinae | |
592 | { | |
593 | using ::boost::qvm::operator*; | |
594 | } | |
595 | ||
596 | namespace | |
597 | qvm_detail | |
598 | { | |
599 | template <int R,int C> | |
600 | struct mul_sm_defined; | |
601 | ||
602 | template <> | |
603 | struct | |
604 | mul_sm_defined<4,4> | |
605 | { | |
606 | static bool const value=true; | |
607 | }; | |
608 | } | |
609 | ||
610 | template <class A,class B> | |
611 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
612 | typename lazy_enable_if_c< | |
613 | mat_traits<A>::rows==4 && mat_traits<A>::cols==1 && is_scalar<B>::value, | |
614 | deduce_mat2<A,B,mat_traits<A>::rows,mat_traits<A>::cols> >::type | |
615 | operator*( A const & a, B b ) | |
616 | { | |
617 | typedef typename deduce_mat2<A,B,mat_traits<A>::rows,mat_traits<A>::cols>::type R; | |
618 | R r; | |
619 | mat_traits<R>::template write_element<0,0>(r)=mat_traits<A>::template read_element<0,0>(a)*b; | |
620 | mat_traits<R>::template write_element<1,0>(r)=mat_traits<A>::template read_element<1,0>(a)*b; | |
621 | mat_traits<R>::template write_element<2,0>(r)=mat_traits<A>::template read_element<2,0>(a)*b; | |
622 | mat_traits<R>::template write_element<3,0>(r)=mat_traits<A>::template read_element<3,0>(a)*b; | |
623 | return r; | |
624 | } | |
625 | ||
626 | namespace | |
627 | sfinae | |
628 | { | |
629 | using ::boost::qvm::operator*; | |
630 | } | |
631 | ||
632 | namespace | |
633 | qvm_detail | |
634 | { | |
635 | template <int R,int C> | |
636 | struct mul_ms_defined; | |
637 | ||
638 | template <> | |
639 | struct | |
640 | mul_ms_defined<4,1> | |
641 | { | |
642 | static bool const value=true; | |
643 | }; | |
644 | } | |
645 | ||
646 | template <class A,class B> | |
647 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
648 | typename lazy_enable_if_c< | |
649 | is_scalar<A>::value && mat_traits<B>::rows==4 && mat_traits<B>::cols==1, | |
650 | deduce_mat2<A,B,mat_traits<B>::rows,mat_traits<B>::cols> >::type | |
651 | operator*( A a, B const & b ) | |
652 | { | |
653 | typedef typename deduce_mat2<A,B,mat_traits<B>::rows,mat_traits<B>::cols>::type R; | |
654 | R r; | |
655 | mat_traits<R>::template write_element<0,0>(r)=a*mat_traits<B>::template read_element<0,0>(b); | |
656 | mat_traits<R>::template write_element<1,0>(r)=a*mat_traits<B>::template read_element<1,0>(b); | |
657 | mat_traits<R>::template write_element<2,0>(r)=a*mat_traits<B>::template read_element<2,0>(b); | |
658 | mat_traits<R>::template write_element<3,0>(r)=a*mat_traits<B>::template read_element<3,0>(b); | |
659 | return r; | |
660 | } | |
661 | ||
662 | namespace | |
663 | sfinae | |
664 | { | |
665 | using ::boost::qvm::operator*; | |
666 | } | |
667 | ||
668 | namespace | |
669 | qvm_detail | |
670 | { | |
671 | template <int R,int C> | |
672 | struct mul_sm_defined; | |
673 | ||
674 | template <> | |
675 | struct | |
676 | mul_sm_defined<4,1> | |
677 | { | |
678 | static bool const value=true; | |
679 | }; | |
680 | } | |
681 | ||
682 | template <class A,class B> | |
683 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
684 | typename lazy_enable_if_c< | |
685 | mat_traits<A>::rows==1 && mat_traits<A>::cols==4 && is_scalar<B>::value, | |
686 | deduce_mat2<A,B,mat_traits<A>::rows,mat_traits<A>::cols> >::type | |
687 | operator*( A const & a, B b ) | |
688 | { | |
689 | typedef typename deduce_mat2<A,B,mat_traits<A>::rows,mat_traits<A>::cols>::type R; | |
690 | R r; | |
691 | mat_traits<R>::template write_element<0,0>(r)=mat_traits<A>::template read_element<0,0>(a)*b; | |
692 | mat_traits<R>::template write_element<0,1>(r)=mat_traits<A>::template read_element<0,1>(a)*b; | |
693 | mat_traits<R>::template write_element<0,2>(r)=mat_traits<A>::template read_element<0,2>(a)*b; | |
694 | mat_traits<R>::template write_element<0,3>(r)=mat_traits<A>::template read_element<0,3>(a)*b; | |
695 | return r; | |
696 | } | |
697 | ||
698 | namespace | |
699 | sfinae | |
700 | { | |
701 | using ::boost::qvm::operator*; | |
702 | } | |
703 | ||
704 | namespace | |
705 | qvm_detail | |
706 | { | |
707 | template <int R,int C> | |
708 | struct mul_ms_defined; | |
709 | ||
710 | template <> | |
711 | struct | |
712 | mul_ms_defined<1,4> | |
713 | { | |
714 | static bool const value=true; | |
715 | }; | |
716 | } | |
717 | ||
718 | template <class A,class B> | |
719 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
720 | typename lazy_enable_if_c< | |
721 | is_scalar<A>::value && mat_traits<B>::rows==1 && mat_traits<B>::cols==4, | |
722 | deduce_mat2<A,B,mat_traits<B>::rows,mat_traits<B>::cols> >::type | |
723 | operator*( A a, B const & b ) | |
724 | { | |
725 | typedef typename deduce_mat2<A,B,mat_traits<B>::rows,mat_traits<B>::cols>::type R; | |
726 | R r; | |
727 | mat_traits<R>::template write_element<0,0>(r)=a*mat_traits<B>::template read_element<0,0>(b); | |
728 | mat_traits<R>::template write_element<0,1>(r)=a*mat_traits<B>::template read_element<0,1>(b); | |
729 | mat_traits<R>::template write_element<0,2>(r)=a*mat_traits<B>::template read_element<0,2>(b); | |
730 | mat_traits<R>::template write_element<0,3>(r)=a*mat_traits<B>::template read_element<0,3>(b); | |
731 | return r; | |
732 | } | |
733 | ||
734 | namespace | |
735 | sfinae | |
736 | { | |
737 | using ::boost::qvm::operator*; | |
738 | } | |
739 | ||
740 | namespace | |
741 | qvm_detail | |
742 | { | |
743 | template <int R,int C> | |
744 | struct mul_sm_defined; | |
745 | ||
746 | template <> | |
747 | struct | |
748 | mul_sm_defined<1,4> | |
749 | { | |
750 | static bool const value=true; | |
751 | }; | |
752 | } | |
753 | ||
754 | template <class A,class B> | |
755 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
756 | typename enable_if_c< | |
757 | mat_traits<A>::rows==4 && mat_traits<A>::cols==4 && is_scalar<B>::value, | |
758 | A &>::type | |
759 | operator*=( A & a, B b ) | |
760 | { | |
761 | mat_traits<A>::template write_element<0,0>(a)*=b; | |
762 | mat_traits<A>::template write_element<0,1>(a)*=b; | |
763 | mat_traits<A>::template write_element<0,2>(a)*=b; | |
764 | mat_traits<A>::template write_element<0,3>(a)*=b; | |
765 | mat_traits<A>::template write_element<1,0>(a)*=b; | |
766 | mat_traits<A>::template write_element<1,1>(a)*=b; | |
767 | mat_traits<A>::template write_element<1,2>(a)*=b; | |
768 | mat_traits<A>::template write_element<1,3>(a)*=b; | |
769 | mat_traits<A>::template write_element<2,0>(a)*=b; | |
770 | mat_traits<A>::template write_element<2,1>(a)*=b; | |
771 | mat_traits<A>::template write_element<2,2>(a)*=b; | |
772 | mat_traits<A>::template write_element<2,3>(a)*=b; | |
773 | mat_traits<A>::template write_element<3,0>(a)*=b; | |
774 | mat_traits<A>::template write_element<3,1>(a)*=b; | |
775 | mat_traits<A>::template write_element<3,2>(a)*=b; | |
776 | mat_traits<A>::template write_element<3,3>(a)*=b; | |
777 | return a; | |
778 | } | |
779 | ||
780 | namespace | |
781 | sfinae | |
782 | { | |
783 | using ::boost::qvm::operator*=; | |
784 | } | |
785 | ||
786 | namespace | |
787 | qvm_detail | |
788 | { | |
789 | template <int R,int C> | |
790 | struct mul_eq_ms_defined; | |
791 | ||
792 | template <> | |
793 | struct | |
794 | mul_eq_ms_defined<4,4> | |
795 | { | |
796 | static bool const value=true; | |
797 | }; | |
798 | } | |
799 | ||
800 | template <class A,class B> | |
801 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
802 | typename enable_if_c< | |
803 | mat_traits<A>::rows==4 && mat_traits<A>::cols==1 && is_scalar<B>::value, | |
804 | A &>::type | |
805 | operator*=( A & a, B b ) | |
806 | { | |
807 | mat_traits<A>::template write_element<0,0>(a)*=b; | |
808 | mat_traits<A>::template write_element<1,0>(a)*=b; | |
809 | mat_traits<A>::template write_element<2,0>(a)*=b; | |
810 | mat_traits<A>::template write_element<3,0>(a)*=b; | |
811 | return a; | |
812 | } | |
813 | ||
814 | namespace | |
815 | sfinae | |
816 | { | |
817 | using ::boost::qvm::operator*=; | |
818 | } | |
819 | ||
820 | namespace | |
821 | qvm_detail | |
822 | { | |
823 | template <int R,int C> | |
824 | struct mul_eq_ms_defined; | |
825 | ||
826 | template <> | |
827 | struct | |
828 | mul_eq_ms_defined<4,1> | |
829 | { | |
830 | static bool const value=true; | |
831 | }; | |
832 | } | |
833 | ||
834 | template <class A,class B> | |
835 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
836 | typename enable_if_c< | |
837 | mat_traits<A>::rows==1 && mat_traits<A>::cols==4 && is_scalar<B>::value, | |
838 | A &>::type | |
839 | operator*=( A & a, B b ) | |
840 | { | |
841 | mat_traits<A>::template write_element<0,0>(a)*=b; | |
842 | mat_traits<A>::template write_element<0,1>(a)*=b; | |
843 | mat_traits<A>::template write_element<0,2>(a)*=b; | |
844 | mat_traits<A>::template write_element<0,3>(a)*=b; | |
845 | return a; | |
846 | } | |
847 | ||
848 | namespace | |
849 | sfinae | |
850 | { | |
851 | using ::boost::qvm::operator*=; | |
852 | } | |
853 | ||
854 | namespace | |
855 | qvm_detail | |
856 | { | |
857 | template <int R,int C> | |
858 | struct mul_eq_ms_defined; | |
859 | ||
860 | template <> | |
861 | struct | |
862 | mul_eq_ms_defined<1,4> | |
863 | { | |
864 | static bool const value=true; | |
865 | }; | |
866 | } | |
867 | ||
868 | template <class A,class B> | |
869 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
870 | typename lazy_enable_if_c< | |
871 | mat_traits<A>::rows==4 && mat_traits<A>::cols==4 && is_scalar<B>::value, | |
872 | deduce_mat2<A,B,mat_traits<A>::rows,mat_traits<A>::cols> >::type | |
873 | operator/( A const & a, B b ) | |
874 | { | |
875 | typedef typename deduce_mat2<A,B,mat_traits<A>::rows,mat_traits<A>::cols>::type R; | |
876 | R r; | |
877 | mat_traits<R>::template write_element<0,0>(r)=mat_traits<A>::template read_element<0,0>(a)/b; | |
878 | mat_traits<R>::template write_element<0,1>(r)=mat_traits<A>::template read_element<0,1>(a)/b; | |
879 | mat_traits<R>::template write_element<0,2>(r)=mat_traits<A>::template read_element<0,2>(a)/b; | |
880 | mat_traits<R>::template write_element<0,3>(r)=mat_traits<A>::template read_element<0,3>(a)/b; | |
881 | mat_traits<R>::template write_element<1,0>(r)=mat_traits<A>::template read_element<1,0>(a)/b; | |
882 | mat_traits<R>::template write_element<1,1>(r)=mat_traits<A>::template read_element<1,1>(a)/b; | |
883 | mat_traits<R>::template write_element<1,2>(r)=mat_traits<A>::template read_element<1,2>(a)/b; | |
884 | mat_traits<R>::template write_element<1,3>(r)=mat_traits<A>::template read_element<1,3>(a)/b; | |
885 | mat_traits<R>::template write_element<2,0>(r)=mat_traits<A>::template read_element<2,0>(a)/b; | |
886 | mat_traits<R>::template write_element<2,1>(r)=mat_traits<A>::template read_element<2,1>(a)/b; | |
887 | mat_traits<R>::template write_element<2,2>(r)=mat_traits<A>::template read_element<2,2>(a)/b; | |
888 | mat_traits<R>::template write_element<2,3>(r)=mat_traits<A>::template read_element<2,3>(a)/b; | |
889 | mat_traits<R>::template write_element<3,0>(r)=mat_traits<A>::template read_element<3,0>(a)/b; | |
890 | mat_traits<R>::template write_element<3,1>(r)=mat_traits<A>::template read_element<3,1>(a)/b; | |
891 | mat_traits<R>::template write_element<3,2>(r)=mat_traits<A>::template read_element<3,2>(a)/b; | |
892 | mat_traits<R>::template write_element<3,3>(r)=mat_traits<A>::template read_element<3,3>(a)/b; | |
893 | return r; | |
894 | } | |
895 | ||
896 | namespace | |
897 | sfinae | |
898 | { | |
899 | using ::boost::qvm::operator/; | |
900 | } | |
901 | ||
902 | namespace | |
903 | qvm_detail | |
904 | { | |
905 | template <int R,int C> | |
906 | struct div_ms_defined; | |
907 | ||
908 | template <> | |
909 | struct | |
910 | div_ms_defined<4,4> | |
911 | { | |
912 | static bool const value=true; | |
913 | }; | |
914 | } | |
915 | ||
916 | template <class A,class B> | |
917 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
918 | typename lazy_enable_if_c< | |
919 | is_scalar<A>::value && mat_traits<B>::rows==4 && mat_traits<B>::cols==4, | |
920 | deduce_mat2<A,B,mat_traits<B>::rows,mat_traits<B>::cols> >::type | |
921 | operator/( A a, B const & b ) | |
922 | { | |
923 | typedef typename deduce_mat2<A,B,mat_traits<B>::rows,mat_traits<B>::cols>::type R; | |
924 | R r; | |
925 | mat_traits<R>::template write_element<0,0>(r)=a/mat_traits<B>::template read_element<0,0>(b); | |
926 | mat_traits<R>::template write_element<0,1>(r)=a/mat_traits<B>::template read_element<0,1>(b); | |
927 | mat_traits<R>::template write_element<0,2>(r)=a/mat_traits<B>::template read_element<0,2>(b); | |
928 | mat_traits<R>::template write_element<0,3>(r)=a/mat_traits<B>::template read_element<0,3>(b); | |
929 | mat_traits<R>::template write_element<1,0>(r)=a/mat_traits<B>::template read_element<1,0>(b); | |
930 | mat_traits<R>::template write_element<1,1>(r)=a/mat_traits<B>::template read_element<1,1>(b); | |
931 | mat_traits<R>::template write_element<1,2>(r)=a/mat_traits<B>::template read_element<1,2>(b); | |
932 | mat_traits<R>::template write_element<1,3>(r)=a/mat_traits<B>::template read_element<1,3>(b); | |
933 | mat_traits<R>::template write_element<2,0>(r)=a/mat_traits<B>::template read_element<2,0>(b); | |
934 | mat_traits<R>::template write_element<2,1>(r)=a/mat_traits<B>::template read_element<2,1>(b); | |
935 | mat_traits<R>::template write_element<2,2>(r)=a/mat_traits<B>::template read_element<2,2>(b); | |
936 | mat_traits<R>::template write_element<2,3>(r)=a/mat_traits<B>::template read_element<2,3>(b); | |
937 | mat_traits<R>::template write_element<3,0>(r)=a/mat_traits<B>::template read_element<3,0>(b); | |
938 | mat_traits<R>::template write_element<3,1>(r)=a/mat_traits<B>::template read_element<3,1>(b); | |
939 | mat_traits<R>::template write_element<3,2>(r)=a/mat_traits<B>::template read_element<3,2>(b); | |
940 | mat_traits<R>::template write_element<3,3>(r)=a/mat_traits<B>::template read_element<3,3>(b); | |
941 | return r; | |
942 | } | |
943 | ||
944 | namespace | |
945 | sfinae | |
946 | { | |
947 | using ::boost::qvm::operator/; | |
948 | } | |
949 | ||
950 | namespace | |
951 | qvm_detail | |
952 | { | |
953 | template <int R,int C> | |
954 | struct div_sm_defined; | |
955 | ||
956 | template <> | |
957 | struct | |
958 | div_sm_defined<4,4> | |
959 | { | |
960 | static bool const value=true; | |
961 | }; | |
962 | } | |
963 | ||
964 | template <class A,class B> | |
965 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
966 | typename lazy_enable_if_c< | |
967 | mat_traits<A>::rows==4 && mat_traits<A>::cols==1 && is_scalar<B>::value, | |
968 | deduce_mat2<A,B,mat_traits<A>::rows,mat_traits<A>::cols> >::type | |
969 | operator/( A const & a, B b ) | |
970 | { | |
971 | typedef typename deduce_mat2<A,B,mat_traits<A>::rows,mat_traits<A>::cols>::type R; | |
972 | R r; | |
973 | mat_traits<R>::template write_element<0,0>(r)=mat_traits<A>::template read_element<0,0>(a)/b; | |
974 | mat_traits<R>::template write_element<1,0>(r)=mat_traits<A>::template read_element<1,0>(a)/b; | |
975 | mat_traits<R>::template write_element<2,0>(r)=mat_traits<A>::template read_element<2,0>(a)/b; | |
976 | mat_traits<R>::template write_element<3,0>(r)=mat_traits<A>::template read_element<3,0>(a)/b; | |
977 | return r; | |
978 | } | |
979 | ||
980 | namespace | |
981 | sfinae | |
982 | { | |
983 | using ::boost::qvm::operator/; | |
984 | } | |
985 | ||
986 | namespace | |
987 | qvm_detail | |
988 | { | |
989 | template <int R,int C> | |
990 | struct div_ms_defined; | |
991 | ||
992 | template <> | |
993 | struct | |
994 | div_ms_defined<4,1> | |
995 | { | |
996 | static bool const value=true; | |
997 | }; | |
998 | } | |
999 | ||
1000 | template <class A,class B> | |
1001 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1002 | typename lazy_enable_if_c< | |
1003 | is_scalar<A>::value && mat_traits<B>::rows==4 && mat_traits<B>::cols==1, | |
1004 | deduce_mat2<A,B,mat_traits<B>::rows,mat_traits<B>::cols> >::type | |
1005 | operator/( A a, B const & b ) | |
1006 | { | |
1007 | typedef typename deduce_mat2<A,B,mat_traits<B>::rows,mat_traits<B>::cols>::type R; | |
1008 | R r; | |
1009 | mat_traits<R>::template write_element<0,0>(r)=a/mat_traits<B>::template read_element<0,0>(b); | |
1010 | mat_traits<R>::template write_element<1,0>(r)=a/mat_traits<B>::template read_element<1,0>(b); | |
1011 | mat_traits<R>::template write_element<2,0>(r)=a/mat_traits<B>::template read_element<2,0>(b); | |
1012 | mat_traits<R>::template write_element<3,0>(r)=a/mat_traits<B>::template read_element<3,0>(b); | |
1013 | return r; | |
1014 | } | |
1015 | ||
1016 | namespace | |
1017 | sfinae | |
1018 | { | |
1019 | using ::boost::qvm::operator/; | |
1020 | } | |
1021 | ||
1022 | namespace | |
1023 | qvm_detail | |
1024 | { | |
1025 | template <int R,int C> | |
1026 | struct div_sm_defined; | |
1027 | ||
1028 | template <> | |
1029 | struct | |
1030 | div_sm_defined<4,1> | |
1031 | { | |
1032 | static bool const value=true; | |
1033 | }; | |
1034 | } | |
1035 | ||
1036 | template <class A,class B> | |
1037 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1038 | typename lazy_enable_if_c< | |
1039 | mat_traits<A>::rows==1 && mat_traits<A>::cols==4 && is_scalar<B>::value, | |
1040 | deduce_mat2<A,B,mat_traits<A>::rows,mat_traits<A>::cols> >::type | |
1041 | operator/( A const & a, B b ) | |
1042 | { | |
1043 | typedef typename deduce_mat2<A,B,mat_traits<A>::rows,mat_traits<A>::cols>::type R; | |
1044 | R r; | |
1045 | mat_traits<R>::template write_element<0,0>(r)=mat_traits<A>::template read_element<0,0>(a)/b; | |
1046 | mat_traits<R>::template write_element<0,1>(r)=mat_traits<A>::template read_element<0,1>(a)/b; | |
1047 | mat_traits<R>::template write_element<0,2>(r)=mat_traits<A>::template read_element<0,2>(a)/b; | |
1048 | mat_traits<R>::template write_element<0,3>(r)=mat_traits<A>::template read_element<0,3>(a)/b; | |
1049 | return r; | |
1050 | } | |
1051 | ||
1052 | namespace | |
1053 | sfinae | |
1054 | { | |
1055 | using ::boost::qvm::operator/; | |
1056 | } | |
1057 | ||
1058 | namespace | |
1059 | qvm_detail | |
1060 | { | |
1061 | template <int R,int C> | |
1062 | struct div_ms_defined; | |
1063 | ||
1064 | template <> | |
1065 | struct | |
1066 | div_ms_defined<1,4> | |
1067 | { | |
1068 | static bool const value=true; | |
1069 | }; | |
1070 | } | |
1071 | ||
1072 | template <class A,class B> | |
1073 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1074 | typename enable_if_c< | |
1075 | mat_traits<A>::rows==4 && mat_traits<A>::cols==4 && is_scalar<B>::value, | |
1076 | A &>::type | |
1077 | operator/=( A & a, B b ) | |
1078 | { | |
1079 | mat_traits<A>::template write_element<0,0>(a)/=b; | |
1080 | mat_traits<A>::template write_element<0,1>(a)/=b; | |
1081 | mat_traits<A>::template write_element<0,2>(a)/=b; | |
1082 | mat_traits<A>::template write_element<0,3>(a)/=b; | |
1083 | mat_traits<A>::template write_element<1,0>(a)/=b; | |
1084 | mat_traits<A>::template write_element<1,1>(a)/=b; | |
1085 | mat_traits<A>::template write_element<1,2>(a)/=b; | |
1086 | mat_traits<A>::template write_element<1,3>(a)/=b; | |
1087 | mat_traits<A>::template write_element<2,0>(a)/=b; | |
1088 | mat_traits<A>::template write_element<2,1>(a)/=b; | |
1089 | mat_traits<A>::template write_element<2,2>(a)/=b; | |
1090 | mat_traits<A>::template write_element<2,3>(a)/=b; | |
1091 | mat_traits<A>::template write_element<3,0>(a)/=b; | |
1092 | mat_traits<A>::template write_element<3,1>(a)/=b; | |
1093 | mat_traits<A>::template write_element<3,2>(a)/=b; | |
1094 | mat_traits<A>::template write_element<3,3>(a)/=b; | |
1095 | return a; | |
1096 | } | |
1097 | ||
1098 | namespace | |
1099 | sfinae | |
1100 | { | |
1101 | using ::boost::qvm::operator/=; | |
1102 | } | |
1103 | ||
1104 | namespace | |
1105 | qvm_detail | |
1106 | { | |
1107 | template <int R,int C> | |
1108 | struct div_eq_ms_defined; | |
1109 | ||
1110 | template <> | |
1111 | struct | |
1112 | div_eq_ms_defined<4,4> | |
1113 | { | |
1114 | static bool const value=true; | |
1115 | }; | |
1116 | } | |
1117 | ||
1118 | template <class A,class B> | |
1119 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1120 | typename enable_if_c< | |
1121 | mat_traits<A>::rows==4 && mat_traits<A>::cols==1 && is_scalar<B>::value, | |
1122 | A &>::type | |
1123 | operator/=( A & a, B b ) | |
1124 | { | |
1125 | mat_traits<A>::template write_element<0,0>(a)/=b; | |
1126 | mat_traits<A>::template write_element<1,0>(a)/=b; | |
1127 | mat_traits<A>::template write_element<2,0>(a)/=b; | |
1128 | mat_traits<A>::template write_element<3,0>(a)/=b; | |
1129 | return a; | |
1130 | } | |
1131 | ||
1132 | namespace | |
1133 | sfinae | |
1134 | { | |
1135 | using ::boost::qvm::operator/=; | |
1136 | } | |
1137 | ||
1138 | namespace | |
1139 | qvm_detail | |
1140 | { | |
1141 | template <int R,int C> | |
1142 | struct div_eq_ms_defined; | |
1143 | ||
1144 | template <> | |
1145 | struct | |
1146 | div_eq_ms_defined<4,1> | |
1147 | { | |
1148 | static bool const value=true; | |
1149 | }; | |
1150 | } | |
1151 | ||
1152 | template <class A,class B> | |
1153 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1154 | typename enable_if_c< | |
1155 | mat_traits<A>::rows==1 && mat_traits<A>::cols==4 && is_scalar<B>::value, | |
1156 | A &>::type | |
1157 | operator/=( A & a, B b ) | |
1158 | { | |
1159 | mat_traits<A>::template write_element<0,0>(a)/=b; | |
1160 | mat_traits<A>::template write_element<0,1>(a)/=b; | |
1161 | mat_traits<A>::template write_element<0,2>(a)/=b; | |
1162 | mat_traits<A>::template write_element<0,3>(a)/=b; | |
1163 | return a; | |
1164 | } | |
1165 | ||
1166 | namespace | |
1167 | sfinae | |
1168 | { | |
1169 | using ::boost::qvm::operator/=; | |
1170 | } | |
1171 | ||
1172 | namespace | |
1173 | qvm_detail | |
1174 | { | |
1175 | template <int R,int C> | |
1176 | struct div_eq_ms_defined; | |
1177 | ||
1178 | template <> | |
1179 | struct | |
1180 | div_eq_ms_defined<1,4> | |
1181 | { | |
1182 | static bool const value=true; | |
1183 | }; | |
1184 | } | |
1185 | ||
1186 | template <class R,class A> | |
1187 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1188 | typename enable_if_c< | |
1189 | mat_traits<R>::rows==4 && mat_traits<A>::rows==4 && | |
1190 | mat_traits<R>::cols==4 && mat_traits<A>::cols==4, | |
1191 | R>::type | |
1192 | convert_to( A const & a ) | |
1193 | { | |
1194 | R r; | |
1195 | mat_traits<R>::template write_element<0,0>(r) = mat_traits<A>::template read_element<0,0>(a); | |
1196 | mat_traits<R>::template write_element<0,1>(r) = mat_traits<A>::template read_element<0,1>(a); | |
1197 | mat_traits<R>::template write_element<0,2>(r) = mat_traits<A>::template read_element<0,2>(a); | |
1198 | mat_traits<R>::template write_element<0,3>(r) = mat_traits<A>::template read_element<0,3>(a); | |
1199 | mat_traits<R>::template write_element<1,0>(r) = mat_traits<A>::template read_element<1,0>(a); | |
1200 | mat_traits<R>::template write_element<1,1>(r) = mat_traits<A>::template read_element<1,1>(a); | |
1201 | mat_traits<R>::template write_element<1,2>(r) = mat_traits<A>::template read_element<1,2>(a); | |
1202 | mat_traits<R>::template write_element<1,3>(r) = mat_traits<A>::template read_element<1,3>(a); | |
1203 | mat_traits<R>::template write_element<2,0>(r) = mat_traits<A>::template read_element<2,0>(a); | |
1204 | mat_traits<R>::template write_element<2,1>(r) = mat_traits<A>::template read_element<2,1>(a); | |
1205 | mat_traits<R>::template write_element<2,2>(r) = mat_traits<A>::template read_element<2,2>(a); | |
1206 | mat_traits<R>::template write_element<2,3>(r) = mat_traits<A>::template read_element<2,3>(a); | |
1207 | mat_traits<R>::template write_element<3,0>(r) = mat_traits<A>::template read_element<3,0>(a); | |
1208 | mat_traits<R>::template write_element<3,1>(r) = mat_traits<A>::template read_element<3,1>(a); | |
1209 | mat_traits<R>::template write_element<3,2>(r) = mat_traits<A>::template read_element<3,2>(a); | |
1210 | mat_traits<R>::template write_element<3,3>(r) = mat_traits<A>::template read_element<3,3>(a); | |
1211 | return r; | |
1212 | } | |
1213 | ||
1214 | template <class R,class A> | |
1215 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE | |
1216 | typename enable_if_c< | |
1217 | is_mat<R>::value && is_quat<A>::value && | |
1218 | mat_traits<R>::rows==4 && mat_traits<R>::cols==4, | |
1219 | R>::type | |
1220 | convert_to( A const & q ) | |
1221 | { | |
1222 | typedef typename mat_traits<R>::scalar_type T; | |
1223 | T const a=quat_traits<A>::template read_element<0>(q); | |
1224 | T const b=quat_traits<A>::template read_element<1>(q); | |
1225 | T const c=quat_traits<A>::template read_element<2>(q); | |
1226 | T const d=quat_traits<A>::template read_element<3>(q); | |
1227 | T const bb = b*b; | |
1228 | T const cc = c*c; | |
1229 | T const dd = d*d; | |
1230 | T const bc = b*c; | |
1231 | T const bd = b*d; | |
1232 | T const cd = c*d; | |
1233 | T const ab = a*b; | |
1234 | T const ac = a*c; | |
1235 | T const ad = a*d; | |
1236 | T const zero = scalar_traits<T>::value(0); | |
1237 | T const one = scalar_traits<T>::value(1); | |
1238 | T const two = one+one; | |
1239 | R r; | |
1240 | mat_traits<R>::template write_element<0,0>(r) = one - two*(cc+dd); | |
1241 | mat_traits<R>::template write_element<0,1>(r) = two*(bc-ad); | |
1242 | mat_traits<R>::template write_element<0,2>(r) = two*(bd+ac); | |
1243 | mat_traits<R>::template write_element<0,3>(r) = zero; | |
1244 | mat_traits<R>::template write_element<1,0>(r) = two*(bc+ad); | |
1245 | mat_traits<R>::template write_element<1,1>(r) = one - two*(bb+dd); | |
1246 | mat_traits<R>::template write_element<1,2>(r) = two*(cd-ab); | |
1247 | mat_traits<R>::template write_element<1,3>(r) = zero; | |
1248 | mat_traits<R>::template write_element<2,0>(r) = two*(bd-ac); | |
1249 | mat_traits<R>::template write_element<2,1>(r) = two*(cd+ab); | |
1250 | mat_traits<R>::template write_element<2,2>(r) = one - two*(bb+cc); | |
1251 | mat_traits<R>::template write_element<2,3>(r) = zero; | |
1252 | mat_traits<R>::template write_element<3,0>(r) = zero; | |
1253 | mat_traits<R>::template write_element<3,1>(r) = zero; | |
1254 | mat_traits<R>::template write_element<3,2>(r) = zero; | |
1255 | mat_traits<R>::template write_element<3,3>(r) = one; | |
1256 | return r; | |
1257 | } | |
1258 | ||
1259 | namespace | |
1260 | sfinae | |
1261 | { | |
1262 | using ::boost::qvm::convert_to; | |
1263 | } | |
1264 | ||
1265 | namespace | |
1266 | qvm_detail | |
1267 | { | |
1268 | template <int R,int C> | |
1269 | struct convert_to_m_defined; | |
1270 | ||
1271 | template <> | |
1272 | struct | |
1273 | convert_to_m_defined<4,4> | |
1274 | { | |
1275 | static bool const value=true; | |
1276 | }; | |
1277 | } | |
1278 | ||
1279 | template <class R,class A> | |
1280 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1281 | typename enable_if_c< | |
1282 | mat_traits<R>::rows==4 && mat_traits<A>::rows==4 && | |
1283 | mat_traits<R>::cols==1 && mat_traits<A>::cols==1, | |
1284 | R>::type | |
1285 | convert_to( A const & a ) | |
1286 | { | |
1287 | R r; | |
1288 | mat_traits<R>::template write_element<0,0>(r) = mat_traits<A>::template read_element<0,0>(a); | |
1289 | mat_traits<R>::template write_element<1,0>(r) = mat_traits<A>::template read_element<1,0>(a); | |
1290 | mat_traits<R>::template write_element<2,0>(r) = mat_traits<A>::template read_element<2,0>(a); | |
1291 | mat_traits<R>::template write_element<3,0>(r) = mat_traits<A>::template read_element<3,0>(a); | |
1292 | return r; | |
1293 | } | |
1294 | ||
1295 | namespace | |
1296 | sfinae | |
1297 | { | |
1298 | using ::boost::qvm::convert_to; | |
1299 | } | |
1300 | ||
1301 | namespace | |
1302 | qvm_detail | |
1303 | { | |
1304 | template <int R,int C> | |
1305 | struct convert_to_m_defined; | |
1306 | ||
1307 | template <> | |
1308 | struct | |
1309 | convert_to_m_defined<4,1> | |
1310 | { | |
1311 | static bool const value=true; | |
1312 | }; | |
1313 | } | |
1314 | ||
1315 | template <class R,class A> | |
1316 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1317 | typename enable_if_c< | |
1318 | mat_traits<R>::rows==1 && mat_traits<A>::rows==1 && | |
1319 | mat_traits<R>::cols==4 && mat_traits<A>::cols==4, | |
1320 | R>::type | |
1321 | convert_to( A const & a ) | |
1322 | { | |
1323 | R r; | |
1324 | mat_traits<R>::template write_element<0,0>(r) = mat_traits<A>::template read_element<0,0>(a); | |
1325 | mat_traits<R>::template write_element<0,1>(r) = mat_traits<A>::template read_element<0,1>(a); | |
1326 | mat_traits<R>::template write_element<0,2>(r) = mat_traits<A>::template read_element<0,2>(a); | |
1327 | mat_traits<R>::template write_element<0,3>(r) = mat_traits<A>::template read_element<0,3>(a); | |
1328 | return r; | |
1329 | } | |
1330 | ||
1331 | namespace | |
1332 | sfinae | |
1333 | { | |
1334 | using ::boost::qvm::convert_to; | |
1335 | } | |
1336 | ||
1337 | namespace | |
1338 | qvm_detail | |
1339 | { | |
1340 | template <int R,int C> | |
1341 | struct convert_to_m_defined; | |
1342 | ||
1343 | template <> | |
1344 | struct | |
1345 | convert_to_m_defined<1,4> | |
1346 | { | |
1347 | static bool const value=true; | |
1348 | }; | |
1349 | } | |
1350 | ||
1351 | template <class A,class B> | |
1352 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1353 | typename enable_if_c< | |
1354 | mat_traits<A>::rows==4 && mat_traits<B>::rows==4 && | |
1355 | mat_traits<A>::cols==4 && mat_traits<B>::cols==4, | |
1356 | bool>::type | |
1357 | operator==( A const & a, B const & b ) | |
1358 | { | |
1359 | return | |
1360 | mat_traits<A>::template read_element<0,0>(a)==mat_traits<B>::template read_element<0,0>(b) && | |
1361 | mat_traits<A>::template read_element<0,1>(a)==mat_traits<B>::template read_element<0,1>(b) && | |
1362 | mat_traits<A>::template read_element<0,2>(a)==mat_traits<B>::template read_element<0,2>(b) && | |
1363 | mat_traits<A>::template read_element<0,3>(a)==mat_traits<B>::template read_element<0,3>(b) && | |
1364 | mat_traits<A>::template read_element<1,0>(a)==mat_traits<B>::template read_element<1,0>(b) && | |
1365 | mat_traits<A>::template read_element<1,1>(a)==mat_traits<B>::template read_element<1,1>(b) && | |
1366 | mat_traits<A>::template read_element<1,2>(a)==mat_traits<B>::template read_element<1,2>(b) && | |
1367 | mat_traits<A>::template read_element<1,3>(a)==mat_traits<B>::template read_element<1,3>(b) && | |
1368 | mat_traits<A>::template read_element<2,0>(a)==mat_traits<B>::template read_element<2,0>(b) && | |
1369 | mat_traits<A>::template read_element<2,1>(a)==mat_traits<B>::template read_element<2,1>(b) && | |
1370 | mat_traits<A>::template read_element<2,2>(a)==mat_traits<B>::template read_element<2,2>(b) && | |
1371 | mat_traits<A>::template read_element<2,3>(a)==mat_traits<B>::template read_element<2,3>(b) && | |
1372 | mat_traits<A>::template read_element<3,0>(a)==mat_traits<B>::template read_element<3,0>(b) && | |
1373 | mat_traits<A>::template read_element<3,1>(a)==mat_traits<B>::template read_element<3,1>(b) && | |
1374 | mat_traits<A>::template read_element<3,2>(a)==mat_traits<B>::template read_element<3,2>(b) && | |
1375 | mat_traits<A>::template read_element<3,3>(a)==mat_traits<B>::template read_element<3,3>(b); | |
1376 | } | |
1377 | ||
1378 | namespace | |
1379 | sfinae | |
1380 | { | |
1381 | using ::boost::qvm::operator==; | |
1382 | } | |
1383 | ||
1384 | namespace | |
1385 | qvm_detail | |
1386 | { | |
1387 | template <int R,int C> | |
1388 | struct eq_mm_defined; | |
1389 | ||
1390 | template <> | |
1391 | struct | |
1392 | eq_mm_defined<4,4> | |
1393 | { | |
1394 | static bool const value=true; | |
1395 | }; | |
1396 | } | |
1397 | ||
1398 | template <class A,class B> | |
1399 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1400 | typename enable_if_c< | |
1401 | mat_traits<A>::rows==4 && mat_traits<B>::rows==4 && | |
1402 | mat_traits<A>::cols==1 && mat_traits<B>::cols==1, | |
1403 | bool>::type | |
1404 | operator==( A const & a, B const & b ) | |
1405 | { | |
1406 | return | |
1407 | mat_traits<A>::template read_element<0,0>(a)==mat_traits<B>::template read_element<0,0>(b) && | |
1408 | mat_traits<A>::template read_element<1,0>(a)==mat_traits<B>::template read_element<1,0>(b) && | |
1409 | mat_traits<A>::template read_element<2,0>(a)==mat_traits<B>::template read_element<2,0>(b) && | |
1410 | mat_traits<A>::template read_element<3,0>(a)==mat_traits<B>::template read_element<3,0>(b); | |
1411 | } | |
1412 | ||
1413 | namespace | |
1414 | sfinae | |
1415 | { | |
1416 | using ::boost::qvm::operator==; | |
1417 | } | |
1418 | ||
1419 | namespace | |
1420 | qvm_detail | |
1421 | { | |
1422 | template <int R,int C> | |
1423 | struct eq_mm_defined; | |
1424 | ||
1425 | template <> | |
1426 | struct | |
1427 | eq_mm_defined<4,1> | |
1428 | { | |
1429 | static bool const value=true; | |
1430 | }; | |
1431 | } | |
1432 | ||
1433 | template <class A,class B> | |
1434 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1435 | typename enable_if_c< | |
1436 | mat_traits<A>::rows==1 && mat_traits<B>::rows==1 && | |
1437 | mat_traits<A>::cols==4 && mat_traits<B>::cols==4, | |
1438 | bool>::type | |
1439 | operator==( A const & a, B const & b ) | |
1440 | { | |
1441 | return | |
1442 | mat_traits<A>::template read_element<0,0>(a)==mat_traits<B>::template read_element<0,0>(b) && | |
1443 | mat_traits<A>::template read_element<0,1>(a)==mat_traits<B>::template read_element<0,1>(b) && | |
1444 | mat_traits<A>::template read_element<0,2>(a)==mat_traits<B>::template read_element<0,2>(b) && | |
1445 | mat_traits<A>::template read_element<0,3>(a)==mat_traits<B>::template read_element<0,3>(b); | |
1446 | } | |
1447 | ||
1448 | namespace | |
1449 | sfinae | |
1450 | { | |
1451 | using ::boost::qvm::operator==; | |
1452 | } | |
1453 | ||
1454 | namespace | |
1455 | qvm_detail | |
1456 | { | |
1457 | template <int R,int C> | |
1458 | struct eq_mm_defined; | |
1459 | ||
1460 | template <> | |
1461 | struct | |
1462 | eq_mm_defined<1,4> | |
1463 | { | |
1464 | static bool const value=true; | |
1465 | }; | |
1466 | } | |
1467 | ||
1468 | template <class A,class B> | |
1469 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1470 | typename enable_if_c< | |
1471 | mat_traits<A>::rows==4 && mat_traits<B>::rows==4 && | |
1472 | mat_traits<A>::cols==4 && mat_traits<B>::cols==4, | |
1473 | bool>::type | |
1474 | operator!=( A const & a, B const & b ) | |
1475 | { | |
1476 | return | |
1477 | !(mat_traits<A>::template read_element<0,0>(a)==mat_traits<B>::template read_element<0,0>(b)) || | |
1478 | !(mat_traits<A>::template read_element<0,1>(a)==mat_traits<B>::template read_element<0,1>(b)) || | |
1479 | !(mat_traits<A>::template read_element<0,2>(a)==mat_traits<B>::template read_element<0,2>(b)) || | |
1480 | !(mat_traits<A>::template read_element<0,3>(a)==mat_traits<B>::template read_element<0,3>(b)) || | |
1481 | !(mat_traits<A>::template read_element<1,0>(a)==mat_traits<B>::template read_element<1,0>(b)) || | |
1482 | !(mat_traits<A>::template read_element<1,1>(a)==mat_traits<B>::template read_element<1,1>(b)) || | |
1483 | !(mat_traits<A>::template read_element<1,2>(a)==mat_traits<B>::template read_element<1,2>(b)) || | |
1484 | !(mat_traits<A>::template read_element<1,3>(a)==mat_traits<B>::template read_element<1,3>(b)) || | |
1485 | !(mat_traits<A>::template read_element<2,0>(a)==mat_traits<B>::template read_element<2,0>(b)) || | |
1486 | !(mat_traits<A>::template read_element<2,1>(a)==mat_traits<B>::template read_element<2,1>(b)) || | |
1487 | !(mat_traits<A>::template read_element<2,2>(a)==mat_traits<B>::template read_element<2,2>(b)) || | |
1488 | !(mat_traits<A>::template read_element<2,3>(a)==mat_traits<B>::template read_element<2,3>(b)) || | |
1489 | !(mat_traits<A>::template read_element<3,0>(a)==mat_traits<B>::template read_element<3,0>(b)) || | |
1490 | !(mat_traits<A>::template read_element<3,1>(a)==mat_traits<B>::template read_element<3,1>(b)) || | |
1491 | !(mat_traits<A>::template read_element<3,2>(a)==mat_traits<B>::template read_element<3,2>(b)) || | |
1492 | !(mat_traits<A>::template read_element<3,3>(a)==mat_traits<B>::template read_element<3,3>(b)); | |
1493 | } | |
1494 | ||
1495 | namespace | |
1496 | sfinae | |
1497 | { | |
1498 | using ::boost::qvm::operator!=; | |
1499 | } | |
1500 | ||
1501 | namespace | |
1502 | qvm_detail | |
1503 | { | |
1504 | template <int R,int C> | |
1505 | struct neq_mm_defined; | |
1506 | ||
1507 | template <> | |
1508 | struct | |
1509 | neq_mm_defined<4,4> | |
1510 | { | |
1511 | static bool const value=true; | |
1512 | }; | |
1513 | } | |
1514 | ||
1515 | template <class A,class B> | |
1516 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1517 | typename enable_if_c< | |
1518 | mat_traits<A>::rows==4 && mat_traits<B>::rows==4 && | |
1519 | mat_traits<A>::cols==1 && mat_traits<B>::cols==1, | |
1520 | bool>::type | |
1521 | operator!=( A const & a, B const & b ) | |
1522 | { | |
1523 | return | |
1524 | !(mat_traits<A>::template read_element<0,0>(a)==mat_traits<B>::template read_element<0,0>(b)) || | |
1525 | !(mat_traits<A>::template read_element<1,0>(a)==mat_traits<B>::template read_element<1,0>(b)) || | |
1526 | !(mat_traits<A>::template read_element<2,0>(a)==mat_traits<B>::template read_element<2,0>(b)) || | |
1527 | !(mat_traits<A>::template read_element<3,0>(a)==mat_traits<B>::template read_element<3,0>(b)); | |
1528 | } | |
1529 | ||
1530 | namespace | |
1531 | sfinae | |
1532 | { | |
1533 | using ::boost::qvm::operator!=; | |
1534 | } | |
1535 | ||
1536 | namespace | |
1537 | qvm_detail | |
1538 | { | |
1539 | template <int R,int C> | |
1540 | struct neq_mm_defined; | |
1541 | ||
1542 | template <> | |
1543 | struct | |
1544 | neq_mm_defined<4,1> | |
1545 | { | |
1546 | static bool const value=true; | |
1547 | }; | |
1548 | } | |
1549 | ||
1550 | template <class A,class B> | |
1551 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1552 | typename enable_if_c< | |
1553 | mat_traits<A>::rows==1 && mat_traits<B>::rows==1 && | |
1554 | mat_traits<A>::cols==4 && mat_traits<B>::cols==4, | |
1555 | bool>::type | |
1556 | operator!=( A const & a, B const & b ) | |
1557 | { | |
1558 | return | |
1559 | !(mat_traits<A>::template read_element<0,0>(a)==mat_traits<B>::template read_element<0,0>(b)) || | |
1560 | !(mat_traits<A>::template read_element<0,1>(a)==mat_traits<B>::template read_element<0,1>(b)) || | |
1561 | !(mat_traits<A>::template read_element<0,2>(a)==mat_traits<B>::template read_element<0,2>(b)) || | |
1562 | !(mat_traits<A>::template read_element<0,3>(a)==mat_traits<B>::template read_element<0,3>(b)); | |
1563 | } | |
1564 | ||
1565 | namespace | |
1566 | sfinae | |
1567 | { | |
1568 | using ::boost::qvm::operator!=; | |
1569 | } | |
1570 | ||
1571 | namespace | |
1572 | qvm_detail | |
1573 | { | |
1574 | template <int R,int C> | |
1575 | struct neq_mm_defined; | |
1576 | ||
1577 | template <> | |
1578 | struct | |
1579 | neq_mm_defined<1,4> | |
1580 | { | |
1581 | static bool const value=true; | |
1582 | }; | |
1583 | } | |
1584 | ||
1585 | template <class A> | |
1586 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1587 | typename lazy_enable_if_c< | |
1588 | mat_traits<A>::rows==4 && mat_traits<A>::cols==4, | |
1589 | deduce_mat<A> >::type | |
1590 | operator-( A const & a ) | |
1591 | { | |
1592 | typedef typename deduce_mat<A>::type R; | |
1593 | R r; | |
1594 | mat_traits<R>::template write_element<0,0>(r)=-mat_traits<A>::template read_element<0,0>(a); | |
1595 | mat_traits<R>::template write_element<0,1>(r)=-mat_traits<A>::template read_element<0,1>(a); | |
1596 | mat_traits<R>::template write_element<0,2>(r)=-mat_traits<A>::template read_element<0,2>(a); | |
1597 | mat_traits<R>::template write_element<0,3>(r)=-mat_traits<A>::template read_element<0,3>(a); | |
1598 | mat_traits<R>::template write_element<1,0>(r)=-mat_traits<A>::template read_element<1,0>(a); | |
1599 | mat_traits<R>::template write_element<1,1>(r)=-mat_traits<A>::template read_element<1,1>(a); | |
1600 | mat_traits<R>::template write_element<1,2>(r)=-mat_traits<A>::template read_element<1,2>(a); | |
1601 | mat_traits<R>::template write_element<1,3>(r)=-mat_traits<A>::template read_element<1,3>(a); | |
1602 | mat_traits<R>::template write_element<2,0>(r)=-mat_traits<A>::template read_element<2,0>(a); | |
1603 | mat_traits<R>::template write_element<2,1>(r)=-mat_traits<A>::template read_element<2,1>(a); | |
1604 | mat_traits<R>::template write_element<2,2>(r)=-mat_traits<A>::template read_element<2,2>(a); | |
1605 | mat_traits<R>::template write_element<2,3>(r)=-mat_traits<A>::template read_element<2,3>(a); | |
1606 | mat_traits<R>::template write_element<3,0>(r)=-mat_traits<A>::template read_element<3,0>(a); | |
1607 | mat_traits<R>::template write_element<3,1>(r)=-mat_traits<A>::template read_element<3,1>(a); | |
1608 | mat_traits<R>::template write_element<3,2>(r)=-mat_traits<A>::template read_element<3,2>(a); | |
1609 | mat_traits<R>::template write_element<3,3>(r)=-mat_traits<A>::template read_element<3,3>(a); | |
1610 | return r; | |
1611 | } | |
1612 | ||
1613 | namespace | |
1614 | sfinae | |
1615 | { | |
1616 | using ::boost::qvm::operator-; | |
1617 | } | |
1618 | ||
1619 | namespace | |
1620 | qvm_detail | |
1621 | { | |
1622 | template <int R,int C> | |
1623 | struct minus_m_defined; | |
1624 | ||
1625 | template <> | |
1626 | struct | |
1627 | minus_m_defined<4,4> | |
1628 | { | |
1629 | static bool const value=true; | |
1630 | }; | |
1631 | } | |
1632 | ||
1633 | template <class A> | |
1634 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1635 | typename lazy_enable_if_c< | |
1636 | mat_traits<A>::rows==4 && mat_traits<A>::cols==1, | |
1637 | deduce_mat<A> >::type | |
1638 | operator-( A const & a ) | |
1639 | { | |
1640 | typedef typename deduce_mat<A>::type R; | |
1641 | R r; | |
1642 | mat_traits<R>::template write_element<0,0>(r)=-mat_traits<A>::template read_element<0,0>(a); | |
1643 | mat_traits<R>::template write_element<1,0>(r)=-mat_traits<A>::template read_element<1,0>(a); | |
1644 | mat_traits<R>::template write_element<2,0>(r)=-mat_traits<A>::template read_element<2,0>(a); | |
1645 | mat_traits<R>::template write_element<3,0>(r)=-mat_traits<A>::template read_element<3,0>(a); | |
1646 | return r; | |
1647 | } | |
1648 | ||
1649 | namespace | |
1650 | sfinae | |
1651 | { | |
1652 | using ::boost::qvm::operator-; | |
1653 | } | |
1654 | ||
1655 | namespace | |
1656 | qvm_detail | |
1657 | { | |
1658 | template <int R,int C> | |
1659 | struct minus_m_defined; | |
1660 | ||
1661 | template <> | |
1662 | struct | |
1663 | minus_m_defined<4,1> | |
1664 | { | |
1665 | static bool const value=true; | |
1666 | }; | |
1667 | } | |
1668 | ||
1669 | template <class A> | |
1670 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1671 | typename lazy_enable_if_c< | |
1672 | mat_traits<A>::rows==1 && mat_traits<A>::cols==4, | |
1673 | deduce_mat<A> >::type | |
1674 | operator-( A const & a ) | |
1675 | { | |
1676 | typedef typename deduce_mat<A>::type R; | |
1677 | R r; | |
1678 | mat_traits<R>::template write_element<0,0>(r)=-mat_traits<A>::template read_element<0,0>(a); | |
1679 | mat_traits<R>::template write_element<0,1>(r)=-mat_traits<A>::template read_element<0,1>(a); | |
1680 | mat_traits<R>::template write_element<0,2>(r)=-mat_traits<A>::template read_element<0,2>(a); | |
1681 | mat_traits<R>::template write_element<0,3>(r)=-mat_traits<A>::template read_element<0,3>(a); | |
1682 | return r; | |
1683 | } | |
1684 | ||
1685 | namespace | |
1686 | sfinae | |
1687 | { | |
1688 | using ::boost::qvm::operator-; | |
1689 | } | |
1690 | ||
1691 | namespace | |
1692 | qvm_detail | |
1693 | { | |
1694 | template <int R,int C> | |
1695 | struct minus_m_defined; | |
1696 | ||
1697 | template <> | |
1698 | struct | |
1699 | minus_m_defined<1,4> | |
1700 | { | |
1701 | static bool const value=true; | |
1702 | }; | |
1703 | } | |
1704 | ||
1705 | template <class A> | |
1706 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1707 | typename enable_if_c< | |
1708 | mat_traits<A>::rows==4 && mat_traits<A>::cols==4, | |
1709 | typename mat_traits<A>::scalar_type>::type | |
1710 | determinant( A const & a ) | |
1711 | { | |
1712 | typedef typename mat_traits<A>::scalar_type T; | |
1713 | T const a00=mat_traits<A>::template read_element<0,0>(a); | |
1714 | T const a01=mat_traits<A>::template read_element<0,1>(a); | |
1715 | T const a02=mat_traits<A>::template read_element<0,2>(a); | |
1716 | T const a03=mat_traits<A>::template read_element<0,3>(a); | |
1717 | T const a10=mat_traits<A>::template read_element<1,0>(a); | |
1718 | T const a11=mat_traits<A>::template read_element<1,1>(a); | |
1719 | T const a12=mat_traits<A>::template read_element<1,2>(a); | |
1720 | T const a13=mat_traits<A>::template read_element<1,3>(a); | |
1721 | T const a20=mat_traits<A>::template read_element<2,0>(a); | |
1722 | T const a21=mat_traits<A>::template read_element<2,1>(a); | |
1723 | T const a22=mat_traits<A>::template read_element<2,2>(a); | |
1724 | T const a23=mat_traits<A>::template read_element<2,3>(a); | |
1725 | T const a30=mat_traits<A>::template read_element<3,0>(a); | |
1726 | T const a31=mat_traits<A>::template read_element<3,1>(a); | |
1727 | T const a32=mat_traits<A>::template read_element<3,2>(a); | |
1728 | T const a33=mat_traits<A>::template read_element<3,3>(a); | |
1729 | T det=(a00*(a11*(a22*a33-a23*a32)-a12*(a21*a33-a23*a31)+a13*(a21*a32-a22*a31))-a01*(a10*(a22*a33-a23*a32)-a12*(a20*a33-a23*a30)+a13*(a20*a32-a22*a30))+a02*(a10*(a21*a33-a23*a31)-a11*(a20*a33-a23*a30)+a13*(a20*a31-a21*a30))-a03*(a10*(a21*a32-a22*a31)-a11*(a20*a32-a22*a30)+a12*(a20*a31-a21*a30))); | |
1730 | return det; | |
1731 | } | |
1732 | ||
1733 | namespace | |
1734 | sfinae | |
1735 | { | |
1736 | using ::boost::qvm::determinant; | |
1737 | } | |
1738 | ||
1739 | namespace | |
1740 | qvm_detail | |
1741 | { | |
1742 | template <int D> | |
1743 | struct determinant_defined; | |
1744 | ||
1745 | template <> | |
1746 | struct | |
1747 | determinant_defined<4> | |
1748 | { | |
1749 | static bool const value=true; | |
1750 | }; | |
1751 | } | |
1752 | ||
1753 | template <class A,class B> | |
1754 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1755 | typename lazy_enable_if_c< | |
1756 | mat_traits<A>::rows==4 && mat_traits<A>::cols==4 && is_scalar<B>::value, | |
1757 | deduce_mat2<A,B,mat_traits<A>::rows,mat_traits<A>::cols> >::type | |
1758 | inverse( A const & a, B det ) | |
1759 | { | |
1760 | typedef typename mat_traits<A>::scalar_type T; | |
1761 | BOOST_QVM_ASSERT(det!=scalar_traits<B>::value(0)); | |
1762 | T const a00=mat_traits<A>::template read_element<0,0>(a); | |
1763 | T const a01=mat_traits<A>::template read_element<0,1>(a); | |
1764 | T const a02=mat_traits<A>::template read_element<0,2>(a); | |
1765 | T const a03=mat_traits<A>::template read_element<0,3>(a); | |
1766 | T const a10=mat_traits<A>::template read_element<1,0>(a); | |
1767 | T const a11=mat_traits<A>::template read_element<1,1>(a); | |
1768 | T const a12=mat_traits<A>::template read_element<1,2>(a); | |
1769 | T const a13=mat_traits<A>::template read_element<1,3>(a); | |
1770 | T const a20=mat_traits<A>::template read_element<2,0>(a); | |
1771 | T const a21=mat_traits<A>::template read_element<2,1>(a); | |
1772 | T const a22=mat_traits<A>::template read_element<2,2>(a); | |
1773 | T const a23=mat_traits<A>::template read_element<2,3>(a); | |
1774 | T const a30=mat_traits<A>::template read_element<3,0>(a); | |
1775 | T const a31=mat_traits<A>::template read_element<3,1>(a); | |
1776 | T const a32=mat_traits<A>::template read_element<3,2>(a); | |
1777 | T const a33=mat_traits<A>::template read_element<3,3>(a); | |
1778 | T const f=scalar_traits<T>::value(1)/det; | |
1779 | typedef typename deduce_mat2<A,B,mat_traits<A>::rows,mat_traits<A>::cols>::type R; | |
1780 | R r; | |
1781 | mat_traits<R>::template write_element<0,0>(r)= f*(a11*(a22*a33-a23*a32)-a12*(a21*a33-a23*a31)+a13*(a21*a32-a22*a31)); | |
1782 | mat_traits<R>::template write_element<0,1>(r)=-f*(a01*(a22*a33-a23*a32)-a02*(a21*a33-a23*a31)+a03*(a21*a32-a22*a31)); | |
1783 | mat_traits<R>::template write_element<0,2>(r)= f*(a01*(a12*a33-a13*a32)-a02*(a11*a33-a13*a31)+a03*(a11*a32-a12*a31)); | |
1784 | mat_traits<R>::template write_element<0,3>(r)=-f*(a01*(a12*a23-a13*a22)-a02*(a11*a23-a13*a21)+a03*(a11*a22-a12*a21)); | |
1785 | mat_traits<R>::template write_element<1,0>(r)=-f*(a10*(a22*a33-a23*a32)-a12*(a20*a33-a23*a30)+a13*(a20*a32-a22*a30)); | |
1786 | mat_traits<R>::template write_element<1,1>(r)= f*(a00*(a22*a33-a23*a32)-a02*(a20*a33-a23*a30)+a03*(a20*a32-a22*a30)); | |
1787 | mat_traits<R>::template write_element<1,2>(r)=-f*(a00*(a12*a33-a13*a32)-a02*(a10*a33-a13*a30)+a03*(a10*a32-a12*a30)); | |
1788 | mat_traits<R>::template write_element<1,3>(r)= f*(a00*(a12*a23-a13*a22)-a02*(a10*a23-a13*a20)+a03*(a10*a22-a12*a20)); | |
1789 | mat_traits<R>::template write_element<2,0>(r)= f*(a10*(a21*a33-a23*a31)-a11*(a20*a33-a23*a30)+a13*(a20*a31-a21*a30)); | |
1790 | mat_traits<R>::template write_element<2,1>(r)=-f*(a00*(a21*a33-a23*a31)-a01*(a20*a33-a23*a30)+a03*(a20*a31-a21*a30)); | |
1791 | mat_traits<R>::template write_element<2,2>(r)= f*(a00*(a11*a33-a13*a31)-a01*(a10*a33-a13*a30)+a03*(a10*a31-a11*a30)); | |
1792 | mat_traits<R>::template write_element<2,3>(r)=-f*(a00*(a11*a23-a13*a21)-a01*(a10*a23-a13*a20)+a03*(a10*a21-a11*a20)); | |
1793 | mat_traits<R>::template write_element<3,0>(r)=-f*(a10*(a21*a32-a22*a31)-a11*(a20*a32-a22*a30)+a12*(a20*a31-a21*a30)); | |
1794 | mat_traits<R>::template write_element<3,1>(r)= f*(a00*(a21*a32-a22*a31)-a01*(a20*a32-a22*a30)+a02*(a20*a31-a21*a30)); | |
1795 | mat_traits<R>::template write_element<3,2>(r)=-f*(a00*(a11*a32-a12*a31)-a01*(a10*a32-a12*a30)+a02*(a10*a31-a11*a30)); | |
1796 | mat_traits<R>::template write_element<3,3>(r)= f*(a00*(a11*a22-a12*a21)-a01*(a10*a22-a12*a20)+a02*(a10*a21-a11*a20)); | |
1797 | return r; | |
1798 | } | |
1799 | ||
1800 | template <class A> | |
1801 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1802 | typename lazy_enable_if_c< | |
1803 | mat_traits<A>::rows==4 && mat_traits<A>::cols==4, | |
1804 | deduce_mat<A> >::type | |
1805 | inverse( A const & a ) | |
1806 | { | |
1807 | typedef typename mat_traits<A>::scalar_type T; | |
1808 | T det=determinant(a); | |
1809 | if( det==scalar_traits<T>::value(0) ) | |
1810 | BOOST_QVM_THROW_EXCEPTION(zero_determinant_error()); | |
1811 | return inverse(a,det); | |
1812 | } | |
1813 | ||
1814 | namespace | |
1815 | sfinae | |
1816 | { | |
1817 | using ::boost::qvm::inverse; | |
1818 | } | |
1819 | ||
1820 | namespace | |
1821 | qvm_detail | |
1822 | { | |
1823 | template <int D> | |
1824 | struct inverse_m_defined; | |
1825 | ||
1826 | template <> | |
1827 | struct | |
1828 | inverse_m_defined<4> | |
1829 | { | |
1830 | static bool const value=true; | |
1831 | }; | |
1832 | } | |
1833 | ||
1834 | template <class A,class B> | |
1835 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1836 | typename lazy_enable_if_c< | |
1837 | mat_traits<A>::rows==4 && mat_traits<B>::rows==4 && | |
1838 | mat_traits<A>::cols==4 && mat_traits<B>::cols==4, | |
1839 | deduce_mat2<A,B,4,4> >::type | |
1840 | operator*( A const & a, B const & b ) | |
1841 | { | |
1842 | typedef typename mat_traits<A>::scalar_type Ta; | |
1843 | typedef typename mat_traits<B>::scalar_type Tb; | |
1844 | Ta const a00 = mat_traits<A>::template read_element<0,0>(a); | |
1845 | Ta const a01 = mat_traits<A>::template read_element<0,1>(a); | |
1846 | Ta const a02 = mat_traits<A>::template read_element<0,2>(a); | |
1847 | Ta const a03 = mat_traits<A>::template read_element<0,3>(a); | |
1848 | Ta const a10 = mat_traits<A>::template read_element<1,0>(a); | |
1849 | Ta const a11 = mat_traits<A>::template read_element<1,1>(a); | |
1850 | Ta const a12 = mat_traits<A>::template read_element<1,2>(a); | |
1851 | Ta const a13 = mat_traits<A>::template read_element<1,3>(a); | |
1852 | Ta const a20 = mat_traits<A>::template read_element<2,0>(a); | |
1853 | Ta const a21 = mat_traits<A>::template read_element<2,1>(a); | |
1854 | Ta const a22 = mat_traits<A>::template read_element<2,2>(a); | |
1855 | Ta const a23 = mat_traits<A>::template read_element<2,3>(a); | |
1856 | Ta const a30 = mat_traits<A>::template read_element<3,0>(a); | |
1857 | Ta const a31 = mat_traits<A>::template read_element<3,1>(a); | |
1858 | Ta const a32 = mat_traits<A>::template read_element<3,2>(a); | |
1859 | Ta const a33 = mat_traits<A>::template read_element<3,3>(a); | |
1860 | Tb const b00 = mat_traits<B>::template read_element<0,0>(b); | |
1861 | Tb const b01 = mat_traits<B>::template read_element<0,1>(b); | |
1862 | Tb const b02 = mat_traits<B>::template read_element<0,2>(b); | |
1863 | Tb const b03 = mat_traits<B>::template read_element<0,3>(b); | |
1864 | Tb const b10 = mat_traits<B>::template read_element<1,0>(b); | |
1865 | Tb const b11 = mat_traits<B>::template read_element<1,1>(b); | |
1866 | Tb const b12 = mat_traits<B>::template read_element<1,2>(b); | |
1867 | Tb const b13 = mat_traits<B>::template read_element<1,3>(b); | |
1868 | Tb const b20 = mat_traits<B>::template read_element<2,0>(b); | |
1869 | Tb const b21 = mat_traits<B>::template read_element<2,1>(b); | |
1870 | Tb const b22 = mat_traits<B>::template read_element<2,2>(b); | |
1871 | Tb const b23 = mat_traits<B>::template read_element<2,3>(b); | |
1872 | Tb const b30 = mat_traits<B>::template read_element<3,0>(b); | |
1873 | Tb const b31 = mat_traits<B>::template read_element<3,1>(b); | |
1874 | Tb const b32 = mat_traits<B>::template read_element<3,2>(b); | |
1875 | Tb const b33 = mat_traits<B>::template read_element<3,3>(b); | |
1876 | typedef typename deduce_mat2<A,B,4,4>::type R; | |
1877 | BOOST_QVM_STATIC_ASSERT(mat_traits<R>::rows==4); | |
1878 | BOOST_QVM_STATIC_ASSERT(mat_traits<R>::cols==4); | |
1879 | R r; | |
1880 | mat_traits<R>::template write_element<0,0>(r)=a00*b00+a01*b10+a02*b20+a03*b30; | |
1881 | mat_traits<R>::template write_element<0,1>(r)=a00*b01+a01*b11+a02*b21+a03*b31; | |
1882 | mat_traits<R>::template write_element<0,2>(r)=a00*b02+a01*b12+a02*b22+a03*b32; | |
1883 | mat_traits<R>::template write_element<0,3>(r)=a00*b03+a01*b13+a02*b23+a03*b33; | |
1884 | mat_traits<R>::template write_element<1,0>(r)=a10*b00+a11*b10+a12*b20+a13*b30; | |
1885 | mat_traits<R>::template write_element<1,1>(r)=a10*b01+a11*b11+a12*b21+a13*b31; | |
1886 | mat_traits<R>::template write_element<1,2>(r)=a10*b02+a11*b12+a12*b22+a13*b32; | |
1887 | mat_traits<R>::template write_element<1,3>(r)=a10*b03+a11*b13+a12*b23+a13*b33; | |
1888 | mat_traits<R>::template write_element<2,0>(r)=a20*b00+a21*b10+a22*b20+a23*b30; | |
1889 | mat_traits<R>::template write_element<2,1>(r)=a20*b01+a21*b11+a22*b21+a23*b31; | |
1890 | mat_traits<R>::template write_element<2,2>(r)=a20*b02+a21*b12+a22*b22+a23*b32; | |
1891 | mat_traits<R>::template write_element<2,3>(r)=a20*b03+a21*b13+a22*b23+a23*b33; | |
1892 | mat_traits<R>::template write_element<3,0>(r)=a30*b00+a31*b10+a32*b20+a33*b30; | |
1893 | mat_traits<R>::template write_element<3,1>(r)=a30*b01+a31*b11+a32*b21+a33*b31; | |
1894 | mat_traits<R>::template write_element<3,2>(r)=a30*b02+a31*b12+a32*b22+a33*b32; | |
1895 | mat_traits<R>::template write_element<3,3>(r)=a30*b03+a31*b13+a32*b23+a33*b33; | |
1896 | return r; | |
1897 | } | |
1898 | ||
1899 | namespace | |
1900 | sfinae | |
1901 | { | |
1902 | using ::boost::qvm::operator*; | |
1903 | } | |
1904 | ||
1905 | namespace | |
1906 | qvm_detail | |
1907 | { | |
1908 | template <int R,int /*CR*/,int C> | |
1909 | struct mul_mm_defined; | |
1910 | ||
1911 | template <> | |
1912 | struct | |
1913 | mul_mm_defined<4,4,4> | |
1914 | { | |
1915 | static bool const value=true; | |
1916 | }; | |
1917 | } | |
1918 | ||
1919 | template <class A,class B> | |
1920 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
1921 | typename enable_if_c< | |
1922 | mat_traits<A>::rows==4 && mat_traits<B>::rows==4 && | |
1923 | mat_traits<A>::cols==4 && mat_traits<B>::cols==4, | |
1924 | A &>::type | |
1925 | operator*=( A & a, B const & b ) | |
1926 | { | |
1927 | typedef typename mat_traits<A>::scalar_type Ta; | |
1928 | typedef typename mat_traits<B>::scalar_type Tb; | |
1929 | Ta const a00 = mat_traits<A>::template read_element<0,0>(a); | |
1930 | Ta const a01 = mat_traits<A>::template read_element<0,1>(a); | |
1931 | Ta const a02 = mat_traits<A>::template read_element<0,2>(a); | |
1932 | Ta const a03 = mat_traits<A>::template read_element<0,3>(a); | |
1933 | Ta const a10 = mat_traits<A>::template read_element<1,0>(a); | |
1934 | Ta const a11 = mat_traits<A>::template read_element<1,1>(a); | |
1935 | Ta const a12 = mat_traits<A>::template read_element<1,2>(a); | |
1936 | Ta const a13 = mat_traits<A>::template read_element<1,3>(a); | |
1937 | Ta const a20 = mat_traits<A>::template read_element<2,0>(a); | |
1938 | Ta const a21 = mat_traits<A>::template read_element<2,1>(a); | |
1939 | Ta const a22 = mat_traits<A>::template read_element<2,2>(a); | |
1940 | Ta const a23 = mat_traits<A>::template read_element<2,3>(a); | |
1941 | Ta const a30 = mat_traits<A>::template read_element<3,0>(a); | |
1942 | Ta const a31 = mat_traits<A>::template read_element<3,1>(a); | |
1943 | Ta const a32 = mat_traits<A>::template read_element<3,2>(a); | |
1944 | Ta const a33 = mat_traits<A>::template read_element<3,3>(a); | |
1945 | Tb const b00 = mat_traits<B>::template read_element<0,0>(b); | |
1946 | Tb const b01 = mat_traits<B>::template read_element<0,1>(b); | |
1947 | Tb const b02 = mat_traits<B>::template read_element<0,2>(b); | |
1948 | Tb const b03 = mat_traits<B>::template read_element<0,3>(b); | |
1949 | Tb const b10 = mat_traits<B>::template read_element<1,0>(b); | |
1950 | Tb const b11 = mat_traits<B>::template read_element<1,1>(b); | |
1951 | Tb const b12 = mat_traits<B>::template read_element<1,2>(b); | |
1952 | Tb const b13 = mat_traits<B>::template read_element<1,3>(b); | |
1953 | Tb const b20 = mat_traits<B>::template read_element<2,0>(b); | |
1954 | Tb const b21 = mat_traits<B>::template read_element<2,1>(b); | |
1955 | Tb const b22 = mat_traits<B>::template read_element<2,2>(b); | |
1956 | Tb const b23 = mat_traits<B>::template read_element<2,3>(b); | |
1957 | Tb const b30 = mat_traits<B>::template read_element<3,0>(b); | |
1958 | Tb const b31 = mat_traits<B>::template read_element<3,1>(b); | |
1959 | Tb const b32 = mat_traits<B>::template read_element<3,2>(b); | |
1960 | Tb const b33 = mat_traits<B>::template read_element<3,3>(b); | |
1961 | mat_traits<A>::template write_element<0,0>(a)=a00*b00+a01*b10+a02*b20+a03*b30; | |
1962 | mat_traits<A>::template write_element<0,1>(a)=a00*b01+a01*b11+a02*b21+a03*b31; | |
1963 | mat_traits<A>::template write_element<0,2>(a)=a00*b02+a01*b12+a02*b22+a03*b32; | |
1964 | mat_traits<A>::template write_element<0,3>(a)=a00*b03+a01*b13+a02*b23+a03*b33; | |
1965 | mat_traits<A>::template write_element<1,0>(a)=a10*b00+a11*b10+a12*b20+a13*b30; | |
1966 | mat_traits<A>::template write_element<1,1>(a)=a10*b01+a11*b11+a12*b21+a13*b31; | |
1967 | mat_traits<A>::template write_element<1,2>(a)=a10*b02+a11*b12+a12*b22+a13*b32; | |
1968 | mat_traits<A>::template write_element<1,3>(a)=a10*b03+a11*b13+a12*b23+a13*b33; | |
1969 | mat_traits<A>::template write_element<2,0>(a)=a20*b00+a21*b10+a22*b20+a23*b30; | |
1970 | mat_traits<A>::template write_element<2,1>(a)=a20*b01+a21*b11+a22*b21+a23*b31; | |
1971 | mat_traits<A>::template write_element<2,2>(a)=a20*b02+a21*b12+a22*b22+a23*b32; | |
1972 | mat_traits<A>::template write_element<2,3>(a)=a20*b03+a21*b13+a22*b23+a23*b33; | |
1973 | mat_traits<A>::template write_element<3,0>(a)=a30*b00+a31*b10+a32*b20+a33*b30; | |
1974 | mat_traits<A>::template write_element<3,1>(a)=a30*b01+a31*b11+a32*b21+a33*b31; | |
1975 | mat_traits<A>::template write_element<3,2>(a)=a30*b02+a31*b12+a32*b22+a33*b32; | |
1976 | mat_traits<A>::template write_element<3,3>(a)=a30*b03+a31*b13+a32*b23+a33*b33; | |
1977 | return a; | |
1978 | } | |
1979 | ||
92f5a8d4 | 1980 | namespace |
1e59de90 | 1981 | sfinae |
92f5a8d4 | 1982 | { |
1e59de90 TL |
1983 | using ::boost::qvm::operator*=; |
1984 | } | |
1985 | ||
1986 | namespace | |
1987 | qvm_detail | |
1988 | { | |
1989 | template <int D> | |
1990 | struct mul_eq_mm_defined; | |
1991 | ||
1992 | template <> | |
1993 | struct | |
1994 | mul_eq_mm_defined<4> | |
1995 | { | |
1996 | static bool const value=true; | |
1997 | }; | |
1998 | } | |
1999 | ||
2000 | template <class A,class B> | |
2001 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
2002 | typename lazy_enable_if_c< | |
2003 | mat_traits<A>::rows==4 && mat_traits<B>::rows==4 && | |
2004 | mat_traits<A>::cols==4 && mat_traits<B>::cols==1, | |
2005 | deduce_mat2<A,B,4,1> >::type | |
2006 | operator*( A const & a, B const & b ) | |
2007 | { | |
2008 | typedef typename mat_traits<A>::scalar_type Ta; | |
2009 | typedef typename mat_traits<B>::scalar_type Tb; | |
2010 | Ta const a00 = mat_traits<A>::template read_element<0,0>(a); | |
2011 | Ta const a01 = mat_traits<A>::template read_element<0,1>(a); | |
2012 | Ta const a02 = mat_traits<A>::template read_element<0,2>(a); | |
2013 | Ta const a03 = mat_traits<A>::template read_element<0,3>(a); | |
2014 | Ta const a10 = mat_traits<A>::template read_element<1,0>(a); | |
2015 | Ta const a11 = mat_traits<A>::template read_element<1,1>(a); | |
2016 | Ta const a12 = mat_traits<A>::template read_element<1,2>(a); | |
2017 | Ta const a13 = mat_traits<A>::template read_element<1,3>(a); | |
2018 | Ta const a20 = mat_traits<A>::template read_element<2,0>(a); | |
2019 | Ta const a21 = mat_traits<A>::template read_element<2,1>(a); | |
2020 | Ta const a22 = mat_traits<A>::template read_element<2,2>(a); | |
2021 | Ta const a23 = mat_traits<A>::template read_element<2,3>(a); | |
2022 | Ta const a30 = mat_traits<A>::template read_element<3,0>(a); | |
2023 | Ta const a31 = mat_traits<A>::template read_element<3,1>(a); | |
2024 | Ta const a32 = mat_traits<A>::template read_element<3,2>(a); | |
2025 | Ta const a33 = mat_traits<A>::template read_element<3,3>(a); | |
2026 | Tb const b00 = mat_traits<B>::template read_element<0,0>(b); | |
2027 | Tb const b10 = mat_traits<B>::template read_element<1,0>(b); | |
2028 | Tb const b20 = mat_traits<B>::template read_element<2,0>(b); | |
2029 | Tb const b30 = mat_traits<B>::template read_element<3,0>(b); | |
2030 | typedef typename deduce_mat2<A,B,4,1>::type R; | |
2031 | BOOST_QVM_STATIC_ASSERT(mat_traits<R>::rows==4); | |
2032 | BOOST_QVM_STATIC_ASSERT(mat_traits<R>::cols==1); | |
2033 | R r; | |
2034 | mat_traits<R>::template write_element<0,0>(r)=a00*b00+a01*b10+a02*b20+a03*b30; | |
2035 | mat_traits<R>::template write_element<1,0>(r)=a10*b00+a11*b10+a12*b20+a13*b30; | |
2036 | mat_traits<R>::template write_element<2,0>(r)=a20*b00+a21*b10+a22*b20+a23*b30; | |
2037 | mat_traits<R>::template write_element<3,0>(r)=a30*b00+a31*b10+a32*b20+a33*b30; | |
2038 | return r; | |
2039 | } | |
2040 | ||
2041 | namespace | |
2042 | sfinae | |
2043 | { | |
2044 | using ::boost::qvm::operator*; | |
2045 | } | |
2046 | ||
2047 | namespace | |
2048 | qvm_detail | |
2049 | { | |
2050 | template <int R,int /*CR*/,int C> | |
2051 | struct mul_mm_defined; | |
2052 | ||
2053 | template <> | |
2054 | struct | |
2055 | mul_mm_defined<4,4,1> | |
2056 | { | |
2057 | static bool const value=true; | |
2058 | }; | |
2059 | } | |
2060 | ||
2061 | template <class A,class B> | |
2062 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
2063 | typename lazy_enable_if_c< | |
2064 | mat_traits<A>::rows==1 && mat_traits<B>::rows==4 && | |
2065 | mat_traits<A>::cols==4 && mat_traits<B>::cols==4, | |
2066 | deduce_mat2<A,B,1,4> >::type | |
2067 | operator*( A const & a, B const & b ) | |
2068 | { | |
2069 | typedef typename mat_traits<A>::scalar_type Ta; | |
2070 | typedef typename mat_traits<B>::scalar_type Tb; | |
2071 | Ta const a00 = mat_traits<A>::template read_element<0,0>(a); | |
2072 | Ta const a01 = mat_traits<A>::template read_element<0,1>(a); | |
2073 | Ta const a02 = mat_traits<A>::template read_element<0,2>(a); | |
2074 | Ta const a03 = mat_traits<A>::template read_element<0,3>(a); | |
2075 | Tb const b00 = mat_traits<B>::template read_element<0,0>(b); | |
2076 | Tb const b01 = mat_traits<B>::template read_element<0,1>(b); | |
2077 | Tb const b02 = mat_traits<B>::template read_element<0,2>(b); | |
2078 | Tb const b03 = mat_traits<B>::template read_element<0,3>(b); | |
2079 | Tb const b10 = mat_traits<B>::template read_element<1,0>(b); | |
2080 | Tb const b11 = mat_traits<B>::template read_element<1,1>(b); | |
2081 | Tb const b12 = mat_traits<B>::template read_element<1,2>(b); | |
2082 | Tb const b13 = mat_traits<B>::template read_element<1,3>(b); | |
2083 | Tb const b20 = mat_traits<B>::template read_element<2,0>(b); | |
2084 | Tb const b21 = mat_traits<B>::template read_element<2,1>(b); | |
2085 | Tb const b22 = mat_traits<B>::template read_element<2,2>(b); | |
2086 | Tb const b23 = mat_traits<B>::template read_element<2,3>(b); | |
2087 | Tb const b30 = mat_traits<B>::template read_element<3,0>(b); | |
2088 | Tb const b31 = mat_traits<B>::template read_element<3,1>(b); | |
2089 | Tb const b32 = mat_traits<B>::template read_element<3,2>(b); | |
2090 | Tb const b33 = mat_traits<B>::template read_element<3,3>(b); | |
2091 | typedef typename deduce_mat2<A,B,1,4>::type R; | |
2092 | BOOST_QVM_STATIC_ASSERT(mat_traits<R>::rows==1); | |
2093 | BOOST_QVM_STATIC_ASSERT(mat_traits<R>::cols==4); | |
2094 | R r; | |
2095 | mat_traits<R>::template write_element<0,0>(r)=a00*b00+a01*b10+a02*b20+a03*b30; | |
2096 | mat_traits<R>::template write_element<0,1>(r)=a00*b01+a01*b11+a02*b21+a03*b31; | |
2097 | mat_traits<R>::template write_element<0,2>(r)=a00*b02+a01*b12+a02*b22+a03*b32; | |
2098 | mat_traits<R>::template write_element<0,3>(r)=a00*b03+a01*b13+a02*b23+a03*b33; | |
2099 | return r; | |
2100 | } | |
2101 | ||
2102 | namespace | |
2103 | sfinae | |
2104 | { | |
2105 | using ::boost::qvm::operator*; | |
2106 | } | |
2107 | ||
2108 | namespace | |
2109 | qvm_detail | |
2110 | { | |
2111 | template <int R,int /*CR*/,int C> | |
2112 | struct mul_mm_defined; | |
2113 | ||
2114 | template <> | |
2115 | struct | |
2116 | mul_mm_defined<1,4,4> | |
92f5a8d4 | 2117 | { |
1e59de90 TL |
2118 | static bool const value=true; |
2119 | }; | |
92f5a8d4 TL |
2120 | } |
2121 | ||
1e59de90 TL |
2122 | } } |
2123 | ||
92f5a8d4 | 2124 | #endif |