mylibrary/npyffi/
array.rs

1//! Low-Level binding for [Array API](https://numpy.org/doc/stable/reference/c-api/array.html)
2
3#![allow(non_camel_case_types)]
4#![allow(non_snake_case)]
5
6use std::os::raw::*;
7use std::ptr::null_mut;
8
9use libc::FILE;
10use python3_sys::{PyCapsule_GetPointer, PyObject, PyTypeObject};
11
12use crate::npyffi::*;
13use std::borrow::Borrow;
14
15pub type PyArray_GetNDArrayCVersion = unsafe extern "C" fn() -> c_uint;
16pub type PyArray_SetNumericOps = unsafe extern "C" fn(dict: *mut PyObject) -> c_int;
17pub type PyArray_GetNumericOps = unsafe extern "C" fn() -> *mut PyObject;
18pub type PyArray_INCREF = unsafe extern "C" fn(mp: *mut PyArrayObject) -> c_int;
19pub type PyArray_XDECREF = unsafe extern "C" fn(mp: *mut PyArrayObject) -> c_int;
20pub type PyArray_SetStringFunction = unsafe extern "C" fn(op: *mut PyObject, repr: c_int);
21pub type PyArray_DescrFromType = unsafe extern "C" fn(type_: c_int) -> *mut PyArray_Descr;
22pub type PyArray_TypeObjectFromType = unsafe extern "C" fn(type_: c_int) -> *mut PyObject;
23pub type PyArray_Zero = unsafe extern "C" fn(arr: *mut PyArrayObject) -> *mut c_char;
24pub type PyArray_One = unsafe extern "C" fn(arr: *mut PyArrayObject) -> *mut c_char;
25pub type PyArray_CastToType = unsafe extern "C" fn(arr: *mut PyArrayObject, dtype: *mut PyArray_Descr, is_f_order: c_int) -> *mut PyObject;
26pub type PyArray_CastTo = unsafe extern "C" fn(out: *mut PyArrayObject, mp: *mut PyArrayObject) -> c_int;
27pub type PyArray_CastAnyTo = unsafe extern "C" fn(out: *mut PyArrayObject, mp: *mut PyArrayObject) -> c_int;
28pub type PyArray_CanCastSafely = unsafe extern "C" fn(fromtype: c_int, totype: c_int) -> c_int;
29pub type PyArray_CanCastTo = unsafe extern "C" fn(from: *mut PyArray_Descr, to: *mut PyArray_Descr) -> npy_bool;
30pub type PyArray_ObjectType = unsafe extern "C" fn(op: *mut PyObject, minimum_type: c_int) -> c_int;
31pub type PyArray_DescrFromObject = unsafe extern "C" fn(op: *mut PyObject, mintype: *mut PyArray_Descr) -> *mut PyArray_Descr;
32pub type PyArray_ConvertToCommonType = unsafe extern "C" fn(op: *mut PyObject, retn: *mut c_int) -> *mut *mut PyArrayObject;
33pub type PyArray_DescrFromScalar = unsafe extern "C" fn(sc: *mut PyObject) -> *mut PyArray_Descr;
34pub type PyArray_DescrFromTypeObject = unsafe extern "C" fn(type_: *mut PyObject) -> *mut PyArray_Descr;
35pub type PyArray_Size = unsafe extern "C" fn(op: *mut PyObject) -> npy_intp;
36pub type PyArray_Scalar = unsafe extern "C" fn(data: *mut c_void, descr: *mut PyArray_Descr, base: *mut PyObject) -> *mut PyObject;
37pub type PyArray_FromScalar = unsafe extern "C" fn(scalar: *mut PyObject, outcode: *mut PyArray_Descr) -> *mut PyObject;
38pub type PyArray_ScalarAsCtype = unsafe extern "C" fn(scalar: *mut PyObject, ctypeptr: *mut c_void);
39pub type PyArray_CastScalarToCtype = unsafe extern "C" fn(scalar: *mut PyObject, ctypeptr: *mut c_void, outcode: *mut PyArray_Descr) -> c_int;
40pub type PyArray_CastScalarDirect = unsafe extern "C" fn(scalar: *mut PyObject, indescr: *mut PyArray_Descr, ctypeptr: *mut c_void, outtype: c_int) -> c_int;
41pub type PyArray_ScalarFromObject = unsafe extern "C" fn(object: *mut PyObject) -> *mut PyObject;
42pub type PyArray_GetCastFunc = unsafe extern "C" fn(descr: *mut PyArray_Descr, type_num: c_int) -> PyArray_VectorUnaryFunc;
43pub type PyArray_FromDims = unsafe extern "C" fn(nd: c_int, d: *mut c_int, type_: c_int) -> *mut PyObject;
44pub type PyArray_FromDimsAndDataAndDescr = unsafe extern "C" fn(nd: c_int, d: *mut c_int, descr: *mut PyArray_Descr, data: *mut c_char) -> *mut PyObject;
45pub type PyArray_FromAny = unsafe extern "C" fn(op: *mut PyObject, newtype: *mut PyArray_Descr, min_depth: c_int, max_depth: c_int, flags: c_int, context: *mut PyObject) -> *mut PyObject;
46pub type PyArray_EnsureArray = unsafe extern "C" fn(op: *mut PyObject) -> *mut PyObject;
47pub type PyArray_EnsureAnyArray = unsafe extern "C" fn(op: *mut PyObject) -> *mut PyObject;
48pub type PyArray_FromFile = unsafe extern "C" fn(fp: *mut FILE, dtype: *mut PyArray_Descr, num: npy_intp, sep: *mut c_char) -> *mut PyObject;
49pub type PyArray_FromString = unsafe extern "C" fn(data: *mut c_char, slen: npy_intp, dtype: *mut PyArray_Descr, num: npy_intp, sep: *mut c_char) -> *mut PyObject;
50pub type PyArray_FromBuffer = unsafe extern "C" fn(buf: *mut PyObject, type_: *mut PyArray_Descr, count: npy_intp, offset: npy_intp) -> *mut PyObject;
51pub type PyArray_FromIter = unsafe extern "C" fn(obj: *mut PyObject, dtype: *mut PyArray_Descr, count: npy_intp) -> *mut PyObject;
52pub type PyArray_Return = unsafe extern "C" fn(mp: *mut PyArrayObject) -> *mut PyObject;
53pub type PyArray_GetField = unsafe extern "C" fn(self_: *mut PyArrayObject, typed: *mut PyArray_Descr, offset: c_int) -> *mut PyObject;
54pub type PyArray_SetField = unsafe extern "C" fn(self_: *mut PyArrayObject, dtype: *mut PyArray_Descr, offset: c_int, val: *mut PyObject) -> c_int;
55pub type PyArray_Byteswap = unsafe extern "C" fn(self_: *mut PyArrayObject, inplace: npy_bool) -> *mut PyObject;
56pub type PyArray_Resize = unsafe extern "C" fn(self_: *mut PyArrayObject, newshape: *mut PyArray_Dims, refcheck: c_int, order: NPY_ORDER) -> *mut PyObject;
57pub type PyArray_MoveInto = unsafe extern "C" fn(dst: *mut PyArrayObject, src: *mut PyArrayObject) -> c_int;
58pub type PyArray_CopyInto = unsafe extern "C" fn(dst: *mut PyArrayObject, src: *mut PyArrayObject) -> c_int;
59pub type PyArray_CopyAnyInto = unsafe extern "C" fn(dst: *mut PyArrayObject, src: *mut PyArrayObject) -> c_int;
60pub type PyArray_CopyObject = unsafe extern "C" fn(dest: *mut PyArrayObject, src_object: *mut PyObject) -> c_int;
61pub type PyArray_NewCopy = unsafe extern "C" fn(obj: *mut PyArrayObject, order: NPY_ORDER) -> *mut PyObject;
62pub type PyArray_ToList = unsafe extern "C" fn(self_: *mut PyArrayObject) -> *mut PyObject;
63pub type PyArray_ToString = unsafe extern "C" fn(self_: *mut PyArrayObject, order: NPY_ORDER) -> *mut PyObject;
64pub type PyArray_ToFile = unsafe extern "C" fn(self_: *mut PyArrayObject, fp: *mut FILE, sep: *mut c_char, format: *mut c_char) -> c_int;
65pub type PyArray_Dump = unsafe extern "C" fn(self_: *mut PyObject, file: *mut PyObject, protocol: c_int) -> c_int;
66pub type PyArray_Dumps = unsafe extern "C" fn(self_: *mut PyObject, protocol: c_int) -> *mut PyObject;
67pub type PyArray_ValidType = unsafe extern "C" fn(type_: c_int) -> c_int;
68pub type PyArray_UpdateFlags = unsafe extern "C" fn(ret: *mut PyArrayObject, flagmask: c_int);
69pub type PyArray_New = unsafe extern "C" fn(subtype: *mut PyTypeObject, nd: c_int, dims: *mut npy_intp, type_num: c_int, strides: *mut npy_intp, data: *mut c_void, itemsize: c_int, flags: c_int, obj: *mut PyObject) -> *mut PyObject;
70pub type PyArray_NewFromDescr = unsafe extern "C" fn(subtype: *mut PyTypeObject, descr: *mut PyArray_Descr, nd: c_int, dims: *mut npy_intp, strides: *mut npy_intp, data: *mut c_void, flags: c_int, obj: *mut PyObject) -> *mut PyObject;
71pub type PyArray_DescrNew = unsafe extern "C" fn(base: *mut PyArray_Descr) -> *mut PyArray_Descr;
72pub type PyArray_DescrNewFromType = unsafe extern "C" fn(type_num: c_int) -> *mut PyArray_Descr;
73pub type PyArray_GetPriority = unsafe extern "C" fn(obj: *mut PyObject, default_: f64) -> f64;
74pub type PyArray_IterNew = unsafe extern "C" fn(obj: *mut PyObject) -> *mut PyObject;
75// pub type PyArray_MultiIterNew = unsafe extern "C" fn(n: c_int, ...) -> *mut PyObject;
76pub type PyArray_PyIntAsInt = unsafe extern "C" fn(o: *mut PyObject) -> c_int;
77pub type PyArray_PyIntAsIntp = unsafe extern "C" fn(o: *mut PyObject) -> npy_intp;
78pub type PyArray_Broadcast = unsafe extern "C" fn(mit: *mut PyArrayMultiIterObject) -> c_int;
79pub type PyArray_FillObjectArray = unsafe extern "C" fn(arr: *mut PyArrayObject, obj: *mut PyObject);
80pub type PyArray_FillWithScalar = unsafe extern "C" fn(arr: *mut PyArrayObject, obj: *mut PyObject) -> c_int;
81pub type PyArray_CheckStrides = unsafe extern "C" fn(elsize: c_int, nd: c_int, numbytes: npy_intp, offset: npy_intp, dims: *mut npy_intp, newstrides: *mut npy_intp) -> npy_bool;
82pub type PyArray_DescrNewByteorder = unsafe extern "C" fn(self_: *mut PyArray_Descr, newendian: c_char) -> *mut PyArray_Descr;
83pub type PyArray_IterAllButAxis = unsafe extern "C" fn(obj: *mut PyObject, inaxis: *mut c_int) -> *mut PyObject;
84pub type PyArray_CheckFromAny = unsafe extern "C" fn(op: *mut PyObject, descr: *mut PyArray_Descr, min_depth: c_int, max_depth: c_int, requires: c_int, context: *mut PyObject) -> *mut PyObject;
85pub type PyArray_FromArray = unsafe extern "C" fn(arr: *mut PyArrayObject, newtype: *mut PyArray_Descr, flags: c_int) -> *mut PyObject;
86pub type PyArray_FromInterface = unsafe extern "C" fn(origin: *mut PyObject) -> *mut PyObject;
87pub type PyArray_FromStructInterface = unsafe extern "C" fn(input: *mut PyObject) -> *mut PyObject;
88pub type PyArray_FromArrayAttr = unsafe extern "C" fn(op: *mut PyObject, typecode: *mut PyArray_Descr, context: *mut PyObject) -> *mut PyObject;
89pub type PyArray_ScalarKind = unsafe extern "C" fn(typenum: c_int, arr: *mut *mut PyArrayObject) -> NPY_SCALARKIND;
90pub type PyArray_CanCoerceScalar = unsafe extern "C" fn(thistype: c_int, neededtype: c_int, scalar: NPY_SCALARKIND) -> c_int;
91pub type PyArray_NewFlagsObject = unsafe extern "C" fn(obj: *mut PyObject) -> *mut PyObject;
92pub type PyArray_CanCastScalar = unsafe extern "C" fn(from: *mut PyTypeObject, to: *mut PyTypeObject) -> npy_bool;
93pub type PyArray_CompareUCS4 = unsafe extern "C" fn(s1: *mut npy_ucs4, s2: *mut npy_ucs4, len: usize) -> c_int;
94pub type PyArray_RemoveSmallest = unsafe extern "C" fn(multi: *mut PyArrayMultiIterObject) -> c_int;
95pub type PyArray_ElementStrides = unsafe extern "C" fn(obj: *mut PyObject) -> c_int;
96pub type PyArray_Item_INCREF = unsafe extern "C" fn(data: *mut c_char, descr: *mut PyArray_Descr);
97pub type PyArray_Item_XDECREF = unsafe extern "C" fn(data: *mut c_char, descr: *mut PyArray_Descr);
98pub type PyArray_FieldNames = unsafe extern "C" fn(fields: *mut PyObject) -> *mut PyObject;
99pub type PyArray_Transpose = unsafe extern "C" fn(ap: *mut PyArrayObject, permute: *mut PyArray_Dims) -> *mut PyObject;
100pub type PyArray_TakeFrom = unsafe extern "C" fn(self0: *mut PyArrayObject, indices0: *mut PyObject, axis: c_int, out: *mut PyArrayObject, clipmode: NPY_CLIPMODE) -> *mut PyObject;
101pub type PyArray_PutTo = unsafe extern "C" fn(self_: *mut PyArrayObject, values0: *mut PyObject, indices0: *mut PyObject, clipmode: NPY_CLIPMODE) -> *mut PyObject;
102pub type PyArray_PutMask = unsafe extern "C" fn(self_: *mut PyArrayObject, values0: *mut PyObject, mask0: *mut PyObject) -> *mut PyObject;
103pub type PyArray_Repeat = unsafe extern "C" fn(aop: *mut PyArrayObject, op: *mut PyObject, axis: c_int) -> *mut PyObject;
104pub type PyArray_Choose = unsafe extern "C" fn(ip: *mut PyArrayObject, op: *mut PyObject, out: *mut PyArrayObject, clipmode: NPY_CLIPMODE) -> *mut PyObject;
105pub type PyArray_Sort = unsafe extern "C" fn(op: *mut PyArrayObject, axis: c_int, which: NPY_SORTKIND) -> c_int;
106pub type PyArray_ArgSort = unsafe extern "C" fn(op: *mut PyArrayObject, axis: c_int, which: NPY_SORTKIND) -> *mut PyObject;
107pub type PyArray_SearchSorted = unsafe extern "C" fn(op1: *mut PyArrayObject, op2: *mut PyObject, side: NPY_SEARCHSIDE, perm: *mut PyObject) -> *mut PyObject;
108pub type PyArray_ArgMax = unsafe extern "C" fn(op: *mut PyArrayObject, axis: c_int, out: *mut PyArrayObject) -> *mut PyObject;
109pub type PyArray_ArgMin = unsafe extern "C" fn(op: *mut PyArrayObject, axis: c_int, out: *mut PyArrayObject) -> *mut PyObject;
110pub type PyArray_Reshape = unsafe extern "C" fn(self_: *mut PyArrayObject, shape: *mut PyObject) -> *mut PyObject;
111pub type PyArray_Newshape = unsafe extern "C" fn(self_: *mut PyArrayObject, newdims: *mut PyArray_Dims, order: NPY_ORDER) -> *mut PyObject;
112pub type PyArray_Squeeze = unsafe extern "C" fn(self_: *mut PyArrayObject) -> *mut PyObject;
113pub type PyArray_View = unsafe extern "C" fn(self_: *mut PyArrayObject, type_: *mut PyArray_Descr, pytype: *mut PyTypeObject) -> *mut PyObject;
114pub type PyArray_SwapAxes = unsafe extern "C" fn(ap: *mut PyArrayObject, a1: c_int, a2: c_int) -> *mut PyObject;
115pub type PyArray_Max = unsafe extern "C" fn(ap: *mut PyArrayObject, axis: c_int, out: *mut PyArrayObject) -> *mut PyObject;
116pub type PyArray_Min = unsafe extern "C" fn(ap: *mut PyArrayObject, axis: c_int, out: *mut PyArrayObject) -> *mut PyObject;
117pub type PyArray_Ptp = unsafe extern "C" fn(ap: *mut PyArrayObject, axis: c_int, out: *mut PyArrayObject) -> *mut PyObject;
118pub type PyArray_Mean = unsafe extern "C" fn(self_: *mut PyArrayObject, axis: c_int, rtype: c_int, out: *mut PyArrayObject) -> *mut PyObject;
119pub type PyArray_Trace = unsafe extern "C" fn(self_: *mut PyArrayObject, offset: c_int, axis1: c_int, axis2: c_int, rtype: c_int, out: *mut PyArrayObject) -> *mut PyObject;
120pub type PyArray_Diagonal = unsafe extern "C" fn(self_: *mut PyArrayObject, offset: c_int, axis1: c_int, axis2: c_int) -> *mut PyObject;
121pub type PyArray_Clip = unsafe extern "C" fn(self_: *mut PyArrayObject, min: *mut PyObject, max: *mut PyObject, out: *mut PyArrayObject) -> *mut PyObject;
122pub type PyArray_Conjugate = unsafe extern "C" fn(self_: *mut PyArrayObject, out: *mut PyArrayObject) -> *mut PyObject;
123pub type PyArray_Nonzero = unsafe extern "C" fn(self_: *mut PyArrayObject) -> *mut PyObject;
124pub type PyArray_Std = unsafe extern "C" fn(self_: *mut PyArrayObject, axis: c_int, rtype: c_int, out: *mut PyArrayObject, variance: c_int) -> *mut PyObject;
125pub type PyArray_Sum = unsafe extern "C" fn(self_: *mut PyArrayObject, axis: c_int, rtype: c_int, out: *mut PyArrayObject) -> *mut PyObject;
126pub type PyArray_CumSum = unsafe extern "C" fn(self_: *mut PyArrayObject, axis: c_int, rtype: c_int, out: *mut PyArrayObject) -> *mut PyObject;
127pub type PyArray_Prod = unsafe extern "C" fn(self_: *mut PyArrayObject, axis: c_int, rtype: c_int, out: *mut PyArrayObject) -> *mut PyObject;
128pub type PyArray_CumProd = unsafe extern "C" fn(self_: *mut PyArrayObject, axis: c_int, rtype: c_int, out: *mut PyArrayObject) -> *mut PyObject;
129pub type PyArray_All = unsafe extern "C" fn(self_: *mut PyArrayObject, axis: c_int, out: *mut PyArrayObject) -> *mut PyObject;
130pub type PyArray_Any = unsafe extern "C" fn(self_: *mut PyArrayObject, axis: c_int, out: *mut PyArrayObject) -> *mut PyObject;
131pub type PyArray_Compress = unsafe extern "C" fn(self_: *mut PyArrayObject, condition: *mut PyObject, axis: c_int, out: *mut PyArrayObject) -> *mut PyObject;
132pub type PyArray_Flatten = unsafe extern "C" fn(a: *mut PyArrayObject, order: NPY_ORDER) -> *mut PyObject;
133pub type PyArray_Ravel = unsafe extern "C" fn(arr: *mut PyArrayObject, order: NPY_ORDER) -> *mut PyObject;
134pub type PyArray_MultiplyList = unsafe extern "C" fn(l1: *mut npy_intp, n: c_int) -> npy_intp;
135pub type PyArray_MultiplyIntList = unsafe extern "C" fn(l1: *mut c_int, n: c_int) -> c_int;
136pub type PyArray_GetPtr = unsafe extern "C" fn(obj: *mut PyArrayObject, ind: *mut npy_intp) -> *mut c_void;
137pub type PyArray_CompareLists = unsafe extern "C" fn(l1: *mut npy_intp, l2: *mut npy_intp, n: c_int) -> c_int;
138pub type PyArray_AsCArray = unsafe extern "C" fn(op: *mut *mut PyObject, ptr: *mut c_void, dims: *mut npy_intp, nd: c_int, typedescr: *mut PyArray_Descr) -> c_int;
139pub type PyArray_As1D = unsafe extern "C" fn(op: *mut *mut PyObject, ptr: *mut *mut c_char, d1: *mut c_int, typecode: c_int) -> c_int;
140pub type PyArray_As2D = unsafe extern "C" fn(op: *mut *mut PyObject, ptr: *mut *mut *mut c_char, d1: *mut c_int, d2: *mut c_int, typecode: c_int) -> c_int;
141pub type PyArray_Free = unsafe extern "C" fn(op: *mut PyObject, ptr: *mut c_void) -> c_int;
142pub type PyArray_Converter = unsafe extern "C" fn(object: *mut PyObject, address: *mut *mut PyObject) -> c_int;
143pub type PyArray_IntpFromSequence = unsafe extern "C" fn(seq: *mut PyObject, vals: *mut npy_intp, maxvals: c_int) -> c_int;
144pub type PyArray_Concatenate = unsafe extern "C" fn(op: *mut PyObject, axis: c_int) -> *mut PyObject;
145pub type PyArray_InnerProduct = unsafe extern "C" fn(op1: *mut PyObject, op2: *mut PyObject) -> *mut PyObject;
146pub type PyArray_MatrixProduct = unsafe extern "C" fn(op1: *mut PyObject, op2: *mut PyObject) -> *mut PyObject;
147pub type PyArray_CopyAndTranspose = unsafe extern "C" fn(op: *mut PyObject) -> *mut PyObject;
148pub type PyArray_Correlate = unsafe extern "C" fn(op1: *mut PyObject, op2: *mut PyObject, mode: c_int) -> *mut PyObject;
149pub type PyArray_TypestrConvert = unsafe extern "C" fn(itemsize: c_int, gentype: c_int) -> c_int;
150pub type PyArray_DescrConverter = unsafe extern "C" fn(obj: *mut PyObject, at: *mut *mut PyArray_Descr) -> c_int;
151pub type PyArray_DescrConverter2 = unsafe extern "C" fn(obj: *mut PyObject, at: *mut *mut PyArray_Descr) -> c_int;
152pub type PyArray_IntpConverter = unsafe extern "C" fn(obj: *mut PyObject, seq: *mut PyArray_Dims) -> c_int;
153pub type PyArray_BufferConverter = unsafe extern "C" fn(obj: *mut PyObject, buf: *mut PyArray_Chunk) -> c_int;
154pub type PyArray_AxisConverter = unsafe extern "C" fn(obj: *mut PyObject, axis: *mut c_int) -> c_int;
155pub type PyArray_BoolConverter = unsafe extern "C" fn(object: *mut PyObject, val: *mut npy_bool) -> c_int;
156pub type PyArray_ByteorderConverter = unsafe extern "C" fn(obj: *mut PyObject, endian: *mut c_char) -> c_int;
157pub type PyArray_OrderConverter = unsafe extern "C" fn(object: *mut PyObject, val: *mut NPY_ORDER) -> c_int;
158pub type PyArray_EquivTypes = unsafe extern "C" fn(type1: *mut PyArray_Descr, type2: *mut PyArray_Descr) -> c_uchar;
159pub type PyArray_Zeros = unsafe extern "C" fn(nd: c_int, dims: *mut npy_intp, type_: *mut PyArray_Descr, is_f_order: c_int) -> *mut PyObject;
160pub type PyArray_Empty = unsafe extern "C" fn(nd: c_int, dims: *mut npy_intp, type_: *mut PyArray_Descr, is_f_order: c_int) -> *mut PyObject;
161pub type PyArray_Where = unsafe extern "C" fn(condition: *mut PyObject, x: *mut PyObject, y: *mut PyObject) -> *mut PyObject;
162pub type PyArray_Arange = unsafe extern "C" fn(start: f64, stop: f64, step: f64, type_num: c_int) -> *mut PyObject;
163pub type PyArray_ArangeObj = unsafe extern "C" fn(start: *mut PyObject, stop: *mut PyObject, step: *mut PyObject, dtype: *mut PyArray_Descr) -> *mut PyObject;
164pub type PyArray_SortkindConverter = unsafe extern "C" fn(obj: *mut PyObject, sortkind: *mut NPY_SORTKIND) -> c_int;
165pub type PyArray_LexSort = unsafe extern "C" fn(sort_keys: *mut PyObject, axis: c_int) -> *mut PyObject;
166pub type PyArray_Round = unsafe extern "C" fn(a: *mut PyArrayObject, decimals: c_int, out: *mut PyArrayObject) -> *mut PyObject;
167pub type PyArray_EquivTypenums = unsafe extern "C" fn(typenum1: c_int, typenum2: c_int) -> c_uchar;
168pub type PyArray_RegisterDataType = unsafe extern "C" fn(descr: *mut PyArray_Descr) -> c_int;
169pub type PyArray_RegisterCastFunc = unsafe extern "C" fn(descr: *mut PyArray_Descr, totype: c_int, castfunc: PyArray_VectorUnaryFunc) -> c_int;
170pub type PyArray_RegisterCanCast = unsafe extern "C" fn(descr: *mut PyArray_Descr, totype: c_int, scalar: NPY_SCALARKIND) -> c_int;
171pub type PyArray_InitArrFuncs = unsafe extern "C" fn(f: *mut PyArray_ArrFuncs);
172pub type PyArray_IntTupleFromIntp = unsafe extern "C" fn(len: c_int, vals: *mut npy_intp) -> *mut PyObject;
173pub type PyArray_TypeNumFromName = unsafe extern "C" fn(str: *mut c_char) -> c_int;
174pub type PyArray_ClipmodeConverter = unsafe extern "C" fn(object: *mut PyObject, val: *mut NPY_CLIPMODE) -> c_int;
175pub type PyArray_OutputConverter = unsafe extern "C" fn(object: *mut PyObject, address: *mut *mut PyArrayObject) -> c_int;
176pub type PyArray_BroadcastToShape = unsafe extern "C" fn(obj: *mut PyObject, dims: *mut npy_intp, nd: c_int) -> *mut PyObject;
177pub type _PyArray_SigintHandler = unsafe extern "C" fn(signum: c_int);
178pub type _PyArray_GetSigintBuf = unsafe extern "C" fn() -> *mut c_void;
179pub type PyArray_DescrAlignConverter = unsafe extern "C" fn(obj: *mut PyObject, at: *mut *mut PyArray_Descr) -> c_int;
180pub type PyArray_DescrAlignConverter2 = unsafe extern "C" fn(obj: *mut PyObject, at: *mut *mut PyArray_Descr) -> c_int;
181pub type PyArray_SearchsideConverter = unsafe extern "C" fn(obj: *mut PyObject, addr: *mut c_void) -> c_int;
182pub type PyArray_CheckAxis = unsafe extern "C" fn(arr: *mut PyArrayObject, axis: *mut c_int, flags: c_int) -> *mut PyObject;
183pub type PyArray_OverflowMultiplyList = unsafe extern "C" fn(l1: *mut npy_intp, n: c_int) -> npy_intp;
184pub type PyArray_CompareString = unsafe extern "C" fn(s1: *mut c_char, s2: *mut c_char, len: usize) -> c_int;
185// pub type PyArray_MultiIterFromObjects = unsafe extern "C" fn(mps: *mut *mut PyObject, n: c_int, nadd: c_int, ...) -> *mut PyObject;
186pub type PyArray_GetEndianness = unsafe extern "C" fn() -> c_int;
187pub type PyArray_GetNDArrayCFeatureVersion = unsafe extern "C" fn() -> c_uint;
188pub type PyArray_Correlate2 = unsafe extern "C" fn(op1: *mut PyObject, op2: *mut PyObject, mode: c_int) -> *mut PyObject;
189pub type PyArray_NeighborhoodIterNew = unsafe extern "C" fn(x: *mut PyArrayIterObject, bounds: *mut npy_intp, mode: c_int, fill: *mut PyArrayObject) -> *mut PyObject;
190pub type PyArray_SetDatetimeParseFunction = unsafe extern "C" fn(op: *mut PyObject);
191pub type PyArray_DatetimeToDatetimeStruct = unsafe extern "C" fn(val: npy_datetime, fr: NPY_DATETIMEUNIT, result: *mut npy_datetimestruct);
192pub type PyArray_TimedeltaToTimedeltaStruct = unsafe extern "C" fn(val: npy_timedelta, fr: NPY_DATETIMEUNIT, result: *mut npy_timedeltastruct);
193pub type PyArray_DatetimeStructToDatetime = unsafe extern "C" fn(fr: NPY_DATETIMEUNIT, d: *mut npy_datetimestruct) -> npy_datetime;
194pub type PyArray_TimedeltaStructToTimedelta = unsafe extern "C" fn(fr: NPY_DATETIMEUNIT, d: *mut npy_timedeltastruct) -> npy_datetime;
195pub type NpyIter_New = unsafe extern "C" fn(op: *mut PyArrayObject, flags: npy_uint32, order: NPY_ORDER, casting: NPY_CASTING, dtype: *mut PyArray_Descr) -> *mut NpyIter;
196pub type NpyIter_MultiNew = unsafe extern "C" fn(nop: c_int, op_in: *mut *mut PyArrayObject, flags: npy_uint32, order: NPY_ORDER, casting: NPY_CASTING, op_flags: *mut npy_uint32, op_request_dtypes: *mut *mut PyArray_Descr) -> *mut NpyIter;
197pub type NpyIter_AdvancedNew = unsafe extern "C" fn(nop: c_int, op_in: *mut *mut PyArrayObject, flags: npy_uint32, order: NPY_ORDER, casting: NPY_CASTING, op_flags: *mut npy_uint32, op_request_dtypes: *mut *mut PyArray_Descr, oa_ndim: c_int, op_axes: *mut *mut c_int, itershape: *mut npy_intp, buffersize: npy_intp) -> *mut NpyIter;
198pub type NpyIter_Copy = unsafe extern "C" fn(iter: *mut NpyIter) -> *mut NpyIter;
199pub type NpyIter_Deallocate = unsafe extern "C" fn(iter: *mut NpyIter) -> c_int;
200pub type NpyIter_HasDelayedBufAlloc = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_bool;
201pub type NpyIter_HasExternalLoop = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_bool;
202pub type NpyIter_EnableExternalLoop = unsafe extern "C" fn(iter: *mut NpyIter) -> c_int;
203pub type NpyIter_GetInnerStrideArray = unsafe extern "C" fn(iter: *mut NpyIter) -> *mut npy_intp;
204pub type NpyIter_GetInnerLoopSizePtr = unsafe extern "C" fn(iter: *mut NpyIter) -> *mut npy_intp;
205pub type NpyIter_Reset = unsafe extern "C" fn(iter: *mut NpyIter, errmsg: *mut *mut c_char) -> c_int;
206pub type NpyIter_ResetBasePointers = unsafe extern "C" fn(iter: *mut NpyIter, baseptrs: *mut *mut c_char, errmsg: *mut *mut c_char) -> c_int;
207pub type NpyIter_ResetToIterIndexRange = unsafe extern "C" fn(iter: *mut NpyIter, istart: npy_intp, iend: npy_intp, errmsg: *mut *mut c_char) -> c_int;
208pub type NpyIter_GetNDim = unsafe extern "C" fn(iter: *mut NpyIter) -> c_int;
209pub type NpyIter_GetNOp = unsafe extern "C" fn(iter: *mut NpyIter) -> c_int;
210pub type NpyIter_GetIterNext = unsafe extern "C" fn(iter: *mut NpyIter, errmsg: *mut *mut c_char) -> NpyIter_IterNextFunc;
211pub type NpyIter_GetIterSize = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_intp;
212pub type NpyIter_GetIterIndexRange = unsafe extern "C" fn(iter: *mut NpyIter, istart: *mut npy_intp, iend: *mut npy_intp);
213pub type NpyIter_GetIterIndex = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_intp;
214pub type NpyIter_GotoIterIndex = unsafe extern "C" fn(iter: *mut NpyIter, iterindex: npy_intp) -> c_int;
215pub type NpyIter_HasMultiIndex = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_bool;
216pub type NpyIter_GetShape = unsafe extern "C" fn(iter: *mut NpyIter, outshape: *mut npy_intp) -> c_int;
217pub type NpyIter_GetGetMultiIndex = unsafe extern "C" fn(iter: *mut NpyIter, errmsg: *mut *mut c_char) -> NpyIter_GetMultiIndexFunc;
218pub type NpyIter_GotoMultiIndex = unsafe extern "C" fn(iter: *mut NpyIter, multi_index: *mut npy_intp) -> c_int;
219pub type NpyIter_RemoveMultiIndex = unsafe extern "C" fn(iter: *mut NpyIter) -> c_int;
220pub type NpyIter_HasIndex = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_bool;
221pub type NpyIter_IsBuffered = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_bool;
222pub type NpyIter_IsGrowInner = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_bool;
223pub type NpyIter_GetBufferSize = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_intp;
224pub type NpyIter_GetIndexPtr = unsafe extern "C" fn(iter: *mut NpyIter) -> *mut npy_intp;
225pub type NpyIter_GotoIndex = unsafe extern "C" fn(iter: *mut NpyIter, flat_index: npy_intp) -> c_int;
226pub type NpyIter_GetDataPtrArray = unsafe extern "C" fn(iter: *mut NpyIter) -> *mut *mut c_char;
227pub type NpyIter_GetDescrArray = unsafe extern "C" fn(iter: *mut NpyIter) -> *mut *mut PyArray_Descr;
228pub type NpyIter_GetOperandArray = unsafe extern "C" fn(iter: *mut NpyIter) -> *mut *mut PyArrayObject;
229pub type NpyIter_GetIterView = unsafe extern "C" fn(iter: *mut NpyIter, i: npy_intp) -> *mut PyArrayObject;
230pub type NpyIter_GetReadFlags = unsafe extern "C" fn(iter: *mut NpyIter, outreadflags: *mut c_char);
231pub type NpyIter_GetWriteFlags = unsafe extern "C" fn(iter: *mut NpyIter, outwriteflags: *mut c_char);
232pub type NpyIter_DebugPrint = unsafe extern "C" fn(iter: *mut NpyIter);
233pub type NpyIter_IterationNeedsAPI = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_bool;
234pub type NpyIter_GetInnerFixedStrideArray = unsafe extern "C" fn(iter: *mut NpyIter, out_strides: *mut npy_intp);
235pub type NpyIter_RemoveAxis = unsafe extern "C" fn(iter: *mut NpyIter, axis: c_int) -> c_int;
236pub type NpyIter_GetAxisStrideArray = unsafe extern "C" fn(iter: *mut NpyIter, axis: c_int) -> *mut npy_intp;
237pub type NpyIter_RequiresBuffering = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_bool;
238pub type NpyIter_GetInitialDataPtrArray = unsafe extern "C" fn(iter: *mut NpyIter) -> *mut *mut c_char;
239pub type NpyIter_CreateCompatibleStrides = unsafe extern "C" fn(iter: *mut NpyIter, itemsize: npy_intp, outstrides: *mut npy_intp) -> c_int;
240pub type PyArray_CastingConverter = unsafe extern "C" fn(obj: *mut PyObject, casting: *mut NPY_CASTING) -> c_int;
241pub type PyArray_CountNonzero = unsafe extern "C" fn(self_: *mut PyArrayObject) -> npy_intp;
242pub type PyArray_PromoteTypes = unsafe extern "C" fn(type1: *mut PyArray_Descr, type2: *mut PyArray_Descr) -> *mut PyArray_Descr;
243pub type PyArray_MinScalarType = unsafe extern "C" fn(arr: *mut PyArrayObject) -> *mut PyArray_Descr;
244pub type PyArray_ResultType = unsafe extern "C" fn(narrs: npy_intp, arr: *mut *mut PyArrayObject, ndtypes: npy_intp, dtypes: *mut *mut PyArray_Descr) -> *mut PyArray_Descr;
245pub type PyArray_CanCastArrayTo = unsafe extern "C" fn(arr: *mut PyArrayObject, to: *mut PyArray_Descr, casting: NPY_CASTING) -> npy_bool;
246pub type PyArray_CanCastTypeTo = unsafe extern "C" fn(from: *mut PyArray_Descr, to: *mut PyArray_Descr, casting: NPY_CASTING) -> npy_bool;
247pub type PyArray_EinsteinSum = unsafe extern "C" fn(subscripts: *mut c_char, nop: npy_intp, op_in: *mut *mut PyArrayObject, dtype: *mut PyArray_Descr, order: NPY_ORDER, casting: NPY_CASTING, out: *mut PyArrayObject) -> *mut PyArrayObject;
248pub type PyArray_NewLikeArray = unsafe extern "C" fn(prototype: *mut PyArrayObject, order: NPY_ORDER, dtype: *mut PyArray_Descr, subok: c_int) -> *mut PyObject;
249pub type PyArray_GetArrayParamsFromObject = unsafe extern "C" fn(op: *mut PyObject, requested_dtype: *mut PyArray_Descr, writeable: npy_bool, out_dtype: *mut *mut PyArray_Descr, out_ndim: *mut c_int, out_dims: *mut npy_intp, out_arr: *mut *mut PyArrayObject, context: *mut PyObject) -> c_int;
250pub type PyArray_ConvertClipmodeSequence = unsafe extern "C" fn(object: *mut PyObject, modes: *mut NPY_CLIPMODE, n: c_int) -> c_int;
251pub type PyArray_MatrixProduct2 = unsafe extern "C" fn(op1: *mut PyObject, op2: *mut PyObject, out: *mut PyArrayObject) -> *mut PyObject;
252pub type NpyIter_IsFirstVisit = unsafe extern "C" fn(iter: *mut NpyIter, iop: c_int) -> npy_bool;
253pub type PyArray_SetBaseObject = unsafe extern "C" fn(arr: *mut PyArrayObject, obj: *mut PyObject) -> c_int;
254pub type PyArray_CreateSortedStridePerm = unsafe extern "C" fn(ndim: c_int, strides: *mut npy_intp, out_strideperm: *mut npy_stride_sort_item);
255pub type PyArray_RemoveAxesInPlace = unsafe extern "C" fn(arr: *mut PyArrayObject, flags: *mut npy_bool);
256pub type PyArray_DebugPrint = unsafe extern "C" fn(obj: *mut PyArrayObject);
257pub type PyArray_FailUnlessWriteable = unsafe extern "C" fn(obj: *mut PyArrayObject, name: *const c_char) -> c_int;
258pub type PyArray_SetUpdateIfCopyBase = unsafe extern "C" fn(arr: *mut PyArrayObject, base: *mut PyArrayObject) -> c_int;
259pub type PyDataMem_NEW = unsafe extern "C" fn(size: usize) -> *mut c_void;
260pub type PyDataMem_FREE = unsafe extern "C" fn(ptr: *mut c_void);
261pub type PyDataMem_RENEW = unsafe extern "C" fn(ptr: *mut c_void, size: usize) -> *mut c_void;
262pub type PyDataMem_SetEventHook = unsafe extern "C" fn(newhook: PyDataMem_EventHookFunc, user_data: *mut c_void, old_data: *mut *mut c_void) -> PyDataMem_EventHookFunc;
263pub type PyArray_MapIterSwapAxes = unsafe extern "C" fn(mit: *mut PyArrayMapIterObject, ret: *mut *mut PyArrayObject, getmap: c_int);
264pub type PyArray_MapIterArray = unsafe extern "C" fn(a: *mut PyArrayObject, index: *mut PyObject) -> *mut PyObject;
265pub type PyArray_MapIterNext = unsafe extern "C" fn(mit: *mut PyArrayMapIterObject);
266pub type PyArray_Partition = unsafe extern "C" fn(op: *mut PyArrayObject, ktharray: *mut PyArrayObject, axis: c_int, which: NPY_SELECTKIND) -> c_int;
267pub type PyArray_ArgPartition = unsafe extern "C" fn(op: *mut PyArrayObject, ktharray: *mut PyArrayObject, axis: c_int, which: NPY_SELECTKIND) -> *mut PyObject;
268pub type PyArray_SelectkindConverter = unsafe extern "C" fn(obj: *mut PyObject, selectkind: *mut NPY_SELECTKIND) -> c_int;
269pub type PyDataMem_NEW_ZEROED = unsafe extern "C" fn(size: usize, elsize: usize) -> *mut c_void;
270pub type PyArray_CheckAnyScalarExact = unsafe extern "C" fn(obj: *mut PyObject) -> c_int;
271pub type PyArray_MapIterArrayCopyIfOverlap = unsafe extern "C" fn(a: *mut PyArrayObject, index: *mut PyObject, copy_if_overlap: c_int, extra_op: *mut PyArrayObject) -> *mut PyObject;
272pub type PyArray_ResolveWritebackIfCopy = unsafe extern "C" fn(self_: *mut PyArrayObject) -> c_int;
273pub type PyArray_SetWritebackIfCopyBase = unsafe extern "C" fn(arr: *mut PyArrayObject, base: *mut PyArrayObject) -> c_int;
274pub type PyArray_SimpleNewFromData = unsafe extern "C" fn(nd: c_int, dims: *mut c_int, type_num: c_int, data: *mut c_char) -> *mut PyObject;
275
276
277pub struct NumpyModuleReference {
278    pointer: *const *const c_void,
279    pub PyBigArray_Type: *mut PyTypeObject,
280    pub PyArray_Type: *mut PyTypeObject,
281    pub PyArrayDescr_Type: *mut PyTypeObject,
282    pub PyArrayFlags_Type: *mut PyTypeObject,
283    pub PyArrayIter_Type: *mut PyTypeObject,
284    pub PyArrayMultiIter_Type: *mut PyTypeObject,
285    pub NPY_NUMUSERTYPES: *mut PyTypeObject,
286    pub PyBoolArrType_Type: *mut PyTypeObject,
287    pub _PyArrayScalar_BoolValues: *mut PyTypeObject,
288    pub PyGenericArrType_Type: *mut PyTypeObject,
289    pub PyNumberArrType_Type: *mut PyTypeObject,
290    pub PyIntegerArrType_Type: *mut PyTypeObject,
291    pub PySignedIntegerArrType_Type: *mut PyTypeObject,
292    pub PyUnsignedIntegerArrType_Type: *mut PyTypeObject,
293    pub PyInexactArrType_Type: *mut PyTypeObject,
294    pub PyFloatingArrType_Type: *mut PyTypeObject,
295    pub PyComplexFloatingArrType_Type: *mut PyTypeObject,
296    pub PyFlexibleArrType_Type: *mut PyTypeObject,
297    pub PyCharacterArrType_Type: *mut PyTypeObject,
298    pub PyByteArrType_Type: *mut PyTypeObject,
299    pub PyShortArrType_Type: *mut PyTypeObject,
300    pub PyIntArrType_Type: *mut PyTypeObject,
301    pub PyLongArrType_Type: *mut PyTypeObject,
302    pub PyLongLongArrType_Type: *mut PyTypeObject,
303    pub PyUByteArrType_Type: *mut PyTypeObject,
304    pub PyUShortArrType_Type: *mut PyTypeObject,
305    pub PyUIntArrType_Type: *mut PyTypeObject,
306    pub PyULongArrType_Type: *mut PyTypeObject,
307    pub PyULongLongArrType_Type: *mut PyTypeObject,
308    pub PyFloatArrType_Type: *mut PyTypeObject,
309    pub PyDoubleArrType_Type: *mut PyTypeObject,
310    pub PyLongDoubleArrType_Type: *mut PyTypeObject,
311    pub PyCFloatArrType_Type: *mut PyTypeObject,
312    pub PyCDoubleArrType_Type: *mut PyTypeObject,
313    pub PyCLongDoubleArrType_Type: *mut PyTypeObject,
314    pub PyObjectArrType_Type: *mut PyTypeObject,
315    pub PyStringArrType_Type: *mut PyTypeObject,
316    pub PyUnicodeArrType_Type: *mut PyTypeObject,
317    pub PyVoidArrType_Type: *mut PyTypeObject,
318
319    pub PyArray_GetNDArrayCVersion: PyArray_GetNDArrayCVersion,
320    pub PyArray_SetNumericOps: PyArray_SetNumericOps,
321    pub PyArray_GetNumericOps: PyArray_GetNumericOps,
322    pub PyArray_INCREF: PyArray_INCREF,
323    pub PyArray_XDECREF: PyArray_XDECREF,
324    pub PyArray_SetStringFunction: PyArray_SetStringFunction,
325    pub PyArray_DescrFromType: PyArray_DescrFromType,
326    pub PyArray_TypeObjectFromType: PyArray_TypeObjectFromType,
327    pub PyArray_Zero: PyArray_Zero,
328    pub PyArray_One: PyArray_One,
329    pub PyArray_CastToType: PyArray_CastToType,
330    pub PyArray_CastTo: PyArray_CastTo,
331    pub PyArray_CastAnyTo: PyArray_CastAnyTo,
332    pub PyArray_CanCastSafely: PyArray_CanCastSafely,
333    pub PyArray_CanCastTo: PyArray_CanCastTo,
334    pub PyArray_ObjectType: PyArray_ObjectType,
335    pub PyArray_DescrFromObject: PyArray_DescrFromObject,
336    pub PyArray_ConvertToCommonType: PyArray_ConvertToCommonType,
337    pub PyArray_DescrFromScalar: PyArray_DescrFromScalar,
338    pub PyArray_DescrFromTypeObject: PyArray_DescrFromTypeObject,
339    pub PyArray_Size: PyArray_Size,
340    pub PyArray_Scalar: PyArray_Scalar,
341    pub PyArray_FromScalar: PyArray_FromScalar,
342    pub PyArray_ScalarAsCtype: PyArray_ScalarAsCtype,
343    pub PyArray_CastScalarToCtype: PyArray_CastScalarToCtype,
344    pub PyArray_CastScalarDirect: PyArray_CastScalarDirect,
345    pub PyArray_ScalarFromObject: PyArray_ScalarFromObject,
346    pub PyArray_GetCastFunc: PyArray_GetCastFunc,
347    pub PyArray_FromDims: PyArray_FromDims,
348    pub PyArray_FromDimsAndDataAndDescr: PyArray_FromDimsAndDataAndDescr,
349    pub PyArray_FromAny: PyArray_FromAny,
350    pub PyArray_EnsureArray: PyArray_EnsureArray,
351    pub PyArray_EnsureAnyArray: PyArray_EnsureAnyArray,
352    pub PyArray_FromFile: PyArray_FromFile,
353    pub PyArray_FromString: PyArray_FromString,
354    pub PyArray_FromBuffer: PyArray_FromBuffer,
355    pub PyArray_FromIter: PyArray_FromIter,
356    pub PyArray_Return: PyArray_Return,
357    pub PyArray_GetField: PyArray_GetField,
358    pub PyArray_SetField: PyArray_SetField,
359    pub PyArray_Byteswap: PyArray_Byteswap,
360    pub PyArray_Resize: PyArray_Resize,
361    pub PyArray_MoveInto: PyArray_MoveInto,
362    pub PyArray_CopyInto: PyArray_CopyInto,
363    pub PyArray_CopyAnyInto: PyArray_CopyAnyInto,
364    pub PyArray_CopyObject: PyArray_CopyObject,
365    pub PyArray_NewCopy: PyArray_NewCopy,
366    pub PyArray_ToList: PyArray_ToList,
367    pub PyArray_ToString: PyArray_ToString,
368    pub PyArray_ToFile: PyArray_ToFile,
369    pub PyArray_Dump: PyArray_Dump,
370    pub PyArray_Dumps: PyArray_Dumps,
371    pub PyArray_ValidType: PyArray_ValidType,
372    pub PyArray_UpdateFlags: PyArray_UpdateFlags,
373    pub PyArray_New: PyArray_New,
374    pub PyArray_NewFromDescr: PyArray_NewFromDescr,
375    pub PyArray_DescrNew: PyArray_DescrNew,
376    pub PyArray_DescrNewFromType: PyArray_DescrNewFromType,
377    pub PyArray_GetPriority: PyArray_GetPriority,
378    pub PyArray_IterNew: PyArray_IterNew,
379    // pub PyArray_MultiIterNew: PyArray_MultiIterNew,
380    pub PyArray_PyIntAsInt: PyArray_PyIntAsInt,
381    pub PyArray_PyIntAsIntp: PyArray_PyIntAsIntp,
382    pub PyArray_Broadcast: PyArray_Broadcast,
383    pub PyArray_FillObjectArray: PyArray_FillObjectArray,
384    pub PyArray_FillWithScalar: PyArray_FillWithScalar,
385    pub PyArray_CheckStrides: PyArray_CheckStrides,
386    pub PyArray_DescrNewByteorder: PyArray_DescrNewByteorder,
387    pub PyArray_IterAllButAxis: PyArray_IterAllButAxis,
388    pub PyArray_CheckFromAny: PyArray_CheckFromAny,
389    pub PyArray_FromArray: PyArray_FromArray,
390    pub PyArray_FromInterface: PyArray_FromInterface,
391    pub PyArray_FromStructInterface: PyArray_FromStructInterface,
392    pub PyArray_FromArrayAttr: PyArray_FromArrayAttr,
393    pub PyArray_ScalarKind: PyArray_ScalarKind,
394    pub PyArray_CanCoerceScalar: PyArray_CanCoerceScalar,
395    pub PyArray_NewFlagsObject: PyArray_NewFlagsObject,
396    pub PyArray_CanCastScalar: PyArray_CanCastScalar,
397    pub PyArray_CompareUCS4: PyArray_CompareUCS4,
398    pub PyArray_RemoveSmallest: PyArray_RemoveSmallest,
399    pub PyArray_ElementStrides: PyArray_ElementStrides,
400    pub PyArray_Item_INCREF: PyArray_Item_INCREF,
401    pub PyArray_Item_XDECREF: PyArray_Item_XDECREF,
402    pub PyArray_FieldNames: PyArray_FieldNames,
403    pub PyArray_Transpose: PyArray_Transpose,
404    pub PyArray_TakeFrom: PyArray_TakeFrom,
405    pub PyArray_PutTo: PyArray_PutTo,
406    pub PyArray_PutMask: PyArray_PutMask,
407    pub PyArray_Repeat: PyArray_Repeat,
408    pub PyArray_Choose: PyArray_Choose,
409    pub PyArray_Sort: PyArray_Sort,
410    pub PyArray_ArgSort: PyArray_ArgSort,
411    pub PyArray_SearchSorted: PyArray_SearchSorted,
412    pub PyArray_ArgMax: PyArray_ArgMax,
413    pub PyArray_ArgMin: PyArray_ArgMin,
414    pub PyArray_Reshape: PyArray_Reshape,
415    pub PyArray_Newshape: PyArray_Newshape,
416    pub PyArray_Squeeze: PyArray_Squeeze,
417    pub PyArray_View: PyArray_View,
418    pub PyArray_SwapAxes: PyArray_SwapAxes,
419    pub PyArray_Max: PyArray_Max,
420    pub PyArray_Min: PyArray_Min,
421    pub PyArray_Ptp: PyArray_Ptp,
422    pub PyArray_Mean: PyArray_Mean,
423    pub PyArray_Trace: PyArray_Trace,
424    pub PyArray_Diagonal: PyArray_Diagonal,
425    pub PyArray_Clip: PyArray_Clip,
426    pub PyArray_Conjugate: PyArray_Conjugate,
427    pub PyArray_Nonzero: PyArray_Nonzero,
428    pub PyArray_Std: PyArray_Std,
429    pub PyArray_Sum: PyArray_Sum,
430    pub PyArray_CumSum: PyArray_CumSum,
431    pub PyArray_Prod: PyArray_Prod,
432    pub PyArray_CumProd: PyArray_CumProd,
433    pub PyArray_All: PyArray_All,
434    pub PyArray_Any: PyArray_Any,
435    pub PyArray_Compress: PyArray_Compress,
436    pub PyArray_Flatten: PyArray_Flatten,
437    pub PyArray_Ravel: PyArray_Ravel,
438    pub PyArray_MultiplyList: PyArray_MultiplyList,
439    pub PyArray_MultiplyIntList: PyArray_MultiplyIntList,
440    pub PyArray_GetPtr: PyArray_GetPtr,
441    pub PyArray_CompareLists: PyArray_CompareLists,
442    pub PyArray_AsCArray: PyArray_AsCArray,
443    pub PyArray_As1D: PyArray_As1D,
444    pub PyArray_As2D: PyArray_As2D,
445    pub PyArray_Free: PyArray_Free,
446    pub PyArray_Converter: PyArray_Converter,
447    pub PyArray_IntpFromSequence: PyArray_IntpFromSequence,
448    pub PyArray_Concatenate: PyArray_Concatenate,
449    pub PyArray_InnerProduct: PyArray_InnerProduct,
450    pub PyArray_MatrixProduct: PyArray_MatrixProduct,
451    pub PyArray_CopyAndTranspose: PyArray_CopyAndTranspose,
452    pub PyArray_Correlate: PyArray_Correlate,
453    pub PyArray_TypestrConvert: PyArray_TypestrConvert,
454    pub PyArray_DescrConverter: PyArray_DescrConverter,
455    pub PyArray_DescrConverter2: PyArray_DescrConverter2,
456    pub PyArray_IntpConverter: PyArray_IntpConverter,
457    pub PyArray_BufferConverter: PyArray_BufferConverter,
458    pub PyArray_AxisConverter: PyArray_AxisConverter,
459    pub PyArray_BoolConverter: PyArray_BoolConverter,
460    pub PyArray_ByteorderConverter: PyArray_ByteorderConverter,
461    pub PyArray_OrderConverter: PyArray_OrderConverter,
462    pub PyArray_EquivTypes: PyArray_EquivTypes,
463    pub PyArray_Zeros: PyArray_Zeros,
464    pub PyArray_Empty: PyArray_Empty,
465    pub PyArray_Where: PyArray_Where,
466    pub PyArray_Arange: PyArray_Arange,
467    pub PyArray_ArangeObj: PyArray_ArangeObj,
468    pub PyArray_SortkindConverter: PyArray_SortkindConverter,
469    pub PyArray_LexSort: PyArray_LexSort,
470    pub PyArray_Round: PyArray_Round,
471    pub PyArray_EquivTypenums: PyArray_EquivTypenums,
472    pub PyArray_RegisterDataType: PyArray_RegisterDataType,
473    pub PyArray_RegisterCastFunc: PyArray_RegisterCastFunc,
474    pub PyArray_RegisterCanCast: PyArray_RegisterCanCast,
475    pub PyArray_InitArrFuncs: PyArray_InitArrFuncs,
476    pub PyArray_IntTupleFromIntp: PyArray_IntTupleFromIntp,
477    pub PyArray_TypeNumFromName: PyArray_TypeNumFromName,
478    pub PyArray_ClipmodeConverter: PyArray_ClipmodeConverter,
479    pub PyArray_OutputConverter: PyArray_OutputConverter,
480    pub PyArray_BroadcastToShape: PyArray_BroadcastToShape,
481    pub _PyArray_SigintHandler: _PyArray_SigintHandler,
482    pub _PyArray_GetSigintBuf: _PyArray_GetSigintBuf,
483    pub PyArray_DescrAlignConverter: PyArray_DescrAlignConverter,
484    pub PyArray_DescrAlignConverter2: PyArray_DescrAlignConverter2,
485    pub PyArray_SearchsideConverter: PyArray_SearchsideConverter,
486    pub PyArray_CheckAxis: PyArray_CheckAxis,
487    pub PyArray_OverflowMultiplyList: PyArray_OverflowMultiplyList,
488    pub PyArray_CompareString: PyArray_CompareString,
489    // pub PyArray_MultiIterFromObjects: PyArray_MultiIterFromObjects,
490    pub PyArray_GetEndianness: PyArray_GetEndianness,
491    pub PyArray_GetNDArrayCFeatureVersion: PyArray_GetNDArrayCFeatureVersion,
492    pub PyArray_Correlate2: PyArray_Correlate2,
493    pub PyArray_NeighborhoodIterNew: PyArray_NeighborhoodIterNew,
494    pub PyArray_SetDatetimeParseFunction: PyArray_SetDatetimeParseFunction,
495    pub PyArray_DatetimeToDatetimeStruct: PyArray_DatetimeToDatetimeStruct,
496    pub PyArray_TimedeltaToTimedeltaStruct: PyArray_TimedeltaToTimedeltaStruct,
497    pub PyArray_DatetimeStructToDatetime: PyArray_DatetimeStructToDatetime,
498    pub PyArray_TimedeltaStructToTimedelta: PyArray_TimedeltaStructToTimedelta,
499    pub NpyIter_New: NpyIter_New,
500    pub NpyIter_MultiNew: NpyIter_MultiNew,
501    pub NpyIter_AdvancedNew: NpyIter_AdvancedNew,
502    pub NpyIter_Copy: NpyIter_Copy,
503    pub NpyIter_Deallocate: NpyIter_Deallocate,
504    pub NpyIter_HasDelayedBufAlloc: NpyIter_HasDelayedBufAlloc,
505    pub NpyIter_HasExternalLoop: NpyIter_HasExternalLoop,
506    pub NpyIter_EnableExternalLoop: NpyIter_EnableExternalLoop,
507    pub NpyIter_GetInnerStrideArray: NpyIter_GetInnerStrideArray,
508    pub NpyIter_GetInnerLoopSizePtr: NpyIter_GetInnerLoopSizePtr,
509    pub NpyIter_Reset: NpyIter_Reset,
510    pub NpyIter_ResetBasePointers: NpyIter_ResetBasePointers,
511    pub NpyIter_ResetToIterIndexRange: NpyIter_ResetToIterIndexRange,
512    pub NpyIter_GetNDim: NpyIter_GetNDim,
513    pub NpyIter_GetNOp: NpyIter_GetNOp,
514    pub NpyIter_GetIterNext: NpyIter_GetIterNext,
515    pub NpyIter_GetIterSize: NpyIter_GetIterSize,
516    pub NpyIter_GetIterIndexRange: NpyIter_GetIterIndexRange,
517    pub NpyIter_GetIterIndex: NpyIter_GetIterIndex,
518    pub NpyIter_GotoIterIndex: NpyIter_GotoIterIndex,
519    pub NpyIter_HasMultiIndex: NpyIter_HasMultiIndex,
520    pub NpyIter_GetShape: NpyIter_GetShape,
521    pub NpyIter_GetGetMultiIndex: NpyIter_GetGetMultiIndex,
522    pub NpyIter_GotoMultiIndex: NpyIter_GotoMultiIndex,
523    pub NpyIter_RemoveMultiIndex: NpyIter_RemoveMultiIndex,
524    pub NpyIter_HasIndex: NpyIter_HasIndex,
525    pub NpyIter_IsBuffered: NpyIter_IsBuffered,
526    pub NpyIter_IsGrowInner: NpyIter_IsGrowInner,
527    pub NpyIter_GetBufferSize: NpyIter_GetBufferSize,
528    pub NpyIter_GetIndexPtr: NpyIter_GetIndexPtr,
529    pub NpyIter_GotoIndex: NpyIter_GotoIndex,
530    pub NpyIter_GetDataPtrArray: NpyIter_GetDataPtrArray,
531    pub NpyIter_GetDescrArray: NpyIter_GetDescrArray,
532    pub NpyIter_GetOperandArray: NpyIter_GetOperandArray,
533    pub NpyIter_GetIterView: NpyIter_GetIterView,
534    pub NpyIter_GetReadFlags: NpyIter_GetReadFlags,
535    pub NpyIter_GetWriteFlags: NpyIter_GetWriteFlags,
536    pub NpyIter_DebugPrint: NpyIter_DebugPrint,
537    pub NpyIter_IterationNeedsAPI: NpyIter_IterationNeedsAPI,
538    pub NpyIter_GetInnerFixedStrideArray: NpyIter_GetInnerFixedStrideArray,
539    pub NpyIter_RemoveAxis: NpyIter_RemoveAxis,
540    pub NpyIter_GetAxisStrideArray: NpyIter_GetAxisStrideArray,
541    pub NpyIter_RequiresBuffering: NpyIter_RequiresBuffering,
542    pub NpyIter_GetInitialDataPtrArray: NpyIter_GetInitialDataPtrArray,
543    pub NpyIter_CreateCompatibleStrides: NpyIter_CreateCompatibleStrides,
544    pub PyArray_CastingConverter: PyArray_CastingConverter,
545    pub PyArray_CountNonzero: PyArray_CountNonzero,
546    pub PyArray_PromoteTypes: PyArray_PromoteTypes,
547    pub PyArray_MinScalarType: PyArray_MinScalarType,
548    pub PyArray_ResultType: PyArray_ResultType,
549    pub PyArray_CanCastArrayTo: PyArray_CanCastArrayTo,
550    pub PyArray_CanCastTypeTo: PyArray_CanCastTypeTo,
551    pub PyArray_EinsteinSum: PyArray_EinsteinSum,
552    pub PyArray_NewLikeArray: PyArray_NewLikeArray,
553    pub PyArray_GetArrayParamsFromObject: PyArray_GetArrayParamsFromObject,
554    pub PyArray_ConvertClipmodeSequence: PyArray_ConvertClipmodeSequence,
555    pub PyArray_MatrixProduct2: PyArray_MatrixProduct2,
556    pub NpyIter_IsFirstVisit: NpyIter_IsFirstVisit,
557    pub PyArray_SetBaseObject: PyArray_SetBaseObject,
558    pub PyArray_CreateSortedStridePerm: PyArray_CreateSortedStridePerm,
559    pub PyArray_RemoveAxesInPlace: PyArray_RemoveAxesInPlace,
560    pub PyArray_DebugPrint: PyArray_DebugPrint,
561    pub PyArray_FailUnlessWriteable: PyArray_FailUnlessWriteable,
562    pub PyArray_SetUpdateIfCopyBase: PyArray_SetUpdateIfCopyBase,
563    pub PyDataMem_NEW: PyDataMem_NEW,
564    pub PyDataMem_FREE: PyDataMem_FREE,
565    pub PyDataMem_RENEW: PyDataMem_RENEW,
566    pub PyDataMem_SetEventHook: PyDataMem_SetEventHook,
567    pub PyArray_MapIterSwapAxes: PyArray_MapIterSwapAxes,
568    pub PyArray_MapIterArray: PyArray_MapIterArray,
569    pub PyArray_MapIterNext: PyArray_MapIterNext,
570    pub PyArray_Partition: PyArray_Partition,
571    pub PyArray_ArgPartition: PyArray_ArgPartition,
572    pub PyArray_SelectkindConverter: PyArray_SelectkindConverter,
573    pub PyDataMem_NEW_ZEROED: PyDataMem_NEW_ZEROED,
574    pub PyArray_CheckAnyScalarExact: PyArray_CheckAnyScalarExact,
575    pub PyArray_MapIterArrayCopyIfOverlap: PyArray_MapIterArrayCopyIfOverlap,
576    pub PyArray_ResolveWritebackIfCopy: PyArray_ResolveWritebackIfCopy,
577    pub PyArray_SetWritebackIfCopyBase: PyArray_SetWritebackIfCopyBase,
578    pub PyArray_SimpleNewFromData: PyArray_SimpleNewFromData,
579}
580
581impl NumpyModuleReference {
582    pub unsafe fn new(pointer: *const *const c_void) -> Self {
583        Self {
584            pointer,
585            PyBigArray_Type: (*pointer.offset(1)) as *mut PyTypeObject,
586            PyArray_Type: (*pointer.offset(2)) as *mut PyTypeObject,
587            PyArrayDescr_Type: (*pointer.offset(3)) as *mut PyTypeObject,
588            PyArrayFlags_Type: (*pointer.offset(4)) as *mut PyTypeObject,
589            PyArrayIter_Type: (*pointer.offset(5)) as *mut PyTypeObject,
590            PyArrayMultiIter_Type: (*pointer.offset(6)) as *mut PyTypeObject,
591            NPY_NUMUSERTYPES: (*pointer.offset(7)) as *mut PyTypeObject,
592            PyBoolArrType_Type: (*pointer.offset(8)) as *mut PyTypeObject,
593            _PyArrayScalar_BoolValues: (*pointer.offset(9)) as *mut PyTypeObject,
594            PyGenericArrType_Type: (*pointer.offset(10)) as *mut PyTypeObject,
595            PyNumberArrType_Type: (*pointer.offset(11)) as *mut PyTypeObject,
596            PyIntegerArrType_Type: (*pointer.offset(12)) as *mut PyTypeObject,
597            PySignedIntegerArrType_Type: (*pointer.offset(13)) as *mut PyTypeObject,
598            PyUnsignedIntegerArrType_Type: (*pointer.offset(14)) as *mut PyTypeObject,
599            PyInexactArrType_Type: (*pointer.offset(15)) as *mut PyTypeObject,
600            PyFloatingArrType_Type: (*pointer.offset(16)) as *mut PyTypeObject,
601            PyComplexFloatingArrType_Type: (*pointer.offset(17)) as *mut PyTypeObject,
602            PyFlexibleArrType_Type: (*pointer.offset(18)) as *mut PyTypeObject,
603            PyCharacterArrType_Type: (*pointer.offset(19)) as *mut PyTypeObject,
604            PyByteArrType_Type: (*pointer.offset(20)) as *mut PyTypeObject,
605            PyShortArrType_Type: (*pointer.offset(21)) as *mut PyTypeObject,
606            PyIntArrType_Type: (*pointer.offset(22)) as *mut PyTypeObject,
607            PyLongArrType_Type: (*pointer.offset(23)) as *mut PyTypeObject,
608            PyLongLongArrType_Type: (*pointer.offset(24)) as *mut PyTypeObject,
609            PyUByteArrType_Type: (*pointer.offset(25)) as *mut PyTypeObject,
610            PyUShortArrType_Type: (*pointer.offset(26)) as *mut PyTypeObject,
611            PyUIntArrType_Type: (*pointer.offset(27)) as *mut PyTypeObject,
612            PyULongArrType_Type: (*pointer.offset(28)) as *mut PyTypeObject,
613            PyULongLongArrType_Type: (*pointer.offset(29)) as *mut PyTypeObject,
614            PyFloatArrType_Type: (*pointer.offset(30)) as *mut PyTypeObject,
615            PyDoubleArrType_Type: (*pointer.offset(31)) as *mut PyTypeObject,
616            PyLongDoubleArrType_Type: (*pointer.offset(32)) as *mut PyTypeObject,
617            PyCFloatArrType_Type: (*pointer.offset(33)) as *mut PyTypeObject,
618            PyCDoubleArrType_Type: (*pointer.offset(34)) as *mut PyTypeObject,
619            PyCLongDoubleArrType_Type: (*pointer.offset(35)) as *mut PyTypeObject,
620            PyObjectArrType_Type: (*pointer.offset(36)) as *mut PyTypeObject,
621            PyStringArrType_Type: (*pointer.offset(37)) as *mut PyTypeObject,
622            PyUnicodeArrType_Type: (*pointer.offset(38)) as *mut PyTypeObject,
623            PyVoidArrType_Type: (*pointer.offset(39)) as *mut PyTypeObject,
624
625            PyArray_GetNDArrayCVersion: *(pointer.offset(0) as *const PyArray_GetNDArrayCVersion),
626            PyArray_SetNumericOps: *(pointer.offset(40) as *const PyArray_SetNumericOps),
627            PyArray_GetNumericOps: *(pointer.offset(41) as *const PyArray_GetNumericOps),
628            PyArray_INCREF: *(pointer.offset(42) as *const PyArray_INCREF),
629            PyArray_XDECREF: *(pointer.offset(43) as *const PyArray_XDECREF),
630            PyArray_SetStringFunction: *(pointer.offset(44) as *const PyArray_SetStringFunction),
631            PyArray_DescrFromType: *(pointer.offset(45) as *const PyArray_DescrFromType),
632            PyArray_TypeObjectFromType: *(pointer.offset(46) as *const PyArray_TypeObjectFromType),
633            PyArray_Zero: *(pointer.offset(47) as *const PyArray_Zero),
634            PyArray_One: *(pointer.offset(48) as *const PyArray_One),
635            PyArray_CastToType: *(pointer.offset(49) as *const PyArray_CastToType),
636            PyArray_CastTo: *(pointer.offset(50) as *const PyArray_CastTo),
637            PyArray_CastAnyTo: *(pointer.offset(51) as *const PyArray_CastAnyTo),
638            PyArray_CanCastSafely: *(pointer.offset(52) as *const PyArray_CanCastSafely),
639            PyArray_CanCastTo: *(pointer.offset(53) as *const PyArray_CanCastTo),
640            PyArray_ObjectType: *(pointer.offset(54) as *const PyArray_ObjectType),
641            PyArray_DescrFromObject: *(pointer.offset(55) as *const PyArray_DescrFromObject),
642            PyArray_ConvertToCommonType: *(pointer.offset(56) as *const PyArray_ConvertToCommonType),
643            PyArray_DescrFromScalar: *(pointer.offset(57) as *const PyArray_DescrFromScalar),
644            PyArray_DescrFromTypeObject: *(pointer.offset(58) as *const PyArray_DescrFromTypeObject),
645            PyArray_Size: *(pointer.offset(59) as *const PyArray_Size),
646            PyArray_Scalar: *(pointer.offset(60) as *const PyArray_Scalar),
647            PyArray_FromScalar: *(pointer.offset(61) as *const PyArray_FromScalar),
648            PyArray_ScalarAsCtype: *(pointer.offset(62) as *const PyArray_ScalarAsCtype),
649            PyArray_CastScalarToCtype: *(pointer.offset(63) as *const PyArray_CastScalarToCtype),
650            PyArray_CastScalarDirect: *(pointer.offset(64) as *const PyArray_CastScalarDirect),
651            PyArray_ScalarFromObject: *(pointer.offset(65) as *const PyArray_ScalarFromObject),
652            PyArray_GetCastFunc: *(pointer.offset(66) as *const PyArray_GetCastFunc),
653            PyArray_FromDims: *(pointer.offset(67) as *const PyArray_FromDims),
654            PyArray_FromDimsAndDataAndDescr: *(pointer.offset(68) as *const PyArray_FromDimsAndDataAndDescr),
655            PyArray_FromAny: *(pointer.offset(69) as *const PyArray_FromAny),
656            PyArray_EnsureArray: *(pointer.offset(70) as *const PyArray_EnsureArray),
657            PyArray_EnsureAnyArray: *(pointer.offset(71) as *const PyArray_EnsureAnyArray),
658            PyArray_FromFile: *(pointer.offset(72) as *const PyArray_FromFile),
659            PyArray_FromString: *(pointer.offset(73) as *const PyArray_FromString),
660            PyArray_FromBuffer: *(pointer.offset(74) as *const PyArray_FromBuffer),
661            PyArray_FromIter: *(pointer.offset(75) as *const PyArray_FromIter),
662            PyArray_Return: *(pointer.offset(76) as *const PyArray_Return),
663            PyArray_GetField: *(pointer.offset(77) as *const PyArray_GetField),
664            PyArray_SetField: *(pointer.offset(78) as *const PyArray_SetField),
665            PyArray_Byteswap: *(pointer.offset(79) as *const PyArray_Byteswap),
666            PyArray_Resize: *(pointer.offset(80) as *const PyArray_Resize),
667            PyArray_MoveInto: *(pointer.offset(81) as *const PyArray_MoveInto),
668            PyArray_CopyInto: *(pointer.offset(82) as *const PyArray_CopyInto),
669            PyArray_CopyAnyInto: *(pointer.offset(83) as *const PyArray_CopyAnyInto),
670            PyArray_CopyObject: *(pointer.offset(84) as *const PyArray_CopyObject),
671            PyArray_NewCopy: *(pointer.offset(85) as *const PyArray_NewCopy),
672            PyArray_ToList: *(pointer.offset(86) as *const PyArray_ToList),
673            PyArray_ToString: *(pointer.offset(87) as *const PyArray_ToString),
674            PyArray_ToFile: *(pointer.offset(88) as *const PyArray_ToFile),
675            PyArray_Dump: *(pointer.offset(89) as *const PyArray_Dump),
676            PyArray_Dumps: *(pointer.offset(90) as *const PyArray_Dumps),
677            PyArray_ValidType: *(pointer.offset(91) as *const PyArray_ValidType),
678            PyArray_UpdateFlags: *(pointer.offset(92) as *const PyArray_UpdateFlags),
679            PyArray_New: *(pointer.offset(93) as *const PyArray_New),
680            PyArray_NewFromDescr: *(pointer.offset(94) as *const PyArray_NewFromDescr),
681            PyArray_DescrNew: *(pointer.offset(95) as *const PyArray_DescrNew),
682            PyArray_DescrNewFromType: *(pointer.offset(96) as *const PyArray_DescrNewFromType),
683            PyArray_GetPriority: *(pointer.offset(97) as *const PyArray_GetPriority),
684            PyArray_IterNew: *(pointer.offset(98) as *const PyArray_IterNew),
685            // PyArray_MultiIterNew: *(pointer.offset(99) as *const PyArray_MultiIterNew),
686            PyArray_PyIntAsInt: *(pointer.offset(100) as *const PyArray_PyIntAsInt),
687            PyArray_PyIntAsIntp: *(pointer.offset(101) as *const PyArray_PyIntAsIntp),
688            PyArray_Broadcast: *(pointer.offset(102) as *const PyArray_Broadcast),
689            PyArray_FillObjectArray: *(pointer.offset(103) as *const PyArray_FillObjectArray),
690            PyArray_FillWithScalar: *(pointer.offset(104) as *const PyArray_FillWithScalar),
691            PyArray_CheckStrides: *(pointer.offset(105) as *const PyArray_CheckStrides),
692            PyArray_DescrNewByteorder: *(pointer.offset(106) as *const PyArray_DescrNewByteorder),
693            PyArray_IterAllButAxis: *(pointer.offset(107) as *const PyArray_IterAllButAxis),
694            PyArray_CheckFromAny: *(pointer.offset(108) as *const PyArray_CheckFromAny),
695            PyArray_FromArray: *(pointer.offset(109) as *const PyArray_FromArray),
696            PyArray_FromInterface: *(pointer.offset(110) as *const PyArray_FromInterface),
697            PyArray_FromStructInterface: *(pointer.offset(111) as *const PyArray_FromStructInterface),
698            PyArray_FromArrayAttr: *(pointer.offset(112) as *const PyArray_FromArrayAttr),
699            PyArray_ScalarKind: *(pointer.offset(113) as *const PyArray_ScalarKind),
700            PyArray_CanCoerceScalar: *(pointer.offset(114) as *const PyArray_CanCoerceScalar),
701            PyArray_NewFlagsObject: *(pointer.offset(115) as *const PyArray_NewFlagsObject),
702            PyArray_CanCastScalar: *(pointer.offset(116) as *const PyArray_CanCastScalar),
703            PyArray_CompareUCS4: *(pointer.offset(117) as *const PyArray_CompareUCS4),
704            PyArray_RemoveSmallest: *(pointer.offset(118) as *const PyArray_RemoveSmallest),
705            PyArray_ElementStrides: *(pointer.offset(119) as *const PyArray_ElementStrides),
706            PyArray_Item_INCREF: *(pointer.offset(120) as *const PyArray_Item_INCREF),
707            PyArray_Item_XDECREF: *(pointer.offset(121) as *const PyArray_Item_XDECREF),
708            PyArray_FieldNames: *(pointer.offset(122) as *const PyArray_FieldNames),
709            PyArray_Transpose: *(pointer.offset(123) as *const PyArray_Transpose),
710            PyArray_TakeFrom: *(pointer.offset(124) as *const PyArray_TakeFrom),
711            PyArray_PutTo: *(pointer.offset(125) as *const PyArray_PutTo),
712            PyArray_PutMask: *(pointer.offset(126) as *const PyArray_PutMask),
713            PyArray_Repeat: *(pointer.offset(127) as *const PyArray_Repeat),
714            PyArray_Choose: *(pointer.offset(128) as *const PyArray_Choose),
715            PyArray_Sort: *(pointer.offset(129) as *const PyArray_Sort),
716            PyArray_ArgSort: *(pointer.offset(130) as *const PyArray_ArgSort),
717            PyArray_SearchSorted: *(pointer.offset(131) as *const PyArray_SearchSorted),
718            PyArray_ArgMax: *(pointer.offset(132) as *const PyArray_ArgMax),
719            PyArray_ArgMin: *(pointer.offset(133) as *const PyArray_ArgMin),
720            PyArray_Reshape: *(pointer.offset(134) as *const PyArray_Reshape),
721            PyArray_Newshape: *(pointer.offset(135) as *const PyArray_Newshape),
722            PyArray_Squeeze: *(pointer.offset(136) as *const PyArray_Squeeze),
723            PyArray_View: *(pointer.offset(137) as *const PyArray_View),
724            PyArray_SwapAxes: *(pointer.offset(138) as *const PyArray_SwapAxes),
725            PyArray_Max: *(pointer.offset(139) as *const PyArray_Max),
726            PyArray_Min: *(pointer.offset(140) as *const PyArray_Min),
727            PyArray_Ptp: *(pointer.offset(141) as *const PyArray_Ptp),
728            PyArray_Mean: *(pointer.offset(142) as *const PyArray_Mean),
729            PyArray_Trace: *(pointer.offset(143) as *const PyArray_Trace),
730            PyArray_Diagonal: *(pointer.offset(144) as *const PyArray_Diagonal),
731            PyArray_Clip: *(pointer.offset(145) as *const PyArray_Clip),
732            PyArray_Conjugate: *(pointer.offset(146) as *const PyArray_Conjugate),
733            PyArray_Nonzero: *(pointer.offset(147) as *const PyArray_Nonzero),
734            PyArray_Std: *(pointer.offset(148) as *const PyArray_Std),
735            PyArray_Sum: *(pointer.offset(149) as *const PyArray_Sum),
736            PyArray_CumSum: *(pointer.offset(150) as *const PyArray_CumSum),
737            PyArray_Prod: *(pointer.offset(151) as *const PyArray_Prod),
738            PyArray_CumProd: *(pointer.offset(152) as *const PyArray_CumProd),
739            PyArray_All: *(pointer.offset(153) as *const PyArray_All),
740            PyArray_Any: *(pointer.offset(154) as *const PyArray_Any),
741            PyArray_Compress: *(pointer.offset(155) as *const PyArray_Compress),
742            PyArray_Flatten: *(pointer.offset(156) as *const PyArray_Flatten),
743            PyArray_Ravel: *(pointer.offset(157) as *const PyArray_Ravel),
744            PyArray_MultiplyList: *(pointer.offset(158) as *const PyArray_MultiplyList),
745            PyArray_MultiplyIntList: *(pointer.offset(159) as *const PyArray_MultiplyIntList),
746            PyArray_GetPtr: *(pointer.offset(160) as *const PyArray_GetPtr),
747            PyArray_CompareLists: *(pointer.offset(161) as *const PyArray_CompareLists),
748            PyArray_AsCArray: *(pointer.offset(162) as *const PyArray_AsCArray),
749            PyArray_As1D: *(pointer.offset(163) as *const PyArray_As1D),
750            PyArray_As2D: *(pointer.offset(164) as *const PyArray_As2D),
751            PyArray_Free: *(pointer.offset(165) as *const PyArray_Free),
752            PyArray_Converter: *(pointer.offset(166) as *const PyArray_Converter),
753            PyArray_IntpFromSequence: *(pointer.offset(167) as *const PyArray_IntpFromSequence),
754            PyArray_Concatenate: *(pointer.offset(168) as *const PyArray_Concatenate),
755            PyArray_InnerProduct: *(pointer.offset(169) as *const PyArray_InnerProduct),
756            PyArray_MatrixProduct: *(pointer.offset(170) as *const PyArray_MatrixProduct),
757            PyArray_CopyAndTranspose: *(pointer.offset(171) as *const PyArray_CopyAndTranspose),
758            PyArray_Correlate: *(pointer.offset(172) as *const PyArray_Correlate),
759            PyArray_TypestrConvert: *(pointer.offset(173) as *const PyArray_TypestrConvert),
760            PyArray_DescrConverter: *(pointer.offset(174) as *const PyArray_DescrConverter),
761            PyArray_DescrConverter2: *(pointer.offset(175) as *const PyArray_DescrConverter2),
762            PyArray_IntpConverter: *(pointer.offset(176) as *const PyArray_IntpConverter),
763            PyArray_BufferConverter: *(pointer.offset(177) as *const PyArray_BufferConverter),
764            PyArray_AxisConverter: *(pointer.offset(178) as *const PyArray_AxisConverter),
765            PyArray_BoolConverter: *(pointer.offset(179) as *const PyArray_BoolConverter),
766            PyArray_ByteorderConverter: *(pointer.offset(180) as *const PyArray_ByteorderConverter),
767            PyArray_OrderConverter: *(pointer.offset(181) as *const PyArray_OrderConverter),
768            PyArray_EquivTypes: *(pointer.offset(182) as *const PyArray_EquivTypes),
769            PyArray_Zeros: *(pointer.offset(183) as *const PyArray_Zeros),
770            PyArray_Empty: *(pointer.offset(184) as *const PyArray_Empty),
771            PyArray_Where: *(pointer.offset(185) as *const PyArray_Where),
772            PyArray_Arange: *(pointer.offset(186) as *const PyArray_Arange),
773            PyArray_ArangeObj: *(pointer.offset(187) as *const PyArray_ArangeObj),
774            PyArray_SortkindConverter: *(pointer.offset(188) as *const PyArray_SortkindConverter),
775            PyArray_LexSort: *(pointer.offset(189) as *const PyArray_LexSort),
776            PyArray_Round: *(pointer.offset(190) as *const PyArray_Round),
777            PyArray_EquivTypenums: *(pointer.offset(191) as *const PyArray_EquivTypenums),
778            PyArray_RegisterDataType: *(pointer.offset(192) as *const PyArray_RegisterDataType),
779            PyArray_RegisterCastFunc: *(pointer.offset(193) as *const PyArray_RegisterCastFunc),
780            PyArray_RegisterCanCast: *(pointer.offset(194) as *const PyArray_RegisterCanCast),
781            PyArray_InitArrFuncs: *(pointer.offset(195) as *const PyArray_InitArrFuncs),
782            PyArray_IntTupleFromIntp: *(pointer.offset(196) as *const PyArray_IntTupleFromIntp),
783            PyArray_TypeNumFromName: *(pointer.offset(197) as *const PyArray_TypeNumFromName),
784            PyArray_ClipmodeConverter: *(pointer.offset(198) as *const PyArray_ClipmodeConverter),
785            PyArray_OutputConverter: *(pointer.offset(199) as *const PyArray_OutputConverter),
786            PyArray_BroadcastToShape: *(pointer.offset(200) as *const PyArray_BroadcastToShape),
787            _PyArray_SigintHandler: *(pointer.offset(201) as *const _PyArray_SigintHandler),
788            _PyArray_GetSigintBuf: *(pointer.offset(202) as *const _PyArray_GetSigintBuf),
789            PyArray_DescrAlignConverter: *(pointer.offset(203) as *const PyArray_DescrAlignConverter),
790            PyArray_DescrAlignConverter2: *(pointer.offset(204) as *const PyArray_DescrAlignConverter2),
791            PyArray_SearchsideConverter: *(pointer.offset(205) as *const PyArray_SearchsideConverter),
792            PyArray_CheckAxis: *(pointer.offset(206) as *const PyArray_CheckAxis),
793            PyArray_OverflowMultiplyList: *(pointer.offset(207) as *const PyArray_OverflowMultiplyList),
794            PyArray_CompareString: *(pointer.offset(208) as *const PyArray_CompareString),
795            // PyArray_MultiIterFromObjects: *(pointer.offset(209) as *const PyArray_MultiIterFromObjects),
796            PyArray_GetEndianness: *(pointer.offset(210) as *const PyArray_GetEndianness),
797            PyArray_GetNDArrayCFeatureVersion: *(pointer.offset(211) as *const PyArray_GetNDArrayCFeatureVersion),
798            PyArray_Correlate2: *(pointer.offset(212) as *const PyArray_Correlate2),
799            PyArray_NeighborhoodIterNew: *(pointer.offset(213) as *const PyArray_NeighborhoodIterNew),
800            PyArray_SetDatetimeParseFunction: *(pointer.offset(219) as *const PyArray_SetDatetimeParseFunction),
801            PyArray_DatetimeToDatetimeStruct: *(pointer.offset(220) as *const PyArray_DatetimeToDatetimeStruct),
802            PyArray_TimedeltaToTimedeltaStruct: *(pointer.offset(221) as *const PyArray_TimedeltaToTimedeltaStruct),
803            PyArray_DatetimeStructToDatetime: *(pointer.offset(222) as *const PyArray_DatetimeStructToDatetime),
804            PyArray_TimedeltaStructToTimedelta: *(pointer.offset(223) as *const PyArray_TimedeltaStructToTimedelta),
805            NpyIter_New: *(pointer.offset(224) as *const NpyIter_New),
806            NpyIter_MultiNew: *(pointer.offset(225) as *const NpyIter_MultiNew),
807            NpyIter_AdvancedNew: *(pointer.offset(226) as *const NpyIter_AdvancedNew),
808            NpyIter_Copy: *(pointer.offset(227) as *const NpyIter_Copy),
809            NpyIter_Deallocate: *(pointer.offset(228) as *const NpyIter_Deallocate),
810            NpyIter_HasDelayedBufAlloc: *(pointer.offset(229) as *const NpyIter_HasDelayedBufAlloc),
811            NpyIter_HasExternalLoop: *(pointer.offset(230) as *const NpyIter_HasExternalLoop),
812            NpyIter_EnableExternalLoop: *(pointer.offset(231) as *const NpyIter_EnableExternalLoop),
813            NpyIter_GetInnerStrideArray: *(pointer.offset(232) as *const NpyIter_GetInnerStrideArray),
814            NpyIter_GetInnerLoopSizePtr: *(pointer.offset(233) as *const NpyIter_GetInnerLoopSizePtr),
815            NpyIter_Reset: *(pointer.offset(234) as *const NpyIter_Reset),
816            NpyIter_ResetBasePointers: *(pointer.offset(235) as *const NpyIter_ResetBasePointers),
817            NpyIter_ResetToIterIndexRange: *(pointer.offset(236) as *const NpyIter_ResetToIterIndexRange),
818            NpyIter_GetNDim: *(pointer.offset(237) as *const NpyIter_GetNDim),
819            NpyIter_GetNOp: *(pointer.offset(238) as *const NpyIter_GetNOp),
820            NpyIter_GetIterNext: *(pointer.offset(239) as *const NpyIter_GetIterNext),
821            NpyIter_GetIterSize: *(pointer.offset(240) as *const NpyIter_GetIterSize),
822            NpyIter_GetIterIndexRange: *(pointer.offset(241) as *const NpyIter_GetIterIndexRange),
823            NpyIter_GetIterIndex: *(pointer.offset(242) as *const NpyIter_GetIterIndex),
824            NpyIter_GotoIterIndex: *(pointer.offset(243) as *const NpyIter_GotoIterIndex),
825            NpyIter_HasMultiIndex: *(pointer.offset(244) as *const NpyIter_HasMultiIndex),
826            NpyIter_GetShape: *(pointer.offset(245) as *const NpyIter_GetShape),
827            NpyIter_GetGetMultiIndex: *(pointer.offset(246) as *const NpyIter_GetGetMultiIndex),
828            NpyIter_GotoMultiIndex: *(pointer.offset(247) as *const NpyIter_GotoMultiIndex),
829            NpyIter_RemoveMultiIndex: *(pointer.offset(248) as *const NpyIter_RemoveMultiIndex),
830            NpyIter_HasIndex: *(pointer.offset(249) as *const NpyIter_HasIndex),
831            NpyIter_IsBuffered: *(pointer.offset(250) as *const NpyIter_IsBuffered),
832            NpyIter_IsGrowInner: *(pointer.offset(251) as *const NpyIter_IsGrowInner),
833            NpyIter_GetBufferSize: *(pointer.offset(252) as *const NpyIter_GetBufferSize),
834            NpyIter_GetIndexPtr: *(pointer.offset(253) as *const NpyIter_GetIndexPtr),
835            NpyIter_GotoIndex: *(pointer.offset(254) as *const NpyIter_GotoIndex),
836            NpyIter_GetDataPtrArray: *(pointer.offset(255) as *const NpyIter_GetDataPtrArray),
837            NpyIter_GetDescrArray: *(pointer.offset(256) as *const NpyIter_GetDescrArray),
838            NpyIter_GetOperandArray: *(pointer.offset(257) as *const NpyIter_GetOperandArray),
839            NpyIter_GetIterView: *(pointer.offset(258) as *const NpyIter_GetIterView),
840            NpyIter_GetReadFlags: *(pointer.offset(259) as *const NpyIter_GetReadFlags),
841            NpyIter_GetWriteFlags: *(pointer.offset(260) as *const NpyIter_GetWriteFlags),
842            NpyIter_DebugPrint: *(pointer.offset(261) as *const NpyIter_DebugPrint),
843            NpyIter_IterationNeedsAPI: *(pointer.offset(262) as *const NpyIter_IterationNeedsAPI),
844            NpyIter_GetInnerFixedStrideArray: *(pointer.offset(263) as *const NpyIter_GetInnerFixedStrideArray),
845            NpyIter_RemoveAxis: *(pointer.offset(264) as *const NpyIter_RemoveAxis),
846            NpyIter_GetAxisStrideArray: *(pointer.offset(265) as *const NpyIter_GetAxisStrideArray),
847            NpyIter_RequiresBuffering: *(pointer.offset(266) as *const NpyIter_RequiresBuffering),
848            NpyIter_GetInitialDataPtrArray: *(pointer.offset(267) as *const NpyIter_GetInitialDataPtrArray),
849            NpyIter_CreateCompatibleStrides: *(pointer.offset(268) as *const NpyIter_CreateCompatibleStrides),
850            PyArray_CastingConverter: *(pointer.offset(269) as *const PyArray_CastingConverter),
851            PyArray_CountNonzero: *(pointer.offset(270) as *const PyArray_CountNonzero),
852            PyArray_PromoteTypes: *(pointer.offset(271) as *const PyArray_PromoteTypes),
853            PyArray_MinScalarType: *(pointer.offset(272) as *const PyArray_MinScalarType),
854            PyArray_ResultType: *(pointer.offset(273) as *const PyArray_ResultType),
855            PyArray_CanCastArrayTo: *(pointer.offset(274) as *const PyArray_CanCastArrayTo),
856            PyArray_CanCastTypeTo: *(pointer.offset(275) as *const PyArray_CanCastTypeTo),
857            PyArray_EinsteinSum: *(pointer.offset(276) as *const PyArray_EinsteinSum),
858            PyArray_NewLikeArray: *(pointer.offset(277) as *const PyArray_NewLikeArray),
859            PyArray_GetArrayParamsFromObject: *(pointer.offset(278) as *const PyArray_GetArrayParamsFromObject),
860            PyArray_ConvertClipmodeSequence: *(pointer.offset(279) as *const PyArray_ConvertClipmodeSequence),
861            PyArray_MatrixProduct2: *(pointer.offset(280) as *const PyArray_MatrixProduct2),
862            NpyIter_IsFirstVisit: *(pointer.offset(281) as *const NpyIter_IsFirstVisit),
863            PyArray_SetBaseObject: *(pointer.offset(282) as *const PyArray_SetBaseObject),
864            PyArray_CreateSortedStridePerm: *(pointer.offset(283) as *const PyArray_CreateSortedStridePerm),
865            PyArray_RemoveAxesInPlace: *(pointer.offset(284) as *const PyArray_RemoveAxesInPlace),
866            PyArray_DebugPrint: *(pointer.offset(285) as *const PyArray_DebugPrint),
867            PyArray_FailUnlessWriteable: *(pointer.offset(286) as *const PyArray_FailUnlessWriteable),
868            PyArray_SetUpdateIfCopyBase: *(pointer.offset(287) as *const PyArray_SetUpdateIfCopyBase),
869            PyDataMem_NEW: *(pointer.offset(288) as *const PyDataMem_NEW),
870            PyDataMem_FREE: *(pointer.offset(289) as *const PyDataMem_FREE),
871            PyDataMem_RENEW: *(pointer.offset(290) as *const PyDataMem_RENEW),
872            PyDataMem_SetEventHook: *(pointer.offset(291) as *const PyDataMem_SetEventHook),
873            PyArray_MapIterSwapAxes: *(pointer.offset(293) as *const PyArray_MapIterSwapAxes),
874            PyArray_MapIterArray: *(pointer.offset(294) as *const PyArray_MapIterArray),
875            PyArray_MapIterNext: *(pointer.offset(295) as *const PyArray_MapIterNext),
876            PyArray_Partition: *(pointer.offset(296) as *const PyArray_Partition),
877            PyArray_ArgPartition: *(pointer.offset(297) as *const PyArray_ArgPartition),
878            PyArray_SelectkindConverter: *(pointer.offset(298) as *const PyArray_SelectkindConverter),
879            PyDataMem_NEW_ZEROED: *(pointer.offset(299) as *const PyDataMem_NEW_ZEROED),
880            PyArray_CheckAnyScalarExact: *(pointer.offset(300) as *const PyArray_CheckAnyScalarExact),
881            PyArray_MapIterArrayCopyIfOverlap: *(pointer.offset(301) as *const PyArray_MapIterArrayCopyIfOverlap),
882            PyArray_ResolveWritebackIfCopy: *(pointer.offset(302) as *const PyArray_ResolveWritebackIfCopy),
883            PyArray_SetWritebackIfCopyBase: *(pointer.offset(303) as *const PyArray_SetWritebackIfCopyBase),
884            PyArray_SimpleNewFromData: *(pointer.offset(304) as *const PyArray_SimpleNewFromData),
885        }
886    }
887
888    pub unsafe fn from(capsule: *mut PyObject) -> Self {
889        let pointer = PyCapsule_GetPointer(capsule, null_mut()) as *const *const c_void;
890        NumpyModuleReference::new(pointer)
891    }
892
893    pub fn PyArray_Sort2(&self, op: *mut PyArrayObject, axis: c_int, which: NPY_SORTKIND) -> c_int {
894        unsafe {
895            let function = *(self.pointer.offset(129) as *const PyArray_Sort);
896            (function)(op, axis, which)
897        }
898    }
899}
900