1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
//! Low-Level binding for [Array API](https://numpy.org/doc/stable/reference/c-api/array.html)

#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

use std::os::raw::*;
use std::ptr::null_mut;

use libc::FILE;
use python3_sys::{PyCapsule_GetPointer, PyObject, PyTypeObject};

use crate::npyffi::*;
use std::borrow::Borrow;

pub type PyArray_GetNDArrayCVersion = unsafe extern "C" fn() -> c_uint;
pub type PyArray_SetNumericOps = unsafe extern "C" fn(dict: *mut PyObject) -> c_int;
pub type PyArray_GetNumericOps = unsafe extern "C" fn() -> *mut PyObject;
pub type PyArray_INCREF = unsafe extern "C" fn(mp: *mut PyArrayObject) -> c_int;
pub type PyArray_XDECREF = unsafe extern "C" fn(mp: *mut PyArrayObject) -> c_int;
pub type PyArray_SetStringFunction = unsafe extern "C" fn(op: *mut PyObject, repr: c_int);
pub type PyArray_DescrFromType = unsafe extern "C" fn(type_: c_int) -> *mut PyArray_Descr;
pub type PyArray_TypeObjectFromType = unsafe extern "C" fn(type_: c_int) -> *mut PyObject;
pub type PyArray_Zero = unsafe extern "C" fn(arr: *mut PyArrayObject) -> *mut c_char;
pub type PyArray_One = unsafe extern "C" fn(arr: *mut PyArrayObject) -> *mut c_char;
pub type PyArray_CastToType = unsafe extern "C" fn(arr: *mut PyArrayObject, dtype: *mut PyArray_Descr, is_f_order: c_int) -> *mut PyObject;
pub type PyArray_CastTo = unsafe extern "C" fn(out: *mut PyArrayObject, mp: *mut PyArrayObject) -> c_int;
pub type PyArray_CastAnyTo = unsafe extern "C" fn(out: *mut PyArrayObject, mp: *mut PyArrayObject) -> c_int;
pub type PyArray_CanCastSafely = unsafe extern "C" fn(fromtype: c_int, totype: c_int) -> c_int;
pub type PyArray_CanCastTo = unsafe extern "C" fn(from: *mut PyArray_Descr, to: *mut PyArray_Descr) -> npy_bool;
pub type PyArray_ObjectType = unsafe extern "C" fn(op: *mut PyObject, minimum_type: c_int) -> c_int;
pub type PyArray_DescrFromObject = unsafe extern "C" fn(op: *mut PyObject, mintype: *mut PyArray_Descr) -> *mut PyArray_Descr;
pub type PyArray_ConvertToCommonType = unsafe extern "C" fn(op: *mut PyObject, retn: *mut c_int) -> *mut *mut PyArrayObject;
pub type PyArray_DescrFromScalar = unsafe extern "C" fn(sc: *mut PyObject) -> *mut PyArray_Descr;
pub type PyArray_DescrFromTypeObject = unsafe extern "C" fn(type_: *mut PyObject) -> *mut PyArray_Descr;
pub type PyArray_Size = unsafe extern "C" fn(op: *mut PyObject) -> npy_intp;
pub type PyArray_Scalar = unsafe extern "C" fn(data: *mut c_void, descr: *mut PyArray_Descr, base: *mut PyObject) -> *mut PyObject;
pub type PyArray_FromScalar = unsafe extern "C" fn(scalar: *mut PyObject, outcode: *mut PyArray_Descr) -> *mut PyObject;
pub type PyArray_ScalarAsCtype = unsafe extern "C" fn(scalar: *mut PyObject, ctypeptr: *mut c_void);
pub type PyArray_CastScalarToCtype = unsafe extern "C" fn(scalar: *mut PyObject, ctypeptr: *mut c_void, outcode: *mut PyArray_Descr) -> c_int;
pub type PyArray_CastScalarDirect = unsafe extern "C" fn(scalar: *mut PyObject, indescr: *mut PyArray_Descr, ctypeptr: *mut c_void, outtype: c_int) -> c_int;
pub type PyArray_ScalarFromObject = unsafe extern "C" fn(object: *mut PyObject) -> *mut PyObject;
pub type PyArray_GetCastFunc = unsafe extern "C" fn(descr: *mut PyArray_Descr, type_num: c_int) -> PyArray_VectorUnaryFunc;
pub type PyArray_FromDims = unsafe extern "C" fn(nd: c_int, d: *mut c_int, type_: c_int) -> *mut PyObject;
pub type PyArray_FromDimsAndDataAndDescr = unsafe extern "C" fn(nd: c_int, d: *mut c_int, descr: *mut PyArray_Descr, data: *mut c_char) -> *mut PyObject;
pub 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;
pub type PyArray_EnsureArray = unsafe extern "C" fn(op: *mut PyObject) -> *mut PyObject;
pub type PyArray_EnsureAnyArray = unsafe extern "C" fn(op: *mut PyObject) -> *mut PyObject;
pub type PyArray_FromFile = unsafe extern "C" fn(fp: *mut FILE, dtype: *mut PyArray_Descr, num: npy_intp, sep: *mut c_char) -> *mut PyObject;
pub 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;
pub type PyArray_FromBuffer = unsafe extern "C" fn(buf: *mut PyObject, type_: *mut PyArray_Descr, count: npy_intp, offset: npy_intp) -> *mut PyObject;
pub type PyArray_FromIter = unsafe extern "C" fn(obj: *mut PyObject, dtype: *mut PyArray_Descr, count: npy_intp) -> *mut PyObject;
pub type PyArray_Return = unsafe extern "C" fn(mp: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_GetField = unsafe extern "C" fn(self_: *mut PyArrayObject, typed: *mut PyArray_Descr, offset: c_int) -> *mut PyObject;
pub type PyArray_SetField = unsafe extern "C" fn(self_: *mut PyArrayObject, dtype: *mut PyArray_Descr, offset: c_int, val: *mut PyObject) -> c_int;
pub type PyArray_Byteswap = unsafe extern "C" fn(self_: *mut PyArrayObject, inplace: npy_bool) -> *mut PyObject;
pub type PyArray_Resize = unsafe extern "C" fn(self_: *mut PyArrayObject, newshape: *mut PyArray_Dims, refcheck: c_int, order: NPY_ORDER) -> *mut PyObject;
pub type PyArray_MoveInto = unsafe extern "C" fn(dst: *mut PyArrayObject, src: *mut PyArrayObject) -> c_int;
pub type PyArray_CopyInto = unsafe extern "C" fn(dst: *mut PyArrayObject, src: *mut PyArrayObject) -> c_int;
pub type PyArray_CopyAnyInto = unsafe extern "C" fn(dst: *mut PyArrayObject, src: *mut PyArrayObject) -> c_int;
pub type PyArray_CopyObject = unsafe extern "C" fn(dest: *mut PyArrayObject, src_object: *mut PyObject) -> c_int;
pub type PyArray_NewCopy = unsafe extern "C" fn(obj: *mut PyArrayObject, order: NPY_ORDER) -> *mut PyObject;
pub type PyArray_ToList = unsafe extern "C" fn(self_: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_ToString = unsafe extern "C" fn(self_: *mut PyArrayObject, order: NPY_ORDER) -> *mut PyObject;
pub type PyArray_ToFile = unsafe extern "C" fn(self_: *mut PyArrayObject, fp: *mut FILE, sep: *mut c_char, format: *mut c_char) -> c_int;
pub type PyArray_Dump = unsafe extern "C" fn(self_: *mut PyObject, file: *mut PyObject, protocol: c_int) -> c_int;
pub type PyArray_Dumps = unsafe extern "C" fn(self_: *mut PyObject, protocol: c_int) -> *mut PyObject;
pub type PyArray_ValidType = unsafe extern "C" fn(type_: c_int) -> c_int;
pub type PyArray_UpdateFlags = unsafe extern "C" fn(ret: *mut PyArrayObject, flagmask: c_int);
pub 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;
pub 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;
pub type PyArray_DescrNew = unsafe extern "C" fn(base: *mut PyArray_Descr) -> *mut PyArray_Descr;
pub type PyArray_DescrNewFromType = unsafe extern "C" fn(type_num: c_int) -> *mut PyArray_Descr;
pub type PyArray_GetPriority = unsafe extern "C" fn(obj: *mut PyObject, default_: f64) -> f64;
pub type PyArray_IterNew = unsafe extern "C" fn(obj: *mut PyObject) -> *mut PyObject;
// pub type PyArray_MultiIterNew = unsafe extern "C" fn(n: c_int, ...) -> *mut PyObject;
pub type PyArray_PyIntAsInt = unsafe extern "C" fn(o: *mut PyObject) -> c_int;
pub type PyArray_PyIntAsIntp = unsafe extern "C" fn(o: *mut PyObject) -> npy_intp;
pub type PyArray_Broadcast = unsafe extern "C" fn(mit: *mut PyArrayMultiIterObject) -> c_int;
pub type PyArray_FillObjectArray = unsafe extern "C" fn(arr: *mut PyArrayObject, obj: *mut PyObject);
pub type PyArray_FillWithScalar = unsafe extern "C" fn(arr: *mut PyArrayObject, obj: *mut PyObject) -> c_int;
pub 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;
pub type PyArray_DescrNewByteorder = unsafe extern "C" fn(self_: *mut PyArray_Descr, newendian: c_char) -> *mut PyArray_Descr;
pub type PyArray_IterAllButAxis = unsafe extern "C" fn(obj: *mut PyObject, inaxis: *mut c_int) -> *mut PyObject;
pub 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;
pub type PyArray_FromArray = unsafe extern "C" fn(arr: *mut PyArrayObject, newtype: *mut PyArray_Descr, flags: c_int) -> *mut PyObject;
pub type PyArray_FromInterface = unsafe extern "C" fn(origin: *mut PyObject) -> *mut PyObject;
pub type PyArray_FromStructInterface = unsafe extern "C" fn(input: *mut PyObject) -> *mut PyObject;
pub type PyArray_FromArrayAttr = unsafe extern "C" fn(op: *mut PyObject, typecode: *mut PyArray_Descr, context: *mut PyObject) -> *mut PyObject;
pub type PyArray_ScalarKind = unsafe extern "C" fn(typenum: c_int, arr: *mut *mut PyArrayObject) -> NPY_SCALARKIND;
pub type PyArray_CanCoerceScalar = unsafe extern "C" fn(thistype: c_int, neededtype: c_int, scalar: NPY_SCALARKIND) -> c_int;
pub type PyArray_NewFlagsObject = unsafe extern "C" fn(obj: *mut PyObject) -> *mut PyObject;
pub type PyArray_CanCastScalar = unsafe extern "C" fn(from: *mut PyTypeObject, to: *mut PyTypeObject) -> npy_bool;
pub type PyArray_CompareUCS4 = unsafe extern "C" fn(s1: *mut npy_ucs4, s2: *mut npy_ucs4, len: usize) -> c_int;
pub type PyArray_RemoveSmallest = unsafe extern "C" fn(multi: *mut PyArrayMultiIterObject) -> c_int;
pub type PyArray_ElementStrides = unsafe extern "C" fn(obj: *mut PyObject) -> c_int;
pub type PyArray_Item_INCREF = unsafe extern "C" fn(data: *mut c_char, descr: *mut PyArray_Descr);
pub type PyArray_Item_XDECREF = unsafe extern "C" fn(data: *mut c_char, descr: *mut PyArray_Descr);
pub type PyArray_FieldNames = unsafe extern "C" fn(fields: *mut PyObject) -> *mut PyObject;
pub type PyArray_Transpose = unsafe extern "C" fn(ap: *mut PyArrayObject, permute: *mut PyArray_Dims) -> *mut PyObject;
pub type PyArray_TakeFrom = unsafe extern "C" fn(self0: *mut PyArrayObject, indices0: *mut PyObject, axis: c_int, out: *mut PyArrayObject, clipmode: NPY_CLIPMODE) -> *mut PyObject;
pub type PyArray_PutTo = unsafe extern "C" fn(self_: *mut PyArrayObject, values0: *mut PyObject, indices0: *mut PyObject, clipmode: NPY_CLIPMODE) -> *mut PyObject;
pub type PyArray_PutMask = unsafe extern "C" fn(self_: *mut PyArrayObject, values0: *mut PyObject, mask0: *mut PyObject) -> *mut PyObject;
pub type PyArray_Repeat = unsafe extern "C" fn(aop: *mut PyArrayObject, op: *mut PyObject, axis: c_int) -> *mut PyObject;
pub type PyArray_Choose = unsafe extern "C" fn(ip: *mut PyArrayObject, op: *mut PyObject, out: *mut PyArrayObject, clipmode: NPY_CLIPMODE) -> *mut PyObject;
pub type PyArray_Sort = unsafe extern "C" fn(op: *mut PyArrayObject, axis: c_int, which: NPY_SORTKIND) -> c_int;
pub type PyArray_ArgSort = unsafe extern "C" fn(op: *mut PyArrayObject, axis: c_int, which: NPY_SORTKIND) -> *mut PyObject;
pub type PyArray_SearchSorted = unsafe extern "C" fn(op1: *mut PyArrayObject, op2: *mut PyObject, side: NPY_SEARCHSIDE, perm: *mut PyObject) -> *mut PyObject;
pub type PyArray_ArgMax = unsafe extern "C" fn(op: *mut PyArrayObject, axis: c_int, out: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_ArgMin = unsafe extern "C" fn(op: *mut PyArrayObject, axis: c_int, out: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_Reshape = unsafe extern "C" fn(self_: *mut PyArrayObject, shape: *mut PyObject) -> *mut PyObject;
pub type PyArray_Newshape = unsafe extern "C" fn(self_: *mut PyArrayObject, newdims: *mut PyArray_Dims, order: NPY_ORDER) -> *mut PyObject;
pub type PyArray_Squeeze = unsafe extern "C" fn(self_: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_View = unsafe extern "C" fn(self_: *mut PyArrayObject, type_: *mut PyArray_Descr, pytype: *mut PyTypeObject) -> *mut PyObject;
pub type PyArray_SwapAxes = unsafe extern "C" fn(ap: *mut PyArrayObject, a1: c_int, a2: c_int) -> *mut PyObject;
pub type PyArray_Max = unsafe extern "C" fn(ap: *mut PyArrayObject, axis: c_int, out: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_Min = unsafe extern "C" fn(ap: *mut PyArrayObject, axis: c_int, out: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_Ptp = unsafe extern "C" fn(ap: *mut PyArrayObject, axis: c_int, out: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_Mean = unsafe extern "C" fn(self_: *mut PyArrayObject, axis: c_int, rtype: c_int, out: *mut PyArrayObject) -> *mut PyObject;
pub 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;
pub type PyArray_Diagonal = unsafe extern "C" fn(self_: *mut PyArrayObject, offset: c_int, axis1: c_int, axis2: c_int) -> *mut PyObject;
pub type PyArray_Clip = unsafe extern "C" fn(self_: *mut PyArrayObject, min: *mut PyObject, max: *mut PyObject, out: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_Conjugate = unsafe extern "C" fn(self_: *mut PyArrayObject, out: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_Nonzero = unsafe extern "C" fn(self_: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_Std = unsafe extern "C" fn(self_: *mut PyArrayObject, axis: c_int, rtype: c_int, out: *mut PyArrayObject, variance: c_int) -> *mut PyObject;
pub type PyArray_Sum = unsafe extern "C" fn(self_: *mut PyArrayObject, axis: c_int, rtype: c_int, out: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_CumSum = unsafe extern "C" fn(self_: *mut PyArrayObject, axis: c_int, rtype: c_int, out: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_Prod = unsafe extern "C" fn(self_: *mut PyArrayObject, axis: c_int, rtype: c_int, out: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_CumProd = unsafe extern "C" fn(self_: *mut PyArrayObject, axis: c_int, rtype: c_int, out: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_All = unsafe extern "C" fn(self_: *mut PyArrayObject, axis: c_int, out: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_Any = unsafe extern "C" fn(self_: *mut PyArrayObject, axis: c_int, out: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_Compress = unsafe extern "C" fn(self_: *mut PyArrayObject, condition: *mut PyObject, axis: c_int, out: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_Flatten = unsafe extern "C" fn(a: *mut PyArrayObject, order: NPY_ORDER) -> *mut PyObject;
pub type PyArray_Ravel = unsafe extern "C" fn(arr: *mut PyArrayObject, order: NPY_ORDER) -> *mut PyObject;
pub type PyArray_MultiplyList = unsafe extern "C" fn(l1: *mut npy_intp, n: c_int) -> npy_intp;
pub type PyArray_MultiplyIntList = unsafe extern "C" fn(l1: *mut c_int, n: c_int) -> c_int;
pub type PyArray_GetPtr = unsafe extern "C" fn(obj: *mut PyArrayObject, ind: *mut npy_intp) -> *mut c_void;
pub type PyArray_CompareLists = unsafe extern "C" fn(l1: *mut npy_intp, l2: *mut npy_intp, n: c_int) -> c_int;
pub 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;
pub 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;
pub 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;
pub type PyArray_Free = unsafe extern "C" fn(op: *mut PyObject, ptr: *mut c_void) -> c_int;
pub type PyArray_Converter = unsafe extern "C" fn(object: *mut PyObject, address: *mut *mut PyObject) -> c_int;
pub type PyArray_IntpFromSequence = unsafe extern "C" fn(seq: *mut PyObject, vals: *mut npy_intp, maxvals: c_int) -> c_int;
pub type PyArray_Concatenate = unsafe extern "C" fn(op: *mut PyObject, axis: c_int) -> *mut PyObject;
pub type PyArray_InnerProduct = unsafe extern "C" fn(op1: *mut PyObject, op2: *mut PyObject) -> *mut PyObject;
pub type PyArray_MatrixProduct = unsafe extern "C" fn(op1: *mut PyObject, op2: *mut PyObject) -> *mut PyObject;
pub type PyArray_CopyAndTranspose = unsafe extern "C" fn(op: *mut PyObject) -> *mut PyObject;
pub type PyArray_Correlate = unsafe extern "C" fn(op1: *mut PyObject, op2: *mut PyObject, mode: c_int) -> *mut PyObject;
pub type PyArray_TypestrConvert = unsafe extern "C" fn(itemsize: c_int, gentype: c_int) -> c_int;
pub type PyArray_DescrConverter = unsafe extern "C" fn(obj: *mut PyObject, at: *mut *mut PyArray_Descr) -> c_int;
pub type PyArray_DescrConverter2 = unsafe extern "C" fn(obj: *mut PyObject, at: *mut *mut PyArray_Descr) -> c_int;
pub type PyArray_IntpConverter = unsafe extern "C" fn(obj: *mut PyObject, seq: *mut PyArray_Dims) -> c_int;
pub type PyArray_BufferConverter = unsafe extern "C" fn(obj: *mut PyObject, buf: *mut PyArray_Chunk) -> c_int;
pub type PyArray_AxisConverter = unsafe extern "C" fn(obj: *mut PyObject, axis: *mut c_int) -> c_int;
pub type PyArray_BoolConverter = unsafe extern "C" fn(object: *mut PyObject, val: *mut npy_bool) -> c_int;
pub type PyArray_ByteorderConverter = unsafe extern "C" fn(obj: *mut PyObject, endian: *mut c_char) -> c_int;
pub type PyArray_OrderConverter = unsafe extern "C" fn(object: *mut PyObject, val: *mut NPY_ORDER) -> c_int;
pub type PyArray_EquivTypes = unsafe extern "C" fn(type1: *mut PyArray_Descr, type2: *mut PyArray_Descr) -> c_uchar;
pub 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;
pub 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;
pub type PyArray_Where = unsafe extern "C" fn(condition: *mut PyObject, x: *mut PyObject, y: *mut PyObject) -> *mut PyObject;
pub type PyArray_Arange = unsafe extern "C" fn(start: f64, stop: f64, step: f64, type_num: c_int) -> *mut PyObject;
pub type PyArray_ArangeObj = unsafe extern "C" fn(start: *mut PyObject, stop: *mut PyObject, step: *mut PyObject, dtype: *mut PyArray_Descr) -> *mut PyObject;
pub type PyArray_SortkindConverter = unsafe extern "C" fn(obj: *mut PyObject, sortkind: *mut NPY_SORTKIND) -> c_int;
pub type PyArray_LexSort = unsafe extern "C" fn(sort_keys: *mut PyObject, axis: c_int) -> *mut PyObject;
pub type PyArray_Round = unsafe extern "C" fn(a: *mut PyArrayObject, decimals: c_int, out: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_EquivTypenums = unsafe extern "C" fn(typenum1: c_int, typenum2: c_int) -> c_uchar;
pub type PyArray_RegisterDataType = unsafe extern "C" fn(descr: *mut PyArray_Descr) -> c_int;
pub type PyArray_RegisterCastFunc = unsafe extern "C" fn(descr: *mut PyArray_Descr, totype: c_int, castfunc: PyArray_VectorUnaryFunc) -> c_int;
pub type PyArray_RegisterCanCast = unsafe extern "C" fn(descr: *mut PyArray_Descr, totype: c_int, scalar: NPY_SCALARKIND) -> c_int;
pub type PyArray_InitArrFuncs = unsafe extern "C" fn(f: *mut PyArray_ArrFuncs);
pub type PyArray_IntTupleFromIntp = unsafe extern "C" fn(len: c_int, vals: *mut npy_intp) -> *mut PyObject;
pub type PyArray_TypeNumFromName = unsafe extern "C" fn(str: *mut c_char) -> c_int;
pub type PyArray_ClipmodeConverter = unsafe extern "C" fn(object: *mut PyObject, val: *mut NPY_CLIPMODE) -> c_int;
pub type PyArray_OutputConverter = unsafe extern "C" fn(object: *mut PyObject, address: *mut *mut PyArrayObject) -> c_int;
pub type PyArray_BroadcastToShape = unsafe extern "C" fn(obj: *mut PyObject, dims: *mut npy_intp, nd: c_int) -> *mut PyObject;
pub type _PyArray_SigintHandler = unsafe extern "C" fn(signum: c_int);
pub type _PyArray_GetSigintBuf = unsafe extern "C" fn() -> *mut c_void;
pub type PyArray_DescrAlignConverter = unsafe extern "C" fn(obj: *mut PyObject, at: *mut *mut PyArray_Descr) -> c_int;
pub type PyArray_DescrAlignConverter2 = unsafe extern "C" fn(obj: *mut PyObject, at: *mut *mut PyArray_Descr) -> c_int;
pub type PyArray_SearchsideConverter = unsafe extern "C" fn(obj: *mut PyObject, addr: *mut c_void) -> c_int;
pub type PyArray_CheckAxis = unsafe extern "C" fn(arr: *mut PyArrayObject, axis: *mut c_int, flags: c_int) -> *mut PyObject;
pub type PyArray_OverflowMultiplyList = unsafe extern "C" fn(l1: *mut npy_intp, n: c_int) -> npy_intp;
pub type PyArray_CompareString = unsafe extern "C" fn(s1: *mut c_char, s2: *mut c_char, len: usize) -> c_int;
// pub type PyArray_MultiIterFromObjects = unsafe extern "C" fn(mps: *mut *mut PyObject, n: c_int, nadd: c_int, ...) -> *mut PyObject;
pub type PyArray_GetEndianness = unsafe extern "C" fn() -> c_int;
pub type PyArray_GetNDArrayCFeatureVersion = unsafe extern "C" fn() -> c_uint;
pub type PyArray_Correlate2 = unsafe extern "C" fn(op1: *mut PyObject, op2: *mut PyObject, mode: c_int) -> *mut PyObject;
pub type PyArray_NeighborhoodIterNew = unsafe extern "C" fn(x: *mut PyArrayIterObject, bounds: *mut npy_intp, mode: c_int, fill: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_SetDatetimeParseFunction = unsafe extern "C" fn(op: *mut PyObject);
pub type PyArray_DatetimeToDatetimeStruct = unsafe extern "C" fn(val: npy_datetime, fr: NPY_DATETIMEUNIT, result: *mut npy_datetimestruct);
pub type PyArray_TimedeltaToTimedeltaStruct = unsafe extern "C" fn(val: npy_timedelta, fr: NPY_DATETIMEUNIT, result: *mut npy_timedeltastruct);
pub type PyArray_DatetimeStructToDatetime = unsafe extern "C" fn(fr: NPY_DATETIMEUNIT, d: *mut npy_datetimestruct) -> npy_datetime;
pub type PyArray_TimedeltaStructToTimedelta = unsafe extern "C" fn(fr: NPY_DATETIMEUNIT, d: *mut npy_timedeltastruct) -> npy_datetime;
pub 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;
pub 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;
pub 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;
pub type NpyIter_Copy = unsafe extern "C" fn(iter: *mut NpyIter) -> *mut NpyIter;
pub type NpyIter_Deallocate = unsafe extern "C" fn(iter: *mut NpyIter) -> c_int;
pub type NpyIter_HasDelayedBufAlloc = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_bool;
pub type NpyIter_HasExternalLoop = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_bool;
pub type NpyIter_EnableExternalLoop = unsafe extern "C" fn(iter: *mut NpyIter) -> c_int;
pub type NpyIter_GetInnerStrideArray = unsafe extern "C" fn(iter: *mut NpyIter) -> *mut npy_intp;
pub type NpyIter_GetInnerLoopSizePtr = unsafe extern "C" fn(iter: *mut NpyIter) -> *mut npy_intp;
pub type NpyIter_Reset = unsafe extern "C" fn(iter: *mut NpyIter, errmsg: *mut *mut c_char) -> c_int;
pub type NpyIter_ResetBasePointers = unsafe extern "C" fn(iter: *mut NpyIter, baseptrs: *mut *mut c_char, errmsg: *mut *mut c_char) -> c_int;
pub type NpyIter_ResetToIterIndexRange = unsafe extern "C" fn(iter: *mut NpyIter, istart: npy_intp, iend: npy_intp, errmsg: *mut *mut c_char) -> c_int;
pub type NpyIter_GetNDim = unsafe extern "C" fn(iter: *mut NpyIter) -> c_int;
pub type NpyIter_GetNOp = unsafe extern "C" fn(iter: *mut NpyIter) -> c_int;
pub type NpyIter_GetIterNext = unsafe extern "C" fn(iter: *mut NpyIter, errmsg: *mut *mut c_char) -> NpyIter_IterNextFunc;
pub type NpyIter_GetIterSize = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_intp;
pub type NpyIter_GetIterIndexRange = unsafe extern "C" fn(iter: *mut NpyIter, istart: *mut npy_intp, iend: *mut npy_intp);
pub type NpyIter_GetIterIndex = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_intp;
pub type NpyIter_GotoIterIndex = unsafe extern "C" fn(iter: *mut NpyIter, iterindex: npy_intp) -> c_int;
pub type NpyIter_HasMultiIndex = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_bool;
pub type NpyIter_GetShape = unsafe extern "C" fn(iter: *mut NpyIter, outshape: *mut npy_intp) -> c_int;
pub type NpyIter_GetGetMultiIndex = unsafe extern "C" fn(iter: *mut NpyIter, errmsg: *mut *mut c_char) -> NpyIter_GetMultiIndexFunc;
pub type NpyIter_GotoMultiIndex = unsafe extern "C" fn(iter: *mut NpyIter, multi_index: *mut npy_intp) -> c_int;
pub type NpyIter_RemoveMultiIndex = unsafe extern "C" fn(iter: *mut NpyIter) -> c_int;
pub type NpyIter_HasIndex = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_bool;
pub type NpyIter_IsBuffered = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_bool;
pub type NpyIter_IsGrowInner = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_bool;
pub type NpyIter_GetBufferSize = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_intp;
pub type NpyIter_GetIndexPtr = unsafe extern "C" fn(iter: *mut NpyIter) -> *mut npy_intp;
pub type NpyIter_GotoIndex = unsafe extern "C" fn(iter: *mut NpyIter, flat_index: npy_intp) -> c_int;
pub type NpyIter_GetDataPtrArray = unsafe extern "C" fn(iter: *mut NpyIter) -> *mut *mut c_char;
pub type NpyIter_GetDescrArray = unsafe extern "C" fn(iter: *mut NpyIter) -> *mut *mut PyArray_Descr;
pub type NpyIter_GetOperandArray = unsafe extern "C" fn(iter: *mut NpyIter) -> *mut *mut PyArrayObject;
pub type NpyIter_GetIterView = unsafe extern "C" fn(iter: *mut NpyIter, i: npy_intp) -> *mut PyArrayObject;
pub type NpyIter_GetReadFlags = unsafe extern "C" fn(iter: *mut NpyIter, outreadflags: *mut c_char);
pub type NpyIter_GetWriteFlags = unsafe extern "C" fn(iter: *mut NpyIter, outwriteflags: *mut c_char);
pub type NpyIter_DebugPrint = unsafe extern "C" fn(iter: *mut NpyIter);
pub type NpyIter_IterationNeedsAPI = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_bool;
pub type NpyIter_GetInnerFixedStrideArray = unsafe extern "C" fn(iter: *mut NpyIter, out_strides: *mut npy_intp);
pub type NpyIter_RemoveAxis = unsafe extern "C" fn(iter: *mut NpyIter, axis: c_int) -> c_int;
pub type NpyIter_GetAxisStrideArray = unsafe extern "C" fn(iter: *mut NpyIter, axis: c_int) -> *mut npy_intp;
pub type NpyIter_RequiresBuffering = unsafe extern "C" fn(iter: *mut NpyIter) -> npy_bool;
pub type NpyIter_GetInitialDataPtrArray = unsafe extern "C" fn(iter: *mut NpyIter) -> *mut *mut c_char;
pub type NpyIter_CreateCompatibleStrides = unsafe extern "C" fn(iter: *mut NpyIter, itemsize: npy_intp, outstrides: *mut npy_intp) -> c_int;
pub type PyArray_CastingConverter = unsafe extern "C" fn(obj: *mut PyObject, casting: *mut NPY_CASTING) -> c_int;
pub type PyArray_CountNonzero = unsafe extern "C" fn(self_: *mut PyArrayObject) -> npy_intp;
pub type PyArray_PromoteTypes = unsafe extern "C" fn(type1: *mut PyArray_Descr, type2: *mut PyArray_Descr) -> *mut PyArray_Descr;
pub type PyArray_MinScalarType = unsafe extern "C" fn(arr: *mut PyArrayObject) -> *mut PyArray_Descr;
pub 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;
pub type PyArray_CanCastArrayTo = unsafe extern "C" fn(arr: *mut PyArrayObject, to: *mut PyArray_Descr, casting: NPY_CASTING) -> npy_bool;
pub type PyArray_CanCastTypeTo = unsafe extern "C" fn(from: *mut PyArray_Descr, to: *mut PyArray_Descr, casting: NPY_CASTING) -> npy_bool;
pub 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;
pub type PyArray_NewLikeArray = unsafe extern "C" fn(prototype: *mut PyArrayObject, order: NPY_ORDER, dtype: *mut PyArray_Descr, subok: c_int) -> *mut PyObject;
pub 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;
pub type PyArray_ConvertClipmodeSequence = unsafe extern "C" fn(object: *mut PyObject, modes: *mut NPY_CLIPMODE, n: c_int) -> c_int;
pub type PyArray_MatrixProduct2 = unsafe extern "C" fn(op1: *mut PyObject, op2: *mut PyObject, out: *mut PyArrayObject) -> *mut PyObject;
pub type NpyIter_IsFirstVisit = unsafe extern "C" fn(iter: *mut NpyIter, iop: c_int) -> npy_bool;
pub type PyArray_SetBaseObject = unsafe extern "C" fn(arr: *mut PyArrayObject, obj: *mut PyObject) -> c_int;
pub type PyArray_CreateSortedStridePerm = unsafe extern "C" fn(ndim: c_int, strides: *mut npy_intp, out_strideperm: *mut npy_stride_sort_item);
pub type PyArray_RemoveAxesInPlace = unsafe extern "C" fn(arr: *mut PyArrayObject, flags: *mut npy_bool);
pub type PyArray_DebugPrint = unsafe extern "C" fn(obj: *mut PyArrayObject);
pub type PyArray_FailUnlessWriteable = unsafe extern "C" fn(obj: *mut PyArrayObject, name: *const c_char) -> c_int;
pub type PyArray_SetUpdateIfCopyBase = unsafe extern "C" fn(arr: *mut PyArrayObject, base: *mut PyArrayObject) -> c_int;
pub type PyDataMem_NEW = unsafe extern "C" fn(size: usize) -> *mut c_void;
pub type PyDataMem_FREE = unsafe extern "C" fn(ptr: *mut c_void);
pub type PyDataMem_RENEW = unsafe extern "C" fn(ptr: *mut c_void, size: usize) -> *mut c_void;
pub type PyDataMem_SetEventHook = unsafe extern "C" fn(newhook: PyDataMem_EventHookFunc, user_data: *mut c_void, old_data: *mut *mut c_void) -> PyDataMem_EventHookFunc;
pub type PyArray_MapIterSwapAxes = unsafe extern "C" fn(mit: *mut PyArrayMapIterObject, ret: *mut *mut PyArrayObject, getmap: c_int);
pub type PyArray_MapIterArray = unsafe extern "C" fn(a: *mut PyArrayObject, index: *mut PyObject) -> *mut PyObject;
pub type PyArray_MapIterNext = unsafe extern "C" fn(mit: *mut PyArrayMapIterObject);
pub type PyArray_Partition = unsafe extern "C" fn(op: *mut PyArrayObject, ktharray: *mut PyArrayObject, axis: c_int, which: NPY_SELECTKIND) -> c_int;
pub type PyArray_ArgPartition = unsafe extern "C" fn(op: *mut PyArrayObject, ktharray: *mut PyArrayObject, axis: c_int, which: NPY_SELECTKIND) -> *mut PyObject;
pub type PyArray_SelectkindConverter = unsafe extern "C" fn(obj: *mut PyObject, selectkind: *mut NPY_SELECTKIND) -> c_int;
pub type PyDataMem_NEW_ZEROED = unsafe extern "C" fn(size: usize, elsize: usize) -> *mut c_void;
pub type PyArray_CheckAnyScalarExact = unsafe extern "C" fn(obj: *mut PyObject) -> c_int;
pub type PyArray_MapIterArrayCopyIfOverlap = unsafe extern "C" fn(a: *mut PyArrayObject, index: *mut PyObject, copy_if_overlap: c_int, extra_op: *mut PyArrayObject) -> *mut PyObject;
pub type PyArray_ResolveWritebackIfCopy = unsafe extern "C" fn(self_: *mut PyArrayObject) -> c_int;
pub type PyArray_SetWritebackIfCopyBase = unsafe extern "C" fn(arr: *mut PyArrayObject, base: *mut PyArrayObject) -> c_int;
pub type PyArray_SimpleNewFromData = unsafe extern "C" fn(nd: c_int, dims: *mut c_int, type_num: c_int, data: *mut c_char) -> *mut PyObject;


pub struct NumpyModuleReference {
    pointer: *const *const c_void,
    pub PyBigArray_Type: *mut PyTypeObject,
    pub PyArray_Type: *mut PyTypeObject,
    pub PyArrayDescr_Type: *mut PyTypeObject,
    pub PyArrayFlags_Type: *mut PyTypeObject,
    pub PyArrayIter_Type: *mut PyTypeObject,
    pub PyArrayMultiIter_Type: *mut PyTypeObject,
    pub NPY_NUMUSERTYPES: *mut PyTypeObject,
    pub PyBoolArrType_Type: *mut PyTypeObject,
    pub _PyArrayScalar_BoolValues: *mut PyTypeObject,
    pub PyGenericArrType_Type: *mut PyTypeObject,
    pub PyNumberArrType_Type: *mut PyTypeObject,
    pub PyIntegerArrType_Type: *mut PyTypeObject,
    pub PySignedIntegerArrType_Type: *mut PyTypeObject,
    pub PyUnsignedIntegerArrType_Type: *mut PyTypeObject,
    pub PyInexactArrType_Type: *mut PyTypeObject,
    pub PyFloatingArrType_Type: *mut PyTypeObject,
    pub PyComplexFloatingArrType_Type: *mut PyTypeObject,
    pub PyFlexibleArrType_Type: *mut PyTypeObject,
    pub PyCharacterArrType_Type: *mut PyTypeObject,
    pub PyByteArrType_Type: *mut PyTypeObject,
    pub PyShortArrType_Type: *mut PyTypeObject,
    pub PyIntArrType_Type: *mut PyTypeObject,
    pub PyLongArrType_Type: *mut PyTypeObject,
    pub PyLongLongArrType_Type: *mut PyTypeObject,
    pub PyUByteArrType_Type: *mut PyTypeObject,
    pub PyUShortArrType_Type: *mut PyTypeObject,
    pub PyUIntArrType_Type: *mut PyTypeObject,
    pub PyULongArrType_Type: *mut PyTypeObject,
    pub PyULongLongArrType_Type: *mut PyTypeObject,
    pub PyFloatArrType_Type: *mut PyTypeObject,
    pub PyDoubleArrType_Type: *mut PyTypeObject,
    pub PyLongDoubleArrType_Type: *mut PyTypeObject,
    pub PyCFloatArrType_Type: *mut PyTypeObject,
    pub PyCDoubleArrType_Type: *mut PyTypeObject,
    pub PyCLongDoubleArrType_Type: *mut PyTypeObject,
    pub PyObjectArrType_Type: *mut PyTypeObject,
    pub PyStringArrType_Type: *mut PyTypeObject,
    pub PyUnicodeArrType_Type: *mut PyTypeObject,
    pub PyVoidArrType_Type: *mut PyTypeObject,

    pub PyArray_GetNDArrayCVersion: PyArray_GetNDArrayCVersion,
    pub PyArray_SetNumericOps: PyArray_SetNumericOps,
    pub PyArray_GetNumericOps: PyArray_GetNumericOps,
    pub PyArray_INCREF: PyArray_INCREF,
    pub PyArray_XDECREF: PyArray_XDECREF,
    pub PyArray_SetStringFunction: PyArray_SetStringFunction,
    pub PyArray_DescrFromType: PyArray_DescrFromType,
    pub PyArray_TypeObjectFromType: PyArray_TypeObjectFromType,
    pub PyArray_Zero: PyArray_Zero,
    pub PyArray_One: PyArray_One,
    pub PyArray_CastToType: PyArray_CastToType,
    pub PyArray_CastTo: PyArray_CastTo,
    pub PyArray_CastAnyTo: PyArray_CastAnyTo,
    pub PyArray_CanCastSafely: PyArray_CanCastSafely,
    pub PyArray_CanCastTo: PyArray_CanCastTo,
    pub PyArray_ObjectType: PyArray_ObjectType,
    pub PyArray_DescrFromObject: PyArray_DescrFromObject,
    pub PyArray_ConvertToCommonType: PyArray_ConvertToCommonType,
    pub PyArray_DescrFromScalar: PyArray_DescrFromScalar,
    pub PyArray_DescrFromTypeObject: PyArray_DescrFromTypeObject,
    pub PyArray_Size: PyArray_Size,
    pub PyArray_Scalar: PyArray_Scalar,
    pub PyArray_FromScalar: PyArray_FromScalar,
    pub PyArray_ScalarAsCtype: PyArray_ScalarAsCtype,
    pub PyArray_CastScalarToCtype: PyArray_CastScalarToCtype,
    pub PyArray_CastScalarDirect: PyArray_CastScalarDirect,
    pub PyArray_ScalarFromObject: PyArray_ScalarFromObject,
    pub PyArray_GetCastFunc: PyArray_GetCastFunc,
    pub PyArray_FromDims: PyArray_FromDims,
    pub PyArray_FromDimsAndDataAndDescr: PyArray_FromDimsAndDataAndDescr,
    pub PyArray_FromAny: PyArray_FromAny,
    pub PyArray_EnsureArray: PyArray_EnsureArray,
    pub PyArray_EnsureAnyArray: PyArray_EnsureAnyArray,
    pub PyArray_FromFile: PyArray_FromFile,
    pub PyArray_FromString: PyArray_FromString,
    pub PyArray_FromBuffer: PyArray_FromBuffer,
    pub PyArray_FromIter: PyArray_FromIter,
    pub PyArray_Return: PyArray_Return,
    pub PyArray_GetField: PyArray_GetField,
    pub PyArray_SetField: PyArray_SetField,
    pub PyArray_Byteswap: PyArray_Byteswap,
    pub PyArray_Resize: PyArray_Resize,
    pub PyArray_MoveInto: PyArray_MoveInto,
    pub PyArray_CopyInto: PyArray_CopyInto,
    pub PyArray_CopyAnyInto: PyArray_CopyAnyInto,
    pub PyArray_CopyObject: PyArray_CopyObject,
    pub PyArray_NewCopy: PyArray_NewCopy,
    pub PyArray_ToList: PyArray_ToList,
    pub PyArray_ToString: PyArray_ToString,
    pub PyArray_ToFile: PyArray_ToFile,
    pub PyArray_Dump: PyArray_Dump,
    pub PyArray_Dumps: PyArray_Dumps,
    pub PyArray_ValidType: PyArray_ValidType,
    pub PyArray_UpdateFlags: PyArray_UpdateFlags,
    pub PyArray_New: PyArray_New,
    pub PyArray_NewFromDescr: PyArray_NewFromDescr,
    pub PyArray_DescrNew: PyArray_DescrNew,
    pub PyArray_DescrNewFromType: PyArray_DescrNewFromType,
    pub PyArray_GetPriority: PyArray_GetPriority,
    pub PyArray_IterNew: PyArray_IterNew,
    // pub PyArray_MultiIterNew: PyArray_MultiIterNew,
    pub PyArray_PyIntAsInt: PyArray_PyIntAsInt,
    pub PyArray_PyIntAsIntp: PyArray_PyIntAsIntp,
    pub PyArray_Broadcast: PyArray_Broadcast,
    pub PyArray_FillObjectArray: PyArray_FillObjectArray,
    pub PyArray_FillWithScalar: PyArray_FillWithScalar,
    pub PyArray_CheckStrides: PyArray_CheckStrides,
    pub PyArray_DescrNewByteorder: PyArray_DescrNewByteorder,
    pub PyArray_IterAllButAxis: PyArray_IterAllButAxis,
    pub PyArray_CheckFromAny: PyArray_CheckFromAny,
    pub PyArray_FromArray: PyArray_FromArray,
    pub PyArray_FromInterface: PyArray_FromInterface,
    pub PyArray_FromStructInterface: PyArray_FromStructInterface,
    pub PyArray_FromArrayAttr: PyArray_FromArrayAttr,
    pub PyArray_ScalarKind: PyArray_ScalarKind,
    pub PyArray_CanCoerceScalar: PyArray_CanCoerceScalar,
    pub PyArray_NewFlagsObject: PyArray_NewFlagsObject,
    pub PyArray_CanCastScalar: PyArray_CanCastScalar,
    pub PyArray_CompareUCS4: PyArray_CompareUCS4,
    pub PyArray_RemoveSmallest: PyArray_RemoveSmallest,
    pub PyArray_ElementStrides: PyArray_ElementStrides,
    pub PyArray_Item_INCREF: PyArray_Item_INCREF,
    pub PyArray_Item_XDECREF: PyArray_Item_XDECREF,
    pub PyArray_FieldNames: PyArray_FieldNames,
    pub PyArray_Transpose: PyArray_Transpose,
    pub PyArray_TakeFrom: PyArray_TakeFrom,
    pub PyArray_PutTo: PyArray_PutTo,
    pub PyArray_PutMask: PyArray_PutMask,
    pub PyArray_Repeat: PyArray_Repeat,
    pub PyArray_Choose: PyArray_Choose,
    pub PyArray_Sort: PyArray_Sort,
    pub PyArray_ArgSort: PyArray_ArgSort,
    pub PyArray_SearchSorted: PyArray_SearchSorted,
    pub PyArray_ArgMax: PyArray_ArgMax,
    pub PyArray_ArgMin: PyArray_ArgMin,
    pub PyArray_Reshape: PyArray_Reshape,
    pub PyArray_Newshape: PyArray_Newshape,
    pub PyArray_Squeeze: PyArray_Squeeze,
    pub PyArray_View: PyArray_View,
    pub PyArray_SwapAxes: PyArray_SwapAxes,
    pub PyArray_Max: PyArray_Max,
    pub PyArray_Min: PyArray_Min,
    pub PyArray_Ptp: PyArray_Ptp,
    pub PyArray_Mean: PyArray_Mean,
    pub PyArray_Trace: PyArray_Trace,
    pub PyArray_Diagonal: PyArray_Diagonal,
    pub PyArray_Clip: PyArray_Clip,
    pub PyArray_Conjugate: PyArray_Conjugate,
    pub PyArray_Nonzero: PyArray_Nonzero,
    pub PyArray_Std: PyArray_Std,
    pub PyArray_Sum: PyArray_Sum,
    pub PyArray_CumSum: PyArray_CumSum,
    pub PyArray_Prod: PyArray_Prod,
    pub PyArray_CumProd: PyArray_CumProd,
    pub PyArray_All: PyArray_All,
    pub PyArray_Any: PyArray_Any,
    pub PyArray_Compress: PyArray_Compress,
    pub PyArray_Flatten: PyArray_Flatten,
    pub PyArray_Ravel: PyArray_Ravel,
    pub PyArray_MultiplyList: PyArray_MultiplyList,
    pub PyArray_MultiplyIntList: PyArray_MultiplyIntList,
    pub PyArray_GetPtr: PyArray_GetPtr,
    pub PyArray_CompareLists: PyArray_CompareLists,
    pub PyArray_AsCArray: PyArray_AsCArray,
    pub PyArray_As1D: PyArray_As1D,
    pub PyArray_As2D: PyArray_As2D,
    pub PyArray_Free: PyArray_Free,
    pub PyArray_Converter: PyArray_Converter,
    pub PyArray_IntpFromSequence: PyArray_IntpFromSequence,
    pub PyArray_Concatenate: PyArray_Concatenate,
    pub PyArray_InnerProduct: PyArray_InnerProduct,
    pub PyArray_MatrixProduct: PyArray_MatrixProduct,
    pub PyArray_CopyAndTranspose: PyArray_CopyAndTranspose,
    pub PyArray_Correlate: PyArray_Correlate,
    pub PyArray_TypestrConvert: PyArray_TypestrConvert,
    pub PyArray_DescrConverter: PyArray_DescrConverter,
    pub PyArray_DescrConverter2: PyArray_DescrConverter2,
    pub PyArray_IntpConverter: PyArray_IntpConverter,
    pub PyArray_BufferConverter: PyArray_BufferConverter,
    pub PyArray_AxisConverter: PyArray_AxisConverter,
    pub PyArray_BoolConverter: PyArray_BoolConverter,
    pub PyArray_ByteorderConverter: PyArray_ByteorderConverter,
    pub PyArray_OrderConverter: PyArray_OrderConverter,
    pub PyArray_EquivTypes: PyArray_EquivTypes,
    pub PyArray_Zeros: PyArray_Zeros,
    pub PyArray_Empty: PyArray_Empty,
    pub PyArray_Where: PyArray_Where,
    pub PyArray_Arange: PyArray_Arange,
    pub PyArray_ArangeObj: PyArray_ArangeObj,
    pub PyArray_SortkindConverter: PyArray_SortkindConverter,
    pub PyArray_LexSort: PyArray_LexSort,
    pub PyArray_Round: PyArray_Round,
    pub PyArray_EquivTypenums: PyArray_EquivTypenums,
    pub PyArray_RegisterDataType: PyArray_RegisterDataType,
    pub PyArray_RegisterCastFunc: PyArray_RegisterCastFunc,
    pub PyArray_RegisterCanCast: PyArray_RegisterCanCast,
    pub PyArray_InitArrFuncs: PyArray_InitArrFuncs,
    pub PyArray_IntTupleFromIntp: PyArray_IntTupleFromIntp,
    pub PyArray_TypeNumFromName: PyArray_TypeNumFromName,
    pub PyArray_ClipmodeConverter: PyArray_ClipmodeConverter,
    pub PyArray_OutputConverter: PyArray_OutputConverter,
    pub PyArray_BroadcastToShape: PyArray_BroadcastToShape,
    pub _PyArray_SigintHandler: _PyArray_SigintHandler,
    pub _PyArray_GetSigintBuf: _PyArray_GetSigintBuf,
    pub PyArray_DescrAlignConverter: PyArray_DescrAlignConverter,
    pub PyArray_DescrAlignConverter2: PyArray_DescrAlignConverter2,
    pub PyArray_SearchsideConverter: PyArray_SearchsideConverter,
    pub PyArray_CheckAxis: PyArray_CheckAxis,
    pub PyArray_OverflowMultiplyList: PyArray_OverflowMultiplyList,
    pub PyArray_CompareString: PyArray_CompareString,
    // pub PyArray_MultiIterFromObjects: PyArray_MultiIterFromObjects,
    pub PyArray_GetEndianness: PyArray_GetEndianness,
    pub PyArray_GetNDArrayCFeatureVersion: PyArray_GetNDArrayCFeatureVersion,
    pub PyArray_Correlate2: PyArray_Correlate2,
    pub PyArray_NeighborhoodIterNew: PyArray_NeighborhoodIterNew,
    pub PyArray_SetDatetimeParseFunction: PyArray_SetDatetimeParseFunction,
    pub PyArray_DatetimeToDatetimeStruct: PyArray_DatetimeToDatetimeStruct,
    pub PyArray_TimedeltaToTimedeltaStruct: PyArray_TimedeltaToTimedeltaStruct,
    pub PyArray_DatetimeStructToDatetime: PyArray_DatetimeStructToDatetime,
    pub PyArray_TimedeltaStructToTimedelta: PyArray_TimedeltaStructToTimedelta,
    pub NpyIter_New: NpyIter_New,
    pub NpyIter_MultiNew: NpyIter_MultiNew,
    pub NpyIter_AdvancedNew: NpyIter_AdvancedNew,
    pub NpyIter_Copy: NpyIter_Copy,
    pub NpyIter_Deallocate: NpyIter_Deallocate,
    pub NpyIter_HasDelayedBufAlloc: NpyIter_HasDelayedBufAlloc,
    pub NpyIter_HasExternalLoop: NpyIter_HasExternalLoop,
    pub NpyIter_EnableExternalLoop: NpyIter_EnableExternalLoop,
    pub NpyIter_GetInnerStrideArray: NpyIter_GetInnerStrideArray,
    pub NpyIter_GetInnerLoopSizePtr: NpyIter_GetInnerLoopSizePtr,
    pub NpyIter_Reset: NpyIter_Reset,
    pub NpyIter_ResetBasePointers: NpyIter_ResetBasePointers,
    pub NpyIter_ResetToIterIndexRange: NpyIter_ResetToIterIndexRange,
    pub NpyIter_GetNDim: NpyIter_GetNDim,
    pub NpyIter_GetNOp: NpyIter_GetNOp,
    pub NpyIter_GetIterNext: NpyIter_GetIterNext,
    pub NpyIter_GetIterSize: NpyIter_GetIterSize,
    pub NpyIter_GetIterIndexRange: NpyIter_GetIterIndexRange,
    pub NpyIter_GetIterIndex: NpyIter_GetIterIndex,
    pub NpyIter_GotoIterIndex: NpyIter_GotoIterIndex,
    pub NpyIter_HasMultiIndex: NpyIter_HasMultiIndex,
    pub NpyIter_GetShape: NpyIter_GetShape,
    pub NpyIter_GetGetMultiIndex: NpyIter_GetGetMultiIndex,
    pub NpyIter_GotoMultiIndex: NpyIter_GotoMultiIndex,
    pub NpyIter_RemoveMultiIndex: NpyIter_RemoveMultiIndex,
    pub NpyIter_HasIndex: NpyIter_HasIndex,
    pub NpyIter_IsBuffered: NpyIter_IsBuffered,
    pub NpyIter_IsGrowInner: NpyIter_IsGrowInner,
    pub NpyIter_GetBufferSize: NpyIter_GetBufferSize,
    pub NpyIter_GetIndexPtr: NpyIter_GetIndexPtr,
    pub NpyIter_GotoIndex: NpyIter_GotoIndex,
    pub NpyIter_GetDataPtrArray: NpyIter_GetDataPtrArray,
    pub NpyIter_GetDescrArray: NpyIter_GetDescrArray,
    pub NpyIter_GetOperandArray: NpyIter_GetOperandArray,
    pub NpyIter_GetIterView: NpyIter_GetIterView,
    pub NpyIter_GetReadFlags: NpyIter_GetReadFlags,
    pub NpyIter_GetWriteFlags: NpyIter_GetWriteFlags,
    pub NpyIter_DebugPrint: NpyIter_DebugPrint,
    pub NpyIter_IterationNeedsAPI: NpyIter_IterationNeedsAPI,
    pub NpyIter_GetInnerFixedStrideArray: NpyIter_GetInnerFixedStrideArray,
    pub NpyIter_RemoveAxis: NpyIter_RemoveAxis,
    pub NpyIter_GetAxisStrideArray: NpyIter_GetAxisStrideArray,
    pub NpyIter_RequiresBuffering: NpyIter_RequiresBuffering,
    pub NpyIter_GetInitialDataPtrArray: NpyIter_GetInitialDataPtrArray,
    pub NpyIter_CreateCompatibleStrides: NpyIter_CreateCompatibleStrides,
    pub PyArray_CastingConverter: PyArray_CastingConverter,
    pub PyArray_CountNonzero: PyArray_CountNonzero,
    pub PyArray_PromoteTypes: PyArray_PromoteTypes,
    pub PyArray_MinScalarType: PyArray_MinScalarType,
    pub PyArray_ResultType: PyArray_ResultType,
    pub PyArray_CanCastArrayTo: PyArray_CanCastArrayTo,
    pub PyArray_CanCastTypeTo: PyArray_CanCastTypeTo,
    pub PyArray_EinsteinSum: PyArray_EinsteinSum,
    pub PyArray_NewLikeArray: PyArray_NewLikeArray,
    pub PyArray_GetArrayParamsFromObject: PyArray_GetArrayParamsFromObject,
    pub PyArray_ConvertClipmodeSequence: PyArray_ConvertClipmodeSequence,
    pub PyArray_MatrixProduct2: PyArray_MatrixProduct2,
    pub NpyIter_IsFirstVisit: NpyIter_IsFirstVisit,
    pub PyArray_SetBaseObject: PyArray_SetBaseObject,
    pub PyArray_CreateSortedStridePerm: PyArray_CreateSortedStridePerm,
    pub PyArray_RemoveAxesInPlace: PyArray_RemoveAxesInPlace,
    pub PyArray_DebugPrint: PyArray_DebugPrint,
    pub PyArray_FailUnlessWriteable: PyArray_FailUnlessWriteable,
    pub PyArray_SetUpdateIfCopyBase: PyArray_SetUpdateIfCopyBase,
    pub PyDataMem_NEW: PyDataMem_NEW,
    pub PyDataMem_FREE: PyDataMem_FREE,
    pub PyDataMem_RENEW: PyDataMem_RENEW,
    pub PyDataMem_SetEventHook: PyDataMem_SetEventHook,
    pub PyArray_MapIterSwapAxes: PyArray_MapIterSwapAxes,
    pub PyArray_MapIterArray: PyArray_MapIterArray,
    pub PyArray_MapIterNext: PyArray_MapIterNext,
    pub PyArray_Partition: PyArray_Partition,
    pub PyArray_ArgPartition: PyArray_ArgPartition,
    pub PyArray_SelectkindConverter: PyArray_SelectkindConverter,
    pub PyDataMem_NEW_ZEROED: PyDataMem_NEW_ZEROED,
    pub PyArray_CheckAnyScalarExact: PyArray_CheckAnyScalarExact,
    pub PyArray_MapIterArrayCopyIfOverlap: PyArray_MapIterArrayCopyIfOverlap,
    pub PyArray_ResolveWritebackIfCopy: PyArray_ResolveWritebackIfCopy,
    pub PyArray_SetWritebackIfCopyBase: PyArray_SetWritebackIfCopyBase,
    pub PyArray_SimpleNewFromData: PyArray_SimpleNewFromData,
}

impl NumpyModuleReference {
    pub unsafe fn new(pointer: *const *const c_void) -> Self {
        Self {
            pointer,
            PyBigArray_Type: (*pointer.offset(1)) as *mut PyTypeObject,
            PyArray_Type: (*pointer.offset(2)) as *mut PyTypeObject,
            PyArrayDescr_Type: (*pointer.offset(3)) as *mut PyTypeObject,
            PyArrayFlags_Type: (*pointer.offset(4)) as *mut PyTypeObject,
            PyArrayIter_Type: (*pointer.offset(5)) as *mut PyTypeObject,
            PyArrayMultiIter_Type: (*pointer.offset(6)) as *mut PyTypeObject,
            NPY_NUMUSERTYPES: (*pointer.offset(7)) as *mut PyTypeObject,
            PyBoolArrType_Type: (*pointer.offset(8)) as *mut PyTypeObject,
            _PyArrayScalar_BoolValues: (*pointer.offset(9)) as *mut PyTypeObject,
            PyGenericArrType_Type: (*pointer.offset(10)) as *mut PyTypeObject,
            PyNumberArrType_Type: (*pointer.offset(11)) as *mut PyTypeObject,
            PyIntegerArrType_Type: (*pointer.offset(12)) as *mut PyTypeObject,
            PySignedIntegerArrType_Type: (*pointer.offset(13)) as *mut PyTypeObject,
            PyUnsignedIntegerArrType_Type: (*pointer.offset(14)) as *mut PyTypeObject,
            PyInexactArrType_Type: (*pointer.offset(15)) as *mut PyTypeObject,
            PyFloatingArrType_Type: (*pointer.offset(16)) as *mut PyTypeObject,
            PyComplexFloatingArrType_Type: (*pointer.offset(17)) as *mut PyTypeObject,
            PyFlexibleArrType_Type: (*pointer.offset(18)) as *mut PyTypeObject,
            PyCharacterArrType_Type: (*pointer.offset(19)) as *mut PyTypeObject,
            PyByteArrType_Type: (*pointer.offset(20)) as *mut PyTypeObject,
            PyShortArrType_Type: (*pointer.offset(21)) as *mut PyTypeObject,
            PyIntArrType_Type: (*pointer.offset(22)) as *mut PyTypeObject,
            PyLongArrType_Type: (*pointer.offset(23)) as *mut PyTypeObject,
            PyLongLongArrType_Type: (*pointer.offset(24)) as *mut PyTypeObject,
            PyUByteArrType_Type: (*pointer.offset(25)) as *mut PyTypeObject,
            PyUShortArrType_Type: (*pointer.offset(26)) as *mut PyTypeObject,
            PyUIntArrType_Type: (*pointer.offset(27)) as *mut PyTypeObject,
            PyULongArrType_Type: (*pointer.offset(28)) as *mut PyTypeObject,
            PyULongLongArrType_Type: (*pointer.offset(29)) as *mut PyTypeObject,
            PyFloatArrType_Type: (*pointer.offset(30)) as *mut PyTypeObject,
            PyDoubleArrType_Type: (*pointer.offset(31)) as *mut PyTypeObject,
            PyLongDoubleArrType_Type: (*pointer.offset(32)) as *mut PyTypeObject,
            PyCFloatArrType_Type: (*pointer.offset(33)) as *mut PyTypeObject,
            PyCDoubleArrType_Type: (*pointer.offset(34)) as *mut PyTypeObject,
            PyCLongDoubleArrType_Type: (*pointer.offset(35)) as *mut PyTypeObject,
            PyObjectArrType_Type: (*pointer.offset(36)) as *mut PyTypeObject,
            PyStringArrType_Type: (*pointer.offset(37)) as *mut PyTypeObject,
            PyUnicodeArrType_Type: (*pointer.offset(38)) as *mut PyTypeObject,
            PyVoidArrType_Type: (*pointer.offset(39)) as *mut PyTypeObject,

            PyArray_GetNDArrayCVersion: *(pointer.offset(0) as *const PyArray_GetNDArrayCVersion),
            PyArray_SetNumericOps: *(pointer.offset(40) as *const PyArray_SetNumericOps),
            PyArray_GetNumericOps: *(pointer.offset(41) as *const PyArray_GetNumericOps),
            PyArray_INCREF: *(pointer.offset(42) as *const PyArray_INCREF),
            PyArray_XDECREF: *(pointer.offset(43) as *const PyArray_XDECREF),
            PyArray_SetStringFunction: *(pointer.offset(44) as *const PyArray_SetStringFunction),
            PyArray_DescrFromType: *(pointer.offset(45) as *const PyArray_DescrFromType),
            PyArray_TypeObjectFromType: *(pointer.offset(46) as *const PyArray_TypeObjectFromType),
            PyArray_Zero: *(pointer.offset(47) as *const PyArray_Zero),
            PyArray_One: *(pointer.offset(48) as *const PyArray_One),
            PyArray_CastToType: *(pointer.offset(49) as *const PyArray_CastToType),
            PyArray_CastTo: *(pointer.offset(50) as *const PyArray_CastTo),
            PyArray_CastAnyTo: *(pointer.offset(51) as *const PyArray_CastAnyTo),
            PyArray_CanCastSafely: *(pointer.offset(52) as *const PyArray_CanCastSafely),
            PyArray_CanCastTo: *(pointer.offset(53) as *const PyArray_CanCastTo),
            PyArray_ObjectType: *(pointer.offset(54) as *const PyArray_ObjectType),
            PyArray_DescrFromObject: *(pointer.offset(55) as *const PyArray_DescrFromObject),
            PyArray_ConvertToCommonType: *(pointer.offset(56) as *const PyArray_ConvertToCommonType),
            PyArray_DescrFromScalar: *(pointer.offset(57) as *const PyArray_DescrFromScalar),
            PyArray_DescrFromTypeObject: *(pointer.offset(58) as *const PyArray_DescrFromTypeObject),
            PyArray_Size: *(pointer.offset(59) as *const PyArray_Size),
            PyArray_Scalar: *(pointer.offset(60) as *const PyArray_Scalar),
            PyArray_FromScalar: *(pointer.offset(61) as *const PyArray_FromScalar),
            PyArray_ScalarAsCtype: *(pointer.offset(62) as *const PyArray_ScalarAsCtype),
            PyArray_CastScalarToCtype: *(pointer.offset(63) as *const PyArray_CastScalarToCtype),
            PyArray_CastScalarDirect: *(pointer.offset(64) as *const PyArray_CastScalarDirect),
            PyArray_ScalarFromObject: *(pointer.offset(65) as *const PyArray_ScalarFromObject),
            PyArray_GetCastFunc: *(pointer.offset(66) as *const PyArray_GetCastFunc),
            PyArray_FromDims: *(pointer.offset(67) as *const PyArray_FromDims),
            PyArray_FromDimsAndDataAndDescr: *(pointer.offset(68) as *const PyArray_FromDimsAndDataAndDescr),
            PyArray_FromAny: *(pointer.offset(69) as *const PyArray_FromAny),
            PyArray_EnsureArray: *(pointer.offset(70) as *const PyArray_EnsureArray),
            PyArray_EnsureAnyArray: *(pointer.offset(71) as *const PyArray_EnsureAnyArray),
            PyArray_FromFile: *(pointer.offset(72) as *const PyArray_FromFile),
            PyArray_FromString: *(pointer.offset(73) as *const PyArray_FromString),
            PyArray_FromBuffer: *(pointer.offset(74) as *const PyArray_FromBuffer),
            PyArray_FromIter: *(pointer.offset(75) as *const PyArray_FromIter),
            PyArray_Return: *(pointer.offset(76) as *const PyArray_Return),
            PyArray_GetField: *(pointer.offset(77) as *const PyArray_GetField),
            PyArray_SetField: *(pointer.offset(78) as *const PyArray_SetField),
            PyArray_Byteswap: *(pointer.offset(79) as *const PyArray_Byteswap),
            PyArray_Resize: *(pointer.offset(80) as *const PyArray_Resize),
            PyArray_MoveInto: *(pointer.offset(81) as *const PyArray_MoveInto),
            PyArray_CopyInto: *(pointer.offset(82) as *const PyArray_CopyInto),
            PyArray_CopyAnyInto: *(pointer.offset(83) as *const PyArray_CopyAnyInto),
            PyArray_CopyObject: *(pointer.offset(84) as *const PyArray_CopyObject),
            PyArray_NewCopy: *(pointer.offset(85) as *const PyArray_NewCopy),
            PyArray_ToList: *(pointer.offset(86) as *const PyArray_ToList),
            PyArray_ToString: *(pointer.offset(87) as *const PyArray_ToString),
            PyArray_ToFile: *(pointer.offset(88) as *const PyArray_ToFile),
            PyArray_Dump: *(pointer.offset(89) as *const PyArray_Dump),
            PyArray_Dumps: *(pointer.offset(90) as *const PyArray_Dumps),
            PyArray_ValidType: *(pointer.offset(91) as *const PyArray_ValidType),
            PyArray_UpdateFlags: *(pointer.offset(92) as *const PyArray_UpdateFlags),
            PyArray_New: *(pointer.offset(93) as *const PyArray_New),
            PyArray_NewFromDescr: *(pointer.offset(94) as *const PyArray_NewFromDescr),
            PyArray_DescrNew: *(pointer.offset(95) as *const PyArray_DescrNew),
            PyArray_DescrNewFromType: *(pointer.offset(96) as *const PyArray_DescrNewFromType),
            PyArray_GetPriority: *(pointer.offset(97) as *const PyArray_GetPriority),
            PyArray_IterNew: *(pointer.offset(98) as *const PyArray_IterNew),
            // PyArray_MultiIterNew: *(pointer.offset(99) as *const PyArray_MultiIterNew),
            PyArray_PyIntAsInt: *(pointer.offset(100) as *const PyArray_PyIntAsInt),
            PyArray_PyIntAsIntp: *(pointer.offset(101) as *const PyArray_PyIntAsIntp),
            PyArray_Broadcast: *(pointer.offset(102) as *const PyArray_Broadcast),
            PyArray_FillObjectArray: *(pointer.offset(103) as *const PyArray_FillObjectArray),
            PyArray_FillWithScalar: *(pointer.offset(104) as *const PyArray_FillWithScalar),
            PyArray_CheckStrides: *(pointer.offset(105) as *const PyArray_CheckStrides),
            PyArray_DescrNewByteorder: *(pointer.offset(106) as *const PyArray_DescrNewByteorder),
            PyArray_IterAllButAxis: *(pointer.offset(107) as *const PyArray_IterAllButAxis),
            PyArray_CheckFromAny: *(pointer.offset(108) as *const PyArray_CheckFromAny),
            PyArray_FromArray: *(pointer.offset(109) as *const PyArray_FromArray),
            PyArray_FromInterface: *(pointer.offset(110) as *const PyArray_FromInterface),
            PyArray_FromStructInterface: *(pointer.offset(111) as *const PyArray_FromStructInterface),
            PyArray_FromArrayAttr: *(pointer.offset(112) as *const PyArray_FromArrayAttr),
            PyArray_ScalarKind: *(pointer.offset(113) as *const PyArray_ScalarKind),
            PyArray_CanCoerceScalar: *(pointer.offset(114) as *const PyArray_CanCoerceScalar),
            PyArray_NewFlagsObject: *(pointer.offset(115) as *const PyArray_NewFlagsObject),
            PyArray_CanCastScalar: *(pointer.offset(116) as *const PyArray_CanCastScalar),
            PyArray_CompareUCS4: *(pointer.offset(117) as *const PyArray_CompareUCS4),
            PyArray_RemoveSmallest: *(pointer.offset(118) as *const PyArray_RemoveSmallest),
            PyArray_ElementStrides: *(pointer.offset(119) as *const PyArray_ElementStrides),
            PyArray_Item_INCREF: *(pointer.offset(120) as *const PyArray_Item_INCREF),
            PyArray_Item_XDECREF: *(pointer.offset(121) as *const PyArray_Item_XDECREF),
            PyArray_FieldNames: *(pointer.offset(122) as *const PyArray_FieldNames),
            PyArray_Transpose: *(pointer.offset(123) as *const PyArray_Transpose),
            PyArray_TakeFrom: *(pointer.offset(124) as *const PyArray_TakeFrom),
            PyArray_PutTo: *(pointer.offset(125) as *const PyArray_PutTo),
            PyArray_PutMask: *(pointer.offset(126) as *const PyArray_PutMask),
            PyArray_Repeat: *(pointer.offset(127) as *const PyArray_Repeat),
            PyArray_Choose: *(pointer.offset(128) as *const PyArray_Choose),
            PyArray_Sort: *(pointer.offset(129) as *const PyArray_Sort),
            PyArray_ArgSort: *(pointer.offset(130) as *const PyArray_ArgSort),
            PyArray_SearchSorted: *(pointer.offset(131) as *const PyArray_SearchSorted),
            PyArray_ArgMax: *(pointer.offset(132) as *const PyArray_ArgMax),
            PyArray_ArgMin: *(pointer.offset(133) as *const PyArray_ArgMin),
            PyArray_Reshape: *(pointer.offset(134) as *const PyArray_Reshape),
            PyArray_Newshape: *(pointer.offset(135) as *const PyArray_Newshape),
            PyArray_Squeeze: *(pointer.offset(136) as *const PyArray_Squeeze),
            PyArray_View: *(pointer.offset(137) as *const PyArray_View),
            PyArray_SwapAxes: *(pointer.offset(138) as *const PyArray_SwapAxes),
            PyArray_Max: *(pointer.offset(139) as *const PyArray_Max),
            PyArray_Min: *(pointer.offset(140) as *const PyArray_Min),
            PyArray_Ptp: *(pointer.offset(141) as *const PyArray_Ptp),
            PyArray_Mean: *(pointer.offset(142) as *const PyArray_Mean),
            PyArray_Trace: *(pointer.offset(143) as *const PyArray_Trace),
            PyArray_Diagonal: *(pointer.offset(144) as *const PyArray_Diagonal),
            PyArray_Clip: *(pointer.offset(145) as *const PyArray_Clip),
            PyArray_Conjugate: *(pointer.offset(146) as *const PyArray_Conjugate),
            PyArray_Nonzero: *(pointer.offset(147) as *const PyArray_Nonzero),
            PyArray_Std: *(pointer.offset(148) as *const PyArray_Std),
            PyArray_Sum: *(pointer.offset(149) as *const PyArray_Sum),
            PyArray_CumSum: *(pointer.offset(150) as *const PyArray_CumSum),
            PyArray_Prod: *(pointer.offset(151) as *const PyArray_Prod),
            PyArray_CumProd: *(pointer.offset(152) as *const PyArray_CumProd),
            PyArray_All: *(pointer.offset(153) as *const PyArray_All),
            PyArray_Any: *(pointer.offset(154) as *const PyArray_Any),
            PyArray_Compress: *(pointer.offset(155) as *const PyArray_Compress),
            PyArray_Flatten: *(pointer.offset(156) as *const PyArray_Flatten),
            PyArray_Ravel: *(pointer.offset(157) as *const PyArray_Ravel),
            PyArray_MultiplyList: *(pointer.offset(158) as *const PyArray_MultiplyList),
            PyArray_MultiplyIntList: *(pointer.offset(159) as *const PyArray_MultiplyIntList),
            PyArray_GetPtr: *(pointer.offset(160) as *const PyArray_GetPtr),
            PyArray_CompareLists: *(pointer.offset(161) as *const PyArray_CompareLists),
            PyArray_AsCArray: *(pointer.offset(162) as *const PyArray_AsCArray),
            PyArray_As1D: *(pointer.offset(163) as *const PyArray_As1D),
            PyArray_As2D: *(pointer.offset(164) as *const PyArray_As2D),
            PyArray_Free: *(pointer.offset(165) as *const PyArray_Free),
            PyArray_Converter: *(pointer.offset(166) as *const PyArray_Converter),
            PyArray_IntpFromSequence: *(pointer.offset(167) as *const PyArray_IntpFromSequence),
            PyArray_Concatenate: *(pointer.offset(168) as *const PyArray_Concatenate),
            PyArray_InnerProduct: *(pointer.offset(169) as *const PyArray_InnerProduct),
            PyArray_MatrixProduct: *(pointer.offset(170) as *const PyArray_MatrixProduct),
            PyArray_CopyAndTranspose: *(pointer.offset(171) as *const PyArray_CopyAndTranspose),
            PyArray_Correlate: *(pointer.offset(172) as *const PyArray_Correlate),
            PyArray_TypestrConvert: *(pointer.offset(173) as *const PyArray_TypestrConvert),
            PyArray_DescrConverter: *(pointer.offset(174) as *const PyArray_DescrConverter),
            PyArray_DescrConverter2: *(pointer.offset(175) as *const PyArray_DescrConverter2),
            PyArray_IntpConverter: *(pointer.offset(176) as *const PyArray_IntpConverter),
            PyArray_BufferConverter: *(pointer.offset(177) as *const PyArray_BufferConverter),
            PyArray_AxisConverter: *(pointer.offset(178) as *const PyArray_AxisConverter),
            PyArray_BoolConverter: *(pointer.offset(179) as *const PyArray_BoolConverter),
            PyArray_ByteorderConverter: *(pointer.offset(180) as *const PyArray_ByteorderConverter),
            PyArray_OrderConverter: *(pointer.offset(181) as *const PyArray_OrderConverter),
            PyArray_EquivTypes: *(pointer.offset(182) as *const PyArray_EquivTypes),
            PyArray_Zeros: *(pointer.offset(183) as *const PyArray_Zeros),
            PyArray_Empty: *(pointer.offset(184) as *const PyArray_Empty),
            PyArray_Where: *(pointer.offset(185) as *const PyArray_Where),
            PyArray_Arange: *(pointer.offset(186) as *const PyArray_Arange),
            PyArray_ArangeObj: *(pointer.offset(187) as *const PyArray_ArangeObj),
            PyArray_SortkindConverter: *(pointer.offset(188) as *const PyArray_SortkindConverter),
            PyArray_LexSort: *(pointer.offset(189) as *const PyArray_LexSort),
            PyArray_Round: *(pointer.offset(190) as *const PyArray_Round),
            PyArray_EquivTypenums: *(pointer.offset(191) as *const PyArray_EquivTypenums),
            PyArray_RegisterDataType: *(pointer.offset(192) as *const PyArray_RegisterDataType),
            PyArray_RegisterCastFunc: *(pointer.offset(193) as *const PyArray_RegisterCastFunc),
            PyArray_RegisterCanCast: *(pointer.offset(194) as *const PyArray_RegisterCanCast),
            PyArray_InitArrFuncs: *(pointer.offset(195) as *const PyArray_InitArrFuncs),
            PyArray_IntTupleFromIntp: *(pointer.offset(196) as *const PyArray_IntTupleFromIntp),
            PyArray_TypeNumFromName: *(pointer.offset(197) as *const PyArray_TypeNumFromName),
            PyArray_ClipmodeConverter: *(pointer.offset(198) as *const PyArray_ClipmodeConverter),
            PyArray_OutputConverter: *(pointer.offset(199) as *const PyArray_OutputConverter),
            PyArray_BroadcastToShape: *(pointer.offset(200) as *const PyArray_BroadcastToShape),
            _PyArray_SigintHandler: *(pointer.offset(201) as *const _PyArray_SigintHandler),
            _PyArray_GetSigintBuf: *(pointer.offset(202) as *const _PyArray_GetSigintBuf),
            PyArray_DescrAlignConverter: *(pointer.offset(203) as *const PyArray_DescrAlignConverter),
            PyArray_DescrAlignConverter2: *(pointer.offset(204) as *const PyArray_DescrAlignConverter2),
            PyArray_SearchsideConverter: *(pointer.offset(205) as *const PyArray_SearchsideConverter),
            PyArray_CheckAxis: *(pointer.offset(206) as *const PyArray_CheckAxis),
            PyArray_OverflowMultiplyList: *(pointer.offset(207) as *const PyArray_OverflowMultiplyList),
            PyArray_CompareString: *(pointer.offset(208) as *const PyArray_CompareString),
            // PyArray_MultiIterFromObjects: *(pointer.offset(209) as *const PyArray_MultiIterFromObjects),
            PyArray_GetEndianness: *(pointer.offset(210) as *const PyArray_GetEndianness),
            PyArray_GetNDArrayCFeatureVersion: *(pointer.offset(211) as *const PyArray_GetNDArrayCFeatureVersion),
            PyArray_Correlate2: *(pointer.offset(212) as *const PyArray_Correlate2),
            PyArray_NeighborhoodIterNew: *(pointer.offset(213) as *const PyArray_NeighborhoodIterNew),
            PyArray_SetDatetimeParseFunction: *(pointer.offset(219) as *const PyArray_SetDatetimeParseFunction),
            PyArray_DatetimeToDatetimeStruct: *(pointer.offset(220) as *const PyArray_DatetimeToDatetimeStruct),
            PyArray_TimedeltaToTimedeltaStruct: *(pointer.offset(221) as *const PyArray_TimedeltaToTimedeltaStruct),
            PyArray_DatetimeStructToDatetime: *(pointer.offset(222) as *const PyArray_DatetimeStructToDatetime),
            PyArray_TimedeltaStructToTimedelta: *(pointer.offset(223) as *const PyArray_TimedeltaStructToTimedelta),
            NpyIter_New: *(pointer.offset(224) as *const NpyIter_New),
            NpyIter_MultiNew: *(pointer.offset(225) as *const NpyIter_MultiNew),
            NpyIter_AdvancedNew: *(pointer.offset(226) as *const NpyIter_AdvancedNew),
            NpyIter_Copy: *(pointer.offset(227) as *const NpyIter_Copy),
            NpyIter_Deallocate: *(pointer.offset(228) as *const NpyIter_Deallocate),
            NpyIter_HasDelayedBufAlloc: *(pointer.offset(229) as *const NpyIter_HasDelayedBufAlloc),
            NpyIter_HasExternalLoop: *(pointer.offset(230) as *const NpyIter_HasExternalLoop),
            NpyIter_EnableExternalLoop: *(pointer.offset(231) as *const NpyIter_EnableExternalLoop),
            NpyIter_GetInnerStrideArray: *(pointer.offset(232) as *const NpyIter_GetInnerStrideArray),
            NpyIter_GetInnerLoopSizePtr: *(pointer.offset(233) as *const NpyIter_GetInnerLoopSizePtr),
            NpyIter_Reset: *(pointer.offset(234) as *const NpyIter_Reset),
            NpyIter_ResetBasePointers: *(pointer.offset(235) as *const NpyIter_ResetBasePointers),
            NpyIter_ResetToIterIndexRange: *(pointer.offset(236) as *const NpyIter_ResetToIterIndexRange),
            NpyIter_GetNDim: *(pointer.offset(237) as *const NpyIter_GetNDim),
            NpyIter_GetNOp: *(pointer.offset(238) as *const NpyIter_GetNOp),
            NpyIter_GetIterNext: *(pointer.offset(239) as *const NpyIter_GetIterNext),
            NpyIter_GetIterSize: *(pointer.offset(240) as *const NpyIter_GetIterSize),
            NpyIter_GetIterIndexRange: *(pointer.offset(241) as *const NpyIter_GetIterIndexRange),
            NpyIter_GetIterIndex: *(pointer.offset(242) as *const NpyIter_GetIterIndex),
            NpyIter_GotoIterIndex: *(pointer.offset(243) as *const NpyIter_GotoIterIndex),
            NpyIter_HasMultiIndex: *(pointer.offset(244) as *const NpyIter_HasMultiIndex),
            NpyIter_GetShape: *(pointer.offset(245) as *const NpyIter_GetShape),
            NpyIter_GetGetMultiIndex: *(pointer.offset(246) as *const NpyIter_GetGetMultiIndex),
            NpyIter_GotoMultiIndex: *(pointer.offset(247) as *const NpyIter_GotoMultiIndex),
            NpyIter_RemoveMultiIndex: *(pointer.offset(248) as *const NpyIter_RemoveMultiIndex),
            NpyIter_HasIndex: *(pointer.offset(249) as *const NpyIter_HasIndex),
            NpyIter_IsBuffered: *(pointer.offset(250) as *const NpyIter_IsBuffered),
            NpyIter_IsGrowInner: *(pointer.offset(251) as *const NpyIter_IsGrowInner),
            NpyIter_GetBufferSize: *(pointer.offset(252) as *const NpyIter_GetBufferSize),
            NpyIter_GetIndexPtr: *(pointer.offset(253) as *const NpyIter_GetIndexPtr),
            NpyIter_GotoIndex: *(pointer.offset(254) as *const NpyIter_GotoIndex),
            NpyIter_GetDataPtrArray: *(pointer.offset(255) as *const NpyIter_GetDataPtrArray),
            NpyIter_GetDescrArray: *(pointer.offset(256) as *const NpyIter_GetDescrArray),
            NpyIter_GetOperandArray: *(pointer.offset(257) as *const NpyIter_GetOperandArray),
            NpyIter_GetIterView: *(pointer.offset(258) as *const NpyIter_GetIterView),
            NpyIter_GetReadFlags: *(pointer.offset(259) as *const NpyIter_GetReadFlags),
            NpyIter_GetWriteFlags: *(pointer.offset(260) as *const NpyIter_GetWriteFlags),
            NpyIter_DebugPrint: *(pointer.offset(261) as *const NpyIter_DebugPrint),
            NpyIter_IterationNeedsAPI: *(pointer.offset(262) as *const NpyIter_IterationNeedsAPI),
            NpyIter_GetInnerFixedStrideArray: *(pointer.offset(263) as *const NpyIter_GetInnerFixedStrideArray),
            NpyIter_RemoveAxis: *(pointer.offset(264) as *const NpyIter_RemoveAxis),
            NpyIter_GetAxisStrideArray: *(pointer.offset(265) as *const NpyIter_GetAxisStrideArray),
            NpyIter_RequiresBuffering: *(pointer.offset(266) as *const NpyIter_RequiresBuffering),
            NpyIter_GetInitialDataPtrArray: *(pointer.offset(267) as *const NpyIter_GetInitialDataPtrArray),
            NpyIter_CreateCompatibleStrides: *(pointer.offset(268) as *const NpyIter_CreateCompatibleStrides),
            PyArray_CastingConverter: *(pointer.offset(269) as *const PyArray_CastingConverter),
            PyArray_CountNonzero: *(pointer.offset(270) as *const PyArray_CountNonzero),
            PyArray_PromoteTypes: *(pointer.offset(271) as *const PyArray_PromoteTypes),
            PyArray_MinScalarType: *(pointer.offset(272) as *const PyArray_MinScalarType),
            PyArray_ResultType: *(pointer.offset(273) as *const PyArray_ResultType),
            PyArray_CanCastArrayTo: *(pointer.offset(274) as *const PyArray_CanCastArrayTo),
            PyArray_CanCastTypeTo: *(pointer.offset(275) as *const PyArray_CanCastTypeTo),
            PyArray_EinsteinSum: *(pointer.offset(276) as *const PyArray_EinsteinSum),
            PyArray_NewLikeArray: *(pointer.offset(277) as *const PyArray_NewLikeArray),
            PyArray_GetArrayParamsFromObject: *(pointer.offset(278) as *const PyArray_GetArrayParamsFromObject),
            PyArray_ConvertClipmodeSequence: *(pointer.offset(279) as *const PyArray_ConvertClipmodeSequence),
            PyArray_MatrixProduct2: *(pointer.offset(280) as *const PyArray_MatrixProduct2),
            NpyIter_IsFirstVisit: *(pointer.offset(281) as *const NpyIter_IsFirstVisit),
            PyArray_SetBaseObject: *(pointer.offset(282) as *const PyArray_SetBaseObject),
            PyArray_CreateSortedStridePerm: *(pointer.offset(283) as *const PyArray_CreateSortedStridePerm),
            PyArray_RemoveAxesInPlace: *(pointer.offset(284) as *const PyArray_RemoveAxesInPlace),
            PyArray_DebugPrint: *(pointer.offset(285) as *const PyArray_DebugPrint),
            PyArray_FailUnlessWriteable: *(pointer.offset(286) as *const PyArray_FailUnlessWriteable),
            PyArray_SetUpdateIfCopyBase: *(pointer.offset(287) as *const PyArray_SetUpdateIfCopyBase),
            PyDataMem_NEW: *(pointer.offset(288) as *const PyDataMem_NEW),
            PyDataMem_FREE: *(pointer.offset(289) as *const PyDataMem_FREE),
            PyDataMem_RENEW: *(pointer.offset(290) as *const PyDataMem_RENEW),
            PyDataMem_SetEventHook: *(pointer.offset(291) as *const PyDataMem_SetEventHook),
            PyArray_MapIterSwapAxes: *(pointer.offset(293) as *const PyArray_MapIterSwapAxes),
            PyArray_MapIterArray: *(pointer.offset(294) as *const PyArray_MapIterArray),
            PyArray_MapIterNext: *(pointer.offset(295) as *const PyArray_MapIterNext),
            PyArray_Partition: *(pointer.offset(296) as *const PyArray_Partition),
            PyArray_ArgPartition: *(pointer.offset(297) as *const PyArray_ArgPartition),
            PyArray_SelectkindConverter: *(pointer.offset(298) as *const PyArray_SelectkindConverter),
            PyDataMem_NEW_ZEROED: *(pointer.offset(299) as *const PyDataMem_NEW_ZEROED),
            PyArray_CheckAnyScalarExact: *(pointer.offset(300) as *const PyArray_CheckAnyScalarExact),
            PyArray_MapIterArrayCopyIfOverlap: *(pointer.offset(301) as *const PyArray_MapIterArrayCopyIfOverlap),
            PyArray_ResolveWritebackIfCopy: *(pointer.offset(302) as *const PyArray_ResolveWritebackIfCopy),
            PyArray_SetWritebackIfCopyBase: *(pointer.offset(303) as *const PyArray_SetWritebackIfCopyBase),
            PyArray_SimpleNewFromData: *(pointer.offset(304) as *const PyArray_SimpleNewFromData),
        }
    }

    pub unsafe fn from(capsule: *mut PyObject) -> Self {
        let pointer = PyCapsule_GetPointer(capsule, null_mut()) as *const *const c_void;
        NumpyModuleReference::new(pointer)
    }

    pub fn PyArray_Sort2(&self, op: *mut PyArrayObject, axis: c_int, which: NPY_SORTKIND) -> c_int {
        unsafe {
            let function = *(self.pointer.offset(129) as *const PyArray_Sort);
            (function)(op, axis, which)
        }
    }
}