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