numpy
2.0.0
|
00001 #ifndef MEM_OVERLAP_H_ 00002 #define MEM_OVERLAP_H_ 00003 00004 #include "npy_config.h" 00005 #include "numpy/ndarraytypes.h" 00006 00007 00008 /* Bounds check only */ 00009 #define NPY_MAY_SHARE_BOUNDS 0 00010 00011 /* Exact solution */ 00012 #define NPY_MAY_SHARE_EXACT -1 00013 00014 00015 typedef enum { 00016 MEM_OVERLAP_NO = 0, /* no solution exists */ 00017 MEM_OVERLAP_YES = 1, /* solution found */ 00018 MEM_OVERLAP_TOO_HARD = -1, /* max_work exceeded */ 00019 MEM_OVERLAP_OVERFLOW = -2, /* algorithm failed due to integer overflow */ 00020 MEM_OVERLAP_ERROR = -3 /* invalid input */ 00021 } mem_overlap_t; 00022 00023 00024 typedef struct { 00025 npy_int64 a; 00026 npy_int64 ub; 00027 } diophantine_term_t; 00028 00029 NPY_VISIBILITY_HIDDEN mem_overlap_t 00030 solve_diophantine(unsigned int n, diophantine_term_t *E, 00031 npy_int64 b, Py_ssize_t max_work, int require_nontrivial, 00032 npy_int64 *x); 00033 00034 NPY_VISIBILITY_HIDDEN int 00035 diophantine_simplify(unsigned int *n, diophantine_term_t *E, npy_int64 b); 00036 00037 NPY_VISIBILITY_HIDDEN mem_overlap_t 00038 solve_may_share_memory(PyArrayObject *a, PyArrayObject *b, 00039 Py_ssize_t max_work); 00040 00041 NPY_VISIBILITY_HIDDEN mem_overlap_t 00042 solve_may_have_internal_overlap(PyArrayObject *a, Py_ssize_t max_work); 00043 00044 NPY_VISIBILITY_HIDDEN void 00045 offset_bounds_from_strides(const int itemsize, const int nd, 00046 const npy_intp *dims, const npy_intp *strides, 00047 npy_intp *lower_offset, npy_intp *upper_offset); 00048 00049 #endif 00050