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