| 356 | |
| 357 | template <class T> |
| 358 | static Shear6<T> |
| 359 | divTuple(Shear6<T> &v, const tuple &t) |
| 360 | { |
| 361 | MATH_EXC_ON; |
| 362 | if(t.attr("__len__")() != 6) |
| 363 | throw std::domain_error ("Shear6 expects tuple of length 6"); |
| 364 | |
| 365 | Shear6<T> w; |
| 366 | for(int i = 0; i < 6; ++i) |
| 367 | { |
| 368 | T a = extract<T>(t[i]); |
| 369 | if(a != T (0)) |
| 370 | w[i] = v[i] / a; |
| 371 | else |
| 372 | throw std::domain_error ("Division by Zero"); |
| 373 | } |
| 374 | |
| 375 | return w; |
| 376 | } |
| 377 | |
| 378 | template <class T> |
| 379 | static Shear6<T> |