1 /* -*- C -*- (not really, but good for syntax highlighting) */
5 #ifndef SWIG_FILE_WITH_INIT
6 #define NO_IMPORT_ARRAY
9 #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
10 #include <numpy/arrayobject.h>
13 /**********************************************************************/
15 %fragment("NumPy_Backward_Compatibility", "header")
17 %#if NPY_API_VERSION < 0x00000007
18 %#define NPY_ARRAY_DEFAULT NPY_DEFAULT
19 %#define NPY_ARRAY_FARRAY NPY_FARRAY
20 %#define NPY_FORTRANORDER NPY_FORTRAN
24 /**********************************************************************/
26 /* The following code originally appeared in
27 * enthought/kiva/agg/src/numeric.i written by Eric Jones. It was
28 * translated from C++ to C by John Hunter. Bill Spotz has modified
29 * it to fix some minor bugs, upgrade from Numeric to numpy (all
30 * versions), add some comments and functionality, and convert from
31 * direct code insertion to SWIG fragments.
34 %fragment("NumPy_Macros", "header")
36 /* Macros to extract array attributes.
38 %#if NPY_API_VERSION < 0x00000007
39 %#define is_array(a) ((a) && PyArray_Check((PyArrayObject*)a))
40 %#define array_type(a) (int)(PyArray_TYPE((PyArrayObject*)a))
41 %#define array_numdims(a) (((PyArrayObject*)a)->nd)
42 %#define array_dimensions(a) (((PyArrayObject*)a)->dimensions)
43 %#define array_size(a,i) (((PyArrayObject*)a)->dimensions[i])
44 %#define array_strides(a) (((PyArrayObject*)a)->strides)
45 %#define array_stride(a,i) (((PyArrayObject*)a)->strides[i])
46 %#define array_data(a) (((PyArrayObject*)a)->data)
47 %#define array_descr(a) (((PyArrayObject*)a)->descr)
48 %#define array_flags(a) (((PyArrayObject*)a)->flags)
49 %#define array_enableflags(a,f) (((PyArrayObject*)a)->flags) = f
51 %#define is_array(a) ((a) && PyArray_Check(a))
52 %#define array_type(a) PyArray_TYPE((PyArrayObject*)a)
53 %#define array_numdims(a) PyArray_NDIM((PyArrayObject*)a)
54 %#define array_dimensions(a) PyArray_DIMS((PyArrayObject*)a)
55 %#define array_strides(a) PyArray_STRIDES((PyArrayObject*)a)
56 %#define array_stride(a,i) PyArray_STRIDE((PyArrayObject*)a,i)
57 %#define array_size(a,i) PyArray_DIM((PyArrayObject*)a,i)
58 %#define array_data(a) PyArray_DATA((PyArrayObject*)a)
59 %#define array_descr(a) PyArray_DESCR((PyArrayObject*)a)
60 %#define array_flags(a) PyArray_FLAGS((PyArrayObject*)a)
61 %#define array_enableflags(a,f) PyArray_ENABLEFLAGS((PyArrayObject*)a,f)
63 %#define array_is_contiguous(a) (PyArray_ISCONTIGUOUS((PyArrayObject*)a))
64 %#define array_is_native(a) (PyArray_ISNOTSWAPPED((PyArrayObject*)a))
65 %#define array_is_fortran(a) (PyArray_ISFORTRAN((PyArrayObject*)a))
68 /**********************************************************************/
70 %fragment("NumPy_Utilities",
73 /* Given a PyObject, return a string describing its type.
75 const char* pytype_string(PyObject* py_obj)
77 if (py_obj == NULL ) return "C NULL value";
78 if (py_obj == Py_None ) return "Python None" ;
79 if (PyCallable_Check(py_obj)) return "callable" ;
80 if (PyString_Check( py_obj)) return "string" ;
81 if (PyInt_Check( py_obj)) return "int" ;
82 if (PyFloat_Check( py_obj)) return "float" ;
83 if (PyDict_Check( py_obj)) return "dict" ;
84 if (PyList_Check( py_obj)) return "list" ;
85 if (PyTuple_Check( py_obj)) return "tuple" ;
86 %#if PY_MAJOR_VERSION < 3
87 if (PyFile_Check( py_obj)) return "file" ;
88 if (PyModule_Check( py_obj)) return "module" ;
89 if (PyInstance_Check(py_obj)) return "instance" ;
95 /* Given a NumPy typecode, return a string describing the type.
97 const char* typecode_string(int typecode)
99 static const char* type_names[25] = {"bool",
109 "unsigned long long",
115 "complex long double",
124 return typecode < 24 ? type_names[typecode] : type_names[24];
127 /* Make sure input has correct numpy type. This now just calls
128 PyArray_EquivTypenums().
130 int type_match(int actual_type,
133 return PyArray_EquivTypenums(actual_type, desired_type);
136 %#ifdef SWIGPY_USE_CAPSULE
137 void free_cap(PyObject * cap)
139 void* array = (void*) PyCapsule_GetPointer(cap,SWIGPY_CAPSULE_NAME);
140 if (array != NULL) free(array);
147 /**********************************************************************/
149 %fragment("NumPy_Object_to_Array",
151 fragment="NumPy_Backward_Compatibility",
152 fragment="NumPy_Macros",
153 fragment="NumPy_Utilities")
155 /* Given a PyObject pointer, cast it to a PyArrayObject pointer if
156 * legal. If not, set the python error string appropriately and
159 PyArrayObject* obj_to_array_no_conversion(PyObject* input,
162 PyArrayObject* ary = NULL;
163 if (is_array(input) && (typecode == NPY_NOTYPE ||
164 PyArray_EquivTypenums(array_type(input), typecode)))
166 ary = (PyArrayObject*) input;
168 else if is_array(input)
170 const char* desired_type = typecode_string(typecode);
171 const char* actual_type = typecode_string(array_type(input));
172 PyErr_Format(PyExc_TypeError,
173 "Array of type '%s' required. Array of type '%s' given",
174 desired_type, actual_type);
179 const char* desired_type = typecode_string(typecode);
180 const char* actual_type = pytype_string(input);
181 PyErr_Format(PyExc_TypeError,
182 "Array of type '%s' required. A '%s' was given",
190 /* Convert the given PyObject to a NumPy array with the given
191 * typecode. On success, return a valid PyArrayObject* with the
192 * correct type. On failure, the python error string will be set and
193 * the routine returns NULL.
195 PyArrayObject* obj_to_array_allow_conversion(PyObject* input,
199 PyArrayObject* ary = NULL;
201 if (is_array(input) && (typecode == NPY_NOTYPE ||
202 PyArray_EquivTypenums(array_type(input),typecode)))
204 ary = (PyArrayObject*) input;
209 py_obj = PyArray_FROMANY(input, typecode, 0, 0, NPY_ARRAY_DEFAULT);
210 /* If NULL, PyArray_FromObject will have set python error value.*/
211 ary = (PyArrayObject*) py_obj;
217 /* Given a PyArrayObject, check to see if it is contiguous. If so,
218 * return the input pointer and flag it as not a new object. If it is
219 * not contiguous, create a new PyArrayObject using the original data,
220 * flag it as a new object and return the pointer.
222 PyArrayObject* make_contiguous(PyArrayObject* ary,
227 PyArrayObject* result;
228 if (array_is_contiguous(ary))
235 result = (PyArrayObject*) PyArray_ContiguousFromObject((PyObject*)ary,
244 /* Given a PyArrayObject, check to see if it is Fortran-contiguous.
245 * If so, return the input pointer, but do not flag it as not a new
246 * object. If it is not Fortran-contiguous, create a new
247 * PyArrayObject using the original data, flag it as a new object
248 * and return the pointer.
250 PyArrayObject* make_fortran(PyArrayObject* ary,
253 PyArrayObject* result;
254 if (array_is_fortran(ary))
261 Py_INCREF(array_descr(ary));
262 result = (PyArrayObject*) PyArray_FromArray(ary,
270 /* Convert a given PyObject to a contiguous PyArrayObject of the
271 * specified type. If the input object is not a contiguous
272 * PyArrayObject, a new one will be created and the new object flag
275 PyArrayObject* obj_to_array_contiguous_allow_conversion(PyObject* input,
282 PyArrayObject* ary1 = obj_to_array_allow_conversion(input,
287 ary2 = make_contiguous(ary1, &is_new2, 0, 0);
288 if ( is_new1 && is_new2)
294 *is_new_object = is_new1 || is_new2;
298 /* Convert a given PyObject to a Fortran-ordered PyArrayObject of the
299 * specified type. If the input object is not a Fortran-ordered
300 * PyArrayObject, a new one will be created and the new object flag
303 PyArrayObject* obj_to_array_fortran_allow_conversion(PyObject* input,
310 PyArrayObject* ary1 = obj_to_array_allow_conversion(input,
315 ary2 = make_fortran(ary1, &is_new2);
316 if (is_new1 && is_new2)
322 *is_new_object = is_new1 || is_new2;
327 /**********************************************************************/
329 %fragment("NumPy_Array_Requirements",
331 fragment="NumPy_Backward_Compatibility",
332 fragment="NumPy_Macros")
334 /* Test whether a python object is contiguous. If array is
335 * contiguous, return 1. Otherwise, set the python error string and
338 int require_contiguous(PyArrayObject* ary)
341 if (!array_is_contiguous(ary))
343 PyErr_SetString(PyExc_TypeError,
344 "Array must be contiguous. A non-contiguous array was given");
350 /* Require that a numpy array is not byte-swapped. If the array is
351 * not byte-swapped, return 1. Otherwise, set the python error string
354 int require_native(PyArrayObject* ary)
357 if (!array_is_native(ary))
359 PyErr_SetString(PyExc_TypeError,
360 "Array must have native byteorder. "
361 "A byte-swapped array was given");
367 /* Require the given PyArrayObject to have a specified number of
368 * dimensions. If the array has the specified number of dimensions,
369 * return 1. Otherwise, set the python error string and return 0.
371 int require_dimensions(PyArrayObject* ary,
372 int exact_dimensions)
375 if (array_numdims(ary) != exact_dimensions)
377 PyErr_Format(PyExc_TypeError,
378 "Array must have %d dimensions. Given array has %d dimensions",
386 /* Require the given PyArrayObject to have one of a list of specified
387 * number of dimensions. If the array has one of the specified number
388 * of dimensions, return 1. Otherwise, set the python error string
391 int require_dimensions_n(PyArrayObject* ary,
392 int* exact_dimensions,
397 char dims_str[255] = "";
399 for (i = 0; i < n && !success; i++)
401 if (array_numdims(ary) == exact_dimensions[i])
408 for (i = 0; i < n-1; i++)
410 sprintf(s, "%d, ", exact_dimensions[i]);
413 sprintf(s, " or %d", exact_dimensions[n-1]);
415 PyErr_Format(PyExc_TypeError,
416 "Array must have %s dimensions. Given array has %d dimensions",
423 /* Require the given PyArrayObject to have a specified shape. If the
424 * array has the specified shape, return 1. Otherwise, set the python
425 * error string and return 0.
427 int require_size(PyArrayObject* ary,
434 char desired_dims[255] = "[";
436 char actual_dims[255] = "[";
439 if (size[i] != -1 && size[i] != array_size(ary,i))
446 for (i = 0; i < n; i++)
454 sprintf(s, "%ld,", (long int)size[i]);
456 strcat(desired_dims,s);
458 len = strlen(desired_dims);
459 desired_dims[len-1] = ']';
460 for (i = 0; i < n; i++)
462 sprintf(s, "%ld,", (long int)array_size(ary,i));
463 strcat(actual_dims,s);
465 len = strlen(actual_dims);
466 actual_dims[len-1] = ']';
467 PyErr_Format(PyExc_TypeError,
468 "Array must have shape of %s. Given array has shape of %s",
475 /* Require the given PyArrayObject to to be Fortran ordered. If the
476 * the PyArrayObject is already Fortran ordered, do nothing. Else,
477 * set the Fortran ordering flag and recompute the strides.
479 int require_fortran(PyArrayObject* ary)
482 int nd = array_numdims(ary);
484 npy_intp * strides = array_strides(ary);
485 if (array_is_fortran(ary)) return success;
486 /* Set the Fortran ordered flag */
487 array_enableflags(ary,NPY_ARRAY_FARRAY);
488 /* Recompute the strides */
489 strides[0] = strides[nd-1];
490 for (i=1; i < nd; ++i)
491 strides[i] = strides[i-1] * array_size(ary,i-1);
496 /* Combine all NumPy fragments into one for convenience */
497 %fragment("NumPy_Fragments",
499 fragment="NumPy_Backward_Compatibility",
500 fragment="NumPy_Macros",
501 fragment="NumPy_Utilities",
502 fragment="NumPy_Object_to_Array",
503 fragment="NumPy_Array_Requirements")
507 /* End John Hunter translation (with modifications by Bill Spotz)
510 /* %numpy_typemaps() macro
512 * This macro defines a family of 74 typemaps that allow C arguments
515 * 1. (DATA_TYPE IN_ARRAY1[ANY])
516 * 2. (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1)
517 * 3. (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1)
519 * 4. (DATA_TYPE IN_ARRAY2[ANY][ANY])
520 * 5. (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
521 * 6. (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2)
522 * 7. (DATA_TYPE* IN_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
523 * 8. (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_FARRAY2)
525 * 9. (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY])
526 * 10. (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
527 * 11. (DATA_TYPE** IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
528 * 12. (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3)
529 * 13. (DATA_TYPE* IN_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
530 * 14. (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_FARRAY3)
532 * 15. (DATA_TYPE IN_ARRAY4[ANY][ANY][ANY][ANY])
533 * 16. (DATA_TYPE* IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
534 * 17. (DATA_TYPE** IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
535 * 18. (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, , DIM_TYPE DIM4, DATA_TYPE* IN_ARRAY4)
536 * 19. (DATA_TYPE* IN_FARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
537 * 20. (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* IN_FARRAY4)
539 * 21. (DATA_TYPE INPLACE_ARRAY1[ANY])
540 * 22. (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1)
541 * 23. (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1)
543 * 24. (DATA_TYPE INPLACE_ARRAY2[ANY][ANY])
544 * 25. (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
545 * 26. (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2)
546 * 27. (DATA_TYPE* INPLACE_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
547 * 28. (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_FARRAY2)
549 * 29. (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY])
550 * 30. (DATA_TYPE* INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
551 * 31. (DATA_TYPE** INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
552 * 32. (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_ARRAY3)
553 * 33. (DATA_TYPE* INPLACE_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
554 * 34. (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_FARRAY3)
556 * 35. (DATA_TYPE INPLACE_ARRAY4[ANY][ANY][ANY][ANY])
557 * 36. (DATA_TYPE* INPLACE_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
558 * 37. (DATA_TYPE** INPLACE_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
559 * 38. (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* INPLACE_ARRAY4)
560 * 39. (DATA_TYPE* INPLACE_FARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
561 * 40. (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* INPLACE_FARRAY4)
563 * 41. (DATA_TYPE ARGOUT_ARRAY1[ANY])
564 * 42. (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1)
565 * 43. (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1)
567 * 44. (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY])
569 * 45. (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY])
571 * 46. (DATA_TYPE ARGOUT_ARRAY4[ANY][ANY][ANY][ANY])
573 * 47. (DATA_TYPE** ARGOUTVIEW_ARRAY1, DIM_TYPE* DIM1)
574 * 48. (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEW_ARRAY1)
576 * 49. (DATA_TYPE** ARGOUTVIEW_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
577 * 50. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_ARRAY2)
578 * 51. (DATA_TYPE** ARGOUTVIEW_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
579 * 52. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_FARRAY2)
581 * 53. (DATA_TYPE** ARGOUTVIEW_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
582 * 54. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_ARRAY3)
583 * 55. (DATA_TYPE** ARGOUTVIEW_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
584 * 56. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_FARRAY3)
586 * 57. (DATA_TYPE** ARGOUTVIEW_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
587 * 58. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEW_ARRAY4)
588 * 59. (DATA_TYPE** ARGOUTVIEW_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
589 * 60. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEW_FARRAY4)
591 * 61. (DATA_TYPE** ARGOUTVIEWM_ARRAY1, DIM_TYPE* DIM1)
592 * 62. (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEWM_ARRAY1)
594 * 63. (DATA_TYPE** ARGOUTVIEWM_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
595 * 64. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEWM_ARRAY2)
596 * 65. (DATA_TYPE** ARGOUTVIEWM_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
597 * 66. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEWM_FARRAY2)
599 * 67. (DATA_TYPE** ARGOUTVIEWM_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
600 * 68. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEWM_ARRAY3)
601 * 69. (DATA_TYPE** ARGOUTVIEWM_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
602 * 70. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEWM_FARRAY3)
604 * 71. (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
605 * 72. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_ARRAY4)
606 * 73. (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
607 * 74. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_FARRAY4)
609 * where "DATA_TYPE" is any type supported by the NumPy module, and
610 * "DIM_TYPE" is any int-like type suitable for specifying dimensions.
611 * The difference between "ARRAY" typemaps and "FARRAY" typemaps is
612 * that the "FARRAY" typemaps expect Fortran ordering of
613 * multidimensional arrays. In python, the dimensions will not need
614 * to be specified (except for the "DATA_TYPE* ARGOUT_ARRAY1"
615 * typemaps). The IN_ARRAYs can be a numpy array or any sequence that
616 * can be converted to a numpy array of the specified type. The
617 * INPLACE_ARRAYs must be numpy arrays of the appropriate type. The
618 * ARGOUT_ARRAYs will be returned as new numpy arrays of the
621 * These typemaps can be applied to existing functions using the
622 * %apply directive. For example:
624 * %apply (double* IN_ARRAY1, int DIM1) {(double* series, int length)};
625 * double prod(double* series, int length);
627 * %apply (int DIM1, int DIM2, double* INPLACE_ARRAY2)
628 * {(int rows, int cols, double* matrix )};
629 * void floor(int rows, int cols, double* matrix, double f);
631 * %apply (double IN_ARRAY3[ANY][ANY][ANY])
632 * {(double tensor[2][2][2] )};
633 * %apply (double ARGOUT_ARRAY3[ANY][ANY][ANY])
634 * {(double low[2][2][2] )};
635 * %apply (double ARGOUT_ARRAY3[ANY][ANY][ANY])
636 * {(double upp[2][2][2] )};
637 * void luSplit(double tensor[2][2][2],
638 * double low[2][2][2],
639 * double upp[2][2][2] );
643 * double prod(double* IN_ARRAY1, int DIM1);
645 * void floor(int DIM1, int DIM2, double* INPLACE_ARRAY2, double f);
647 * void luSplit(double IN_ARRAY3[ANY][ANY][ANY],
648 * double ARGOUT_ARRAY3[ANY][ANY][ANY],
649 * double ARGOUT_ARRAY3[ANY][ANY][ANY]);
652 %define %numpy_typemaps(DATA_TYPE, DATA_TYPECODE, DIM_TYPE)
654 /************************/
655 /* Input Array Typemaps */
656 /************************/
658 /* Typemap suite for (DATA_TYPE IN_ARRAY1[ANY])
660 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
661 fragment="NumPy_Macros")
662 (DATA_TYPE IN_ARRAY1[ANY])
664 $1 = is_array($input) || PySequence_Check($input);
667 fragment="NumPy_Fragments")
668 (DATA_TYPE IN_ARRAY1[ANY])
669 (PyArrayObject* array=NULL, int is_new_object=0)
671 npy_intp size[1] = { $1_dim0 };
672 array = obj_to_array_contiguous_allow_conversion($input,
675 if (!array || !require_dimensions(array, 1) ||
676 !require_size(array, size, 1)) SWIG_fail;
677 $1 = ($1_ltype) array_data(array);
680 (DATA_TYPE IN_ARRAY1[ANY])
682 if (is_new_object$argnum && array$argnum)
683 { Py_DECREF(array$argnum); }
686 /* Typemap suite for (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1)
688 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
689 fragment="NumPy_Macros")
690 (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1)
692 $1 = is_array($input) || PySequence_Check($input);
695 fragment="NumPy_Fragments")
696 (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1)
697 (PyArrayObject* array=NULL, int is_new_object=0)
699 npy_intp size[1] = { -1 };
700 array = obj_to_array_contiguous_allow_conversion($input,
703 if (!array || !require_dimensions(array, 1) ||
704 !require_size(array, size, 1)) SWIG_fail;
705 $1 = (DATA_TYPE*) array_data(array);
706 $2 = (DIM_TYPE) array_size(array,0);
709 (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1)
711 if (is_new_object$argnum && array$argnum)
712 { Py_DECREF(array$argnum); }
715 /* Typemap suite for (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1)
717 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
718 fragment="NumPy_Macros")
719 (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1)
721 $1 = is_array($input) || PySequence_Check($input);
724 fragment="NumPy_Fragments")
725 (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1)
726 (PyArrayObject* array=NULL, int is_new_object=0)
728 npy_intp size[1] = {-1};
729 array = obj_to_array_contiguous_allow_conversion($input,
732 if (!array || !require_dimensions(array, 1) ||
733 !require_size(array, size, 1)) SWIG_fail;
734 $1 = (DIM_TYPE) array_size(array,0);
735 $2 = (DATA_TYPE*) array_data(array);
738 (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1)
740 if (is_new_object$argnum && array$argnum)
741 { Py_DECREF(array$argnum); }
744 /* Typemap suite for (DATA_TYPE IN_ARRAY2[ANY][ANY])
746 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
747 fragment="NumPy_Macros")
748 (DATA_TYPE IN_ARRAY2[ANY][ANY])
750 $1 = is_array($input) || PySequence_Check($input);
753 fragment="NumPy_Fragments")
754 (DATA_TYPE IN_ARRAY2[ANY][ANY])
755 (PyArrayObject* array=NULL, int is_new_object=0)
757 npy_intp size[2] = { $1_dim0, $1_dim1 };
758 array = obj_to_array_contiguous_allow_conversion($input,
761 if (!array || !require_dimensions(array, 2) ||
762 !require_size(array, size, 2)) SWIG_fail;
763 $1 = ($1_ltype) array_data(array);
766 (DATA_TYPE IN_ARRAY2[ANY][ANY])
768 if (is_new_object$argnum && array$argnum)
769 { Py_DECREF(array$argnum); }
772 /* Typemap suite for (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
774 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
775 fragment="NumPy_Macros")
776 (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
778 $1 = is_array($input) || PySequence_Check($input);
781 fragment="NumPy_Fragments")
782 (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
783 (PyArrayObject* array=NULL, int is_new_object=0)
785 npy_intp size[2] = { -1, -1 };
786 array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE,
788 if (!array || !require_dimensions(array, 2) ||
789 !require_size(array, size, 2)) SWIG_fail;
790 $1 = (DATA_TYPE*) array_data(array);
791 $2 = (DIM_TYPE) array_size(array,0);
792 $3 = (DIM_TYPE) array_size(array,1);
795 (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
797 if (is_new_object$argnum && array$argnum)
798 { Py_DECREF(array$argnum); }
801 /* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2)
803 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
804 fragment="NumPy_Macros")
805 (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2)
807 $1 = is_array($input) || PySequence_Check($input);
810 fragment="NumPy_Fragments")
811 (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2)
812 (PyArrayObject* array=NULL, int is_new_object=0)
814 npy_intp size[2] = { -1, -1 };
815 array = obj_to_array_contiguous_allow_conversion($input,
818 if (!array || !require_dimensions(array, 2) ||
819 !require_size(array, size, 2)) SWIG_fail;
820 $1 = (DIM_TYPE) array_size(array,0);
821 $2 = (DIM_TYPE) array_size(array,1);
822 $3 = (DATA_TYPE*) array_data(array);
825 (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2)
827 if (is_new_object$argnum && array$argnum)
828 { Py_DECREF(array$argnum); }
831 /* Typemap suite for (DATA_TYPE* IN_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
833 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
834 fragment="NumPy_Macros")
835 (DATA_TYPE* IN_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
837 $1 = is_array($input) || PySequence_Check($input);
840 fragment="NumPy_Fragments")
841 (DATA_TYPE* IN_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
842 (PyArrayObject* array=NULL, int is_new_object=0)
844 npy_intp size[2] = { -1, -1 };
845 array = obj_to_array_fortran_allow_conversion($input,
848 if (!array || !require_dimensions(array, 2) ||
849 !require_size(array, size, 2) || !require_fortran(array)) SWIG_fail;
850 $1 = (DATA_TYPE*) array_data(array);
851 $2 = (DIM_TYPE) array_size(array,0);
852 $3 = (DIM_TYPE) array_size(array,1);
855 (DATA_TYPE* IN_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
857 if (is_new_object$argnum && array$argnum)
858 { Py_DECREF(array$argnum); }
861 /* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_FARRAY2)
863 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
864 fragment="NumPy_Macros")
865 (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_FARRAY2)
867 $1 = is_array($input) || PySequence_Check($input);
870 fragment="NumPy_Fragments")
871 (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_FARRAY2)
872 (PyArrayObject* array=NULL, int is_new_object=0)
874 npy_intp size[2] = { -1, -1 };
875 array = obj_to_array_contiguous_allow_conversion($input,
878 if (!array || !require_dimensions(array, 2) ||
879 !require_size(array, size, 2) || !require_fortran(array)) SWIG_fail;
880 $1 = (DIM_TYPE) array_size(array,0);
881 $2 = (DIM_TYPE) array_size(array,1);
882 $3 = (DATA_TYPE*) array_data(array);
885 (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_FARRAY2)
887 if (is_new_object$argnum && array$argnum)
888 { Py_DECREF(array$argnum); }
891 /* Typemap suite for (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY])
893 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
894 fragment="NumPy_Macros")
895 (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY])
897 $1 = is_array($input) || PySequence_Check($input);
900 fragment="NumPy_Fragments")
901 (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY])
902 (PyArrayObject* array=NULL, int is_new_object=0)
904 npy_intp size[3] = { $1_dim0, $1_dim1, $1_dim2 };
905 array = obj_to_array_contiguous_allow_conversion($input,
908 if (!array || !require_dimensions(array, 3) ||
909 !require_size(array, size, 3)) SWIG_fail;
910 $1 = ($1_ltype) array_data(array);
913 (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY])
915 if (is_new_object$argnum && array$argnum)
916 { Py_DECREF(array$argnum); }
919 /* Typemap suite for (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2,
922 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
923 fragment="NumPy_Macros")
924 (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
926 $1 = is_array($input) || PySequence_Check($input);
929 fragment="NumPy_Fragments")
930 (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
931 (PyArrayObject* array=NULL, int is_new_object=0)
933 npy_intp size[3] = { -1, -1, -1 };
934 array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE,
936 if (!array || !require_dimensions(array, 3) ||
937 !require_size(array, size, 3)) SWIG_fail;
938 $1 = (DATA_TYPE*) array_data(array);
939 $2 = (DIM_TYPE) array_size(array,0);
940 $3 = (DIM_TYPE) array_size(array,1);
941 $4 = (DIM_TYPE) array_size(array,2);
944 (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
946 if (is_new_object$argnum && array$argnum)
947 { Py_DECREF(array$argnum); }
950 /* Typemap suite for (DATA_TYPE** IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2,
953 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
954 fragment="NumPy_Macros")
955 (DATA_TYPE** IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
957 /* for now, only concerned with lists */
958 $1 = PySequence_Check($input);
961 fragment="NumPy_Fragments")
962 (DATA_TYPE** IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
963 (DATA_TYPE** array=NULL, PyArrayObject** object_array=NULL, int* is_new_object_array=NULL)
965 npy_intp size[2] = { -1, -1 };
966 PyArrayObject* temp_array;
970 /* length of the list */
971 $2 = PyList_Size($input);
974 array = (DATA_TYPE **)malloc($2*sizeof(DATA_TYPE *));
975 object_array = (PyArrayObject **)calloc($2,sizeof(PyArrayObject *));
976 is_new_object_array = (int *)calloc($2,sizeof(int));
978 if (array == NULL || object_array == NULL || is_new_object_array == NULL)
985 temp_array = obj_to_array_contiguous_allow_conversion(PySequence_GetItem($input,i), DATA_TYPECODE, &is_new_object);
987 /* the new array must be stored so that it can be destroyed in freearg */
988 object_array[i] = temp_array;
989 is_new_object_array[i] = is_new_object;
991 if (!temp_array || !require_dimensions(temp_array, 2)) SWIG_fail;
993 /* store the size of the first array in the list, then use that for comparison. */
996 size[0] = array_size(temp_array,0);
997 size[1] = array_size(temp_array,1);
1000 if (!require_size(temp_array, size, 2)) SWIG_fail;
1002 array[i] = (DATA_TYPE*) array_data(temp_array);
1005 $1 = (DATA_TYPE**) array;
1006 $3 = (DIM_TYPE) size[0];
1007 $4 = (DIM_TYPE) size[1];
1010 (DATA_TYPE** IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
1014 if (array$argnum!=NULL) free(array$argnum);
1016 /*freeing the individual arrays if needed */
1017 if (object_array$argnum!=NULL)
1019 if (is_new_object_array$argnum!=NULL)
1021 for (i=0; i<$2; i++)
1023 if (object_array$argnum[i] != NULL && is_new_object_array$argnum[i])
1024 { Py_DECREF(object_array$argnum[i]); }
1026 free(is_new_object_array$argnum);
1028 free(object_array$argnum);
1032 /* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3,
1033 * DATA_TYPE* IN_ARRAY3)
1035 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1036 fragment="NumPy_Macros")
1037 (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3)
1039 $1 = is_array($input) || PySequence_Check($input);
1042 fragment="NumPy_Fragments")
1043 (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3)
1044 (PyArrayObject* array=NULL, int is_new_object=0)
1046 npy_intp size[3] = { -1, -1, -1 };
1047 array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE,
1049 if (!array || !require_dimensions(array, 3) ||
1050 !require_size(array, size, 3)) SWIG_fail;
1051 $1 = (DIM_TYPE) array_size(array,0);
1052 $2 = (DIM_TYPE) array_size(array,1);
1053 $3 = (DIM_TYPE) array_size(array,2);
1054 $4 = (DATA_TYPE*) array_data(array);
1057 (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3)
1059 if (is_new_object$argnum && array$argnum)
1060 { Py_DECREF(array$argnum); }
1063 /* Typemap suite for (DATA_TYPE* IN_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2,
1066 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1067 fragment="NumPy_Macros")
1068 (DATA_TYPE* IN_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
1070 $1 = is_array($input) || PySequence_Check($input);
1073 fragment="NumPy_Fragments")
1074 (DATA_TYPE* IN_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
1075 (PyArrayObject* array=NULL, int is_new_object=0)
1077 npy_intp size[3] = { -1, -1, -1 };
1078 array = obj_to_array_fortran_allow_conversion($input, DATA_TYPECODE,
1080 if (!array || !require_dimensions(array, 3) ||
1081 !require_size(array, size, 3) | !require_fortran(array)) SWIG_fail;
1082 $1 = (DATA_TYPE*) array_data(array);
1083 $2 = (DIM_TYPE) array_size(array,0);
1084 $3 = (DIM_TYPE) array_size(array,1);
1085 $4 = (DIM_TYPE) array_size(array,2);
1088 (DATA_TYPE* IN_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
1090 if (is_new_object$argnum && array$argnum)
1091 { Py_DECREF(array$argnum); }
1094 /* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3,
1095 * DATA_TYPE* IN_FARRAY3)
1097 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1098 fragment="NumPy_Macros")
1099 (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_FARRAY3)
1101 $1 = is_array($input) || PySequence_Check($input);
1104 fragment="NumPy_Fragments")
1105 (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_FARRAY3)
1106 (PyArrayObject* array=NULL, int is_new_object=0)
1108 npy_intp size[3] = { -1, -1, -1 };
1109 array = obj_to_array_contiguous_allow_conversion($input,
1112 if (!array || !require_dimensions(array, 3) ||
1113 !require_size(array, size, 3) || !require_fortran(array)) SWIG_fail;
1114 $1 = (DIM_TYPE) array_size(array,0);
1115 $2 = (DIM_TYPE) array_size(array,1);
1116 $3 = (DIM_TYPE) array_size(array,2);
1117 $4 = (DATA_TYPE*) array_data(array);
1120 (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_FARRAY3)
1122 if (is_new_object$argnum && array$argnum)
1123 { Py_DECREF(array$argnum); }
1126 /* Typemap suite for (DATA_TYPE IN_ARRAY4[ANY][ANY][ANY][ANY])
1128 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1129 fragment="NumPy_Macros")
1130 (DATA_TYPE IN_ARRAY4[ANY][ANY][ANY][ANY])
1132 $1 = is_array($input) || PySequence_Check($input);
1135 fragment="NumPy_Fragments")
1136 (DATA_TYPE IN_ARRAY4[ANY][ANY][ANY][ANY])
1137 (PyArrayObject* array=NULL, int is_new_object=0)
1139 npy_intp size[4] = { $1_dim0, $1_dim1, $1_dim2 , $1_dim3};
1140 array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE,
1142 if (!array || !require_dimensions(array, 4) ||
1143 !require_size(array, size, 4)) SWIG_fail;
1144 $1 = ($1_ltype) array_data(array);
1147 (DATA_TYPE IN_ARRAY4[ANY][ANY][ANY][ANY])
1149 if (is_new_object$argnum && array$argnum)
1150 { Py_DECREF(array$argnum); }
1153 /* Typemap suite for (DATA_TYPE* IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2,
1154 * DIM_TYPE DIM3, DIM_TYPE DIM4)
1156 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1157 fragment="NumPy_Macros")
1158 (DATA_TYPE* IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
1160 $1 = is_array($input) || PySequence_Check($input);
1163 fragment="NumPy_Fragments")
1164 (DATA_TYPE* IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
1165 (PyArrayObject* array=NULL, int is_new_object=0)
1167 npy_intp size[4] = { -1, -1, -1, -1 };
1168 array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE,
1170 if (!array || !require_dimensions(array, 4) ||
1171 !require_size(array, size, 4)) SWIG_fail;
1172 $1 = (DATA_TYPE*) array_data(array);
1173 $2 = (DIM_TYPE) array_size(array,0);
1174 $3 = (DIM_TYPE) array_size(array,1);
1175 $4 = (DIM_TYPE) array_size(array,2);
1176 $5 = (DIM_TYPE) array_size(array,3);
1179 (DATA_TYPE* IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
1181 if (is_new_object$argnum && array$argnum)
1182 { Py_DECREF(array$argnum); }
1185 /* Typemap suite for (DATA_TYPE** IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2,
1186 * DIM_TYPE DIM3, DIM_TYPE DIM4)
1188 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1189 fragment="NumPy_Macros")
1190 (DATA_TYPE** IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
1192 /* for now, only concerned with lists */
1193 $1 = PySequence_Check($input);
1196 fragment="NumPy_Fragments")
1197 (DATA_TYPE** IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
1198 (DATA_TYPE** array=NULL, PyArrayObject** object_array=NULL, int* is_new_object_array=NULL)
1200 npy_intp size[3] = { -1, -1, -1 };
1201 PyArrayObject* temp_array;
1205 /* length of the list */
1206 $2 = PyList_Size($input);
1209 array = (DATA_TYPE **)malloc($2*sizeof(DATA_TYPE *));
1210 object_array = (PyArrayObject **)calloc($2,sizeof(PyArrayObject *));
1211 is_new_object_array = (int *)calloc($2,sizeof(int));
1213 if (array == NULL || object_array == NULL || is_new_object_array == NULL)
1218 for (i=0; i<$2; i++)
1220 temp_array = obj_to_array_contiguous_allow_conversion(PySequence_GetItem($input,i), DATA_TYPECODE, &is_new_object);
1222 /* the new array must be stored so that it can be destroyed in freearg */
1223 object_array[i] = temp_array;
1224 is_new_object_array[i] = is_new_object;
1226 if (!temp_array || !require_dimensions(temp_array, 3)) SWIG_fail;
1228 /* store the size of the first array in the list, then use that for comparison. */
1231 size[0] = array_size(temp_array,0);
1232 size[1] = array_size(temp_array,1);
1233 size[2] = array_size(temp_array,2);
1236 if (!require_size(temp_array, size, 3)) SWIG_fail;
1238 array[i] = (DATA_TYPE*) array_data(temp_array);
1241 $1 = (DATA_TYPE**) array;
1242 $3 = (DIM_TYPE) size[0];
1243 $4 = (DIM_TYPE) size[1];
1244 $5 = (DIM_TYPE) size[2];
1247 (DATA_TYPE** IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
1251 if (array$argnum!=NULL) free(array$argnum);
1253 /*freeing the individual arrays if needed */
1254 if (object_array$argnum!=NULL)
1256 if (is_new_object_array$argnum!=NULL)
1258 for (i=0; i<$2; i++)
1260 if (object_array$argnum[i] != NULL && is_new_object_array$argnum[i])
1261 { Py_DECREF(object_array$argnum[i]); }
1263 free(is_new_object_array$argnum);
1265 free(object_array$argnum);
1269 /* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4,
1270 * DATA_TYPE* IN_ARRAY4)
1272 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1273 fragment="NumPy_Macros")
1274 (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* IN_ARRAY4)
1276 $1 = is_array($input) || PySequence_Check($input);
1279 fragment="NumPy_Fragments")
1280 (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* IN_ARRAY4)
1281 (PyArrayObject* array=NULL, int is_new_object=0)
1283 npy_intp size[4] = { -1, -1, -1 , -1};
1284 array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE,
1286 if (!array || !require_dimensions(array, 4) ||
1287 !require_size(array, size, 4)) SWIG_fail;
1288 $1 = (DIM_TYPE) array_size(array,0);
1289 $2 = (DIM_TYPE) array_size(array,1);
1290 $3 = (DIM_TYPE) array_size(array,2);
1291 $4 = (DIM_TYPE) array_size(array,3);
1292 $5 = (DATA_TYPE*) array_data(array);
1295 (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* IN_ARRAY4)
1297 if (is_new_object$argnum && array$argnum)
1298 { Py_DECREF(array$argnum); }
1301 /* Typemap suite for (DATA_TYPE* IN_FARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2,
1302 * DIM_TYPE DIM3, DIM_TYPE DIM4)
1304 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1305 fragment="NumPy_Macros")
1306 (DATA_TYPE* IN_FARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
1308 $1 = is_array($input) || PySequence_Check($input);
1311 fragment="NumPy_Fragments")
1312 (DATA_TYPE* IN_FARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
1313 (PyArrayObject* array=NULL, int is_new_object=0)
1315 npy_intp size[4] = { -1, -1, -1, -1 };
1316 array = obj_to_array_fortran_allow_conversion($input, DATA_TYPECODE,
1318 if (!array || !require_dimensions(array, 4) ||
1319 !require_size(array, size, 4) | !require_fortran(array)) SWIG_fail;
1320 $1 = (DATA_TYPE*) array_data(array);
1321 $2 = (DIM_TYPE) array_size(array,0);
1322 $3 = (DIM_TYPE) array_size(array,1);
1323 $4 = (DIM_TYPE) array_size(array,2);
1324 $5 = (DIM_TYPE) array_size(array,3);
1327 (DATA_TYPE* IN_FARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
1329 if (is_new_object$argnum && array$argnum)
1330 { Py_DECREF(array$argnum); }
1333 /* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4,
1334 * DATA_TYPE* IN_FARRAY4)
1336 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1337 fragment="NumPy_Macros")
1338 (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* IN_FARRAY4)
1340 $1 = is_array($input) || PySequence_Check($input);
1343 fragment="NumPy_Fragments")
1344 (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* IN_FARRAY4)
1345 (PyArrayObject* array=NULL, int is_new_object=0)
1347 npy_intp size[4] = { -1, -1, -1 , -1 };
1348 array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE,
1350 if (!array || !require_dimensions(array, 4) ||
1351 !require_size(array, size, 4) || !require_fortran(array)) SWIG_fail;
1352 $1 = (DIM_TYPE) array_size(array,0);
1353 $2 = (DIM_TYPE) array_size(array,1);
1354 $3 = (DIM_TYPE) array_size(array,2);
1355 $4 = (DIM_TYPE) array_size(array,3);
1356 $5 = (DATA_TYPE*) array_data(array);
1359 (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* IN_FARRAY4)
1361 if (is_new_object$argnum && array$argnum)
1362 { Py_DECREF(array$argnum); }
1365 /***************************/
1366 /* In-Place Array Typemaps */
1367 /***************************/
1369 /* Typemap suite for (DATA_TYPE INPLACE_ARRAY1[ANY])
1371 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1372 fragment="NumPy_Macros")
1373 (DATA_TYPE INPLACE_ARRAY1[ANY])
1375 $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
1379 fragment="NumPy_Fragments")
1380 (DATA_TYPE INPLACE_ARRAY1[ANY])
1381 (PyArrayObject* array=NULL)
1383 npy_intp size[1] = { $1_dim0 };
1384 array = obj_to_array_no_conversion($input, DATA_TYPECODE);
1385 if (!array || !require_dimensions(array,1) || !require_size(array, size, 1) ||
1386 !require_contiguous(array) || !require_native(array)) SWIG_fail;
1387 $1 = ($1_ltype) array_data(array);
1390 /* Typemap suite for (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1)
1392 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1393 fragment="NumPy_Macros")
1394 (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1)
1396 $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
1400 fragment="NumPy_Fragments")
1401 (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1)
1402 (PyArrayObject* array=NULL, int i=1)
1404 array = obj_to_array_no_conversion($input, DATA_TYPECODE);
1405 if (!array || !require_dimensions(array,1) || !require_contiguous(array)
1406 || !require_native(array)) SWIG_fail;
1407 $1 = (DATA_TYPE*) array_data(array);
1409 for (i=0; i < array_numdims(array); ++i) $2 *= array_size(array,i);
1412 /* Typemap suite for (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1)
1414 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1415 fragment="NumPy_Macros")
1416 (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1)
1418 $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
1422 fragment="NumPy_Fragments")
1423 (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1)
1424 (PyArrayObject* array=NULL, int i=0)
1426 array = obj_to_array_no_conversion($input, DATA_TYPECODE);
1427 if (!array || !require_dimensions(array,1) || !require_contiguous(array)
1428 || !require_native(array)) SWIG_fail;
1430 for (i=0; i < array_numdims(array); ++i) $1 *= array_size(array,i);
1431 $2 = (DATA_TYPE*) array_data(array);
1434 /* Typemap suite for (DATA_TYPE INPLACE_ARRAY2[ANY][ANY])
1436 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1437 fragment="NumPy_Macros")
1438 (DATA_TYPE INPLACE_ARRAY2[ANY][ANY])
1440 $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
1444 fragment="NumPy_Fragments")
1445 (DATA_TYPE INPLACE_ARRAY2[ANY][ANY])
1446 (PyArrayObject* array=NULL)
1448 npy_intp size[2] = { $1_dim0, $1_dim1 };
1449 array = obj_to_array_no_conversion($input, DATA_TYPECODE);
1450 if (!array || !require_dimensions(array,2) || !require_size(array, size, 2) ||
1451 !require_contiguous(array) || !require_native(array)) SWIG_fail;
1452 $1 = ($1_ltype) array_data(array);
1455 /* Typemap suite for (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
1457 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1458 fragment="NumPy_Macros")
1459 (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
1461 $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
1465 fragment="NumPy_Fragments")
1466 (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
1467 (PyArrayObject* array=NULL)
1469 array = obj_to_array_no_conversion($input, DATA_TYPECODE);
1470 if (!array || !require_dimensions(array,2) || !require_contiguous(array)
1471 || !require_native(array)) SWIG_fail;
1472 $1 = (DATA_TYPE*) array_data(array);
1473 $2 = (DIM_TYPE) array_size(array,0);
1474 $3 = (DIM_TYPE) array_size(array,1);
1477 /* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2)
1479 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1480 fragment="NumPy_Macros")
1481 (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2)
1483 $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
1487 fragment="NumPy_Fragments")
1488 (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2)
1489 (PyArrayObject* array=NULL)
1491 array = obj_to_array_no_conversion($input, DATA_TYPECODE);
1492 if (!array || !require_dimensions(array,2) || !require_contiguous(array) ||
1493 !require_native(array)) SWIG_fail;
1494 $1 = (DIM_TYPE) array_size(array,0);
1495 $2 = (DIM_TYPE) array_size(array,1);
1496 $3 = (DATA_TYPE*) array_data(array);
1499 /* Typemap suite for (DATA_TYPE* INPLACE_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
1501 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1502 fragment="NumPy_Macros")
1503 (DATA_TYPE* INPLACE_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
1505 $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
1509 fragment="NumPy_Fragments")
1510 (DATA_TYPE* INPLACE_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
1511 (PyArrayObject* array=NULL)
1513 array = obj_to_array_no_conversion($input, DATA_TYPECODE);
1514 if (!array || !require_dimensions(array,2) || !require_contiguous(array)
1515 || !require_native(array) || !require_fortran(array)) SWIG_fail;
1516 $1 = (DATA_TYPE*) array_data(array);
1517 $2 = (DIM_TYPE) array_size(array,0);
1518 $3 = (DIM_TYPE) array_size(array,1);
1521 /* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_FARRAY2)
1523 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1524 fragment="NumPy_Macros")
1525 (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_FARRAY2)
1527 $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
1531 fragment="NumPy_Fragments")
1532 (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_FARRAY2)
1533 (PyArrayObject* array=NULL)
1535 array = obj_to_array_no_conversion($input, DATA_TYPECODE);
1536 if (!array || !require_dimensions(array,2) || !require_contiguous(array) ||
1537 !require_native(array) || !require_fortran(array)) SWIG_fail;
1538 $1 = (DIM_TYPE) array_size(array,0);
1539 $2 = (DIM_TYPE) array_size(array,1);
1540 $3 = (DATA_TYPE*) array_data(array);
1543 /* Typemap suite for (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY])
1545 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1546 fragment="NumPy_Macros")
1547 (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY])
1549 $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
1553 fragment="NumPy_Fragments")
1554 (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY])
1555 (PyArrayObject* array=NULL)
1557 npy_intp size[3] = { $1_dim0, $1_dim1, $1_dim2 };
1558 array = obj_to_array_no_conversion($input, DATA_TYPECODE);
1559 if (!array || !require_dimensions(array,3) || !require_size(array, size, 3) ||
1560 !require_contiguous(array) || !require_native(array)) SWIG_fail;
1561 $1 = ($1_ltype) array_data(array);
1564 /* Typemap suite for (DATA_TYPE* INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2,
1567 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1568 fragment="NumPy_Macros")
1569 (DATA_TYPE* INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
1571 $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
1575 fragment="NumPy_Fragments")
1576 (DATA_TYPE* INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
1577 (PyArrayObject* array=NULL)
1579 array = obj_to_array_no_conversion($input, DATA_TYPECODE);
1580 if (!array || !require_dimensions(array,3) || !require_contiguous(array) ||
1581 !require_native(array)) SWIG_fail;
1582 $1 = (DATA_TYPE*) array_data(array);
1583 $2 = (DIM_TYPE) array_size(array,0);
1584 $3 = (DIM_TYPE) array_size(array,1);
1585 $4 = (DIM_TYPE) array_size(array,2);
1588 /* Typemap suite for (DATA_TYPE** INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2,
1591 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1592 fragment="NumPy_Macros")
1593 (DATA_TYPE** INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
1595 $1 = PySequence_Check($input);
1598 fragment="NumPy_Fragments")
1599 (DATA_TYPE** INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
1600 (DATA_TYPE** array=NULL, PyArrayObject** object_array=NULL)
1602 npy_intp size[2] = { -1, -1 };
1603 PyArrayObject* temp_array;
1606 /* length of the list */
1607 $2 = PyList_Size($input);
1610 array = (DATA_TYPE **)malloc($2*sizeof(DATA_TYPE *));
1611 object_array = (PyArrayObject **)calloc($2,sizeof(PyArrayObject *));
1613 if (array == NULL || object_array == NULL)
1618 for (i=0; i<$2; i++)
1620 temp_array = obj_to_array_no_conversion(PySequence_GetItem($input,i), DATA_TYPECODE);
1622 /* the new array must be stored so that it can be destroyed in freearg */
1623 object_array[i] = temp_array;
1625 if ( !temp_array || !require_dimensions(temp_array, 2) ||
1626 !require_contiguous(temp_array) ||
1627 !require_native(temp_array) ||
1628 !PyArray_EquivTypenums(array_type(temp_array), DATA_TYPECODE)
1631 /* store the size of the first array in the list, then use that for comparison. */
1634 size[0] = array_size(temp_array,0);
1635 size[1] = array_size(temp_array,1);
1638 if (!require_size(temp_array, size, 2)) SWIG_fail;
1640 array[i] = (DATA_TYPE*) array_data(temp_array);
1643 $1 = (DATA_TYPE**) array;
1644 $3 = (DIM_TYPE) size[0];
1645 $4 = (DIM_TYPE) size[1];
1648 (DATA_TYPE** INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
1650 if (array$argnum!=NULL) free(array$argnum);
1651 if (object_array$argnum!=NULL) free(object_array$argnum);
1654 /* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3,
1655 * DATA_TYPE* INPLACE_ARRAY3)
1657 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1658 fragment="NumPy_Macros")
1659 (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_ARRAY3)
1661 $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
1665 fragment="NumPy_Fragments")
1666 (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_ARRAY3)
1667 (PyArrayObject* array=NULL)
1669 array = obj_to_array_no_conversion($input, DATA_TYPECODE);
1670 if (!array || !require_dimensions(array,3) || !require_contiguous(array)
1671 || !require_native(array)) SWIG_fail;
1672 $1 = (DIM_TYPE) array_size(array,0);
1673 $2 = (DIM_TYPE) array_size(array,1);
1674 $3 = (DIM_TYPE) array_size(array,2);
1675 $4 = (DATA_TYPE*) array_data(array);
1678 /* Typemap suite for (DATA_TYPE* INPLACE_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2,
1681 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1682 fragment="NumPy_Macros")
1683 (DATA_TYPE* INPLACE_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
1685 $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
1689 fragment="NumPy_Fragments")
1690 (DATA_TYPE* INPLACE_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
1691 (PyArrayObject* array=NULL)
1693 array = obj_to_array_no_conversion($input, DATA_TYPECODE);
1694 if (!array || !require_dimensions(array,3) || !require_contiguous(array) ||
1695 !require_native(array) || !require_fortran(array)) SWIG_fail;
1696 $1 = (DATA_TYPE*) array_data(array);
1697 $2 = (DIM_TYPE) array_size(array,0);
1698 $3 = (DIM_TYPE) array_size(array,1);
1699 $4 = (DIM_TYPE) array_size(array,2);
1702 /* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3,
1703 * DATA_TYPE* INPLACE_FARRAY3)
1705 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1706 fragment="NumPy_Macros")
1707 (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_FARRAY3)
1709 $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
1713 fragment="NumPy_Fragments")
1714 (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_FARRAY3)
1715 (PyArrayObject* array=NULL)
1717 array = obj_to_array_no_conversion($input, DATA_TYPECODE);
1718 if (!array || !require_dimensions(array,3) || !require_contiguous(array)
1719 || !require_native(array) || !require_fortran(array)) SWIG_fail;
1720 $1 = (DIM_TYPE) array_size(array,0);
1721 $2 = (DIM_TYPE) array_size(array,1);
1722 $3 = (DIM_TYPE) array_size(array,2);
1723 $4 = (DATA_TYPE*) array_data(array);
1726 /* Typemap suite for (DATA_TYPE INPLACE_ARRAY4[ANY][ANY][ANY][ANY])
1728 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1729 fragment="NumPy_Macros")
1730 (DATA_TYPE INPLACE_ARRAY4[ANY][ANY][ANY][ANY])
1732 $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
1736 fragment="NumPy_Fragments")
1737 (DATA_TYPE INPLACE_ARRAY4[ANY][ANY][ANY][ANY])
1738 (PyArrayObject* array=NULL)
1740 npy_intp size[4] = { $1_dim0, $1_dim1, $1_dim2 , $1_dim3 };
1741 array = obj_to_array_no_conversion($input, DATA_TYPECODE);
1742 if (!array || !require_dimensions(array,4) || !require_size(array, size, 4) ||
1743 !require_contiguous(array) || !require_native(array)) SWIG_fail;
1744 $1 = ($1_ltype) array_data(array);
1747 /* Typemap suite for (DATA_TYPE* INPLACE_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2,
1748 * DIM_TYPE DIM3, DIM_TYPE DIM4)
1750 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1751 fragment="NumPy_Macros")
1752 (DATA_TYPE* INPLACE_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
1754 $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
1758 fragment="NumPy_Fragments")
1759 (DATA_TYPE* INPLACE_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
1760 (PyArrayObject* array=NULL)
1762 array = obj_to_array_no_conversion($input, DATA_TYPECODE);
1763 if (!array || !require_dimensions(array,4) || !require_contiguous(array) ||
1764 !require_native(array)) SWIG_fail;
1765 $1 = (DATA_TYPE*) array_data(array);
1766 $2 = (DIM_TYPE) array_size(array,0);
1767 $3 = (DIM_TYPE) array_size(array,1);
1768 $4 = (DIM_TYPE) array_size(array,2);
1769 $5 = (DIM_TYPE) array_size(array,3);
1772 /* Typemap suite for (DATA_TYPE** INPLACE_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2,
1773 * DIM_TYPE DIM3, DIM_TYPE DIM4)
1775 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1776 fragment="NumPy_Macros")
1777 (DATA_TYPE** INPLACE_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
1779 $1 = PySequence_Check($input);
1782 fragment="NumPy_Fragments")
1783 (DATA_TYPE** INPLACE_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
1784 (DATA_TYPE** array=NULL, PyArrayObject** object_array=NULL)
1786 npy_intp size[3] = { -1, -1, -1 };
1787 PyArrayObject* temp_array;
1790 /* length of the list */
1791 $2 = PyList_Size($input);
1794 array = (DATA_TYPE **)malloc($2*sizeof(DATA_TYPE *));
1795 object_array = (PyArrayObject **)calloc($2,sizeof(PyArrayObject *));
1797 if (array == NULL || object_array == NULL)
1802 for (i=0; i<$2; i++)
1804 temp_array = obj_to_array_no_conversion(PySequence_GetItem($input,i), DATA_TYPECODE);
1806 /* the new array must be stored so that it can be destroyed in freearg */
1807 object_array[i] = temp_array;
1809 if ( !temp_array || !require_dimensions(temp_array, 3) ||
1810 !require_contiguous(temp_array) ||
1811 !require_native(temp_array) ||
1812 !PyArray_EquivTypenums(array_type(temp_array), DATA_TYPECODE)
1815 /* store the size of the first array in the list, then use that for comparison. */
1818 size[0] = array_size(temp_array,0);
1819 size[1] = array_size(temp_array,1);
1820 size[2] = array_size(temp_array,2);
1823 if (!require_size(temp_array, size, 3)) SWIG_fail;
1825 array[i] = (DATA_TYPE*) array_data(temp_array);
1828 $1 = (DATA_TYPE**) array;
1829 $3 = (DIM_TYPE) size[0];
1830 $4 = (DIM_TYPE) size[1];
1831 $5 = (DIM_TYPE) size[2];
1834 (DATA_TYPE** INPLACE_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
1836 if (array$argnum!=NULL) free(array$argnum);
1837 if (object_array$argnum!=NULL) free(object_array$argnum);
1840 /* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4,
1841 * DATA_TYPE* INPLACE_ARRAY4)
1843 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1844 fragment="NumPy_Macros")
1845 (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* INPLACE_ARRAY4)
1847 $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
1851 fragment="NumPy_Fragments")
1852 (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* INPLACE_ARRAY4)
1853 (PyArrayObject* array=NULL)
1855 array = obj_to_array_no_conversion($input, DATA_TYPECODE);
1856 if (!array || !require_dimensions(array,4) || !require_contiguous(array)
1857 || !require_native(array)) SWIG_fail;
1858 $1 = (DIM_TYPE) array_size(array,0);
1859 $2 = (DIM_TYPE) array_size(array,1);
1860 $3 = (DIM_TYPE) array_size(array,2);
1861 $4 = (DIM_TYPE) array_size(array,3);
1862 $5 = (DATA_TYPE*) array_data(array);
1865 /* Typemap suite for (DATA_TYPE* INPLACE_FARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2,
1866 * DIM_TYPE DIM3, DIM_TYPE DIM4)
1868 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1869 fragment="NumPy_Macros")
1870 (DATA_TYPE* INPLACE_FARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
1872 $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
1876 fragment="NumPy_Fragments")
1877 (DATA_TYPE* INPLACE_FARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
1878 (PyArrayObject* array=NULL)
1880 array = obj_to_array_no_conversion($input, DATA_TYPECODE);
1881 if (!array || !require_dimensions(array,4) || !require_contiguous(array) ||
1882 !require_native(array) || !require_fortran(array)) SWIG_fail;
1883 $1 = (DATA_TYPE*) array_data(array);
1884 $2 = (DIM_TYPE) array_size(array,0);
1885 $3 = (DIM_TYPE) array_size(array,1);
1886 $4 = (DIM_TYPE) array_size(array,2);
1887 $5 = (DIM_TYPE) array_size(array,3);
1890 /* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3,
1891 * DATA_TYPE* INPLACE_FARRAY4)
1893 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
1894 fragment="NumPy_Macros")
1895 (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* INPLACE_FARRAY4)
1897 $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
1901 fragment="NumPy_Fragments")
1902 (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* INPLACE_FARRAY4)
1903 (PyArrayObject* array=NULL)
1905 array = obj_to_array_no_conversion($input, DATA_TYPECODE);
1906 if (!array || !require_dimensions(array,4) || !require_contiguous(array)
1907 || !require_native(array) || !require_fortran(array)) SWIG_fail;
1908 $1 = (DIM_TYPE) array_size(array,0);
1909 $2 = (DIM_TYPE) array_size(array,1);
1910 $3 = (DIM_TYPE) array_size(array,2);
1911 $4 = (DIM_TYPE) array_size(array,3);
1912 $5 = (DATA_TYPE*) array_data(array);
1915 /*************************/
1916 /* Argout Array Typemaps */
1917 /*************************/
1919 /* Typemap suite for (DATA_TYPE ARGOUT_ARRAY1[ANY])
1921 %typemap(in,numinputs=0,
1922 fragment="NumPy_Backward_Compatibility,NumPy_Macros")
1923 (DATA_TYPE ARGOUT_ARRAY1[ANY])
1924 (PyObject* array = NULL)
1926 npy_intp dims[1] = { $1_dim0 };
1927 array = PyArray_SimpleNew(1, dims, DATA_TYPECODE);
1928 if (!array) SWIG_fail;
1929 $1 = ($1_ltype) array_data(array);
1932 (DATA_TYPE ARGOUT_ARRAY1[ANY])
1934 $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum);
1937 /* Typemap suite for (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1)
1939 %typemap(in,numinputs=1,
1940 fragment="NumPy_Fragments")
1941 (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1)
1942 (PyObject* array = NULL)
1945 if (!PyInt_Check($input))
1947 const char* typestring = pytype_string($input);
1948 PyErr_Format(PyExc_TypeError,
1949 "Int dimension expected. '%s' given.",
1953 $2 = (DIM_TYPE) PyInt_AsLong($input);
1954 dims[0] = (npy_intp) $2;
1955 array = PyArray_SimpleNew(1, dims, DATA_TYPECODE);
1956 if (!array) SWIG_fail;
1957 $1 = (DATA_TYPE*) array_data(array);
1960 (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1)
1962 $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum);
1965 /* Typemap suite for (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1)
1967 %typemap(in,numinputs=1,
1968 fragment="NumPy_Fragments")
1969 (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1)
1970 (PyObject* array = NULL)
1973 if (!PyInt_Check($input))
1975 const char* typestring = pytype_string($input);
1976 PyErr_Format(PyExc_TypeError,
1977 "Int dimension expected. '%s' given.",
1981 $1 = (DIM_TYPE) PyInt_AsLong($input);
1982 dims[0] = (npy_intp) $1;
1983 array = PyArray_SimpleNew(1, dims, DATA_TYPECODE);
1984 if (!array) SWIG_fail;
1985 $2 = (DATA_TYPE*) array_data(array);
1988 (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1)
1990 $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum);
1993 /* Typemap suite for (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY])
1995 %typemap(in,numinputs=0,
1996 fragment="NumPy_Backward_Compatibility,NumPy_Macros")
1997 (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY])
1998 (PyObject* array = NULL)
2000 npy_intp dims[2] = { $1_dim0, $1_dim1 };
2001 array = PyArray_SimpleNew(2, dims, DATA_TYPECODE);
2002 if (!array) SWIG_fail;
2003 $1 = ($1_ltype) array_data(array);
2006 (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY])
2008 $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum);
2011 /* Typemap suite for (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY])
2013 %typemap(in,numinputs=0,
2014 fragment="NumPy_Backward_Compatibility,NumPy_Macros")
2015 (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY])
2016 (PyObject* array = NULL)
2018 npy_intp dims[3] = { $1_dim0, $1_dim1, $1_dim2 };
2019 array = PyArray_SimpleNew(3, dims, DATA_TYPECODE);
2020 if (!array) SWIG_fail;
2021 $1 = ($1_ltype) array_data(array);
2024 (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY])
2026 $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum);
2029 /* Typemap suite for (DATA_TYPE ARGOUT_ARRAY4[ANY][ANY][ANY][ANY])
2031 %typemap(in,numinputs=0,
2032 fragment="NumPy_Backward_Compatibility,NumPy_Macros")
2033 (DATA_TYPE ARGOUT_ARRAY4[ANY][ANY][ANY][ANY])
2034 (PyObject* array = NULL)
2036 npy_intp dims[4] = { $1_dim0, $1_dim1, $1_dim2, $1_dim3 };
2037 array = PyArray_SimpleNew(4, dims, DATA_TYPECODE);
2038 if (!array) SWIG_fail;
2039 $1 = ($1_ltype) array_data(array);
2042 (DATA_TYPE ARGOUT_ARRAY4[ANY][ANY][ANY][ANY])
2044 $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum);
2047 /*****************************/
2048 /* Argoutview Array Typemaps */
2049 /*****************************/
2051 /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY1, DIM_TYPE* DIM1)
2053 %typemap(in,numinputs=0)
2054 (DATA_TYPE** ARGOUTVIEW_ARRAY1, DIM_TYPE* DIM1 )
2055 (DATA_TYPE* data_temp = NULL , DIM_TYPE dim_temp)
2061 fragment="NumPy_Backward_Compatibility")
2062 (DATA_TYPE** ARGOUTVIEW_ARRAY1, DIM_TYPE* DIM1)
2064 npy_intp dims[1] = { *$2 };
2065 PyObject* obj = PyArray_SimpleNewFromData(1, dims, DATA_TYPECODE, (void*)(*$1));
2066 PyArrayObject* array = (PyArrayObject*) obj;
2068 if (!array) SWIG_fail;
2069 $result = SWIG_Python_AppendOutput($result,obj);
2072 /* Typemap suite for (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEW_ARRAY1)
2074 %typemap(in,numinputs=0)
2075 (DIM_TYPE* DIM1 , DATA_TYPE** ARGOUTVIEW_ARRAY1)
2076 (DIM_TYPE dim_temp, DATA_TYPE* data_temp = NULL )
2082 fragment="NumPy_Backward_Compatibility")
2083 (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEW_ARRAY1)
2085 npy_intp dims[1] = { *$1 };
2086 PyObject* obj = PyArray_SimpleNewFromData(1, dims, DATA_TYPECODE, (void*)(*$2));
2087 PyArrayObject* array = (PyArrayObject*) obj;
2089 if (!array) SWIG_fail;
2090 $result = SWIG_Python_AppendOutput($result,obj);
2093 /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
2095 %typemap(in,numinputs=0)
2096 (DATA_TYPE** ARGOUTVIEW_ARRAY2, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 )
2097 (DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp)
2104 fragment="NumPy_Backward_Compatibility")
2105 (DATA_TYPE** ARGOUTVIEW_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
2107 npy_intp dims[2] = { *$2, *$3 };
2108 PyObject* obj = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$1));
2109 PyArrayObject* array = (PyArrayObject*) obj;
2111 if (!array) SWIG_fail;
2112 $result = SWIG_Python_AppendOutput($result,obj);
2115 /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_ARRAY2)
2117 %typemap(in,numinputs=0)
2118 (DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DATA_TYPE** ARGOUTVIEW_ARRAY2)
2119 (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DATA_TYPE* data_temp = NULL )
2126 fragment="NumPy_Backward_Compatibility")
2127 (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_ARRAY2)
2129 npy_intp dims[2] = { *$1, *$2 };
2130 PyObject* obj = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$3));
2131 PyArrayObject* array = (PyArrayObject*) obj;
2133 if (!array) SWIG_fail;
2134 $result = SWIG_Python_AppendOutput($result,obj);
2137 /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
2139 %typemap(in,numinputs=0)
2140 (DATA_TYPE** ARGOUTVIEW_FARRAY2, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 )
2141 (DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp)
2148 fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements")
2149 (DATA_TYPE** ARGOUTVIEW_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
2151 npy_intp dims[2] = { *$2, *$3 };
2152 PyObject* obj = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$1));
2153 PyArrayObject* array = (PyArrayObject*) obj;
2155 if (!array || !require_fortran(array)) SWIG_fail;
2156 $result = SWIG_Python_AppendOutput($result,obj);
2159 /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_FARRAY2)
2161 %typemap(in,numinputs=0)
2162 (DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DATA_TYPE** ARGOUTVIEW_FARRAY2)
2163 (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DATA_TYPE* data_temp = NULL )
2170 fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements")
2171 (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_FARRAY2)
2173 npy_intp dims[2] = { *$1, *$2 };
2174 PyObject* obj = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$3));
2175 PyArrayObject* array = (PyArrayObject*) obj;
2177 if (!array || !require_fortran(array)) SWIG_fail;
2178 $result = SWIG_Python_AppendOutput($result,obj);
2181 /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
2184 %typemap(in,numinputs=0)
2185 (DATA_TYPE** ARGOUTVIEW_ARRAY3, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 )
2186 (DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp)
2194 fragment="NumPy_Backward_Compatibility")
2195 (DATA_TYPE** ARGOUTVIEW_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
2197 npy_intp dims[3] = { *$2, *$3, *$4 };
2198 PyObject* obj = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$1));
2199 PyArrayObject* array = (PyArrayObject*) obj;
2201 if (!array) SWIG_fail;
2202 $result = SWIG_Python_AppendOutput($result,obj);
2205 /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3,
2206 DATA_TYPE** ARGOUTVIEW_ARRAY3)
2208 %typemap(in,numinputs=0)
2209 (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_ARRAY3)
2210 (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DATA_TYPE* data_temp = NULL)
2218 fragment="NumPy_Backward_Compatibility")
2219 (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_ARRAY3)
2221 npy_intp dims[3] = { *$1, *$2, *$3 };
2222 PyObject* obj = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$4));
2223 PyArrayObject* array = (PyArrayObject*) obj;
2225 if (!array) SWIG_fail;
2226 $result = SWIG_Python_AppendOutput($result,obj);
2229 /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
2232 %typemap(in,numinputs=0)
2233 (DATA_TYPE** ARGOUTVIEW_FARRAY3, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 )
2234 (DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp)
2242 fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements")
2243 (DATA_TYPE** ARGOUTVIEW_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
2245 npy_intp dims[3] = { *$2, *$3, *$4 };
2246 PyObject* obj = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$1));
2247 PyArrayObject* array = (PyArrayObject*) obj;
2249 if (!array || require_fortran(array)) SWIG_fail;
2250 $result = SWIG_Python_AppendOutput($result,obj);
2253 /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3,
2254 DATA_TYPE** ARGOUTVIEW_FARRAY3)
2256 %typemap(in,numinputs=0)
2257 (DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DATA_TYPE** ARGOUTVIEW_FARRAY3)
2258 (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DATA_TYPE* data_temp = NULL )
2266 fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements")
2267 (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_FARRAY3)
2269 npy_intp dims[3] = { *$1, *$2, *$3 };
2270 PyObject* obj = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$4));
2271 PyArrayObject* array = (PyArrayObject*) obj;
2273 if (!array || require_fortran(array)) SWIG_fail;
2274 $result = SWIG_Python_AppendOutput($result,obj);
2277 /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
2278 DIM_TYPE* DIM3, DIM_TYPE* DIM4)
2280 %typemap(in,numinputs=0)
2281 (DATA_TYPE** ARGOUTVIEW_ARRAY4, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 )
2282 (DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp)
2291 fragment="NumPy_Backward_Compatibility")
2292 (DATA_TYPE** ARGOUTVIEW_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
2294 npy_intp dims[4] = { *$2, *$3, *$4 , *$5 };
2295 PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$1));
2296 PyArrayObject* array = (PyArrayObject*) obj;
2298 if (!array) SWIG_fail;
2299 $result = SWIG_Python_AppendOutput($result,obj);
2302 /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4,
2303 DATA_TYPE** ARGOUTVIEW_ARRAY4)
2305 %typemap(in,numinputs=0)
2306 (DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 , DATA_TYPE** ARGOUTVIEW_ARRAY4)
2307 (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp, DATA_TYPE* data_temp = NULL )
2316 fragment="NumPy_Backward_Compatibility")
2317 (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEW_ARRAY4)
2319 npy_intp dims[4] = { *$1, *$2, *$3 , *$4 };
2320 PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$5));
2321 PyArrayObject* array = (PyArrayObject*) obj;
2323 if (!array) SWIG_fail;
2324 $result = SWIG_Python_AppendOutput($result,obj);
2327 /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
2328 DIM_TYPE* DIM3, DIM_TYPE* DIM4)
2330 %typemap(in,numinputs=0)
2331 (DATA_TYPE** ARGOUTVIEW_FARRAY4, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 )
2332 (DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp)
2341 fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements")
2342 (DATA_TYPE** ARGOUTVIEW_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
2344 npy_intp dims[4] = { *$2, *$3, *$4 , *$5 };
2345 PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$1));
2346 PyArrayObject* array = (PyArrayObject*) obj;
2348 if (!array || require_fortran(array)) SWIG_fail;
2349 $result = SWIG_Python_AppendOutput($result,obj);
2352 /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4,
2353 DATA_TYPE** ARGOUTVIEW_FARRAY4)
2355 %typemap(in,numinputs=0)
2356 (DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 , DATA_TYPE** ARGOUTVIEW_FARRAY4)
2357 (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp, DATA_TYPE* data_temp = NULL )
2366 fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements")
2367 (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEW_FARRAY4)
2369 npy_intp dims[4] = { *$1, *$2, *$3 , *$4 };
2370 PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$5));
2371 PyArrayObject* array = (PyArrayObject*) obj;
2373 if (!array || require_fortran(array)) SWIG_fail;
2374 $result = SWIG_Python_AppendOutput($result,obj);
2377 /*************************************/
2378 /* Managed Argoutview Array Typemaps */
2379 /*************************************/
2381 /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY1, DIM_TYPE* DIM1)
2383 %typemap(in,numinputs=0)
2384 (DATA_TYPE** ARGOUTVIEWM_ARRAY1, DIM_TYPE* DIM1 )
2385 (DATA_TYPE* data_temp = NULL , DIM_TYPE dim_temp)
2391 fragment="NumPy_Backward_Compatibility")
2392 (DATA_TYPE** ARGOUTVIEWM_ARRAY1, DIM_TYPE* DIM1)
2394 npy_intp dims[1] = { *$2 };
2395 PyObject* obj = PyArray_SimpleNewFromData(1, dims, DATA_TYPECODE, (void*)(*$1));
2396 PyArrayObject* array = (PyArrayObject*) obj;
2398 if (!array) SWIG_fail;
2400 %#ifdef SWIGPY_USE_CAPSULE
2401 PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
2403 PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
2406 %#if NPY_API_VERSION < 0x00000007
2407 PyArray_BASE(array) = cap;
2409 PyArray_SetBaseObject(array,cap);
2412 $result = SWIG_Python_AppendOutput($result,obj);
2415 /* Typemap suite for (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEWM_ARRAY1)
2417 %typemap(in,numinputs=0)
2418 (DIM_TYPE* DIM1 , DATA_TYPE** ARGOUTVIEWM_ARRAY1)
2419 (DIM_TYPE dim_temp, DATA_TYPE* data_temp = NULL )
2425 fragment="NumPy_Backward_Compatibility")
2426 (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEWM_ARRAY1)
2428 npy_intp dims[1] = { *$1 };
2429 PyObject* obj = PyArray_SimpleNewFromData(1, dims, DATA_TYPECODE, (void*)(*$2));
2430 PyArrayObject* array = (PyArrayObject*) obj;
2432 if (!array) SWIG_fail;
2434 %#ifdef SWIGPY_USE_CAPSULE
2435 PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
2437 PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
2440 %#if NPY_API_VERSION < 0x00000007
2441 PyArray_BASE(array) = cap;
2443 PyArray_SetBaseObject(array,cap);
2446 $result = SWIG_Python_AppendOutput($result,obj);
2449 /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
2451 %typemap(in,numinputs=0)
2452 (DATA_TYPE** ARGOUTVIEWM_ARRAY2, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 )
2453 (DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp)
2460 fragment="NumPy_Backward_Compatibility")
2461 (DATA_TYPE** ARGOUTVIEWM_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
2463 npy_intp dims[2] = { *$2, *$3 };
2464 PyObject* obj = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$1));
2465 PyArrayObject* array = (PyArrayObject*) obj;
2467 if (!array) SWIG_fail;
2469 %#ifdef SWIGPY_USE_CAPSULE
2470 PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
2472 PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
2475 %#if NPY_API_VERSION < 0x00000007
2476 PyArray_BASE(array) = cap;
2478 PyArray_SetBaseObject(array,cap);
2481 $result = SWIG_Python_AppendOutput($result,obj);
2484 /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEWM_ARRAY2)
2486 %typemap(in,numinputs=0)
2487 (DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DATA_TYPE** ARGOUTVIEWM_ARRAY2)
2488 (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DATA_TYPE* data_temp = NULL )
2495 fragment="NumPy_Backward_Compatibility")
2496 (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEWM_ARRAY2)
2498 npy_intp dims[2] = { *$1, *$2 };
2499 PyObject* obj = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$3));
2500 PyArrayObject* array = (PyArrayObject*) obj;
2502 if (!array) SWIG_fail;
2504 %#ifdef SWIGPY_USE_CAPSULE
2505 PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
2507 PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
2510 %#if NPY_API_VERSION < 0x00000007
2511 PyArray_BASE(array) = cap;
2513 PyArray_SetBaseObject(array,cap);
2516 $result = SWIG_Python_AppendOutput($result,obj);
2519 /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
2521 %typemap(in,numinputs=0)
2522 (DATA_TYPE** ARGOUTVIEWM_FARRAY2, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 )
2523 (DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp)
2530 fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements")
2531 (DATA_TYPE** ARGOUTVIEWM_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
2533 npy_intp dims[2] = { *$2, *$3 };
2534 PyObject* obj = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$1));
2535 PyArrayObject* array = (PyArrayObject*) obj;
2537 if (!array || !require_fortran(array)) SWIG_fail;
2539 %#ifdef SWIGPY_USE_CAPSULE
2540 PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
2542 PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
2545 %#if NPY_API_VERSION < 0x00000007
2546 PyArray_BASE(array) = cap;
2548 PyArray_SetBaseObject(array,cap);
2551 $result = SWIG_Python_AppendOutput($result,obj);
2554 /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEWM_FARRAY2)
2556 %typemap(in,numinputs=0)
2557 (DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DATA_TYPE** ARGOUTVIEWM_FARRAY2)
2558 (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DATA_TYPE* data_temp = NULL )
2565 fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements")
2566 (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEWM_FARRAY2)
2568 npy_intp dims[2] = { *$1, *$2 };
2569 PyObject* obj = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$3));
2570 PyArrayObject* array = (PyArrayObject*) obj;
2572 if (!array || !require_fortran(array)) SWIG_fail;
2574 %#ifdef SWIGPY_USE_CAPSULE
2575 PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
2577 PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
2580 %#if NPY_API_VERSION < 0x00000007
2581 PyArray_BASE(array) = cap;
2583 PyArray_SetBaseObject(array,cap);
2586 $result = SWIG_Python_AppendOutput($result,obj);
2589 /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
2592 %typemap(in,numinputs=0)
2593 (DATA_TYPE** ARGOUTVIEWM_ARRAY3, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 )
2594 (DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp)
2602 fragment="NumPy_Backward_Compatibility")
2603 (DATA_TYPE** ARGOUTVIEWM_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
2605 npy_intp dims[3] = { *$2, *$3, *$4 };
2606 PyObject* obj = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$1));
2607 PyArrayObject* array = (PyArrayObject*) obj;
2609 if (!array) SWIG_fail;
2611 %#ifdef SWIGPY_USE_CAPSULE
2612 PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
2614 PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
2617 %#if NPY_API_VERSION < 0x00000007
2618 PyArray_BASE(array) = cap;
2620 PyArray_SetBaseObject(array,cap);
2623 $result = SWIG_Python_AppendOutput($result,obj);
2626 /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3,
2627 DATA_TYPE** ARGOUTVIEWM_ARRAY3)
2629 %typemap(in,numinputs=0)
2630 (DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DATA_TYPE** ARGOUTVIEWM_ARRAY3)
2631 (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DATA_TYPE* data_temp = NULL )
2639 fragment="NumPy_Backward_Compatibility")
2640 (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEWM_ARRAY3)
2642 npy_intp dims[3] = { *$1, *$2, *$3 };
2643 PyObject* obj= PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$4));
2644 PyArrayObject* array = (PyArrayObject*) obj;
2646 if (!array) SWIG_fail;
2648 %#ifdef SWIGPY_USE_CAPSULE
2649 PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
2651 PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
2654 %#if NPY_API_VERSION < 0x00000007
2655 PyArray_BASE(array) = cap;
2657 PyArray_SetBaseObject(array,cap);
2660 $result = SWIG_Python_AppendOutput($result,obj);
2663 /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
2666 %typemap(in,numinputs=0)
2667 (DATA_TYPE** ARGOUTVIEWM_FARRAY3, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 )
2668 (DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp)
2676 fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements")
2677 (DATA_TYPE** ARGOUTVIEWM_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
2679 npy_intp dims[3] = { *$2, *$3, *$4 };
2680 PyObject* obj = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$1));
2681 PyArrayObject* array = (PyArrayObject*) obj;
2683 if (!array || require_fortran(array)) SWIG_fail;
2685 %#ifdef SWIGPY_USE_CAPSULE
2686 PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
2688 PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
2691 %#if NPY_API_VERSION < 0x00000007
2692 PyArray_BASE(array) = cap;
2694 PyArray_SetBaseObject(array,cap);
2697 $result = SWIG_Python_AppendOutput($result,obj);
2700 /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3,
2701 DATA_TYPE** ARGOUTVIEWM_FARRAY3)
2703 %typemap(in,numinputs=0)
2704 (DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DATA_TYPE** ARGOUTVIEWM_FARRAY3)
2705 (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DATA_TYPE* data_temp = NULL )
2713 fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements")
2714 (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEWM_FARRAY3)
2716 npy_intp dims[3] = { *$1, *$2, *$3 };
2717 PyObject* obj = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$4));
2718 PyArrayObject* array = (PyArrayObject*) obj;
2720 if (!array || require_fortran(array)) SWIG_fail;
2722 %#ifdef SWIGPY_USE_CAPSULE
2723 PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
2725 PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
2728 %#if NPY_API_VERSION < 0x00000007
2729 PyArray_BASE(array) = cap;
2731 PyArray_SetBaseObject(array,cap);
2734 $result = SWIG_Python_AppendOutput($result,obj);
2737 /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
2738 DIM_TYPE* DIM3, DIM_TYPE* DIM4)
2740 %typemap(in,numinputs=0)
2741 (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 )
2742 (DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp)
2751 fragment="NumPy_Backward_Compatibility")
2752 (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
2754 npy_intp dims[4] = { *$2, *$3, *$4 , *$5 };
2755 PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$1));
2756 PyArrayObject* array = (PyArrayObject*) obj;
2758 if (!array) SWIG_fail;
2760 %#ifdef SWIGPY_USE_CAPSULE
2761 PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
2763 PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
2766 %#if NPY_API_VERSION < 0x00000007
2767 PyArray_BASE(array) = cap;
2769 PyArray_SetBaseObject(array,cap);
2772 $result = SWIG_Python_AppendOutput($result,obj);
2775 /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4,
2776 DATA_TYPE** ARGOUTVIEWM_ARRAY4)
2778 %typemap(in,numinputs=0)
2779 (DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 , DATA_TYPE** ARGOUTVIEWM_ARRAY4)
2780 (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp, DATA_TYPE* data_temp = NULL )
2789 fragment="NumPy_Backward_Compatibility")
2790 (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_ARRAY4)
2792 npy_intp dims[4] = { *$1, *$2, *$3 , *$4 };
2793 PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$5));
2794 PyArrayObject* array = (PyArrayObject*) obj;
2796 if (!array) SWIG_fail;
2798 %#ifdef SWIGPY_USE_CAPSULE
2799 PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
2801 PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
2804 %#if NPY_API_VERSION < 0x00000007
2805 PyArray_BASE(array) = cap;
2807 PyArray_SetBaseObject(array,cap);
2810 $result = SWIG_Python_AppendOutput($result,obj);
2813 /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
2814 DIM_TYPE* DIM3, DIM_TYPE* DIM4)
2816 %typemap(in,numinputs=0)
2817 (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 )
2818 (DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp)
2827 fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements")
2828 (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
2830 npy_intp dims[4] = { *$2, *$3, *$4 , *$5 };
2831 PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$1));
2832 PyArrayObject* array = (PyArrayObject*) obj;
2834 if (!array || require_fortran(array)) SWIG_fail;
2836 %#ifdef SWIGPY_USE_CAPSULE
2837 PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
2839 PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
2842 %#if NPY_API_VERSION < 0x00000007
2843 PyArray_BASE(array) = cap;
2845 PyArray_SetBaseObject(array,cap);
2848 $result = SWIG_Python_AppendOutput($result,obj);
2851 /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4,
2852 DATA_TYPE** ARGOUTVIEWM_FARRAY4)
2854 %typemap(in,numinputs=0)
2855 (DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 , DATA_TYPE** ARGOUTVIEWM_FARRAY4)
2856 (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp, DATA_TYPE* data_temp = NULL )
2865 fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements")
2866 (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_FARRAY4)
2868 npy_intp dims[4] = { *$1, *$2, *$3 , *$4 };
2869 PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$5));
2870 PyArrayObject* array = (PyArrayObject*) obj;
2872 if (!array || require_fortran(array)) SWIG_fail;
2874 %#ifdef SWIGPY_USE_CAPSULE
2875 PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
2877 PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
2880 %#if NPY_API_VERSION < 0x00000007
2881 PyArray_BASE(array) = cap;
2883 PyArray_SetBaseObject(array,cap);
2886 $result = SWIG_Python_AppendOutput($result,obj);
2889 /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
2890 DIM_TYPE* DIM3, DIM_TYPE* DIM4)
2892 %typemap(in,numinputs=0)
2893 (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 )
2894 (DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp)
2903 fragment="NumPy_Backward_Compatibility")
2904 (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
2906 npy_intp dims[4] = { *$2, *$3, *$4 , *$5 };
2907 PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$1));
2908 PyArrayObject* array = (PyArrayObject*) obj;
2910 if (!array) SWIG_fail;
2912 %#ifdef SWIGPY_USE_CAPSULE
2913 PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
2915 PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
2918 %#if NPY_API_VERSION < 0x00000007
2919 PyArray_BASE(array) = cap;
2921 PyArray_SetBaseObject(array,cap);
2924 $result = SWIG_Python_AppendOutput($result,obj);
2927 /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4,
2928 DATA_TYPE** ARGOUTVIEWM_ARRAY4)
2930 %typemap(in,numinputs=0)
2931 (DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 , DATA_TYPE** ARGOUTVIEWM_ARRAY4)
2932 (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp, DATA_TYPE* data_temp = NULL )
2941 fragment="NumPy_Backward_Compatibility")
2942 (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_ARRAY4)
2944 npy_intp dims[4] = { *$1, *$2, *$3 , *$4 };
2945 PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$5));
2946 PyArrayObject* array = (PyArrayObject*) obj;
2948 if (!array) SWIG_fail;
2950 %#ifdef SWIGPY_USE_CAPSULE
2951 PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
2953 PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
2956 %#if NPY_API_VERSION < 0x00000007
2957 PyArray_BASE(array) = cap;
2959 PyArray_SetBaseObject(array,cap);
2962 $result = SWIG_Python_AppendOutput($result,obj);
2965 /* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
2966 DIM_TYPE* DIM3, DIM_TYPE* DIM4)
2968 %typemap(in,numinputs=0)
2969 (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 )
2970 (DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp)
2979 fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements")
2980 (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
2982 npy_intp dims[4] = { *$2, *$3, *$4 , *$5 };
2983 PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$1));
2984 PyArrayObject* array = (PyArrayObject*) obj;
2986 if (!array || require_fortran(array)) SWIG_fail;
2988 %#ifdef SWIGPY_USE_CAPSULE
2989 PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
2991 PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
2994 %#if NPY_API_VERSION < 0x00000007
2995 PyArray_BASE(array) = cap;
2997 PyArray_SetBaseObject(array,cap);
3000 $result = SWIG_Python_AppendOutput($result,obj);
3003 /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4,
3004 DATA_TYPE** ARGOUTVIEWM_FARRAY4)
3006 %typemap(in,numinputs=0)
3007 (DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 , DATA_TYPE** ARGOUTVIEWM_FARRAY4)
3008 (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp, DATA_TYPE* data_temp = NULL )
3017 fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements")
3018 (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_FARRAY4)
3020 npy_intp dims[4] = { *$1, *$2, *$3 , *$4 };
3021 PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$5));
3022 PyArrayObject* array = (PyArrayObject*) obj;
3024 if (!array || require_fortran(array)) SWIG_fail;
3026 %#ifdef SWIGPY_USE_CAPSULE
3027 PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
3029 PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
3032 %#if NPY_API_VERSION < 0x00000007
3033 PyArray_BASE(array) = cap;
3035 PyArray_SetBaseObject(array,cap);
3038 $result = SWIG_Python_AppendOutput($result,obj);
3041 %enddef /* %numpy_typemaps() macro */
3042 /* *************************************************************** */
3044 /* Concrete instances of the %numpy_typemaps() macro: Each invocation
3045 * below applies all of the typemaps above to the specified data type.
3047 %numpy_typemaps(signed char , NPY_BYTE , int)
3048 %numpy_typemaps(unsigned char , NPY_UBYTE , int)
3049 %numpy_typemaps(short , NPY_SHORT , int)
3050 %numpy_typemaps(unsigned short , NPY_USHORT , int)
3051 %numpy_typemaps(int , NPY_INT , int)
3052 %numpy_typemaps(unsigned int , NPY_UINT , int)
3053 %numpy_typemaps(long , NPY_LONG , int)
3054 %numpy_typemaps(unsigned long , NPY_ULONG , int)
3055 %numpy_typemaps(long long , NPY_LONGLONG , int)
3056 %numpy_typemaps(unsigned long long, NPY_ULONGLONG, int)
3057 %numpy_typemaps(float , NPY_FLOAT , int)
3058 %numpy_typemaps(double , NPY_DOUBLE , int)
3060 /* ***************************************************************
3061 * The follow macro expansion does not work, because C++ bool is 4
3062 * bytes and NPY_BOOL is 1 byte
3064 * %numpy_typemaps(bool, NPY_BOOL, int)
3067 /* ***************************************************************
3068 * On my Mac, I get the following warning for this macro expansion:
3069 * 'swig/python detected a memory leak of type 'long double *', no destructor found.'
3071 * %numpy_typemaps(long double, NPY_LONGDOUBLE, int)
3074 /* ***************************************************************
3075 * Swig complains about a syntax error for the following macro
3078 * %numpy_typemaps(complex float, NPY_CFLOAT , int)
3080 * %numpy_typemaps(complex double, NPY_CDOUBLE, int)
3082 * %numpy_typemaps(complex long double, NPY_CLONGDOUBLE, int)
3085 #endif /* SWIGPYTHON */