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