| 711 | |
| 712 | |
| 713 | static int |
| 714 | strides_to_terms(PyArrayObject *arr, diophantine_term_t *terms, |
| 715 | unsigned int *nterms, int skip_empty) |
| 716 | { |
| 717 | int i; |
| 718 | |
| 719 | for (i = 0; i < PyArray_NDIM(arr); ++i) { |
| 720 | if (skip_empty) { |
| 721 | if (PyArray_DIM(arr, i) <= 1 || PyArray_STRIDE(arr, i) == 0) { |
| 722 | continue; |
| 723 | } |
| 724 | } |
| 725 | |
| 726 | terms[*nterms].a = PyArray_STRIDE(arr, i); |
| 727 | |
| 728 | if (terms[*nterms].a < 0) { |
| 729 | terms[*nterms].a = -terms[*nterms].a; |
| 730 | } |
| 731 | |
| 732 | if (terms[*nterms].a < 0) { |
| 733 | /* integer overflow */ |
| 734 | return 1; |
| 735 | } |
| 736 | |
| 737 | terms[*nterms].ub = PyArray_DIM(arr, i) - 1; |
| 738 | ++*nterms; |
| 739 | } |
| 740 | |
| 741 | return 0; |
| 742 | } |
| 743 | |
| 744 | |
| 745 | /** |
no test coverage detected