{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {},
  "_ordered_sections": [],
  "item_file": null,
  "item_line": null,
  "item_type": null,
  "aliases": [],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": null,
  "references": null,
  "qa": "reference:swig.interface-file",
  "arbitrary": [
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "numpy.i: a SWIG interface file for NumPy"
        }
      ],
      "level": 0,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The Simple Wrapper and Interface Generator (or "
            },
            {
              "__type": "Link",
              "__tag": 4049,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "SWIG"
                }
              ],
              "url": "https://www.swig.org",
              "title": ""
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ") is a powerful tool for generating wrapper code for interfacing to a wide variety of scripting languages. "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " can parse header files, and using only the code prototypes, create an interface to the target language.  But "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is not omnipotent.  For example, it cannot know from the prototype      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "double rms(double* seq, int n);",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "what exactly "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "seq"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is.  Is it a single value to be altered in-place? Is it an array, and if so what is its length?  Is it input-only? Output-only?  Input-output?  "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " cannot determine these details, and does not attempt to do so."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If we designed "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "rms"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", we probably made it a routine that takes an input-only array of length "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "n"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " of "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "double"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " values called "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "seq"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and returns the root mean square.  The default behavior of "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", however, will be to create a wrapper function that compiles, but is nearly impossible to use from the scripting language in the way the C routine was intended."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "For Python, the preferred way of handling contiguous (or technically, "
            },
            {
              "__type": "Emphasis",
              "__tag": 4047,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "strided"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ") blocks of homogeneous data is with NumPy, which provides full object-oriented access to multidimensial arrays of data.  Therefore, the most logical Python interface for the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "rms"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " function would be (including doc string)      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "def rms(seq):\n    \"\"\"\n    rms: return the root mean square of a sequence\n    rms(numpy.ndarray) -> double\n    rms(list) -> double\n    rms(tuple) -> double\n    \"\"\"",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "where "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "seq"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " would be a NumPy array of "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "double"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " values, and its length "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "n"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " would be extracted from "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "seq"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " internally before being passed to the C routine.  Even better, since NumPy supports construction of arrays from arbitrary Python sequences, "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "seq"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " itself could be a nearly arbitrary sequence (so long as each element can be converted to a "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "double"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ") and the wrapper code would internally convert it to a NumPy array before extracting its data and length."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " allows these types of conversions to be defined via a mechanism called "
            },
            {
              "__type": "Emphasis",
              "__tag": 4047,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "typemaps"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  This document provides information on how to use "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", a "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " interface file that defines a series of typemaps intended to make the type of array-related conversions described above relatively simple to implement.  For example, suppose that the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "rms"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " function prototype defined above was in a header file named "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "rms.h"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  To obtain the Python interface discussed above, your "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " interface file would need the following      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "%{\n#define SWIG_FILE_WITH_INIT\n#include \"rms.h\"\n%}\n\n%include \"numpy.i\"\n\n%init %{\nimport_array();\n%}\n\n%apply (double* IN_ARRAY1, int DIM1) {(double* seq, int n)};\n%include \"rms.h\"",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Typemaps are keyed off a list of one or more function arguments, either by type or by type and name.  We will refer to such lists as "
            },
            {
              "__type": "Emphasis",
              "__tag": 4047,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "signatures"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  One of the many typemaps defined by "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is used above and has the signature "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "(double* IN_ARRAY1, int DIM1)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  The argument names are intended to suggest that the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "double*"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " argument is an input array of one dimension and that the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "int"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " represents the size of that dimension.  This is precisely the pattern in the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "rms"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " prototype."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Most likely, no actual prototypes to be wrapped will have the argument names "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "IN_ARRAY1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "DIM1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  We use the "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%apply"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " directive to apply the typemap for one-dimensional input arrays of type "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "double"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " to the actual prototype used by "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "rms"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  Using "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " effectively, therefore, requires knowing what typemaps are available and what they do."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "A "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " interface file that includes the "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " directives given above will produce wrapper code that looks something like       "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": " 1 PyObject *_wrap_rms(PyObject *args) {\n 2   PyObject *resultobj = 0;\n 3   double *arg1 = (double *) 0 ;\n 4   int arg2 ;\n 5   double result;\n 6   PyArrayObject *array1 = NULL ;\n 7   int is_new_object1 = 0 ;\n 8   PyObject * obj0 = 0 ;\n 9\n10   if (!PyArg_ParseTuple(args,(char *)\"O:rms\",&obj0)) SWIG_fail;\n11   {\n12     array1 = obj_to_array_contiguous_allow_conversion(\n13                  obj0, NPY_DOUBLE, &is_new_object1);\n14     npy_intp size[1] = {\n15       -1\n16     };\n17     if (!array1 || !require_dimensions(array1, 1) ||\n18         !require_size(array1, size, 1)) SWIG_fail;\n19     arg1 = (double*) array1->data;\n20     arg2 = (int) array1->dimensions[0];\n21   }\n22   result = (double)rms(arg1,arg2);\n23   resultobj = SWIG_From_double((double)(result));\n24   {\n25     if (is_new_object1 && array1) Py_DECREF(array1);\n26   }\n27   return resultobj;\n28 fail:\n29   {\n30     if (is_new_object1 && array1) Py_DECREF(array1);\n31   }\n32   return NULL;\n33 }",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The typemaps from "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are responsible for the following lines of code: 12--20, 25 and 30.  Line 10 parses the input to the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "rms"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " function.  From the format string "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "\"O:rms\""
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", we can see that the argument list is expected to be a single Python object (specified by the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "O"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " before the colon) and whose pointer is stored in "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "obj0"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  A number of functions, supplied by "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", are called to make and check the (possible) conversion from a generic Python object to a NumPy array.  These functions are explained in the section "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "Helper Functions",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", but hopefully their names are self-explanatory.  At line 12 we use "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "obj0"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " to construct a NumPy array.  At line 17, we check the validity of the result: that it is non-null and that it has a single dimension of arbitrary length.  Once these states are verified, we extract the data buffer and length in lines 19 and 20 so that we can call the underlying C function at line 22.  Line 25 performs memory management for the case where we have created a new array that is no longer needed."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This code has a significant amount of error handling.  Note the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "SWIG_fail"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is a macro for "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "goto fail"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", referring to the label at line 28.  If the user provides the wrong number of arguments, this will be caught at line 10.  If construction of the NumPy array fails or produces an array with the wrong number of dimensions, these errors are caught at line 17.  And finally, if an error is detected, memory is still managed correctly at line 30."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Note that if the C function signature was in a different order      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "double rms(int n, double* seq);",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "that "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " would not match the typemap signature given above with the argument list for "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "rms"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  Fortunately, "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " has a set of typemaps with the data pointer given last      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "%apply (int DIM1, double* IN_ARRAY1) {(int n, double* seq)};",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This simply has the effect of switching the definitions of "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "arg1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "arg2"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " in lines 3 and 4 of the generated code above, and their assignments in lines 19 and 20."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Introduction"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " file is currently located in the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "tools/swig"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " sub-directory under the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " installation directory.  Typically, you will want to copy it to the directory where you are developing your wrappers."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "A simple module that only uses a single "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " interface file should include the following      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "%{\n#define SWIG_FILE_WITH_INIT\n%}\n%include \"numpy.i\"\n%init %{\nimport_array();\n%}",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Within a compiled Python module, "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "import_array()"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " should only get called once.  This could be in a C/C++ file that you have written and is linked to the module.  If this is the case, then none of your interface files should "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "#define SWIG_FILE_WITH_INIT"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " or call "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "import_array()"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  Or, this initialization call could be in a wrapper file generated by "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " from an interface file that has the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%init"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " block as above.  If this is the case, and you have more than one "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " interface file, then only one interface file should "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "#define SWIG_FILE_WITH_INIT"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and call "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "import_array()"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Using numpy.i"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The typemap directives provided by "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for arrays of different data types, say "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "double"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "int"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", and dimensions of different types, say "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "int"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " or "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "long"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", are identical to one another except for the C and NumPy type specifications.  The typemaps are therefore implemented (typically behind the scenes) via a macro      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "%numpy_typemaps(DATA_TYPE, DATA_TYPECODE, DIM_TYPE)",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "that can be invoked for appropriate "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "(DATA_TYPE, DATA_TYPECODE, DIM_TYPE)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " triplets.  For example      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "%numpy_typemaps(double, NPY_DOUBLE, int)\n%numpy_typemaps(int,    NPY_INT   , int)",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " interface file uses the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%numpy_typemaps"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " macro to implement typemaps for the following C data types and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "int"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " dimension types:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "signed char"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "unsigned char"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "short"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "unsigned short"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "int"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "unsigned int"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "long"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "unsigned long"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "long long"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "unsigned long long"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "float"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "double"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "In the following descriptions, we reference a generic "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "DATA_TYPE"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", which could be any of the C data types listed above, and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "DIM_TYPE"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " which should be one of the many types of integers."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The typemap signatures are largely differentiated on the name given to the buffer pointer.  Names with "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "FARRAY"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are for Fortran-ordered arrays, and names with "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "ARRAY"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are for C-ordered (or 1D arrays)."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Available typemaps"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Input arrays are defined as arrays of data that are passed into a routine but are not altered in-place or returned to the user.  The Python input array is therefore allowed to be almost any Python sequence (such as a list) that can be converted to the requested type of array.  The input array signatures are"
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "1D:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE IN_ARRAY1[ANY] )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE* IN_ARRAY1, int DIM1 )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tint DIM1, DATA_TYPE* IN_ARRAY1 )"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "2D:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE IN_ARRAY2[ANY][ANY] )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE* IN_ARRAY2, int DIM1, int DIM2 )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tint DIM1, int DIM2, DATA_TYPE* IN_ARRAY2 )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE* IN_FARRAY2, int DIM1, int DIM2 )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tint DIM1, int DIM2, DATA_TYPE* IN_FARRAY2 )"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "3D:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE IN_ARRAY3[ANY][ANY][ANY] )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE* IN_ARRAY3, int DIM1, int DIM2, int DIM3 )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tint DIM1, int DIM2, int DIM3, DATA_TYPE* IN_ARRAY3 )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE* IN_FARRAY3, int DIM1, int DIM2, int DIM3 )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tint DIM1, int DIM2, int DIM3, DATA_TYPE* IN_FARRAY3 )"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "4D:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DATA_TYPE IN_ARRAY4[ANY][ANY][ANY][ANY])"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DATA_TYPE* IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, , DIM_TYPE DIM4, DATA_TYPE* IN_ARRAY4)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DATA_TYPE* IN_FARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* IN_FARRAY4)"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The first signature listed, "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "( DATA_TYPE IN_ARRAY[ANY] )"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is for one-dimensional arrays with hard-coded dimensions.  Likewise, "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "( DATA_TYPE IN_ARRAY2[ANY][ANY] )"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is for two-dimensional arrays with hard-coded dimensions, and similarly for three-dimensional."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Input Arrays"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "In-place arrays are defined as arrays that are modified in-place.  The input values may or may not be used, but the values at the time the function returns are significant.  The provided Python argument must therefore be a NumPy array of the required type.  The in-place signatures are"
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "1D:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE INPLACE_ARRAY1[ANY] )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE* INPLACE_ARRAY1, int DIM1 )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tint DIM1, DATA_TYPE* INPLACE_ARRAY1 )"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "2D:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE INPLACE_ARRAY2[ANY][ANY] )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE* INPLACE_ARRAY2, int DIM1, int DIM2 )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tint DIM1, int DIM2, DATA_TYPE* INPLACE_ARRAY2 )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE* INPLACE_FARRAY2, int DIM1, int DIM2 )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tint DIM1, int DIM2, DATA_TYPE* INPLACE_FARRAY2 )"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "3D:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY] )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3 )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tint DIM1, int DIM2, int DIM3, DATA_TYPE* INPLACE_ARRAY3 )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE* INPLACE_FARRAY3, int DIM1, int DIM2, int DIM3 )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tint DIM1, int DIM2, int DIM3, DATA_TYPE* INPLACE_FARRAY3 )"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "4D:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DATA_TYPE INPLACE_ARRAY4[ANY][ANY][ANY][ANY])"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DATA_TYPE* INPLACE_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, , DIM_TYPE DIM4, DATA_TYPE* INPLACE_ARRAY4)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DATA_TYPE* INPLACE_FARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* INPLACE_FARRAY4)"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "These typemaps now check to make sure that the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "INPLACE_ARRAY"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " arguments use native byte ordering.  If not, an exception is raised."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "There is also a \"flat\" in-place array for situations in which you would like to modify or process each element, regardless of the number of dimensions. One example is a \"quantization\" function that quantizes each element of an array in-place, be it 1D, 2D or whatever. This form checks for continuity but allows either C or Fortran ordering."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "ND:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DATA_TYPE* INPLACE_ARRAY_FLAT, DIM_TYPE DIM_FLAT)"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "In-Place Arrays"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Argout arrays are arrays that appear in the input arguments in C, but are in fact output arrays.  This pattern occurs often when there is more than one output variable and the single return argument is therefore not sufficient.  In Python, the conventional way to return multiple arguments is to pack them into a sequence (tuple, list, etc.) and return the sequence.  This is what the argout typemaps do.  If a wrapped function that uses these argout typemaps has more than one return argument, they are packed into a tuple or list, depending on the version of Python.  The Python user does not pass these arrays in, they simply get returned.  For the case where a dimension is specified, the python user must provide that dimension as an argument.  The argout signatures are"
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "1D:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE ARGOUT_ARRAY1[ANY] )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE* ARGOUT_ARRAY1, int DIM1 )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tint DIM1, DATA_TYPE* ARGOUT_ARRAY1 )"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "2D:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE ARGOUT_ARRAY2[ANY][ANY] )"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "3D:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY] )"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "4D:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(\tDATA_TYPE ARGOUT_ARRAY4[ANY][ANY][ANY][ANY] )"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "These are typically used in situations where in C/C++, you would allocate a(n) array(s) on the heap, and call the function to fill the array(s) values.  In Python, the arrays are allocated for you and returned as new array objects."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Note that we support "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "DATA_TYPE*"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " argout typemaps in 1D, but not 2D or 3D.  This is because of a quirk with the "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " typemap syntax and cannot be avoided.  Note that for these types of 1D typemaps, the Python function will take a single argument representing "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "DIM1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Argout Arrays"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Argoutview arrays are for when your C code provides you with a view of its internal data and does not require any memory to be allocated by the user.  This can be dangerous.  There is almost no way to guarantee that the internal data from the C code will remain in existence for the entire lifetime of the NumPy array that encapsulates it.  If the user destroys the object that provides the view of the data before destroying the NumPy array, then using that array may result in bad memory references or segmentation faults.  Nevertheless, there are situations, working with large data sets, where you simply have no other choice."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The C code to be wrapped for argoutview arrays are characterized by pointers: pointers to the dimensions and double pointers to the data, so that these values can be passed back to the user.  The argoutview typemap signatures are therefore"
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "1D:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "( DATA_TYPE** ARGOUTVIEW_ARRAY1, DIM_TYPE* DIM1 )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "( DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEW_ARRAY1 )"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "2D:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "( DATA_TYPE** ARGOUTVIEW_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2 )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "( DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_ARRAY2 )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "( DATA_TYPE** ARGOUTVIEW_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2 )"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "( DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_FARRAY2 )"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "3D:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "( DATA_TYPE** ARGOUTVIEW_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "( DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_ARRAY3)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "( DATA_TYPE** ARGOUTVIEW_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "( DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_FARRAY3)"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "4D:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DATA_TYPE** ARGOUTVIEW_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEW_ARRAY4)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DATA_TYPE** ARGOUTVIEW_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEW_FARRAY4)"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Note that arrays with hard-coded dimensions are not supported.  These cannot follow the double pointer signatures of these typemaps."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Argout View Arrays"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "A recent addition to "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are typemaps that permit argout arrays with views into memory that is managed."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "1D:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DATA_TYPE** ARGOUTVIEWM_ARRAY1, DIM_TYPE* DIM1)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEWM_ARRAY1)"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "2D:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DATA_TYPE** ARGOUTVIEWM_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEWM_ARRAY2)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DATA_TYPE** ARGOUTVIEWM_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEWM_FARRAY2)"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "3D:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DATA_TYPE** ARGOUTVIEWM_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEWM_ARRAY3)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DATA_TYPE** ARGOUTVIEWM_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEWM_FARRAY3)"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "4D:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_ARRAY4)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_FARRAY4)"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Memory Managed Argout View Arrays"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " interface file does not support typemaps for output arrays, for several reasons.  First, C/C++ return arguments are limited to a single value.  This prevents obtaining dimension information in a general way.  Second, arrays with hard-coded lengths are not permitted as return arguments.  In other words      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "double[3] newVector(double x, double y, double z);",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "is not legal C/C++ syntax.  Therefore, we cannot provide typemaps of the form      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "%typemap(out) (TYPE[ANY]);",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If you run into a situation where a function or method is returning a pointer to an array, your best bet is to write your own version of the function to be wrapped, either with "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%extend"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for the case of class methods or "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%ignore"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%rename"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for the case of functions."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Output Arrays"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Note that C++ type "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "bool"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is not supported in the list in the "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "Available Typemaps",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " section.  NumPy bools are a single byte, while the C++ "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "bool"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is four bytes (at least on my system).  Therefore      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "%numpy_typemaps(bool, NPY_BOOL, int)",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "will result in typemaps that will produce code that reference improper data lengths.  You can implement the following macro expansion      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "%numpy_typemaps(bool, NPY_UINT, int)",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "to fix the data length problem, and "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "Input Arrays",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " will work fine, but "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "In-Place Arrays",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " might fail type-checking."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Other Common Types: bool"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Typemap conversions for complex floating-point types is also not supported automatically.  This is because Python and NumPy are written in C, which does not have native complex types.  Both Python and NumPy implement their own (essentially equivalent) "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "struct"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " definitions for complex variables      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "/* Python */\ntypedef struct {double real; double imag;} Py_complex;\n\n/* NumPy */\ntypedef struct {float  real, imag;} npy_cfloat;\ntypedef struct {double real, imag;} npy_cdouble;",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "We could have implemented      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "%numpy_typemaps(Py_complex , NPY_CDOUBLE, int)\n%numpy_typemaps(npy_cfloat , NPY_CFLOAT , int)\n%numpy_typemaps(npy_cdouble, NPY_CDOUBLE, int)",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "which would have provided automatic type conversions for arrays of type "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Py_complex"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "npy_cfloat"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "npy_cdouble"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  However, it seemed unlikely that there would be any independent (non-Python, non-NumPy) application code that people would be using "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " to generate a Python interface to, that also used these definitions for complex types.  More likely, these application codes will define their own complex types, or in the case of C++, use "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "std::complex"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". Assuming these data structures are compatible with Python and NumPy complex types, "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%numpy_typemap"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " expansions as above (with the user's complex type substituted for the first argument) should work."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Other Common Types: complex"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " has sophisticated type checking for numerical types.  For example, if your C/C++ routine expects an integer as input, the code generated by "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " will check for both Python integers and Python long integers, and raise an overflow error if the provided Python integer is too big to cast down to a C integer.  With the introduction of NumPy scalar arrays into your Python code, you might conceivably extract an integer from a NumPy array and attempt to pass this to a "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "-wrapped C/C++ function that expects an "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "int"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", but the "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " type checking will not recognize the NumPy array scalar as an integer.  (Often, this does in fact work -- it depends on whether NumPy recognizes the integer type you are using as inheriting from the Python integer type on the platform you are using.  Sometimes, this means that code that works on a 32-bit machine will fail on a 64-bit machine.)"
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If you get a Python error that looks like the following      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "TypeError: in method 'MyClass_MyMethod', argument 2 of type 'int'",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "and the argument you are passing is an integer extracted from a NumPy array, then you have stumbled upon this problem.  The solution is to modify the "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " type conversion system to accept NumPy array scalars in addition to the standard integer types. Fortunately, this capability has been provided for you.  Simply copy the file      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "pyfragments.swg",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "to the working build directory for you project, and this problem will be fixed.  It is suggested that you do this anyway, as it only increases the capabilities of your Python interface."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "NumPy array scalars and SWIG"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " type checking and conversion system is a complicated combination of C macros, "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " macros, "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " typemaps and "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " fragments.  Fragments are a way to conditionally insert code into your wrapper file if it is needed, and not insert it if not needed.  If multiple typemaps require the same fragment, the fragment only gets inserted into your wrapper code once."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "There is a fragment for converting a Python integer to a C "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "long"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  There is a different fragment that converts a Python integer to a C "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "int"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", that calls the routine defined in the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "long"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " fragment.  We can make the changes we want here by changing the definition for the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "long"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " fragment.  "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " determines the active definition for a fragment using a \"first come, first served\" system.  That is, we need to define the fragment for "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "long"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " conversions prior to "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " doing it internally.  "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " allows us to do this by putting our fragment definitions in the file "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "pyfragments.swg"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  If we were to put the new fragment definitions in "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", they would be ignored."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Why is There a Second File?"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " file contains several macros and routines that it uses internally to build its typemaps.  However, these functions may be useful elsewhere in your interface file.  These macros and routines are implemented as fragments, which are described briefly in the previous section.  If you try to use one or more of the following macros or functions, but your compiler complains that it does not recognize the symbol, then you need to force these fragments to appear in your code using      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "%fragment(\"NumPy_Fragments\");",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "in your "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " interface file."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Helper functions"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "DefList",
          "__tag": 4033,
          "children": [
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "is_array(a)"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Evaluates as true if "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is non-"
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "NULL"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and can be cast to a   "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "array_type(a)"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Evaluates to the integer data type code of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", assuming "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " can   be cast to a "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "array_numdims(a)"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Evaluates to the integer number of dimensions of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", assuming   "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " can be cast to a "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "array_dimensions(a)"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Evaluates to an array of type "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "npy_intp"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and length   "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "array_numdims(a)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", giving the lengths of all of the dimensions   of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", assuming "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " can be cast to a "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "array_size(a,i)"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Evaluates to the "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "i"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "-th dimension size of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", assuming "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "   can be cast to a "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "array_strides(a)"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Evaluates to an array of type "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "npy_intp"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and length   "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "array_numdims(a)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", giving the stridess of all of the dimensions   of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", assuming "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " can be cast to a "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ".  A   stride is the distance in bytes between an element and its   immediate neighbor along the same axis."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "array_stride(a,i)"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Evaluates to the "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "i"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "-th stride of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", assuming "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " can be   cast to a "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "array_data(a)"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Evaluates to a pointer of type "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "void*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " that points to the data   buffer of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", assuming "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " can be cast to a "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "array_descr(a)"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Returns a borrowed reference to the dtype property   ("
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArray_Descr*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ") of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", assuming "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " can be cast to a   "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "array_flags(a)"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Returns an integer representing the flags of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", assuming "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "   can be cast to a "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "array_enableflags(a,f)"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Sets the flag represented by "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "f"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", assuming "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " can be   cast to a "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "array_is_contiguous(a)"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Evaluates as true if "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is a contiguous array.  Equivalent to   "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(PyArray_ISCONTIGUOUS(a))"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "array_is_native(a)"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Evaluates as true if the data buffer of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " uses native byte   order.  Equivalent to "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(PyArray_ISNOTSWAPPED(a))"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "array_is_fortran(a)"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Evaluates as true if "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is FORTRAN ordered."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Macros"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "DefList",
          "__tag": 4033,
          "children": [
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "pytype_string()"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Return type: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "const char*"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Arguments:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "PyObject* py_obj"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", a general Python object."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Return a string describing the type of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "py_obj"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "typecode_string()"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Return type: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "const char*"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Arguments:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "int typecode"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", a NumPy integer typecode."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Return a string describing the type corresponding to the NumPy   "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "typecode"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "type_match()"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Return type: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "int"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Arguments:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "int actual_type"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", the NumPy typecode of a NumPy array."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "int desired_type"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", the desired NumPy typecode."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Make sure that "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "actual_type"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is compatible with   "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "desired_type"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ".  For example, this allows character and   byte types, or int and long types, to match.  This is now   equivalent to "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArray_EquivTypenums()"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "obj_to_array_no_conversion()"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Return type: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Arguments:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "PyObject* input"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", a general Python object."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "int typecode"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", the desired NumPy typecode."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Cast "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "input"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to a "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " if legal, and ensure that   it is of type "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "typecode"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ".  If "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "input"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " cannot be cast, or the   "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "typecode"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is wrong, set a Python error and return "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "NULL"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "obj_to_array_allow_conversion()"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Return type: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Arguments:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "PyObject* input"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", a general Python object."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "int typecode"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", the desired NumPy typecode of the resulting     array."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "int* is_new_object"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", returns a value of 0 if no conversion     performed, else 1."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Convert "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "input"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to a NumPy array with the given "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "typecode"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ".   On success, return a valid "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " with the correct   type.  On failure, the Python error string will be set and the   routine returns "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "NULL"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "make_contiguous()"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Return type: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Arguments:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "PyArrayObject* ary"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", a NumPy array."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "int* is_new_object"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", returns a value of 0 if no conversion     performed, else 1."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "int min_dims"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", minimum allowable dimensions."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "int max_dims"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", maximum allowable dimensions."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Check to see if "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "ary"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is contiguous.  If so, return the input   pointer and flag it as not a new object.  If it is not contiguous,   create a new "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " using the original data, flag it   as a new object and return the pointer."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "make_fortran()"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Return type: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Arguments"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "PyArrayObject* ary"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", a NumPy array."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "int* is_new_object"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", returns a value of 0 if no conversion     performed, else 1."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Check to see if "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "ary"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is Fortran contiguous.  If so, return the   input pointer and flag it as not a new object.  If it is not   Fortran contiguous, create a new "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " using the   original data, flag it as a new object and return the pointer."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "obj_to_array_contiguous_allow_conversion()"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Return type: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Arguments:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "PyObject* input"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", a general Python object."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "int typecode"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", the desired NumPy typecode of the resulting     array."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "int* is_new_object"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", returns a value of 0 if no conversion     performed, else 1."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Convert "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "input"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to a contiguous "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " of the   specified type.  If the input object is not a contiguous   "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", a new one will be created and the new object   flag will be set."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "obj_to_array_fortran_allow_conversion()"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Return type: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Arguments:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "PyObject* input"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", a general Python object."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "int typecode"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", the desired NumPy typecode of the resulting     array."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "int* is_new_object"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", returns a value of 0 if no conversion     performed, else 1."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Convert "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "input"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to a Fortran contiguous "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " of   the specified type.  If the input object is not a Fortran   contiguous "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", a new one will be created and the   new object flag will be set."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "require_contiguous()"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Return type: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "int"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Arguments:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "PyArrayObject* ary"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", a NumPy array."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Test whether "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "ary"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is contiguous.  If so, return 1.  Otherwise,   set a Python error and return 0."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "require_native()"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Return type: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "int"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Arguments:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "PyArray_Object* ary"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", a NumPy array."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Require that "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "ary"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is not byte-swapped.  If the array is not   byte-swapped, return 1.  Otherwise, set a Python error and   return 0."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "require_dimensions()"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Return type: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "int"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Arguments:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "PyArrayObject* ary"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", a NumPy array."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "int exact_dimensions"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", the desired number of dimensions."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Require "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "ary"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to have a specified number of dimensions.  If the   array has the specified number of dimensions, return 1.   Otherwise, set a Python error and return 0."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "require_dimensions_n()"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Return type: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "int"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Arguments:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "PyArrayObject* ary"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", a NumPy array."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "int* exact_dimensions"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", an array of integers representing     acceptable numbers of dimensions."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "int n"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", the length of "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "exact_dimensions"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Require "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "ary"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to have one of a list of specified number of   dimensions.  If the array has one of the specified number of   dimensions, return 1.  Otherwise, set the Python error string   and return 0."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "require_size()"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Return type: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "int"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Arguments:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "PyArrayObject* ary"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", a NumPy array."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "npy_int* size"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", an array representing the desired lengths of     each dimension."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "int n"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", the length of "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "size"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Require "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "ary"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to have a specified shape.  If the array has the   specified shape, return 1.  Otherwise, set the Python error   string and return 0."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "require_fortran()"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Return type: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "int"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Arguments:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "PyArrayObject* ary"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", a NumPy array."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Require the given "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to be Fortran ordered.  If   the "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is already Fortran ordered, do nothing.   Else, set the Fortran ordering flag and recompute the strides."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Routines"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "There are many C or C++ array/NumPy array situations not covered by a simple "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%include \"numpy.i\""
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and subsequent "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%apply"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " directives."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Beyond the provided typemaps"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Consider a reasonable prototype for a dot product function      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "double dot(int len, double* vec1, double* vec2);",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The Python interface that we want is      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "def dot(vec1, vec2):\n    \"\"\"\n    dot(PyObject,PyObject) -> double\n    \"\"\"",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The problem here is that there is one dimension argument and two array arguments, and our typemaps are set up for dimensions that apply to a single array (in fact, "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " does not provide a mechanism for associating "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "len"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " with "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "vec2"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " that takes two Python input arguments).  The recommended solution is the following      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "    %apply (int DIM1, double* IN_ARRAY1) {(int len1, double* vec1),\n                                          (int len2, double* vec2)}\n    %rename (dot) my_dot;\n    %exception my_dot {\n        $action\n\tif (PyErr_Occurred()) SWIG_fail;\n    }\n    %inline %{\n    double my_dot(int len1, double* vec1, int len2, double* vec2) {\n        if (len1 != len2) {\n\t    PyErr_Format(PyExc_ValueError,\n                         \"Arrays of lengths (%d,%d) given\",\n                         len1, len2);\n\t    return 0.0;\n        }\n        return dot(len1, vec1, vec2);\n    }\n    %}",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If the header file that contains the prototype for "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "double dot()"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " also contains other prototypes that you want to wrap, so that you need to "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%include"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " this header file, then you will also need a "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%ignore dot;"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " directive, placed after the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%rename"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and before the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%include"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " directives.  Or, if the function in question is a class method, you will want to use "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%extend"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " rather than "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%inline"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " in addition to "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%ignore"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Strong",
              "__tag": 4048,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "A note on error handling:"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " Note that "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "my_dot"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " returns a "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "double"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " but that it can also raise a Python error.  The resulting wrapper function will return a Python float representation of 0.0 when the vector lengths do not match.  Since this is not "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "NULL"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", the Python interpreter will not know to check for an error.  For this reason, we add the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%exception"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " directive above for "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "my_dot"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " to get the behavior we want (note that "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "$action"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is a macro that gets expanded to a valid call to "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "my_dot"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ").  In general, you will probably want to write a "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " macro to perform this task."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "A Common Example"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "There are other wrapping situations in which "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " may be helpful when you encounter them."
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "In some situations, it is possible that you could use the   "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "%numpy_typemaps"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " macro to implement typemaps for your own   types.  See the "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "Other Common Types: bool",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " or "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "Other Common   Types: complex",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " sections for examples.  Another situation is if   your dimensions are of a type other than "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "int"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " (say "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "long"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " for   example)        "
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "%numpy_typemaps(double, NPY_DOUBLE, long)",
                  "execution_status": null
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "You can use the code in "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "numpy.i"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to write your own typemaps.   For example, if you had a five-dimensional array as a function   argument, you could cut-and-paste the appropriate four-dimensional   typemaps into your interface file.  The modifications for the   fourth dimension would be trivial."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Sometimes, the best approach is to use the "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "%extend"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " directive   to define new methods for your classes (or overload existing ones)   that take a "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " (that either is or can be converted to a   "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "PyArrayObject*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ") instead of a pointer to a buffer.  In this   case, the helper routines in "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "numpy.i"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " can be very useful."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Writing typemaps can be a bit nonintuitive.  If you have specific   questions about writing "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "SWIG",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " typemaps for NumPy, the   developers of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "numpy.i"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " do monitor the   "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "Numpy-discussion <mailto:Numpy-discussion@python.org>",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and   "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "Swig-user <mailto:Swig-user@lists.sourceforge.net>",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " mail lists."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Other Situations"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "When you use the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%apply"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " directive, as is usually necessary to use "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", it will remain in effect until you tell "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " that it shouldn't be.  If the arguments to the functions or methods that you are wrapping have common names, such as "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "length"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " or "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "vector"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", these typemaps may get applied in situations you do not expect or want.  Therefore, it is always a good idea to add a "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%clear"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " directive after you are done with a specific typemap      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "%apply (double* IN_ARRAY1, int DIM1) {(double* vector, int length)}\n%include \"my_header.h\"\n%clear (double* vector, int length);",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "In general, you should target these typemap signatures specifically where you want them, and then clear them after you are done."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "A Final Note"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Out of the box, "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " provides typemaps that support conversion between NumPy arrays and C arrays:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "That can be one of 12 different scalar types: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "signed char"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ",   "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "unsigned char"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "short"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "unsigned short"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "int"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ",   "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "unsigned int"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "long"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "unsigned long"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "long long"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ",   "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "unsigned long long"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "float"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "double"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "That support 74 different argument signatures for each data type,   including:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "One-dimensional, two-dimensional, three-dimensional and     four-dimensional arrays."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "Input-only, in-place, argout, argoutview, and memory managed     argoutview behavior."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "Hard-coded dimensions, data-buffer-then-dimensions     specification, and dimensions-then-data-buffer specification."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "Both C-ordering (\"last dimension fastest\") or Fortran-ordering     (\"first dimension fastest\") support for 2D, 3D and 4D arrays."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " interface file also provides additional tools for wrapper developers, including:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "A "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "SWIG",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " macro ("
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "%numpy_typemaps"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ") with three arguments for   implementing the 74 argument signatures for the user's choice of   (1) C data type, (2) NumPy data type (assuming they match), and   (3) dimension type."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Fourteen C macros and fifteen C functions that can be used to   write specialized typemaps, extensions, or inlined functions that   handle cases not covered by the provided typemaps.  Note that the   macros and functions are coded specifically to work with the NumPy   C/API regardless of NumPy version number, both before and after   the deprecation of some aspects of the API after version 1.6."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Summary"
        }
      ],
      "level": 1,
      "target": null
    }
  ],
  "local_refs": []
}