| 377 | |
| 378 | template <class T> |
| 379 | static Shear6<T> |
| 380 | rdivTuple(Shear6<T> &v, const tuple &t) |
| 381 | { |
| 382 | MATH_EXC_ON; |
| 383 | if(t.attr("__len__")() != 6) |
| 384 | throw std::domain_error ("Shear6 expects tuple of length 6"); |
| 385 | |
| 386 | Shear6<T> w; |
| 387 | for(int i = 0; i < 6; ++i) |
| 388 | { |
| 389 | T a = extract<T>(t[i]); |
| 390 | if(v[i] != T (0)) |
| 391 | w[i] = a / v[i]; |
| 392 | else |
| 393 | throw std::domain_error ("Division by Zero"); |
| 394 | } |
| 395 | |
| 396 | return w; |
| 397 | } |
| 398 | |
| 399 | template <class T> |
| 400 | static bool |