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