/* Generated by Cython 0.28.2 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [
            "/usr/local/include/ga.h",
            "/usr/local/include/typesf2c.h",
            "/usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/arrayobject.h",
            "/usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/ufuncobject.h"
        ],
        "include_dirs": [
            "/usr/local/lib/python3.6/dist-packages/numpy/core/include",
            "/usr/local/lib/python3.6/dist-packages/mpi4py/include",
            "/usr/local/include",
            "."
        ],
        "libraries": [
            "ga",
            "lapack",
            "blas",
            "armci",
            "blas",
            "rt",
            "m"
        ],
        "library_dirs": [
            "/usr/local/lib"
        ],
        "name": "miniga4py.ga",
        "runtime_library_dirs": [
            "/usr/local/lib"
        ],
        "sources": [
            "miniga4py/ga.pyx"
        ]
    },
    "module_name": "miniga4py.ga"
}
END: Cython Metadata */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_28_2"
#define CYTHON_FUTURE_DIVISION 0
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x02070000
    #define HAVE_LONG_LONG
  #endif
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (0 && PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #undef SHIFT
  #undef BASE
  #undef MASK
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__ ) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif

#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0; // PyThread_create_key reports success always
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif // TSS (Thread Specific Storage) API
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
#else
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
  #define _USE_MATH_DEFINES
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif


#define __PYX_ERR(f_index, lineno, Ln_error) \
{ \
  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
}

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__miniga4py__ga
#define __PYX_HAVE_API__miniga4py__ga
/* Early includes */
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include "typesf2c.h"
#include "ga.h"
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;

/* Header.proto */
#if !defined(CYTHON_CCOMPLEX)
  #if defined(__cplusplus)
    #define CYTHON_CCOMPLEX 1
  #elif defined(_Complex_I)
    #define CYTHON_CCOMPLEX 1
  #else
    #define CYTHON_CCOMPLEX 0
  #endif
#endif
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #include <complex>
  #else
    #include <complex.h>
  #endif
#endif
#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  #undef _Complex_I
  #define _Complex_I 1.0fj
#endif


static const char *__pyx_f[] = {
  "miniga4py/ga.pyx",
  "__init__.pxd",
  "type.pxd",
};
/* BufferFormatStructs.proto */
#define IS_UNSIGNED(type) (((type) -1) > 0)
struct __Pyx_StructField_;
#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
typedef struct {
  const char* name;
  struct __Pyx_StructField_* fields;
  size_t size;
  size_t arraysize[8];
  int ndim;
  char typegroup;
  char is_unsigned;
  int flags;
} __Pyx_TypeInfo;
typedef struct __Pyx_StructField_ {
  __Pyx_TypeInfo* type;
  const char* name;
  size_t offset;
} __Pyx_StructField;
typedef struct {
  __Pyx_StructField* field;
  size_t parent_offset;
} __Pyx_BufFmt_StackElem;
typedef struct {
  __Pyx_StructField root;
  __Pyx_BufFmt_StackElem* head;
  size_t fmt_offset;
  size_t new_count, enc_count;
  size_t struct_alignment;
  int is_complex;
  char enc_type;
  char new_packmode;
  char enc_packmode;
  char is_valid_array;
} __Pyx_BufFmt_Context;


/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":730
 * # in Cython to enable them only on the right systems.
 * 
 * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 */
typedef npy_int8 __pyx_t_5numpy_int8_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":731
 * 
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t
 */
typedef npy_int16 __pyx_t_5numpy_int16_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":732
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int64      int64_t
 * #ctypedef npy_int96      int96_t
 */
typedef npy_int32 __pyx_t_5numpy_int32_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":733
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_int96      int96_t
 * #ctypedef npy_int128     int128_t
 */
typedef npy_int64 __pyx_t_5numpy_int64_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":737
 * #ctypedef npy_int128     int128_t
 * 
 * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 */
typedef npy_uint8 __pyx_t_5numpy_uint8_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":738
 * 
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t
 */
typedef npy_uint16 __pyx_t_5numpy_uint16_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":739
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint64     uint64_t
 * #ctypedef npy_uint96     uint96_t
 */
typedef npy_uint32 __pyx_t_5numpy_uint32_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":740
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_uint96     uint96_t
 * #ctypedef npy_uint128    uint128_t
 */
typedef npy_uint64 __pyx_t_5numpy_uint64_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":744
 * #ctypedef npy_uint128    uint128_t
 * 
 * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_float64    float64_t
 * #ctypedef npy_float80    float80_t
 */
typedef npy_float32 __pyx_t_5numpy_float32_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":745
 * 
 * ctypedef npy_float32    float32_t
 * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_float80    float80_t
 * #ctypedef npy_float128   float128_t
 */
typedef npy_float64 __pyx_t_5numpy_float64_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":754
 * # The int types are mapped a bit surprising --
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t
 */
typedef npy_long __pyx_t_5numpy_int_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":755
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   longlong_t
 * 
 */
typedef npy_longlong __pyx_t_5numpy_long_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":756
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_ulong      uint_t
 */
typedef npy_longlong __pyx_t_5numpy_longlong_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":758
 * ctypedef npy_longlong   longlong_t
 * 
 * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t
 */
typedef npy_ulong __pyx_t_5numpy_uint_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":759
 * 
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 */
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":760
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_intp       intp_t
 */
typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":762
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uintp      uintp_t
 * 
 */
typedef npy_intp __pyx_t_5numpy_intp_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":763
 * 
 * ctypedef npy_intp       intp_t
 * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_double     float_t
 */
typedef npy_uintp __pyx_t_5numpy_uintp_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":765
 * ctypedef npy_uintp      uintp_t
 * 
 * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t
 */
typedef npy_double __pyx_t_5numpy_float_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":766
 * 
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longdouble longdouble_t
 * 
 */
typedef npy_double __pyx_t_5numpy_double_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":767
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cfloat      cfloat_t
 */
typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
/* Declarations.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< float > __pyx_t_float_complex;
  #else
    typedef float _Complex __pyx_t_float_complex;
  #endif
#else
    typedef struct { float real, imag; } __pyx_t_float_complex;
#endif
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);

/* Declarations.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< double > __pyx_t_double_complex;
  #else
    typedef double _Complex __pyx_t_double_complex;
  #endif
#else
    typedef struct { double real, imag; } __pyx_t_double_complex;
#endif
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);


/*--- Type declarations ---*/

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":769
 * ctypedef npy_longdouble longdouble_t
 * 
 * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t
 */
typedef npy_cfloat __pyx_t_5numpy_cfloat_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":770
 * 
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
 * ctypedef npy_clongdouble clongdouble_t
 * 
 */
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":771
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cdouble     complex_t
 */
typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":773
 * ctypedef npy_clongdouble clongdouble_t
 * 
 * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 */
typedef npy_cdouble __pyx_t_5numpy_complex_t;
struct __pyx_opt_args_9miniga4py_2ga__acc_common;
struct __pyx_opt_args_9miniga4py_2ga_distribution;
struct __pyx_opt_args_9miniga4py_2ga__get_common;
struct __pyx_opt_args_9miniga4py_2ga__put_common;

/* "miniga4py/ga.pyx":318
 *     _acc_common(g_a, buffer, lo, hi, alpha)
 * 
 * cdef _acc_common(int g_a, buffer, lo=None, hi=None, alpha=None,             # <<<<<<<<<<<<<<
 *         bint nb=False, bint periodic=False, skip=None):
 *     """Combines data from buffer with data in the global array patch.
 */
struct __pyx_opt_args_9miniga4py_2ga__acc_common {
  int __pyx_n;
  PyObject *lo;
  PyObject *hi;
  PyObject *alpha;
  int nb;
  int periodic;
  PyObject *skip;
};

/* "miniga4py/ga.pyx":1335
 *     return evalues
 * 
 * cpdef distribution(int g_a, int proc=-1):             # <<<<<<<<<<<<<<
 *     """Return the distribution given to proc.
 * 
 */
struct __pyx_opt_args_9miniga4py_2ga_distribution {
  int __pyx_n;
  int proc;
};

/* "miniga4py/ga.pyx":1939
 *     return _get_common(g_a, lo, hi, buffer)
 * 
 * cdef _get_common(int g_a, lo=None, hi=None, np.ndarray buffer=None,             # <<<<<<<<<<<<<<
 *         bint nb=False, bint periodic=False, skip=None):
 *     """Copies data from global array section to the local array buffer.
 */
struct __pyx_opt_args_9miniga4py_2ga__get_common {
  int __pyx_n;
  PyObject *lo;
  PyObject *hi;
  PyArrayObject *buffer;
  int nb;
  int periodic;
  PyObject *skip;
};

/* "miniga4py/ga.pyx":3291
 *     _put_common(g_a, buffer, lo, hi)
 * 
 * cdef _put_common(int g_a, buffer, lo=None, hi=None,             # <<<<<<<<<<<<<<
 *         bint nb=False, bint periodic=False, skip=None):
 *     """Copies data from local array buffer to the global array section.
 */
struct __pyx_opt_args_9miniga4py_2ga__put_common {
  int __pyx_n;
  PyObject *lo;
  PyObject *hi;
  int nb;
  int periodic;
  PyObject *skip;
};

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#endif

/* PyObjectCall.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* GetModuleGlobalName.proto */
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

/* PySequenceContains.proto */
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

/* ExtTypeTest.proto */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

/* IsLittleEndian.proto */
static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);

/* BufferFormatCheck.proto */
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type);

/* BufferGetAndValidate.proto */
#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
    ((obj == Py_None || obj == NULL) ?\
    (__Pyx_ZeroBuffer(buf), 0) :\
    __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
static int  __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
    __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
static void __Pyx_ZeroBuffer(Py_buffer* buf);
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };

/* BufferFallbackError.proto */
static void __Pyx_RaiseBufferFallbackError(void);

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* PyErrExceptionMatches.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* WriteUnraisableException.proto */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil);

/* RaiseArgTupleInvalid.proto */
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

/* RaiseDoubleKeywords.proto */
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

/* ParseKeywords.proto */
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
    const char* function_name);

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* IterFinish.proto */
static CYTHON_INLINE int __Pyx_IterFinish(void);

/* UnpackItemEndCheck.proto */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

/* ListCompAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
#else
#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
#endif

/* BufferIndexError.proto */
static void __Pyx_RaiseBufferIndexError(int axis);

#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

/* PyObjectCallNoArg.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* None.proto */
static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);

/* UnaryNegOverflows.proto */
#define UNARY_NEG_WOULD_OVERFLOW(x)\
        (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))

/* Import.proto */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

/* SetItemInt.proto */
#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
               __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
                                               int is_list, int wraparound, int boundscheck);

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

/* CodeObjectCache.proto */
typedef struct {
    PyCodeObject* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

/* RealImag.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #define __Pyx_CREAL(z) ((z).real())
    #define __Pyx_CIMAG(z) ((z).imag())
  #else
    #define __Pyx_CREAL(z) (__real__(z))
    #define __Pyx_CIMAG(z) (__imag__(z))
  #endif
#else
    #define __Pyx_CREAL(z) ((z).real)
    #define __Pyx_CIMAG(z) ((z).imag)
#endif
#if defined(__cplusplus) && CYTHON_CCOMPLEX\
        && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
    #define __Pyx_SET_CREAL(z,x) ((z).real(x))
    #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
#else
    #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
    #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
#endif

/* Arithmetic.proto */
#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq_float(a, b)   ((a)==(b))
    #define __Pyx_c_sum_float(a, b)  ((a)+(b))
    #define __Pyx_c_diff_float(a, b) ((a)-(b))
    #define __Pyx_c_prod_float(a, b) ((a)*(b))
    #define __Pyx_c_quot_float(a, b) ((a)/(b))
    #define __Pyx_c_neg_float(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
    #define __Pyx_c_conj_float(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs_float(z)     (::std::abs(z))
        #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero_float(z) ((z)==0)
    #define __Pyx_c_conj_float(z)    (conjf(z))
    #if 1
        #define __Pyx_c_abs_float(z)     (cabsf(z))
        #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
    #if 1
        static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
    #endif
#endif

/* Arithmetic.proto */
#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq_double(a, b)   ((a)==(b))
    #define __Pyx_c_sum_double(a, b)  ((a)+(b))
    #define __Pyx_c_diff_double(a, b) ((a)-(b))
    #define __Pyx_c_prod_double(a, b) ((a)*(b))
    #define __Pyx_c_quot_double(a, b) ((a)/(b))
    #define __Pyx_c_neg_double(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
    #define __Pyx_c_conj_double(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs_double(z)     (::std::abs(z))
        #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero_double(z) ((z)==0)
    #define __Pyx_c_conj_double(z)    (conj(z))
    #if 1
        #define __Pyx_c_abs_double(z)     (cabs(z))
        #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
    #endif
#endif

/* BufferStructDeclare.proto */
typedef struct {
  Py_ssize_t shape, strides, suboffsets;
} __Pyx_Buf_DimInfo;
typedef struct {
  size_t refcount;
  Py_buffer pybuffer;
} __Pyx_Buffer;
typedef struct {
  __Pyx_Buffer *rcbuffer;
  char *data;
  __Pyx_Buf_DimInfo diminfo[8];
} __Pyx_LocalBuf_ND;

#if PY_MAJOR_VERSION < 3
    static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
    static void __Pyx_ReleaseBuffer(Py_buffer *view);
#else
    #define __Pyx_GetBuffer PyObject_GetBuffer
    #define __Pyx_ReleaseBuffer PyBuffer_Release
#endif


/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

/* FromPy.proto */
static __pyx_t_float_complex __Pyx_PyComplex_As___pyx_t_float_complex(PyObject*);

/* FromPy.proto */
static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject*);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Integer(Integer value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int64(npy_int64 value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PY_LONG_LONG(PY_LONG_LONG value);

/* ToPy.proto */
#define __pyx_PyComplex_FromComplex(z)\
        PyComplex_FromDoubles((double)__Pyx_CREAL(z),\
                              (double)__Pyx_CIMAG(z))

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value);

static PyObject* __pyx_convert__to_py_SingleComplex(SingleComplex s);
static PyObject* __pyx_convert__to_py_DoubleComplex(DoubleComplex s);
/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE Integer __Pyx_PyInt_As_Integer(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *);

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

/* PyIdentifierFromString.proto */
#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif

/* ModuleImport.proto */
static PyObject *__Pyx_ImportModule(const char *name);

/* TypeImport.proto */
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);

/* InitStrings.proto */
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);


/* Module declarations from 'libc.string' */

/* Module declarations from 'libc.stdlib' */

/* Module declarations from 'libc.stdio' */

/* Module declarations from 'libc.stdint' */

/* Module declarations from 'miniga4py.gah' */

/* Module declarations from 'cpython.buffer' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.type' */
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;

/* Module declarations from 'cpython' */

/* Module declarations from 'cpython.object' */

/* Module declarations from 'cpython.ref' */

/* Module declarations from 'cpython.mem' */

/* Module declarations from 'numpy' */

/* Module declarations from 'numpy' */
static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
static CYTHON_INLINE int __pyx_f_5numpy_import_array(void); /*proto*/

/* Module declarations from 'miniga4py.ga' */
static int __pyx_v_9miniga4py_2ga__initialized;
static int __pyx_v_9miniga4py_2ga_float128_in_np;
static int __pyx_v_9miniga4py_2ga_complex256_in_np;
static CYTHON_INLINE void *__pyx_f_9miniga4py_2ga__gapy_malloc(size_t, int, char *); /*proto*/
static CYTHON_INLINE void __pyx_f_9miniga4py_2ga__gapy_free(void *); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_9miniga4py_2ga__inta32(PyObject *); /*proto*/
static CYTHON_INLINE PyArrayObject *__pyx_f_9miniga4py_2ga__inta64(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_9miniga4py_2ga__lohi(int, PyObject *, PyObject *); /*proto*/
static void *__pyx_f_9miniga4py_2ga__convert_multiplier(int, PyObject *, int *, long *, PY_LONG_LONG *, float *, double *, long double *, SingleComplex *, DoubleComplex *); /*proto*/
static PyObject *__pyx_f_9miniga4py_2ga__acc_common(int, PyObject *, struct __pyx_opt_args_9miniga4py_2ga__acc_common *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_9miniga4py_2ga_distribution(int, int __pyx_skip_dispatch, struct __pyx_opt_args_9miniga4py_2ga_distribution *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_9miniga4py_2ga__get_common(int, struct __pyx_opt_args_9miniga4py_2ga__get_common *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_9miniga4py_2ga_inquire(int, int __pyx_skip_dispatch); /*proto*/
static PyArrayObject *__pyx_f_9miniga4py_2ga_inquire_dims(int, int __pyx_skip_dispatch); /*proto*/
static int __pyx_f_9miniga4py_2ga_inquire_type(int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_9miniga4py_2ga__put_common(int, PyObject *, struct __pyx_opt_args_9miniga4py_2ga__put_common *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_9miniga4py_2ga__release_common(int, PyObject *, PyObject *, int); /*proto*/
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int32_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t = { "int64_t", NULL, sizeof(__pyx_t_5numpy_int64_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int64_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int64_t), 0 };
#define __Pyx_MODULE_NAME "miniga4py.ga"
extern int __pyx_module_is_main_miniga4py__ga;
int __pyx_module_is_main_miniga4py__ga = 0;

/* Implementation of 'miniga4py.ga' */
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_builtin_ImportError;
static const char __pyx_k_X[] = "X";
static const char __pyx_k_b[] = "b";
static const char __pyx_k_h[] = "h";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_k[] = "k";
static const char __pyx_k_l[] = "l";
static const char __pyx_k_m[] = "m";
static const char __pyx_k_n[] = "n";
static const char __pyx_k_s[] = "s";
static const char __pyx_k_x[] = "x";
static const char __pyx_k__7[] = "";
static const char __pyx_k_hi[] = "hi";
static const char __pyx_k_lo[] = "lo";
static const char __pyx_k_nm[] = "nm";
static const char __pyx_k_np[] = "np";
static const char __pyx_k_op[] = "op";
static const char __pyx_k_ta[] = "ta";
static const char __pyx_k_tb[] = "tb";
static const char __pyx_k__22[] = "+";
static const char __pyx_k__23[] = "*";
static const char __pyx_k_acc[] = "acc";
static const char __pyx_k_add[] = "add";
static const char __pyx_k_ahi[] = "ahi";
static const char __pyx_k_all[] = "all";
static const char __pyx_k_alo[] = "alo";
static const char __pyx_k_any[] = "any";
static const char __pyx_k_bhi[] = "bhi";
static const char __pyx_k_blo[] = "blo";
static const char __pyx_k_chi[] = "chi";
static const char __pyx_k_clo[] = "clo";
static const char __pyx_k_dir[] = "dir";
static const char __pyx_k_dot[] = "dot";
static const char __pyx_k_g_a[] = "g_a";
static const char __pyx_k_g_b[] = "g_b";
static const char __pyx_k_g_c[] = "g_c";
static const char __pyx_k_g_m[] = "g_m";
static const char __pyx_k_g_s[] = "g_s";
static const char __pyx_k_g_v[] = "g_v";
static const char __pyx_k_get[] = "get";
static const char __pyx_k_gop[] = "gop";
static const char __pyx_k_idx[] = "idx";
static const char __pyx_k_inc[] = "inc";
static const char __pyx_k_map[] = "map";
static const char __pyx_k_max[] = "max";
static const char __pyx_k_mhi[] = "mhi";
static const char __pyx_k_min[] = "min";
static const char __pyx_k_mlo[] = "mlo";
static const char __pyx_k_num[] = "num";
static const char __pyx_k_pid[] = "pid";
static const char __pyx_k_ptr[] = "ptr";
static const char __pyx_k_put[] = "put";
static const char __pyx_k_sys[] = "sys";
static const char __pyx_k_val[] = "val";
static const char __pyx_k_zip[] = "zip";
static const char __pyx_k_X_nd[] = "X_nd";
static const char __pyx_k_beta[] = "beta";
static const char __pyx_k_c_hi[] = "c_hi";
static const char __pyx_k_c_lo[] = "c_lo";
static const char __pyx_k_code[] = "code";
static const char __pyx_k_copy[] = "copy";
static const char __pyx_k_data[] = "data";
static const char __pyx_k_diag[] = "diag";
static const char __pyx_k_dims[] = "dims";
static const char __pyx_k_dinc[] = "dinc";
static const char __pyx_k_dval[] = "dval";
static const char __pyx_k_enum[] = "enum";
static const char __pyx_k_excl[] = "excl";
static const char __pyx_k_file[] = "file";
static const char __pyx_k_fill[] = "fill";
static const char __pyx_k_finc[] = "finc";
static const char __pyx_k_flag[] = "flag";
static const char __pyx_k_fval[] = "fval";
static const char __pyx_k_gdcv[] = "gdcv";
static const char __pyx_k_gemm[] = "gemm";
static const char __pyx_k_gfcv[] = "gfcv";
static const char __pyx_k_iinc[] = "iinc";
static const char __pyx_k_imag[] = "imag";
static const char __pyx_k_int8[] = "int8";
static const char __pyx_k_intc[] = "intc";
static const char __pyx_k_ival[] = "ival";
static const char __pyx_k_last[] = "last";
static const char __pyx_k_linc[] = "linc";
static const char __pyx_k_list[] = "list";
static const char __pyx_k_lock[] = "lock";
static const char __pyx_k_long[] = "long";
static const char __pyx_k_lval[] = "lval";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_mapc[] = "mapc";
static const char __pyx_k_name[] = "name";
static const char __pyx_k_ndim[] = "ndim";
static const char __pyx_k_node[] = "node";
static const char __pyx_k_ones[] = "ones";
static const char __pyx_k_pack[] = "pack";
static const char __pyx_k_pdcv[] = "pdcv";
static const char __pyx_k_pfcv[] = "pfcv";
static const char __pyx_k_proc[] = "proc";
static const char __pyx_k_prod[] = "prod";
static const char __pyx_k_real[] = "real";
static const char __pyx_k_root[] = "root";
static const char __pyx_k_size[] = "size";
static const char __pyx_k_skip[] = "skip";
static const char __pyx_k_step[] = "step";
static const char __pyx_k_sync[] = "sync";
static const char __pyx_k_ta_c[] = "ta_c";
static const char __pyx_k_tb_c[] = "tb_c";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_type[] = "type";
static const char __pyx_k_vinc[] = "vinc";
static const char __pyx_k_vval[] = "vval";
static const char __pyx_k_zero[] = "zero";
static const char __pyx_k_C_DBL[] = "C_DBL";
static const char __pyx_k_C_INT[] = "C_INT";
static const char __pyx_k_F_DBL[] = "F_DBL";
static const char __pyx_k_F_INT[] = "F_INT";
static const char __pyx_k_F_LOG[] = "F_LOG";
static const char __pyx_k_alpha[] = "alpha";
static const char __pyx_k_array[] = "array";
static const char __pyx_k_block[] = "block";
static const char __pyx_k_bytes[] = "bytes";
static const char __pyx_k_chunk[] = "chunk";
static const char __pyx_k_color[] = "color";
static const char __pyx_k_coord[] = "coord";
static const char __pyx_k_dbeta[] = "dbeta";
static const char __pyx_k_dcinc[] = "dcinc";
static const char __pyx_k_dcval[] = "dcval";
static const char __pyx_k_debug[] = "debug";
static const char __pyx_k_dtype[] = "dtype";
static const char __pyx_k_elems[] = "elems";
static const char __pyx_k_error[] = "error";
static const char __pyx_k_fbeta[] = "fbeta";
static const char __pyx_k_fcinc[] = "fcinc";
static const char __pyx_k_fcval[] = "fcval";
static const char __pyx_k_fence[] = "fence";
static const char __pyx_k_first[] = "first";
static const char __pyx_k_flags[] = "flags";
static const char __pyx_k_g_dst[] = "g_dst";
static const char __pyx_k_g_msk[] = "g_msk";
static const char __pyx_k_g_src[] = "g_src";
static const char __pyx_k_gtype[] = "gtype";
static const char __pyx_k_hi_nd[] = "hi_nd";
static const char __pyx_k_ibeta[] = "ibeta";
static const char __pyx_k_index[] = "index";
static const char __pyx_k_int32[] = "int32";
static const char __pyx_k_int64[] = "int64";
static const char __pyx_k_isstr[] = "isstr";
static const char __pyx_k_lbeta[] = "lbeta";
static const char __pyx_k_ld_nd[] = "ld_nd";
static const char __pyx_k_ldinc[] = "ldinc";
static const char __pyx_k_ldval[] = "ldval";
static const char __pyx_k_limit[] = "limit";
static const char __pyx_k_llinc[] = "llinc";
static const char __pyx_k_llval[] = "llval";
static const char __pyx_k_lo_nd[] = "lo_nd";
static const char __pyx_k_major[] = "major";
static const char __pyx_k_mutex[] = "mutex";
static const char __pyx_k_nbacc[] = "nbacc";
static const char __pyx_k_nbget[] = "nbget";
static const char __pyx_k_nbput[] = "nbput";
static const char __pyx_k_norm1[] = "norm1";
static const char __pyx_k_numpy[] = "numpy";
static const char __pyx_k_procs[] = "procs";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_recip[] = "recip";
static const char __pyx_k_scale[] = "scale";
static const char __pyx_k_solve[] = "solve";
static const char __pyx_k_start[] = "start";
static const char __pyx_k_trans[] = "trans";
static const char __pyx_k_value[] = "value";
static const char __pyx_k_vbeta[] = "vbeta";
static const char __pyx_k_width[] = "width";
static const char __pyx_k_wtime[] = "wtime";
static const char __pyx_k_zeros[] = "zeros";
static const char __pyx_k_C_CHAR[] = "C_CHAR";
static const char __pyx_k_C_DCPL[] = "C_DCPL";
static const char __pyx_k_C_LDBL[] = "C_LDBL";
static const char __pyx_k_C_LONG[] = "C_LONG";
static const char __pyx_k_C_SCPL[] = "C_SCPL";
static const char __pyx_k_F_BYTE[] = "F_BYTE";
static const char __pyx_k_F_DCPL[] = "F_DCPL";
static const char __pyx_k_F_REAL[] = "F_REAL";
static const char __pyx_k_F_SCPL[] = "F_SCPL";
static const char __pyx_k_absmax[] = "absmax";
static const char __pyx_k_absmin[] = "absmin";
static const char __pyx_k_access[] = "access";
static const char __pyx_k_ahi_nd[] = "ahi_nd";
static const char __pyx_k_alo_nd[] = "alo_nd";
static const char __pyx_k_atexit[] = "atexit";
static const char __pyx_k_bhi_nd[] = "bhi_nd";
static const char __pyx_k_blo_nd[] = "blo_nd";
static const char __pyx_k_brdcst[] = "brdcst";
static const char __pyx_k_buffer[] = "buffer";
static const char __pyx_k_c_excl[] = "c_excl";
static const char __pyx_k_chi_nd[] = "chi_nd";
static const char __pyx_k_clo_nd[] = "clo_nd";
static const char __pyx_k_codecs[] = "codecs";
static const char __pyx_k_create[] = "create";
static const char __pyx_k_ctrans[] = "ctrans";
static const char __pyx_k_dalpha[] = "dalpha";
static const char __pyx_k_dcbeta[] = "dcbeta";
static const char __pyx_k_dimlen[] = "dimlen";
static const char __pyx_k_double[] = "double";
static const char __pyx_k_dstart[] = "dstart";
static const char __pyx_k_dvalue[] = "dvalue";
static const char __pyx_k_falpha[] = "falpha";
static const char __pyx_k_fcbeta[] = "fcbeta";
static const char __pyx_k_fstart[] = "fstart";
static const char __pyx_k_fvalue[] = "fvalue";
static const char __pyx_k_gather[] = "gather";
static const char __pyx_k_gatype[] = "gatype";
static const char __pyx_k_hi_dst[] = "hi_dst";
static const char __pyx_k_ialpha[] = "ialpha";
static const char __pyx_k_icount[] = "icount";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_istart[] = "istart";
static const char __pyx_k_ivalue[] = "ivalue";
static const char __pyx_k_lalpha[] = "lalpha";
static const char __pyx_k_ldbeta[] = "ldbeta";
static const char __pyx_k_llbeta[] = "llbeta";
static const char __pyx_k_lo_dst[] = "lo_dst";
static const char __pyx_k_locate[] = "locate";
static const char __pyx_k_lstart[] = "lstart";
static const char __pyx_k_lvalue[] = "lvalue";
static const char __pyx_k_map_nd[] = "map_nd";
static const char __pyx_k_median[] = "median";
static const char __pyx_k_mhi_nd[] = "mhi_nd";
static const char __pyx_k_mlo_nd[] = "mlo_nd";
static const char __pyx_k_nblock[] = "nblock";
static const char __pyx_k_nbwait[] = "nbwait";
static const char __pyx_k_nnodes[] = "nnodes";
static const char __pyx_k_nodeid[] = "nodeid";
static const char __pyx_k_number[] = "number";
static const char __pyx_k_pgroup[] = "pgroup";
static const char __pyx_k_pretty[] = "pretty";
static const char __pyx_k_result[] = "result";
static const char __pyx_k_single[] = "single";
static const char __pyx_k_slices[] = "slices";
static const char __pyx_k_transa[] = "transa";
static const char __pyx_k_transb[] = "transb";
static const char __pyx_k_unlock[] = "unlock";
static const char __pyx_k_unpack[] = "unpack";
static const char __pyx_k_valpha[] = "valpha";
static const char __pyx_k_values[] = "values";
static const char __pyx_k_vstart[] = "vstart";
static const char __pyx_k_vvalue[] = "vvalue";
static const char __pyx_k_C_FLOAT[] = "C_FLOAT";
static const char __pyx_k_C_LDCPL[] = "C_LDCPL";
static const char __pyx_k_apretty[] = "apretty";
static const char __pyx_k_asarray[] = "asarray";
static const char __pyx_k_builtin[] = "__builtin__";
static const char __pyx_k_control[] = "control";
static const char __pyx_k_dcalpha[] = "dcalpha";
static const char __pyx_k_dcstart[] = "dcstart";
static const char __pyx_k_dcvalue[] = "dcvalue";
static const char __pyx_k_destroy[] = "destroy";
static const char __pyx_k_dims_nd[] = "dims_nd";
static const char __pyx_k_evalues[] = "evalues";
static const char __pyx_k_fcalpha[] = "fcalpha";
static const char __pyx_k_fcstart[] = "fcstart";
static const char __pyx_k_fcvalue[] = "fcvalue";
static const char __pyx_k_float32[] = "float32";
static const char __pyx_k_float64[] = "float64";
static const char __pyx_k_gop_add[] = "gop_add";
static const char __pyx_k_gop_max[] = "gop_max";
static const char __pyx_k_gop_min[] = "gop_min";
static const char __pyx_k_hi_proc[] = "hi_proc";
static const char __pyx_k_isbytes[] = "isbytes";
static const char __pyx_k_ldalpha[] = "ldalpha";
static const char __pyx_k_ldstart[] = "ldstart";
static const char __pyx_k_ldvalue[] = "ldvalue";
static const char __pyx_k_list_nd[] = "list_nd";
static const char __pyx_k_llalpha[] = "llalpha";
static const char __pyx_k_llstart[] = "llstart";
static const char __pyx_k_llvalue[] = "llvalue";
static const char __pyx_k_lo_proc[] = "lo_proc";
static const char __pyx_k_mapc_nd[] = "mapc_nd";
static const char __pyx_k_message[] = "message";
static const char __pyx_k_release[] = "release";
static const char __pyx_k_reshape[] = "reshape";
static const char __pyx_k_scatter[] = "scatter";
static const char __pyx_k_strides[] = "strides";
static const char __pyx_k_ta_char[] = "ta_char";
static const char __pyx_k_tb_char[] = "tb_char";
static const char __pyx_k_trans_c[] = "trans_c";
static const char __pyx_k_typenum[] = "typenum";
static const char __pyx_k_uses_ma[] = "uses_ma";
static const char __pyx_k_verbose[] = "verbose";
static const char __pyx_k_allocate[] = "allocate";
static const char __pyx_k_block_nd[] = "block_nd";
static const char __pyx_k_builtins[] = "builtins";
static const char __pyx_k_chunk_nd[] = "chunk_nd";
static const char __pyx_k_diag_std[] = "diag_std";
static const char __pyx_k_float128[] = "float128";
static const char __pyx_k_get_diag[] = "get_diag";
static const char __pyx_k_itemsize[] = "itemsize";
static const char __pyx_k_longlong[] = "longlong";
static const char __pyx_k_lu_solve[] = "lu_solve";
static const char __pyx_k_nbhandle[] = "nbhandle";
static const char __pyx_k_np_guess[] = "np_guess";
static const char __pyx_k_read_inc[] = "read_inc";
static const char __pyx_k_register[] = "register";
static const char __pyx_k_scan_add[] = "scan_add";
static const char __pyx_k_set_data[] = "set_data";
static const char __pyx_k_sometrue[] = "sometrue";
static const char __pyx_k_step_max[] = "step_max";
static const char __pyx_k_to_dtype[] = "_to_dtype";
static const char __pyx_k_width_nd[] = "width_nd";
static const char __pyx_k_TYPE_BASE[] = "TYPE_BASE";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_abs_value[] = "abs_value";
static const char __pyx_k_buffer_nd[] = "buffer_nd";
static const char __pyx_k_complex64[] = "complex64";
static const char __pyx_k_dimension[] = "dimension";
static const char __pyx_k_duplicate[] = "duplicate";
static const char __pyx_k_ga_dcbeta[] = "ga_dcbeta";
static const char __pyx_k_ga_fcbeta[] = "ga_fcbeta";
static const char __pyx_k_get_debug[] = "get_debug";
static const char __pyx_k_llt_solve[] = "llt_solve";
static const char __pyx_k_mask_sync[] = "mask_sync";
static const char __pyx_k_nblock_nd[] = "nblock_nd";
static const char __pyx_k_np_result[] = "np_result";
static const char __pyx_k_num_group[] = "num_group";
static const char __pyx_k_proc_grid[] = "proc_grid";
static const char __pyx_k_randomize[] = "randomize";
static const char __pyx_k_scan_copy[] = "scan_copy";
static const char __pyx_k_set_chunk[] = "set_chunk";
static const char __pyx_k_set_debug[] = "set_debug";
static const char __pyx_k_subsarray[] = "subsarray";
static const char __pyx_k_subscript[] = "subscript";
static const char __pyx_k_summarize[] = "summarize";
static const char __pyx_k_terminate[] = "terminate";
static const char __pyx_k_transpose[] = "transpose";
static const char __pyx_k_values_nd[] = "values_nd";
static const char __pyx_k_C_LONGLONG[] = "C_LONGLONG";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_block_dims[] = "block_dims";
static const char __pyx_k_complex128[] = "complex128";
static const char __pyx_k_complex256[] = "complex256";
static const char __pyx_k_diag_reuse[] = "diag_reuse";
static const char __pyx_k_ga_dcalpha[] = "ga_dcalpha";
static const char __pyx_k_ga_fcalpha[] = "ga_fcalpha";
static const char __pyx_k_gop_absmax[] = "gop_absmax";
static const char __pyx_k_gop_absmin[] = "gop_absmin";
static const char __pyx_k_has_ghosts[] = "has_ghosts";
static const char __pyx_k_init_fence[] = "init_fence";
static const char __pyx_k_initialize[] = "initialize";
static const char __pyx_k_num_blocks[] = "num_blocks";
static const char __pyx_k_pgroup_gop[] = "pgroup_gop";
static const char __pyx_k_print_file[] = "print_file";
static const char __pyx_k_scale_cols[] = "scale_cols";
static const char __pyx_k_scale_rows[] = "scale_rows";
static const char __pyx_k_set_ghosts[] = "set_ghosts";
static const char __pyx_k_set_pgroup[] = "set_pgroup";
static const char __pyx_k_spd_invert[] = "spd_invert";
static const char __pyx_k_symmetrize[] = "symmetrize";
static const char __pyx_k_ImportError[] = "ImportError";
static const char __pyx_k_char_transa[] = "char_transa";
static const char __pyx_k_char_transb[] = "char_transb";
static const char __pyx_k_elem_divide[] = "elem_divide";
static const char __pyx_k_initialized[] = "initialized";
static const char __pyx_k_is_mirrored[] = "is_mirrored";
static const char __pyx_k_map_reshape[] = "map_reshape";
static const char __pyx_k_pgroup_sync[] = "pgroup_sync";
static const char __pyx_k_print_patch[] = "print_patch";
static const char __pyx_k_print_stats[] = "print_stats";
static const char __pyx_k_scatter_acc[] = "scatter_acc";
static const char __pyx_k_select_elem[] = "select_elem";
static const char __pyx_k_strided_acc[] = "strided_acc";
static const char __pyx_k_strided_get[] = "strided_get";
static const char __pyx_k_strided_put[] = "strided_put";
static const char __pyx_k_C_CONTIGUOUS[] = "C_CONTIGUOUS";
static const char __pyx_k_RuntimeError[] = "RuntimeError";
static const char __pyx_k_access_block[] = "access_block";
static const char __pyx_k_add_constant[] = "add_constant";
static const char __pyx_k_add_diagonal[] = "add_diagonal";
static const char __pyx_k_check_handle[] = "check_handle";
static const char __pyx_k_create_irreg[] = "create_irreg";
static const char __pyx_k_elem_maximum[] = "elem_maximum";
static const char __pyx_k_elem_minimum[] = "elem_minimum";
static const char __pyx_k_gop_multiply[] = "gop_multiply";
static const char __pyx_k_inquire_name[] = "inquire_name";
static const char __pyx_k_matmul_patch[] = "matmul_patch";
static const char __pyx_k_memory_avail[] = "memory_avail";
static const char __pyx_k_miniga4py_ga[] = "miniga4py.ga";
static const char __pyx_k_periodic_acc[] = "periodic_acc";
static const char __pyx_k_periodic_get[] = "periodic_get";
static const char __pyx_k_periodic_put[] = "periodic_put";
static const char __pyx_k_pgroup_split[] = "pgroup_split";
static const char __pyx_k_print_stdout[] = "print_stdout";
static const char __pyx_k_proc_grid_nd[] = "proc_grid_nd";
static const char __pyx_k_set_diagonal[] = "set_diagonal";
static const char __pyx_k_subscript_nd[] = "subscript_nd";
static const char __pyx_k_total_blocks[] = "total_blocks";
static const char __pyx_k_version_info[] = "version_info";
static const char __pyx_k_access_ghosts[] = "access_ghosts";
static const char __pyx_k_compare_distr[] = "compare_distr";
static const char __pyx_k_create_ghosts[] = "create_ghosts";
static const char __pyx_k_create_handle[] = "create_handle";
static const char __pyx_k_elem_multiply[] = "elem_multiply";
static const char __pyx_k_gop_line_2073[] = "gop (line 2073)";
static const char __pyx_k_inquire_dtype[] = "inquire_dtype";
static const char __pyx_k_locate_nnodes[] = "locate_nnodes";
static const char __pyx_k_locate_region[] = "locate_region";
static const char __pyx_k_norm_infinity[] = "norm_infinity";
static const char __pyx_k_pgroup_brdcst[] = "pgroup_brdcst";
static const char __pyx_k_pgroup_create[] = "pgroup_create";
static const char __pyx_k_pgroup_nnodes[] = "pgroup_nnodes";
static const char __pyx_k_pgroup_nodeid[] = "pgroup_nodeid";
static const char __pyx_k_proc_topology[] = "proc_topology";
static const char __pyx_k_register_type[] = "register_type";
static const char __pyx_k_release_block[] = "release_block";
static const char __pyx_k_shift_diagoal[] = "shift_diagoal";
static const char __pyx_k_subsarray1_nd[] = "subsarray1_nd";
static const char __pyx_k_subsarray2_nd[] = "subsarray2_nd";
static const char __pyx_k_update_ghosts[] = "update_ghosts";
static const char __pyx_k_zero_diagonal[] = "zero_diagonal";
static const char __pyx_k_cluster_nnodes[] = "cluster_nnodes";
static const char __pyx_k_cluster_nodeid[] = "cluster_nodeid";
static const char __pyx_k_cluster_nprocs[] = "cluster_nprocs";
static const char __pyx_k_cluster_procid[] = "cluster_procid";
static const char __pyx_k_create_mutexes[] = "create_mutexes";
static const char __pyx_k_get_block_info[] = "get_block_info";
static const char __pyx_k_initialize_ltd[] = "initialize_ltd";
static const char __pyx_k_inquire_memory[] = "inquire_memory";
static const char __pyx_k_latin_1_decode[] = "latin_1_decode";
static const char __pyx_k_latin_1_encode[] = "latin_1_encode";
static const char __pyx_k_memory_limited[] = "memory_limited";
static const char __pyx_k_merge_mirrored[] = "merge_mirrored";
static const char __pyx_k_pgroup_destroy[] = "pgroup_destroy";
static const char __pyx_k_pgroup_gop_add[] = "pgroup_gop_add";
static const char __pyx_k_pgroup_gop_max[] = "pgroup_gop_max";
static const char __pyx_k_pgroup_gop_min[] = "pgroup_gop_min";
static const char __pyx_k_register_dtype[] = "register_dtype";
static const char __pyx_k_release_ghosts[] = "release_ghosts";
static const char __pyx_k_release_update[] = "release_update";
static const char __pyx_k_set_array_name[] = "set_array_name";
static const char __pyx_k_set_restricted[] = "set_restricted";
static const char __pyx_k_deregister_type[] = "deregister_type";
static const char __pyx_k_destroy_mutexes[] = "destroy_mutexes";
static const char __pyx_k_lo_hi_lo_s_hi_s[] = "lo>hi lo=%s hi=%s";
static const char __pyx_k_select_elem_max[] = "select_elem_max";
static const char __pyx_k_select_elem_min[] = "select_elem_min";
static const char __pyx_k_set_irreg_distr[] = "set_irreg_distr";
static const char __pyx_k_WORLD_PROC_GROUP[] = "WORLD_PROC_GROUP";
static const char __pyx_k_miniga4py_ga_pyx[] = "miniga4py/ga.pyx";
static const char __pyx_k_pgroup_get_world[] = "pgroup_get_world";
static const char __pyx_k_set_block_cyclic[] = "set_block_cyclic";
static const char __pyx_k_set_memory_limit[] = "set_memory_limit";
static const char __pyx_k_update_ghost_dir[] = "update_ghost_dir";
static const char __pyx_k_access_block_grid[] = "access_block_grid";
static const char __pyx_k_ascontiguousarray[] = "ascontiguousarray";
static const char __pyx_k_merge_distr_patch[] = "merge_distr_patch";
static const char __pyx_k_pgroup_get_mirror[] = "pgroup_get_mirror";
static const char __pyx_k_pgroup_gop_absmax[] = "pgroup_gop_absmax";
static const char __pyx_k_pgroup_gop_absmin[] = "pgroup_gop_absmin";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_pgroup_absolute_id[] = "pgroup_absolute_id";
static const char __pyx_k_pgroup_get_default[] = "pgroup_get_default";
static const char __pyx_k_pgroup_set_default[] = "pgroup_set_default";
static const char __pyx_k_pgroup_split_irreg[] = "pgroup_split_irreg";
static const char __pyx_k_print_distribution[] = "print_distribution";
static const char __pyx_k_release_block_grid[] = "release_block_grid";
static const char __pyx_k_C_INT_not_supported[] = "C_INT not supported";
static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
static const char __pyx_k_cannot_convert_None[] = "cannot convert None";
static const char __pyx_k_cluster_proc_nodeid[] = "cluster_proc_nodeid";
static const char __pyx_k_create_ghosts_irreg[] = "create_ghosts_irreg";
static const char __pyx_k_how_did_this_happen[] = "how did this happen?";
static const char __pyx_k_pgroup_gop_multiply[] = "pgroup_gop_multiply";
static const char __pyx_k_C_LDBL_not_supported[] = "C_LDBL not supported";
static const char __pyx_k_C_LONG_not_supported[] = "C_LONG not supported";
static const char __pyx_k_X_must_be_contiguous[] = "X must be contiguous";
static const char __pyx_k_access_block_segment[] = "access_block_segment";
static const char __pyx_k_access_ghost_element[] = "access_ghost_element";
static const char __pyx_k_pgroup_gop_line_3055[] = "pgroup_gop (line 3055)";
static const char __pyx_k_release_update_block[] = "release_update_block";
static const char __pyx_k_set_restricted_range[] = "set_restricted_range";
static const char __pyx_k_release_block_segment[] = "release_block_segment";
static const char __pyx_k_release_ghost_element[] = "release_ghost_element";
static const char __pyx_k_release_update_ghosts[] = "release_update_ghosts";
static const char __pyx_k_len_hi_nd_ndim_len_s_s[] = "len(hi_nd) != ndim; len(%s) != %s";
static const char __pyx_k_len_lo_nd_ndim_len_s_s[] = "len(lo_nd) != ndim; len(%s) != %s";
static const char __pyx_k_C_LONGLONG_not_supported[] = "C_LONGLONG not supported";
static const char __pyx_k_C_LDCPL_not_supported_yet[] = "C_LDCPL not supported (yet)";
static const char __pyx_k_release_update_block_grid[] = "release_update_block_grid";
static const char __pyx_k_values_must_be_contiguous[] = "values must be contiguous";
static const char __pyx_k_set_block_cyclic_proc_grid[] = "set_block_cyclic_proc_grid";
static const char __pyx_k_type_of_g_a_not_recognized[] = "type of g_a not recognized";
static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
static const char __pyx_k_values_was_not_large_enough[] = "values was not large enough";
static const char __pyx_k_release_update_block_segment[] = "release_update_block_segment";
static const char __pyx_k_release_update_ghost_element[] = "release_update_ghost_element";
static const char __pyx_k_the_buffer_must_be_contiguous[] = "the buffer must be contiguous";
static const char __pyx_k_use_access_ghosts_g_a_instead[] = "use access_ghosts(g_a) instead";
static const char __pyx_k_d_was_not_a_recognized_GA_type[] = "%d was not a recognized GA type";
static const char __pyx_k_hi_out_of_bounds_hi_dst_s_hi_s[] = "hi out of bounds hi_dst=%s hi=%s";
static const char __pyx_k_lo_out_of_bounds_lo_dst_s_lo_s[] = "lo out of bounds lo_dst=%s lo=%s";
static const char __pyx_k_type_not_supported_by_ga_gop_s[] = "type not supported by ga.gop %s";
static const char __pyx_k_values_must_be_one_dimensional[] = "values must be one-dimensional";
static const char __pyx_k_buffer_is_wrong_type_buffer_s_s[] = "buffer is wrong type :: buffer=%s != %s";
static const char __pyx_k_lo_cannot_be_None_if_hi_is_None[] = "lo cannot be None if hi is None";
static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
static const char __pyx_k_subsarray_must_be_either_1_or_2[] = "subsarray must be either 1- or 2-dimensional";
static const char __pyx_k_type_not_supported_by_ga_pgroup[] = "type not supported by ga.pgroup_gop %s";
static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
static const char __pyx_k_Global_operation_X_1_N_is_a_vect[] = "Global operation.\n\n    X(1:N) is a vector present on each process. gop 'sums' elements of X\n    accross all nodes using the commutative operator op. The result is\n    broadcast to all nodes. Supported operations include '+', '*', 'max',\n    'min', 'absmax', 'absmin'. The use of lowerecase for operators is\n    necessary.\n\n    X must be a contiguous array-like.  X is not guaranteed to be modified\n    in-place so use as:\n\n    >>> value = ga.gop((1,2,3), \"+\")\n\n    This operation is provided only for convenience purposes: it is available\n    regardless of the message-passing library that GA is running with.\n\n    This is a collective operation. \n\n    ";
static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
static const char __pyx_k_The_Global_Arrays_GA_Python_inte[] = "The Global Arrays (GA) Python interface.\n\nThis module exports the GA C API, with a few enhancements.  The notable\nexceptions include supporting Pythonic ranges.  The ranges here are half-open\ne.g. [0,n) instead of in the C API where they are closed e.g. [0,n].  This\nfollows the Python convention.\n\n";
static const char __pyx_k_buffer_cannot_have_negative_stri[] = "buffer cannot have negative strides";
static const char __pyx_k_buffer_shape_does_not_match_requ[] = "buffer shape does not match request shape :: buffer_shape=%s != shape=%s";
static const char __pyx_k_buffer_size_does_not_match_shape[] = "buffer size does not match shape :: buffer.size=%s != np.prod(shape)=%s";
static const char __pyx_k_first_dimension_of_buffer_cannot[] = "first dimension of buffer cannot be strided";
static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
static const char __pyx_k_Global_operation_X_1_N_is_a_vect_2[] = "Global operation.\n\n    X(1:N) is a vector present on each process in the group. gop 'sums'\n    elements of X accross all nodes using the commutative operator op. The\n    result is broadcast to all nodes. Supported operations include '+', '*',\n    'max', 'min', 'absmax', 'absmin'. The use of lowerecase for operators is\n    necessary.\n\n    X must be a contiguous array-like.  X is not guaranteed to be modified\n    in-place so use as:\n\n    >>> value = ga.gop((1,2,3), \"+\")\n\n    This operation is provided only for convenience purposes: it is available\n    regardless of the message-passing library that GA is running with.\n\n    This is a collective operation. \n\n    ";
static PyObject *__pyx_n_s_C_CHAR;
static PyObject *__pyx_n_s_C_CONTIGUOUS;
static PyObject *__pyx_n_s_C_DBL;
static PyObject *__pyx_n_s_C_DCPL;
static PyObject *__pyx_n_s_C_FLOAT;
static PyObject *__pyx_n_s_C_INT;
static PyObject *__pyx_kp_s_C_INT_not_supported;
static PyObject *__pyx_n_s_C_LDBL;
static PyObject *__pyx_kp_s_C_LDBL_not_supported;
static PyObject *__pyx_n_s_C_LDCPL;
static PyObject *__pyx_kp_s_C_LDCPL_not_supported_yet;
static PyObject *__pyx_n_s_C_LONG;
static PyObject *__pyx_n_s_C_LONGLONG;
static PyObject *__pyx_kp_s_C_LONGLONG_not_supported;
static PyObject *__pyx_kp_s_C_LONG_not_supported;
static PyObject *__pyx_n_s_C_SCPL;
static PyObject *__pyx_n_s_F_BYTE;
static PyObject *__pyx_n_s_F_DBL;
static PyObject *__pyx_n_s_F_DCPL;
static PyObject *__pyx_n_s_F_INT;
static PyObject *__pyx_n_s_F_LOG;
static PyObject *__pyx_n_s_F_REAL;
static PyObject *__pyx_n_s_F_SCPL;
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
static PyObject *__pyx_kp_u_Global_operation_X_1_N_is_a_vect;
static PyObject *__pyx_kp_u_Global_operation_X_1_N_is_a_vect_2;
static PyObject *__pyx_n_s_ImportError;
static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
static PyObject *__pyx_n_s_NotImplementedError;
static PyObject *__pyx_n_s_RuntimeError;
static PyObject *__pyx_n_s_TYPE_BASE;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_WORLD_PROC_GROUP;
static PyObject *__pyx_n_s_X;
static PyObject *__pyx_kp_s_X_must_be_contiguous;
static PyObject *__pyx_n_s_X_nd;
static PyObject *__pyx_kp_s__22;
static PyObject *__pyx_kp_s__23;
static PyObject *__pyx_kp_s__7;
static PyObject *__pyx_n_s_abs_value;
static PyObject *__pyx_n_s_absmax;
static PyObject *__pyx_n_s_absmin;
static PyObject *__pyx_n_s_acc;
static PyObject *__pyx_n_s_access;
static PyObject *__pyx_n_s_access_block;
static PyObject *__pyx_n_s_access_block_grid;
static PyObject *__pyx_n_s_access_block_segment;
static PyObject *__pyx_n_s_access_ghost_element;
static PyObject *__pyx_n_s_access_ghosts;
static PyObject *__pyx_n_s_add;
static PyObject *__pyx_n_s_add_constant;
static PyObject *__pyx_n_s_add_diagonal;
static PyObject *__pyx_n_s_ahi;
static PyObject *__pyx_n_s_ahi_nd;
static PyObject *__pyx_n_s_all;
static PyObject *__pyx_n_s_allocate;
static PyObject *__pyx_n_s_alo;
static PyObject *__pyx_n_s_alo_nd;
static PyObject *__pyx_n_s_alpha;
static PyObject *__pyx_n_s_any;
static PyObject *__pyx_n_s_apretty;
static PyObject *__pyx_n_s_array;
static PyObject *__pyx_n_s_asarray;
static PyObject *__pyx_n_s_ascontiguousarray;
static PyObject *__pyx_n_s_atexit;
static PyObject *__pyx_n_s_b;
static PyObject *__pyx_n_s_beta;
static PyObject *__pyx_n_s_bhi;
static PyObject *__pyx_n_s_bhi_nd;
static PyObject *__pyx_n_s_blo;
static PyObject *__pyx_n_s_blo_nd;
static PyObject *__pyx_n_s_block;
static PyObject *__pyx_n_s_block_dims;
static PyObject *__pyx_n_s_block_nd;
static PyObject *__pyx_n_s_brdcst;
static PyObject *__pyx_n_s_buffer;
static PyObject *__pyx_kp_s_buffer_cannot_have_negative_stri;
static PyObject *__pyx_kp_s_buffer_is_wrong_type_buffer_s_s;
static PyObject *__pyx_n_s_buffer_nd;
static PyObject *__pyx_kp_s_buffer_shape_does_not_match_requ;
static PyObject *__pyx_kp_s_buffer_size_does_not_match_shape;
static PyObject *__pyx_n_s_builtin;
static PyObject *__pyx_n_s_builtins;
static PyObject *__pyx_n_s_bytes;
static PyObject *__pyx_n_s_c_excl;
static PyObject *__pyx_n_s_c_hi;
static PyObject *__pyx_n_s_c_lo;
static PyObject *__pyx_kp_s_cannot_convert_None;
static PyObject *__pyx_n_s_char_transa;
static PyObject *__pyx_n_s_char_transb;
static PyObject *__pyx_n_s_check_handle;
static PyObject *__pyx_n_s_chi;
static PyObject *__pyx_n_s_chi_nd;
static PyObject *__pyx_n_s_chunk;
static PyObject *__pyx_n_s_chunk_nd;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_clo;
static PyObject *__pyx_n_s_clo_nd;
static PyObject *__pyx_n_s_cluster_nnodes;
static PyObject *__pyx_n_s_cluster_nodeid;
static PyObject *__pyx_n_s_cluster_nprocs;
static PyObject *__pyx_n_s_cluster_proc_nodeid;
static PyObject *__pyx_n_s_cluster_procid;
static PyObject *__pyx_n_s_code;
static PyObject *__pyx_n_s_codecs;
static PyObject *__pyx_n_s_color;
static PyObject *__pyx_n_s_compare_distr;
static PyObject *__pyx_n_s_complex128;
static PyObject *__pyx_n_s_complex256;
static PyObject *__pyx_n_s_complex64;
static PyObject *__pyx_n_s_control;
static PyObject *__pyx_n_s_coord;
static PyObject *__pyx_n_s_copy;
static PyObject *__pyx_n_s_create;
static PyObject *__pyx_n_s_create_ghosts;
static PyObject *__pyx_n_s_create_ghosts_irreg;
static PyObject *__pyx_n_s_create_handle;
static PyObject *__pyx_n_s_create_irreg;
static PyObject *__pyx_n_s_create_mutexes;
static PyObject *__pyx_n_s_ctrans;
static PyObject *__pyx_kp_s_d_was_not_a_recognized_GA_type;
static PyObject *__pyx_n_s_dalpha;
static PyObject *__pyx_n_s_data;
static PyObject *__pyx_n_s_dbeta;
static PyObject *__pyx_n_s_dcalpha;
static PyObject *__pyx_n_s_dcbeta;
static PyObject *__pyx_n_s_dcinc;
static PyObject *__pyx_n_s_dcstart;
static PyObject *__pyx_n_s_dcval;
static PyObject *__pyx_n_s_dcvalue;
static PyObject *__pyx_n_s_debug;
static PyObject *__pyx_n_s_deregister_type;
static PyObject *__pyx_n_s_destroy;
static PyObject *__pyx_n_s_destroy_mutexes;
static PyObject *__pyx_n_s_diag;
static PyObject *__pyx_n_s_diag_reuse;
static PyObject *__pyx_n_s_diag_std;
static PyObject *__pyx_n_s_dimension;
static PyObject *__pyx_n_s_dimlen;
static PyObject *__pyx_n_s_dims;
static PyObject *__pyx_n_s_dims_nd;
static PyObject *__pyx_n_s_dinc;
static PyObject *__pyx_n_s_dir;
static PyObject *__pyx_n_s_dot;
static PyObject *__pyx_n_s_double;
static PyObject *__pyx_n_s_dstart;
static PyObject *__pyx_n_s_dtype;
static PyObject *__pyx_n_s_duplicate;
static PyObject *__pyx_n_s_dval;
static PyObject *__pyx_n_s_dvalue;
static PyObject *__pyx_n_s_elem_divide;
static PyObject *__pyx_n_s_elem_maximum;
static PyObject *__pyx_n_s_elem_minimum;
static PyObject *__pyx_n_s_elem_multiply;
static PyObject *__pyx_n_s_elems;
static PyObject *__pyx_n_s_enum;
static PyObject *__pyx_n_s_error;
static PyObject *__pyx_n_s_evalues;
static PyObject *__pyx_n_s_excl;
static PyObject *__pyx_n_s_falpha;
static PyObject *__pyx_n_s_fbeta;
static PyObject *__pyx_n_s_fcalpha;
static PyObject *__pyx_n_s_fcbeta;
static PyObject *__pyx_n_s_fcinc;
static PyObject *__pyx_n_s_fcstart;
static PyObject *__pyx_n_s_fcval;
static PyObject *__pyx_n_s_fcvalue;
static PyObject *__pyx_n_s_fence;
static PyObject *__pyx_n_s_file;
static PyObject *__pyx_n_s_fill;
static PyObject *__pyx_n_s_finc;
static PyObject *__pyx_n_s_first;
static PyObject *__pyx_kp_s_first_dimension_of_buffer_cannot;
static PyObject *__pyx_n_s_flag;
static PyObject *__pyx_n_s_flags;
static PyObject *__pyx_n_s_float128;
static PyObject *__pyx_n_s_float32;
static PyObject *__pyx_n_s_float64;
static PyObject *__pyx_n_s_fstart;
static PyObject *__pyx_n_s_fval;
static PyObject *__pyx_n_s_fvalue;
static PyObject *__pyx_n_s_g_a;
static PyObject *__pyx_n_s_g_b;
static PyObject *__pyx_n_s_g_c;
static PyObject *__pyx_n_s_g_dst;
static PyObject *__pyx_n_s_g_m;
static PyObject *__pyx_n_s_g_msk;
static PyObject *__pyx_n_s_g_s;
static PyObject *__pyx_n_s_g_src;
static PyObject *__pyx_n_s_g_v;
static PyObject *__pyx_n_s_ga_dcalpha;
static PyObject *__pyx_n_s_ga_dcbeta;
static PyObject *__pyx_n_s_ga_fcalpha;
static PyObject *__pyx_n_s_ga_fcbeta;
static PyObject *__pyx_n_s_gather;
static PyObject *__pyx_n_s_gatype;
static PyObject *__pyx_n_s_gdcv;
static PyObject *__pyx_n_s_gemm;
static PyObject *__pyx_n_s_get;
static PyObject *__pyx_n_s_get_block_info;
static PyObject *__pyx_n_s_get_debug;
static PyObject *__pyx_n_s_get_diag;
static PyObject *__pyx_n_s_gfcv;
static PyObject *__pyx_n_s_gop;
static PyObject *__pyx_n_s_gop_absmax;
static PyObject *__pyx_n_s_gop_absmin;
static PyObject *__pyx_n_s_gop_add;
static PyObject *__pyx_kp_u_gop_line_2073;
static PyObject *__pyx_n_s_gop_max;
static PyObject *__pyx_n_s_gop_min;
static PyObject *__pyx_n_s_gop_multiply;
static PyObject *__pyx_n_s_gtype;
static PyObject *__pyx_n_s_h;
static PyObject *__pyx_n_s_has_ghosts;
static PyObject *__pyx_n_s_hi;
static PyObject *__pyx_n_s_hi_dst;
static PyObject *__pyx_n_s_hi_nd;
static PyObject *__pyx_kp_s_hi_out_of_bounds_hi_dst_s_hi_s;
static PyObject *__pyx_n_s_hi_proc;
static PyObject *__pyx_kp_s_how_did_this_happen;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_ialpha;
static PyObject *__pyx_n_s_ibeta;
static PyObject *__pyx_n_s_icount;
static PyObject *__pyx_n_s_idx;
static PyObject *__pyx_n_s_iinc;
static PyObject *__pyx_n_s_imag;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_inc;
static PyObject *__pyx_n_s_index;
static PyObject *__pyx_n_s_init_fence;
static PyObject *__pyx_n_s_initialize;
static PyObject *__pyx_n_s_initialize_ltd;
static PyObject *__pyx_n_s_initialized;
static PyObject *__pyx_n_s_inquire_dtype;
static PyObject *__pyx_n_s_inquire_memory;
static PyObject *__pyx_n_s_inquire_name;
static PyObject *__pyx_n_s_int32;
static PyObject *__pyx_n_s_int64;
static PyObject *__pyx_n_s_int8;
static PyObject *__pyx_n_s_intc;
static PyObject *__pyx_n_s_is_mirrored;
static PyObject *__pyx_n_s_isbytes;
static PyObject *__pyx_n_s_isstr;
static PyObject *__pyx_n_s_istart;
static PyObject *__pyx_n_s_itemsize;
static PyObject *__pyx_n_s_ival;
static PyObject *__pyx_n_s_ivalue;
static PyObject *__pyx_n_s_k;
static PyObject *__pyx_n_s_l;
static PyObject *__pyx_n_s_lalpha;
static PyObject *__pyx_n_s_last;
static PyObject *__pyx_n_s_latin_1_decode;
static PyObject *__pyx_n_s_latin_1_encode;
static PyObject *__pyx_n_s_lbeta;
static PyObject *__pyx_n_s_ld_nd;
static PyObject *__pyx_n_s_ldalpha;
static PyObject *__pyx_n_s_ldbeta;
static PyObject *__pyx_n_s_ldinc;
static PyObject *__pyx_n_s_ldstart;
static PyObject *__pyx_n_s_ldval;
static PyObject *__pyx_n_s_ldvalue;
static PyObject *__pyx_kp_s_len_hi_nd_ndim_len_s_s;
static PyObject *__pyx_kp_s_len_lo_nd_ndim_len_s_s;
static PyObject *__pyx_n_s_limit;
static PyObject *__pyx_n_s_linc;
static PyObject *__pyx_n_s_list;
static PyObject *__pyx_n_s_list_nd;
static PyObject *__pyx_n_s_llalpha;
static PyObject *__pyx_n_s_llbeta;
static PyObject *__pyx_n_s_llinc;
static PyObject *__pyx_n_s_llstart;
static PyObject *__pyx_n_s_llt_solve;
static PyObject *__pyx_n_s_llval;
static PyObject *__pyx_n_s_llvalue;
static PyObject *__pyx_n_s_lo;
static PyObject *__pyx_kp_s_lo_cannot_be_None_if_hi_is_None;
static PyObject *__pyx_n_s_lo_dst;
static PyObject *__pyx_kp_s_lo_hi_lo_s_hi_s;
static PyObject *__pyx_n_s_lo_nd;
static PyObject *__pyx_kp_s_lo_out_of_bounds_lo_dst_s_lo_s;
static PyObject *__pyx_n_s_lo_proc;
static PyObject *__pyx_n_s_locate;
static PyObject *__pyx_n_s_locate_nnodes;
static PyObject *__pyx_n_s_locate_region;
static PyObject *__pyx_n_s_lock;
static PyObject *__pyx_n_s_long;
static PyObject *__pyx_n_s_longlong;
static PyObject *__pyx_n_s_lstart;
static PyObject *__pyx_n_s_lu_solve;
static PyObject *__pyx_n_s_lval;
static PyObject *__pyx_n_s_lvalue;
static PyObject *__pyx_n_s_m;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_major;
static PyObject *__pyx_n_s_map;
static PyObject *__pyx_n_s_map_nd;
static PyObject *__pyx_n_s_map_reshape;
static PyObject *__pyx_n_s_mapc;
static PyObject *__pyx_n_s_mapc_nd;
static PyObject *__pyx_n_s_mask_sync;
static PyObject *__pyx_n_s_matmul_patch;
static PyObject *__pyx_n_s_max;
static PyObject *__pyx_n_s_median;
static PyObject *__pyx_n_s_memory_avail;
static PyObject *__pyx_n_s_memory_limited;
static PyObject *__pyx_n_s_merge_distr_patch;
static PyObject *__pyx_n_s_merge_mirrored;
static PyObject *__pyx_n_s_message;
static PyObject *__pyx_n_s_mhi;
static PyObject *__pyx_n_s_mhi_nd;
static PyObject *__pyx_n_s_min;
static PyObject *__pyx_n_s_miniga4py_ga;
static PyObject *__pyx_kp_s_miniga4py_ga_pyx;
static PyObject *__pyx_n_s_mlo;
static PyObject *__pyx_n_s_mlo_nd;
static PyObject *__pyx_n_s_mutex;
static PyObject *__pyx_n_s_n;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_nbacc;
static PyObject *__pyx_n_s_nbget;
static PyObject *__pyx_n_s_nbhandle;
static PyObject *__pyx_n_s_nblock;
static PyObject *__pyx_n_s_nblock_nd;
static PyObject *__pyx_n_s_nbput;
static PyObject *__pyx_n_s_nbwait;
static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
static PyObject *__pyx_n_s_ndim;
static PyObject *__pyx_n_s_nm;
static PyObject *__pyx_n_s_nnodes;
static PyObject *__pyx_n_s_node;
static PyObject *__pyx_n_s_nodeid;
static PyObject *__pyx_n_s_norm1;
static PyObject *__pyx_n_s_norm_infinity;
static PyObject *__pyx_n_s_np;
static PyObject *__pyx_n_s_np_guess;
static PyObject *__pyx_n_s_np_result;
static PyObject *__pyx_n_s_num;
static PyObject *__pyx_n_s_num_blocks;
static PyObject *__pyx_n_s_num_group;
static PyObject *__pyx_n_s_number;
static PyObject *__pyx_n_s_numpy;
static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
static PyObject *__pyx_n_s_ones;
static PyObject *__pyx_n_s_op;
static PyObject *__pyx_n_s_pack;
static PyObject *__pyx_n_s_pdcv;
static PyObject *__pyx_n_s_periodic_acc;
static PyObject *__pyx_n_s_periodic_get;
static PyObject *__pyx_n_s_periodic_put;
static PyObject *__pyx_n_s_pfcv;
static PyObject *__pyx_n_s_pgroup;
static PyObject *__pyx_n_s_pgroup_absolute_id;
static PyObject *__pyx_n_s_pgroup_brdcst;
static PyObject *__pyx_n_s_pgroup_create;
static PyObject *__pyx_n_s_pgroup_destroy;
static PyObject *__pyx_n_s_pgroup_get_default;
static PyObject *__pyx_n_s_pgroup_get_mirror;
static PyObject *__pyx_n_s_pgroup_get_world;
static PyObject *__pyx_n_s_pgroup_gop;
static PyObject *__pyx_n_s_pgroup_gop_absmax;
static PyObject *__pyx_n_s_pgroup_gop_absmin;
static PyObject *__pyx_n_s_pgroup_gop_add;
static PyObject *__pyx_kp_u_pgroup_gop_line_3055;
static PyObject *__pyx_n_s_pgroup_gop_max;
static PyObject *__pyx_n_s_pgroup_gop_min;
static PyObject *__pyx_n_s_pgroup_gop_multiply;
static PyObject *__pyx_n_s_pgroup_nnodes;
static PyObject *__pyx_n_s_pgroup_nodeid;
static PyObject *__pyx_n_s_pgroup_set_default;
static PyObject *__pyx_n_s_pgroup_split;
static PyObject *__pyx_n_s_pgroup_split_irreg;
static PyObject *__pyx_n_s_pgroup_sync;
static PyObject *__pyx_n_s_pid;
static PyObject *__pyx_n_s_pretty;
static PyObject *__pyx_n_s_print_distribution;
static PyObject *__pyx_n_s_print_file;
static PyObject *__pyx_n_s_print_patch;
static PyObject *__pyx_n_s_print_stats;
static PyObject *__pyx_n_s_print_stdout;
static PyObject *__pyx_n_s_proc;
static PyObject *__pyx_n_s_proc_grid;
static PyObject *__pyx_n_s_proc_grid_nd;
static PyObject *__pyx_n_s_proc_topology;
static PyObject *__pyx_n_s_procs;
static PyObject *__pyx_n_s_prod;
static PyObject *__pyx_n_s_ptr;
static PyObject *__pyx_n_s_put;
static PyObject *__pyx_n_s_randomize;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_read_inc;
static PyObject *__pyx_n_s_real;
static PyObject *__pyx_n_s_recip;
static PyObject *__pyx_n_s_register;
static PyObject *__pyx_n_s_register_dtype;
static PyObject *__pyx_n_s_register_type;
static PyObject *__pyx_n_s_release;
static PyObject *__pyx_n_s_release_block;
static PyObject *__pyx_n_s_release_block_grid;
static PyObject *__pyx_n_s_release_block_segment;
static PyObject *__pyx_n_s_release_ghost_element;
static PyObject *__pyx_n_s_release_ghosts;
static PyObject *__pyx_n_s_release_update;
static PyObject *__pyx_n_s_release_update_block;
static PyObject *__pyx_n_s_release_update_block_grid;
static PyObject *__pyx_n_s_release_update_block_segment;
static PyObject *__pyx_n_s_release_update_ghost_element;
static PyObject *__pyx_n_s_release_update_ghosts;
static PyObject *__pyx_n_s_reshape;
static PyObject *__pyx_n_s_result;
static PyObject *__pyx_n_s_root;
static PyObject *__pyx_n_s_s;
static PyObject *__pyx_n_s_scale;
static PyObject *__pyx_n_s_scale_cols;
static PyObject *__pyx_n_s_scale_rows;
static PyObject *__pyx_n_s_scan_add;
static PyObject *__pyx_n_s_scan_copy;
static PyObject *__pyx_n_s_scatter;
static PyObject *__pyx_n_s_scatter_acc;
static PyObject *__pyx_n_s_select_elem;
static PyObject *__pyx_n_s_select_elem_max;
static PyObject *__pyx_n_s_select_elem_min;
static PyObject *__pyx_n_s_set_array_name;
static PyObject *__pyx_n_s_set_block_cyclic;
static PyObject *__pyx_n_s_set_block_cyclic_proc_grid;
static PyObject *__pyx_n_s_set_chunk;
static PyObject *__pyx_n_s_set_data;
static PyObject *__pyx_n_s_set_debug;
static PyObject *__pyx_n_s_set_diagonal;
static PyObject *__pyx_n_s_set_ghosts;
static PyObject *__pyx_n_s_set_irreg_distr;
static PyObject *__pyx_n_s_set_memory_limit;
static PyObject *__pyx_n_s_set_pgroup;
static PyObject *__pyx_n_s_set_restricted;
static PyObject *__pyx_n_s_set_restricted_range;
static PyObject *__pyx_n_s_shift_diagoal;
static PyObject *__pyx_n_s_single;
static PyObject *__pyx_n_s_size;
static PyObject *__pyx_n_s_skip;
static PyObject *__pyx_n_s_slices;
static PyObject *__pyx_n_s_solve;
static PyObject *__pyx_n_s_sometrue;
static PyObject *__pyx_n_s_spd_invert;
static PyObject *__pyx_n_s_start;
static PyObject *__pyx_n_s_step;
static PyObject *__pyx_n_s_step_max;
static PyObject *__pyx_n_s_strided_acc;
static PyObject *__pyx_n_s_strided_get;
static PyObject *__pyx_n_s_strided_put;
static PyObject *__pyx_n_s_strides;
static PyObject *__pyx_n_s_subsarray;
static PyObject *__pyx_n_s_subsarray1_nd;
static PyObject *__pyx_n_s_subsarray2_nd;
static PyObject *__pyx_kp_s_subsarray_must_be_either_1_or_2;
static PyObject *__pyx_n_s_subscript;
static PyObject *__pyx_n_s_subscript_nd;
static PyObject *__pyx_n_s_summarize;
static PyObject *__pyx_n_s_symmetrize;
static PyObject *__pyx_n_s_sync;
static PyObject *__pyx_n_s_sys;
static PyObject *__pyx_n_s_ta;
static PyObject *__pyx_n_s_ta_c;
static PyObject *__pyx_n_s_ta_char;
static PyObject *__pyx_n_s_tb;
static PyObject *__pyx_n_s_tb_c;
static PyObject *__pyx_n_s_tb_char;
static PyObject *__pyx_n_s_terminate;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_kp_s_the_buffer_must_be_contiguous;
static PyObject *__pyx_n_s_to_dtype;
static PyObject *__pyx_n_s_total_blocks;
static PyObject *__pyx_n_s_trans;
static PyObject *__pyx_n_s_trans_c;
static PyObject *__pyx_n_s_transa;
static PyObject *__pyx_n_s_transb;
static PyObject *__pyx_n_s_transpose;
static PyObject *__pyx_n_s_type;
static PyObject *__pyx_kp_s_type_not_supported_by_ga_gop_s;
static PyObject *__pyx_kp_s_type_not_supported_by_ga_pgroup;
static PyObject *__pyx_kp_s_type_of_g_a_not_recognized;
static PyObject *__pyx_n_s_typenum;
static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
static PyObject *__pyx_n_s_unlock;
static PyObject *__pyx_n_s_unpack;
static PyObject *__pyx_n_s_update_ghost_dir;
static PyObject *__pyx_n_s_update_ghosts;
static PyObject *__pyx_kp_s_use_access_ghosts_g_a_instead;
static PyObject *__pyx_n_s_uses_ma;
static PyObject *__pyx_n_s_val;
static PyObject *__pyx_n_s_valpha;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_n_s_values;
static PyObject *__pyx_kp_s_values_must_be_contiguous;
static PyObject *__pyx_kp_s_values_must_be_one_dimensional;
static PyObject *__pyx_n_s_values_nd;
static PyObject *__pyx_kp_s_values_was_not_large_enough;
static PyObject *__pyx_n_s_vbeta;
static PyObject *__pyx_n_s_verbose;
static PyObject *__pyx_n_s_version_info;
static PyObject *__pyx_n_s_vinc;
static PyObject *__pyx_n_s_vstart;
static PyObject *__pyx_n_s_vval;
static PyObject *__pyx_n_s_vvalue;
static PyObject *__pyx_n_s_width;
static PyObject *__pyx_n_s_width_nd;
static PyObject *__pyx_n_s_wtime;
static PyObject *__pyx_n_s_x;
static PyObject *__pyx_n_s_zero;
static PyObject *__pyx_n_s_zero_diagonal;
static PyObject *__pyx_n_s_zeros;
static PyObject *__pyx_n_s_zip;
static PyObject *__pyx_pf_9miniga4py_2ga_b(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_2s(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_4isstr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_6isstr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_8isbytes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_10b(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_12s(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_14dtype(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_gatype); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_16inquire_dtype(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_18zip(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_20abs_value(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_22acc(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_buffer, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, PyObject *__pyx_v_alpha); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_24access(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, int __pyx_v_proc); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_26access_block(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_idx); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_28access_block_grid(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED int __pyx_v_g_a, CYTHON_UNUSED PyObject *__pyx_v_subscript); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_30access_block_segment(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_proc); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_32access_ghost_element(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED int __pyx_v_g_a, CYTHON_UNUSED PyObject *__pyx_v_subscript); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_34access_ghosts(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_36add(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b, int __pyx_v_g_c, PyObject *__pyx_v_alpha, PyObject *__pyx_v_beta, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi, PyObject *__pyx_v_clo, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_38add_constant(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_alpha, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_40add_diagonal(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_v); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_42allocate(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_44brdcst(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, int __pyx_v_root); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_46check_handle(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_message); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_48cluster_nnodes(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_50cluster_nodeid(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_proc); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_52cluster_proc_nodeid(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_proc); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_54cluster_nprocs(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_node); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_56cluster_procid(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_node, int __pyx_v_proc); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_58compare_distr(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_60copy(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi, int __pyx_v_trans); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_62create(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_gtype, PyObject *__pyx_v_dims, PyObject *__pyx_v_name, PyObject *__pyx_v_chunk, int __pyx_v_pgroup); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_64create_ghosts(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_gtype, PyObject *__pyx_v_dims, PyObject *__pyx_v_width, PyObject *__pyx_v_name, PyObject *__pyx_v_chunk, int __pyx_v_pgroup); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_66create_handle(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_68create_irreg(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_gtype, PyObject *__pyx_v_dims, PyObject *__pyx_v_block, PyObject *__pyx_v_map, PyObject *__pyx_v_name, int __pyx_v_pgroup); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_70create_ghosts_irreg(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_gtype, PyObject *__pyx_v_dims, PyObject *__pyx_v_width, PyObject *__pyx_v_block, PyObject *__pyx_v_map, PyObject *__pyx_v_name, int __pyx_v_pgroup); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_72create_mutexes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_number); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_74deregister_type(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_type); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_76destroy(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_78destroy_mutexes(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_80diag(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_s, int __pyx_v_g_v, PyObject *__pyx_v_evalues); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_82diag_reuse(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_control, int __pyx_v_g_a, int __pyx_v_g_s, int __pyx_v_g_v, PyObject *__pyx_v_evalues); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_84diag_std(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_v, PyObject *__pyx_v_evalues); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_86distribution(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_proc); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_88dot(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi, int __pyx_v_ta, int __pyx_v_tb); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_90duplicate(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_92elem_divide(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b, int __pyx_v_g_c, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi, PyObject *__pyx_v_clo, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_94elem_maximum(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b, int __pyx_v_g_c, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi, PyObject *__pyx_v_clo, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_96elem_minimum(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b, int __pyx_v_g_c, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi, PyObject *__pyx_v_clo, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_98elem_multiply(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b, int __pyx_v_g_c, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi, PyObject *__pyx_v_clo, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_100error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_message, int __pyx_v_code); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_102fence(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_104fill(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_value, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_106gather(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_subsarray, PyArrayObject *__pyx_v_values); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_108gemm(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_ta, int __pyx_v_tb, int64_t __pyx_v_m, int64_t __pyx_v_n, int64_t __pyx_v_k, PyObject *__pyx_v_alpha, int __pyx_v_g_a, int __pyx_v_g_b, PyObject *__pyx_v_beta, int __pyx_v_g_c); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_110get(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, PyArrayObject *__pyx_v_buffer); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_112get_block_info(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_114get_diag(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_v); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_116get_debug(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_118gop(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_op); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_120gop_add(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_122gop_multiply(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_124gop_max(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_126gop_min(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_128gop_absmax(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_130gop_absmin(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_132has_ghosts(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_134init_fence(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_136initialize(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_138initialize_ltd(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_limit); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_140initialized(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_142inquire(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_144inquire_dims(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_146inquire_memory(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_148inquire_name(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_150inquire_type(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_152is_mirrored(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_154llt_solve(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_156locate(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_subscript); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_158locate_nnodes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_160locate_region(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_162lock(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_mutex); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_164lu_solve(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b, int __pyx_v_trans); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_166mask_sync(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_first, int __pyx_v_last); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_168matmul_patch(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transa, int __pyx_v_transb, PyObject *__pyx_v_alpha, PyObject *__pyx_v_beta, int __pyx_v_g_a, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, int __pyx_v_g_b, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi, int __pyx_v_g_c, PyObject *__pyx_v_clo, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_170median(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b, int __pyx_v_g_c, int __pyx_v_g_m, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi, PyObject *__pyx_v_clo, PyObject *__pyx_v_chi, PyObject *__pyx_v_mlo, PyObject *__pyx_v_mhi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_172memory_avail(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_174memory_limited(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_176merge_distr_patch(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, int __pyx_v_g_b, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_178merge_mirrored(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_180nbacc(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_buffer, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, PyObject *__pyx_v_alpha); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_182nbget(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, PyArrayObject *__pyx_v_buffer); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_184nblock(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_186nbput(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_buffer, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_188nbwait(CYTHON_UNUSED PyObject *__pyx_self, ga_nbhdl_t __pyx_v_nbhandle); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_190ndim(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_192nnodes(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_194nodeid(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_196norm1(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_198norm_infinity(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_200enum(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, PyObject *__pyx_v_start, PyObject *__pyx_v_inc); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_202pack(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_src, int __pyx_v_g_dst, int __pyx_v_g_msk, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_204periodic_acc(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_buffer, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, PyObject *__pyx_v_alpha); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_206periodic_get(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, PyArrayObject *__pyx_v_buffer); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_208periodic_put(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_buffer, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_210pgroup_absolute_id(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, int __pyx_v_pid); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_212pgroup_brdcst(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, PyObject *__pyx_v_buffer, int __pyx_v_root); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_214pgroup_create(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_list); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_216pgroup_destroy(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_218pgroup_get_default(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_220pgroup_get_mirror(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_222pgroup_get_world(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_224pgroup_gop(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, PyObject *__pyx_v_X, PyObject *__pyx_v_op); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_226pgroup_gop_add(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, PyObject *__pyx_v_X); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_228pgroup_gop_multiply(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, PyObject *__pyx_v_X); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_230pgroup_gop_max(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, PyObject *__pyx_v_X); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_232pgroup_gop_min(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, PyObject *__pyx_v_X); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_234pgroup_gop_absmax(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, PyObject *__pyx_v_X); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_236pgroup_gop_absmin(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, PyObject *__pyx_v_X); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_238pgroup_nnodes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_240pgroup_nodeid(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_242pgroup_set_default(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_244pgroup_split(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, int __pyx_v_num_group); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_246pgroup_split_irreg(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, int __pyx_v_color); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_248pgroup_sync(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_250print_distribution(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_252print_file(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED int __pyx_v_g_a, CYTHON_UNUSED PyObject *__pyx_v_file); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_254print_patch(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, int __pyx_v_pretty); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_256print_stats(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_258print_stdout(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_260proc_topology(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_proc); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_262put(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_buffer, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_264randomize(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_val); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_266read_inc(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_subscript, long __pyx_v_inc); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_268register_dtype(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dtype); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_270register_type(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_bytes); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_272recip(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_274release(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_276release_block(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_index); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_278release_block_grid(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_subscript); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_280release_block_segment(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_proc); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_282release_ghost_element(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_subscript); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_284release_ghosts(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_286release_update(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_288release_update_block(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_index); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_290release_update_block_grid(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_subscript); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_292release_update_block_segment(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_proc); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_294release_update_ghost_element(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_subscript); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_296release_update_ghosts(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_298scale(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_value, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_300scale_rows(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_v); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_302scale_cols(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_v); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_304scan_add(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_src, int __pyx_v_g_dst, int __pyx_v_g_msk, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, int __pyx_v_excl); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_306scan_copy(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_src, int __pyx_v_g_dst, int __pyx_v_g_msk, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_308scatter(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_values, PyObject *__pyx_v_subsarray); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_310scatter_acc(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_values, PyObject *__pyx_v_subsarray, PyObject *__pyx_v_alpha); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_312select_elem(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_op); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_314select_elem_min(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_316select_elem_max(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_318set_array_name(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_320set_block_cyclic(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_dims); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_322set_block_cyclic_proc_grid(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_block, PyObject *__pyx_v_proc_grid); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_324set_chunk(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_chunk); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_326set_data(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_dims, int __pyx_v_type); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_328set_debug(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_debug); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_330set_diagonal(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_v); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_332set_ghosts(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_width); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_334set_irreg_distr(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_mapc, PyObject *__pyx_v_nblock); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_336set_memory_limit(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_limit); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_338set_pgroup(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_pgroup); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_340set_restricted(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_list); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_342set_restricted_range(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_lo_proc, int __pyx_v_hi_proc); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_344shift_diagoal(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_346solve(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_348spd_invert(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_350step_max(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_352strided_acc(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_buffer, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, PyObject *__pyx_v_skip, PyObject *__pyx_v_alpha); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_354strided_get(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, PyObject *__pyx_v_skip, PyArrayObject *__pyx_v_buffer); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_356strided_put(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_buffer, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, PyObject *__pyx_v_skip); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_358summarize(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_verbose); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_360symmetrize(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_362sync(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_364terminate(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_366total_blocks(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_368transpose(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_370unlock(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_mutex); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_372unpack(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_src, int __pyx_v_g_dst, int __pyx_v_g_msk, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_374update_ghosts(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_376update_ghost_dir(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_dimension, int __pyx_v_dir, int __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_378uses_ma(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_380wtime(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_382zero(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi); /* proto */
static PyObject *__pyx_pf_9miniga4py_2ga_384zero_diagonal(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a); /* proto */
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_5;
static PyObject *__pyx_int_6;
static PyObject *__pyx_int_7;
static PyObject *__pyx_int_8;
static PyObject *__pyx_int_9;
static PyObject *__pyx_int_10;
static PyObject *__pyx_int_11;
static PyObject *__pyx_int_12;
static PyObject *__pyx_int_13;
static PyObject *__pyx_int_14;
static PyObject *__pyx_int_15;
static PyObject *__pyx_int_16;
static PyObject *__pyx_int_1000;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_slice__4;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_slice__20;
static PyObject *__pyx_slice__24;
static PyObject *__pyx_slice__25;
static PyObject *__pyx_slice__29;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__50;
static PyObject *__pyx_tuple__52;
static PyObject *__pyx_tuple__54;
static PyObject *__pyx_tuple__56;
static PyObject *__pyx_tuple__58;
static PyObject *__pyx_tuple__60;
static PyObject *__pyx_tuple__62;
static PyObject *__pyx_tuple__64;
static PyObject *__pyx_tuple__66;
static PyObject *__pyx_tuple__68;
static PyObject *__pyx_tuple__70;
static PyObject *__pyx_tuple__72;
static PyObject *__pyx_tuple__74;
static PyObject *__pyx_tuple__76;
static PyObject *__pyx_tuple__78;
static PyObject *__pyx_tuple__80;
static PyObject *__pyx_tuple__82;
static PyObject *__pyx_tuple__84;
static PyObject *__pyx_tuple__86;
static PyObject *__pyx_tuple__88;
static PyObject *__pyx_tuple__90;
static PyObject *__pyx_tuple__92;
static PyObject *__pyx_tuple__94;
static PyObject *__pyx_tuple__96;
static PyObject *__pyx_tuple__99;
static PyObject *__pyx_tuple__101;
static PyObject *__pyx_tuple__103;
static PyObject *__pyx_tuple__105;
static PyObject *__pyx_tuple__107;
static PyObject *__pyx_tuple__109;
static PyObject *__pyx_tuple__111;
static PyObject *__pyx_tuple__113;
static PyObject *__pyx_tuple__116;
static PyObject *__pyx_tuple__118;
static PyObject *__pyx_tuple__120;
static PyObject *__pyx_tuple__122;
static PyObject *__pyx_tuple__124;
static PyObject *__pyx_tuple__127;
static PyObject *__pyx_tuple__129;
static PyObject *__pyx_tuple__131;
static PyObject *__pyx_tuple__133;
static PyObject *__pyx_tuple__135;
static PyObject *__pyx_tuple__137;
static PyObject *__pyx_tuple__139;
static PyObject *__pyx_tuple__141;
static PyObject *__pyx_tuple__143;
static PyObject *__pyx_tuple__145;
static PyObject *__pyx_tuple__148;
static PyObject *__pyx_tuple__150;
static PyObject *__pyx_tuple__152;
static PyObject *__pyx_tuple__154;
static PyObject *__pyx_tuple__156;
static PyObject *__pyx_tuple__158;
static PyObject *__pyx_tuple__161;
static PyObject *__pyx_tuple__163;
static PyObject *__pyx_tuple__165;
static PyObject *__pyx_tuple__167;
static PyObject *__pyx_tuple__169;
static PyObject *__pyx_tuple__171;
static PyObject *__pyx_tuple__173;
static PyObject *__pyx_tuple__175;
static PyObject *__pyx_tuple__178;
static PyObject *__pyx_tuple__180;
static PyObject *__pyx_tuple__184;
static PyObject *__pyx_tuple__186;
static PyObject *__pyx_tuple__188;
static PyObject *__pyx_tuple__190;
static PyObject *__pyx_tuple__192;
static PyObject *__pyx_tuple__194;
static PyObject *__pyx_tuple__196;
static PyObject *__pyx_tuple__198;
static PyObject *__pyx_tuple__200;
static PyObject *__pyx_tuple__202;
static PyObject *__pyx_tuple__204;
static PyObject *__pyx_tuple__208;
static PyObject *__pyx_tuple__210;
static PyObject *__pyx_tuple__212;
static PyObject *__pyx_tuple__214;
static PyObject *__pyx_tuple__216;
static PyObject *__pyx_tuple__218;
static PyObject *__pyx_tuple__220;
static PyObject *__pyx_tuple__222;
static PyObject *__pyx_tuple__226;
static PyObject *__pyx_tuple__228;
static PyObject *__pyx_tuple__230;
static PyObject *__pyx_tuple__232;
static PyObject *__pyx_tuple__234;
static PyObject *__pyx_tuple__236;
static PyObject *__pyx_tuple__238;
static PyObject *__pyx_tuple__240;
static PyObject *__pyx_tuple__242;
static PyObject *__pyx_tuple__244;
static PyObject *__pyx_tuple__246;
static PyObject *__pyx_tuple__251;
static PyObject *__pyx_tuple__253;
static PyObject *__pyx_tuple__255;
static PyObject *__pyx_tuple__257;
static PyObject *__pyx_tuple__259;
static PyObject *__pyx_tuple__261;
static PyObject *__pyx_tuple__263;
static PyObject *__pyx_tuple__265;
static PyObject *__pyx_tuple__267;
static PyObject *__pyx_tuple__269;
static PyObject *__pyx_tuple__271;
static PyObject *__pyx_tuple__273;
static PyObject *__pyx_tuple__275;
static PyObject *__pyx_tuple__277;
static PyObject *__pyx_tuple__279;
static PyObject *__pyx_tuple__281;
static PyObject *__pyx_tuple__284;
static PyObject *__pyx_tuple__286;
static PyObject *__pyx_tuple__288;
static PyObject *__pyx_tuple__290;
static PyObject *__pyx_tuple__292;
static PyObject *__pyx_tuple__294;
static PyObject *__pyx_tuple__296;
static PyObject *__pyx_tuple__298;
static PyObject *__pyx_tuple__300;
static PyObject *__pyx_tuple__302;
static PyObject *__pyx_tuple__304;
static PyObject *__pyx_tuple__306;
static PyObject *__pyx_tuple__308;
static PyObject *__pyx_tuple__310;
static PyObject *__pyx_tuple__312;
static PyObject *__pyx_tuple__314;
static PyObject *__pyx_tuple__316;
static PyObject *__pyx_tuple__318;
static PyObject *__pyx_tuple__320;
static PyObject *__pyx_tuple__322;
static PyObject *__pyx_tuple__324;
static PyObject *__pyx_tuple__326;
static PyObject *__pyx_tuple__328;
static PyObject *__pyx_tuple__330;
static PyObject *__pyx_tuple__332;
static PyObject *__pyx_tuple__334;
static PyObject *__pyx_tuple__336;
static PyObject *__pyx_tuple__338;
static PyObject *__pyx_tuple__340;
static PyObject *__pyx_tuple__342;
static PyObject *__pyx_tuple__344;
static PyObject *__pyx_tuple__346;
static PyObject *__pyx_tuple__348;
static PyObject *__pyx_tuple__350;
static PyObject *__pyx_tuple__352;
static PyObject *__pyx_tuple__354;
static PyObject *__pyx_tuple__356;
static PyObject *__pyx_tuple__358;
static PyObject *__pyx_tuple__360;
static PyObject *__pyx_tuple__362;
static PyObject *__pyx_tuple__364;
static PyObject *__pyx_tuple__366;
static PyObject *__pyx_tuple__368;
static PyObject *__pyx_tuple__370;
static PyObject *__pyx_tuple__372;
static PyObject *__pyx_tuple__374;
static PyObject *__pyx_tuple__376;
static PyObject *__pyx_tuple__378;
static PyObject *__pyx_tuple__380;
static PyObject *__pyx_tuple__382;
static PyObject *__pyx_tuple__384;
static PyObject *__pyx_tuple__386;
static PyObject *__pyx_tuple__390;
static PyObject *__pyx_tuple__392;
static PyObject *__pyx_tuple__394;
static PyObject *__pyx_tuple__396;
static PyObject *__pyx_tuple__398;
static PyObject *__pyx_tuple__400;
static PyObject *__pyx_tuple__404;
static PyObject *__pyx_tuple__406;
static PyObject *__pyx_codeobj__51;
static PyObject *__pyx_codeobj__53;
static PyObject *__pyx_codeobj__55;
static PyObject *__pyx_codeobj__57;
static PyObject *__pyx_codeobj__59;
static PyObject *__pyx_codeobj__61;
static PyObject *__pyx_codeobj__63;
static PyObject *__pyx_codeobj__65;
static PyObject *__pyx_codeobj__67;
static PyObject *__pyx_codeobj__69;
static PyObject *__pyx_codeobj__71;
static PyObject *__pyx_codeobj__73;
static PyObject *__pyx_codeobj__75;
static PyObject *__pyx_codeobj__77;
static PyObject *__pyx_codeobj__79;
static PyObject *__pyx_codeobj__81;
static PyObject *__pyx_codeobj__83;
static PyObject *__pyx_codeobj__85;
static PyObject *__pyx_codeobj__87;
static PyObject *__pyx_codeobj__89;
static PyObject *__pyx_codeobj__91;
static PyObject *__pyx_codeobj__93;
static PyObject *__pyx_codeobj__95;
static PyObject *__pyx_codeobj__97;
static PyObject *__pyx_codeobj__98;
static PyObject *__pyx_codeobj__100;
static PyObject *__pyx_codeobj__102;
static PyObject *__pyx_codeobj__104;
static PyObject *__pyx_codeobj__106;
static PyObject *__pyx_codeobj__108;
static PyObject *__pyx_codeobj__110;
static PyObject *__pyx_codeobj__112;
static PyObject *__pyx_codeobj__114;
static PyObject *__pyx_codeobj__115;
static PyObject *__pyx_codeobj__117;
static PyObject *__pyx_codeobj__119;
static PyObject *__pyx_codeobj__121;
static PyObject *__pyx_codeobj__123;
static PyObject *__pyx_codeobj__125;
static PyObject *__pyx_codeobj__126;
static PyObject *__pyx_codeobj__128;
static PyObject *__pyx_codeobj__130;
static PyObject *__pyx_codeobj__132;
static PyObject *__pyx_codeobj__134;
static PyObject *__pyx_codeobj__136;
static PyObject *__pyx_codeobj__138;
static PyObject *__pyx_codeobj__140;
static PyObject *__pyx_codeobj__142;
static PyObject *__pyx_codeobj__144;
static PyObject *__pyx_codeobj__146;
static PyObject *__pyx_codeobj__147;
static PyObject *__pyx_codeobj__149;
static PyObject *__pyx_codeobj__151;
static PyObject *__pyx_codeobj__153;
static PyObject *__pyx_codeobj__155;
static PyObject *__pyx_codeobj__157;
static PyObject *__pyx_codeobj__159;
static PyObject *__pyx_codeobj__160;
static PyObject *__pyx_codeobj__162;
static PyObject *__pyx_codeobj__164;
static PyObject *__pyx_codeobj__166;
static PyObject *__pyx_codeobj__168;
static PyObject *__pyx_codeobj__170;
static PyObject *__pyx_codeobj__172;
static PyObject *__pyx_codeobj__174;
static PyObject *__pyx_codeobj__176;
static PyObject *__pyx_codeobj__177;
static PyObject *__pyx_codeobj__179;
static PyObject *__pyx_codeobj__181;
static PyObject *__pyx_codeobj__182;
static PyObject *__pyx_codeobj__183;
static PyObject *__pyx_codeobj__185;
static PyObject *__pyx_codeobj__187;
static PyObject *__pyx_codeobj__189;
static PyObject *__pyx_codeobj__191;
static PyObject *__pyx_codeobj__193;
static PyObject *__pyx_codeobj__195;
static PyObject *__pyx_codeobj__197;
static PyObject *__pyx_codeobj__199;
static PyObject *__pyx_codeobj__201;
static PyObject *__pyx_codeobj__203;
static PyObject *__pyx_codeobj__205;
static PyObject *__pyx_codeobj__206;
static PyObject *__pyx_codeobj__207;
static PyObject *__pyx_codeobj__209;
static PyObject *__pyx_codeobj__211;
static PyObject *__pyx_codeobj__213;
static PyObject *__pyx_codeobj__215;
static PyObject *__pyx_codeobj__217;
static PyObject *__pyx_codeobj__219;
static PyObject *__pyx_codeobj__221;
static PyObject *__pyx_codeobj__223;
static PyObject *__pyx_codeobj__224;
static PyObject *__pyx_codeobj__225;
static PyObject *__pyx_codeobj__227;
static PyObject *__pyx_codeobj__229;
static PyObject *__pyx_codeobj__231;
static PyObject *__pyx_codeobj__233;
static PyObject *__pyx_codeobj__235;
static PyObject *__pyx_codeobj__237;
static PyObject *__pyx_codeobj__239;
static PyObject *__pyx_codeobj__241;
static PyObject *__pyx_codeobj__243;
static PyObject *__pyx_codeobj__245;
static PyObject *__pyx_codeobj__247;
static PyObject *__pyx_codeobj__248;
static PyObject *__pyx_codeobj__249;
static PyObject *__pyx_codeobj__250;
static PyObject *__pyx_codeobj__252;
static PyObject *__pyx_codeobj__254;
static PyObject *__pyx_codeobj__256;
static PyObject *__pyx_codeobj__258;
static PyObject *__pyx_codeobj__260;
static PyObject *__pyx_codeobj__262;
static PyObject *__pyx_codeobj__264;
static PyObject *__pyx_codeobj__266;
static PyObject *__pyx_codeobj__268;
static PyObject *__pyx_codeobj__270;
static PyObject *__pyx_codeobj__272;
static PyObject *__pyx_codeobj__274;
static PyObject *__pyx_codeobj__276;
static PyObject *__pyx_codeobj__278;
static PyObject *__pyx_codeobj__280;
static PyObject *__pyx_codeobj__282;
static PyObject *__pyx_codeobj__283;
static PyObject *__pyx_codeobj__285;
static PyObject *__pyx_codeobj__287;
static PyObject *__pyx_codeobj__289;
static PyObject *__pyx_codeobj__291;
static PyObject *__pyx_codeobj__293;
static PyObject *__pyx_codeobj__295;
static PyObject *__pyx_codeobj__297;
static PyObject *__pyx_codeobj__299;
static PyObject *__pyx_codeobj__301;
static PyObject *__pyx_codeobj__303;
static PyObject *__pyx_codeobj__305;
static PyObject *__pyx_codeobj__307;
static PyObject *__pyx_codeobj__309;
static PyObject *__pyx_codeobj__311;
static PyObject *__pyx_codeobj__313;
static PyObject *__pyx_codeobj__315;
static PyObject *__pyx_codeobj__317;
static PyObject *__pyx_codeobj__319;
static PyObject *__pyx_codeobj__321;
static PyObject *__pyx_codeobj__323;
static PyObject *__pyx_codeobj__325;
static PyObject *__pyx_codeobj__327;
static PyObject *__pyx_codeobj__329;
static PyObject *__pyx_codeobj__331;
static PyObject *__pyx_codeobj__333;
static PyObject *__pyx_codeobj__335;
static PyObject *__pyx_codeobj__337;
static PyObject *__pyx_codeobj__339;
static PyObject *__pyx_codeobj__341;
static PyObject *__pyx_codeobj__343;
static PyObject *__pyx_codeobj__345;
static PyObject *__pyx_codeobj__347;
static PyObject *__pyx_codeobj__349;
static PyObject *__pyx_codeobj__351;
static PyObject *__pyx_codeobj__353;
static PyObject *__pyx_codeobj__355;
static PyObject *__pyx_codeobj__357;
static PyObject *__pyx_codeobj__359;
static PyObject *__pyx_codeobj__361;
static PyObject *__pyx_codeobj__363;
static PyObject *__pyx_codeobj__365;
static PyObject *__pyx_codeobj__367;
static PyObject *__pyx_codeobj__369;
static PyObject *__pyx_codeobj__371;
static PyObject *__pyx_codeobj__373;
static PyObject *__pyx_codeobj__375;
static PyObject *__pyx_codeobj__377;
static PyObject *__pyx_codeobj__379;
static PyObject *__pyx_codeobj__381;
static PyObject *__pyx_codeobj__383;
static PyObject *__pyx_codeobj__385;
static PyObject *__pyx_codeobj__387;
static PyObject *__pyx_codeobj__388;
static PyObject *__pyx_codeobj__389;
static PyObject *__pyx_codeobj__391;
static PyObject *__pyx_codeobj__393;
static PyObject *__pyx_codeobj__395;
static PyObject *__pyx_codeobj__397;
static PyObject *__pyx_codeobj__399;
static PyObject *__pyx_codeobj__401;
static PyObject *__pyx_codeobj__402;
static PyObject *__pyx_codeobj__403;
static PyObject *__pyx_codeobj__405;
static PyObject *__pyx_codeobj__407;
/* Late includes */

/* "miniga4py/ga.pyx":25
 * 
 * if sys.version_info.major < 3:
 *     def b(x):             # <<<<<<<<<<<<<<
 *         return str(x)
 *     def s(x):
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_1b(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_9miniga4py_2ga_b[] = "b(x)";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_1b = {"b", (PyCFunction)__pyx_pw_9miniga4py_2ga_1b, METH_O, __pyx_doc_9miniga4py_2ga_b};
static PyObject *__pyx_pw_9miniga4py_2ga_1b(PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("b (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_b(__pyx_self, ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_b(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("b", 0);

  /* "miniga4py/ga.pyx":26
 * if sys.version_info.major < 3:
 *     def b(x):
 *         return str(x)             # <<<<<<<<<<<<<<
 *     def s(x):
 *         return str(x)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":25
 * 
 * if sys.version_info.major < 3:
 *     def b(x):             # <<<<<<<<<<<<<<
 *         return str(x)
 *     def s(x):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.b", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":27
 *     def b(x):
 *         return str(x)
 *     def s(x):             # <<<<<<<<<<<<<<
 *         return str(x)
 *     def isstr(s):
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_3s(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_9miniga4py_2ga_2s[] = "s(x)";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_3s = {"s", (PyCFunction)__pyx_pw_9miniga4py_2ga_3s, METH_O, __pyx_doc_9miniga4py_2ga_2s};
static PyObject *__pyx_pw_9miniga4py_2ga_3s(PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("s (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_2s(__pyx_self, ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_2s(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("s", 0);

  /* "miniga4py/ga.pyx":28
 *         return str(x)
 *     def s(x):
 *         return str(x)             # <<<<<<<<<<<<<<
 *     def isstr(s):
 *         return isinstance(s, basestring)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":27
 *     def b(x):
 *         return str(x)
 *     def s(x):             # <<<<<<<<<<<<<<
 *         return str(x)
 *     def isstr(s):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.s", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":29
 *     def s(x):
 *         return str(x)
 *     def isstr(s):             # <<<<<<<<<<<<<<
 *         return isinstance(s, basestring)
 * else:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_5isstr(PyObject *__pyx_self, PyObject *__pyx_v_s); /*proto*/
static char __pyx_doc_9miniga4py_2ga_4isstr[] = "isstr(s)";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_5isstr = {"isstr", (PyCFunction)__pyx_pw_9miniga4py_2ga_5isstr, METH_O, __pyx_doc_9miniga4py_2ga_4isstr};
static PyObject *__pyx_pw_9miniga4py_2ga_5isstr(PyObject *__pyx_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isstr (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_4isstr(__pyx_self, ((PyObject *)__pyx_v_s));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_4isstr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("isstr", 0);

  /* "miniga4py/ga.pyx":30
 *         return str(x)
 *     def isstr(s):
 *         return isinstance(s, basestring)             # <<<<<<<<<<<<<<
 * else:
 *     import codecs
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBaseString_Check(__pyx_v_s); 
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":29
 *     def s(x):
 *         return str(x)
 *     def isstr(s):             # <<<<<<<<<<<<<<
 *         return isinstance(s, basestring)
 * else:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("miniga4py.ga.isstr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":33
 * else:
 *     import codecs
 *     def isstr(s):             # <<<<<<<<<<<<<<
 *         return isinstance(s, str)
 *     def isbytes(s):
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_7isstr(PyObject *__pyx_self, PyObject *__pyx_v_s); /*proto*/
static char __pyx_doc_9miniga4py_2ga_6isstr[] = "isstr(s)";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_7isstr = {"isstr", (PyCFunction)__pyx_pw_9miniga4py_2ga_7isstr, METH_O, __pyx_doc_9miniga4py_2ga_6isstr};
static PyObject *__pyx_pw_9miniga4py_2ga_7isstr(PyObject *__pyx_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isstr (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_6isstr(__pyx_self, ((PyObject *)__pyx_v_s));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_6isstr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("isstr", 0);

  /* "miniga4py/ga.pyx":34
 *     import codecs
 *     def isstr(s):
 *         return isinstance(s, str)             # <<<<<<<<<<<<<<
 *     def isbytes(s):
 *         return isinstance(s, (bytes, bytearray))
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyString_Check(__pyx_v_s); 
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":33
 * else:
 *     import codecs
 *     def isstr(s):             # <<<<<<<<<<<<<<
 *         return isinstance(s, str)
 *     def isbytes(s):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("miniga4py.ga.isstr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":35
 *     def isstr(s):
 *         return isinstance(s, str)
 *     def isbytes(s):             # <<<<<<<<<<<<<<
 *         return isinstance(s, (bytes, bytearray))
 *     def b(x):
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_9isbytes(PyObject *__pyx_self, PyObject *__pyx_v_s); /*proto*/
static char __pyx_doc_9miniga4py_2ga_8isbytes[] = "isbytes(s)";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_9isbytes = {"isbytes", (PyCFunction)__pyx_pw_9miniga4py_2ga_9isbytes, METH_O, __pyx_doc_9miniga4py_2ga_8isbytes};
static PyObject *__pyx_pw_9miniga4py_2ga_9isbytes(PyObject *__pyx_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isbytes (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_8isbytes(__pyx_self, ((PyObject *)__pyx_v_s));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_8isbytes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("isbytes", 0);

  /* "miniga4py/ga.pyx":36
 *         return isinstance(s, str)
 *     def isbytes(s):
 *         return isinstance(s, (bytes, bytearray))             # <<<<<<<<<<<<<<
 *     def b(x):
 *         if isstr(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyBytes_Check(__pyx_v_s); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_3 = PyByteArray_Check(__pyx_v_s); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L3_bool_binop_done:;
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":35
 *     def isstr(s):
 *         return isinstance(s, str)
 *     def isbytes(s):             # <<<<<<<<<<<<<<
 *         return isinstance(s, (bytes, bytearray))
 *     def b(x):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("miniga4py.ga.isbytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":37
 *     def isbytes(s):
 *         return isinstance(s, (bytes, bytearray))
 *     def b(x):             # <<<<<<<<<<<<<<
 *         if isstr(x):
 *             return codecs.latin_1_encode(str(x))[0]
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_11b(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_9miniga4py_2ga_10b[] = "b(x)";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_11b = {"b", (PyCFunction)__pyx_pw_9miniga4py_2ga_11b, METH_O, __pyx_doc_9miniga4py_2ga_10b};
static PyObject *__pyx_pw_9miniga4py_2ga_11b(PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("b (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_10b(__pyx_self, ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_10b(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("b", 0);

  /* "miniga4py/ga.pyx":38
 *         return isinstance(s, (bytes, bytearray))
 *     def b(x):
 *         if isstr(x):             # <<<<<<<<<<<<<<
 *             return codecs.latin_1_encode(str(x))[0]
 *         else:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_isstr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_x};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_x};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_x);
      __Pyx_GIVEREF(__pyx_v_x);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_x);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "miniga4py/ga.pyx":39
 *     def b(x):
 *         if isstr(x):
 *             return codecs.latin_1_encode(str(x))[0]             # <<<<<<<<<<<<<<
 *         else:
 *             return x
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_codecs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_latin_1_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_2};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_2};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":38
 *         return isinstance(s, (bytes, bytearray))
 *     def b(x):
 *         if isstr(x):             # <<<<<<<<<<<<<<
 *             return codecs.latin_1_encode(str(x))[0]
 *         else:
 */
  }

  /* "miniga4py/ga.pyx":41
 *             return codecs.latin_1_encode(str(x))[0]
 *         else:
 *             return x             # <<<<<<<<<<<<<<
 *     def s(x):
 *         if isbytes(x):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_x);
    __pyx_r = __pyx_v_x;
    goto __pyx_L0;
  }

  /* "miniga4py/ga.pyx":37
 *     def isbytes(s):
 *         return isinstance(s, (bytes, bytearray))
 *     def b(x):             # <<<<<<<<<<<<<<
 *         if isstr(x):
 *             return codecs.latin_1_encode(str(x))[0]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("miniga4py.ga.b", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":42
 *         else:
 *             return x
 *     def s(x):             # <<<<<<<<<<<<<<
 *         if isbytes(x):
 *             return codecs.latin_1_decode(x)[0]
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_13s(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_9miniga4py_2ga_12s[] = "s(x)";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_13s = {"s", (PyCFunction)__pyx_pw_9miniga4py_2ga_13s, METH_O, __pyx_doc_9miniga4py_2ga_12s};
static PyObject *__pyx_pw_9miniga4py_2ga_13s(PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("s (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_12s(__pyx_self, ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_12s(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("s", 0);

  /* "miniga4py/ga.pyx":43
 *             return x
 *     def s(x):
 *         if isbytes(x):             # <<<<<<<<<<<<<<
 *             return codecs.latin_1_decode(x)[0]
 *         else:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_isbytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_x};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_x};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_x);
      __Pyx_GIVEREF(__pyx_v_x);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_x);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "miniga4py/ga.pyx":44
 *     def s(x):
 *         if isbytes(x):
 *             return codecs.latin_1_decode(x)[0]             # <<<<<<<<<<<<<<
 *         else:
 *             return x
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_codecs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_latin_1_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_2) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_x};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_x};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
        __Pyx_INCREF(__pyx_v_x);
        __Pyx_GIVEREF(__pyx_v_x);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_x);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":43
 *             return x
 *     def s(x):
 *         if isbytes(x):             # <<<<<<<<<<<<<<
 *             return codecs.latin_1_decode(x)[0]
 *         else:
 */
  }

  /* "miniga4py/ga.pyx":46
 *             return codecs.latin_1_decode(x)[0]
 *         else:
 *             return x             # <<<<<<<<<<<<<<
 * 
 * DEF EXCLUSIVE = 0
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_x);
    __pyx_r = __pyx_v_x;
    goto __pyx_L0;
  }

  /* "miniga4py/ga.pyx":42
 *         else:
 *             return x
 *     def s(x):             # <<<<<<<<<<<<<<
 *         if isbytes(x):
 *             return codecs.latin_1_decode(x)[0]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("miniga4py.ga.s", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":107
 * #############################################################################
 * 
 * def dtype(int gatype):             # <<<<<<<<<<<<<<
 *     """Converts the given GA type to a numpy dtype."""
 *     if gatype in _to_dtype:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_15dtype(PyObject *__pyx_self, PyObject *__pyx_arg_gatype); /*proto*/
static char __pyx_doc_9miniga4py_2ga_14dtype[] = "dtype(int gatype)\nConverts the given GA type to a numpy dtype.";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_15dtype = {"dtype", (PyCFunction)__pyx_pw_9miniga4py_2ga_15dtype, METH_O, __pyx_doc_9miniga4py_2ga_14dtype};
static PyObject *__pyx_pw_9miniga4py_2ga_15dtype(PyObject *__pyx_self, PyObject *__pyx_arg_gatype) {
  int __pyx_v_gatype;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dtype (wrapper)", 0);
  assert(__pyx_arg_gatype); {
    __pyx_v_gatype = __Pyx_PyInt_As_int(__pyx_arg_gatype); if (unlikely((__pyx_v_gatype == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.dtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_14dtype(__pyx_self, ((int)__pyx_v_gatype));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_14dtype(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_gatype) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("dtype", 0);

  /* "miniga4py/ga.pyx":109
 * def dtype(int gatype):
 *     """Converts the given GA type to a numpy dtype."""
 *     if gatype in _to_dtype:             # <<<<<<<<<<<<<<
 *         return _to_dtype[gatype]
 *     raise ValueError("%d was not a recognized GA type" % gatype)
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_gatype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_to_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 109, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "miniga4py/ga.pyx":110
 *     """Converts the given GA type to a numpy dtype."""
 *     if gatype in _to_dtype:
 *         return _to_dtype[gatype]             # <<<<<<<<<<<<<<
 *     raise ValueError("%d was not a recognized GA type" % gatype)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_to_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, __pyx_v_gatype, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":109
 * def dtype(int gatype):
 *     """Converts the given GA type to a numpy dtype."""
 *     if gatype in _to_dtype:             # <<<<<<<<<<<<<<
 *         return _to_dtype[gatype]
 *     raise ValueError("%d was not a recognized GA type" % gatype)
 */
  }

  /* "miniga4py/ga.pyx":111
 *     if gatype in _to_dtype:
 *         return _to_dtype[gatype]
 *     raise ValueError("%d was not a recognized GA type" % gatype)             # <<<<<<<<<<<<<<
 * 
 * def inquire_dtype(int g_a):
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_gatype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_d_was_not_a_recognized_GA_type, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(0, 111, __pyx_L1_error)

  /* "miniga4py/ga.pyx":107
 * #############################################################################
 * 
 * def dtype(int gatype):             # <<<<<<<<<<<<<<
 *     """Converts the given GA type to a numpy dtype."""
 *     if gatype in _to_dtype:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("miniga4py.ga.dtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":113
 *     raise ValueError("%d was not a recognized GA type" % gatype)
 * 
 * def inquire_dtype(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns the numpy dtype of the given GA."""
 *     gatype = inquire_type(g_a)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_17inquire_dtype(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_16inquire_dtype[] = "inquire_dtype(int g_a)\nReturns the numpy dtype of the given GA.";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_17inquire_dtype = {"inquire_dtype", (PyCFunction)__pyx_pw_9miniga4py_2ga_17inquire_dtype, METH_O, __pyx_doc_9miniga4py_2ga_16inquire_dtype};
static PyObject *__pyx_pw_9miniga4py_2ga_17inquire_dtype(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("inquire_dtype (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.inquire_dtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_16inquire_dtype(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_16inquire_dtype(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  int __pyx_v_gatype;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("inquire_dtype", 0);

  /* "miniga4py/ga.pyx":115
 * def inquire_dtype(int g_a):
 *     """Returns the numpy dtype of the given GA."""
 *     gatype = inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     return dtype(gatype)
 * 
 */
  __pyx_v_gatype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":116
 *     """Returns the numpy dtype of the given GA."""
 *     gatype = inquire_type(g_a)
 *     return dtype(gatype)             # <<<<<<<<<<<<<<
 * 
 * cdef inline void* _gapy_malloc(size_t bytes, int align, char *name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_gatype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 116, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":113
 *     raise ValueError("%d was not a recognized GA type" % gatype)
 * 
 * def inquire_dtype(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns the numpy dtype of the given GA."""
 *     gatype = inquire_type(g_a)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("miniga4py.ga.inquire_dtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":118
 *     return dtype(gatype)
 * 
 * cdef inline void* _gapy_malloc(size_t bytes, int align, char *name):             # <<<<<<<<<<<<<<
 *     """Wrapper around C stdlib malloc()."""
 *     return malloc(bytes)
 */

static CYTHON_INLINE void *__pyx_f_9miniga4py_2ga__gapy_malloc(size_t __pyx_v_bytes, CYTHON_UNUSED int __pyx_v_align, CYTHON_UNUSED char *__pyx_v_name) {
  void *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_gapy_malloc", 0);

  /* "miniga4py/ga.pyx":120
 * cdef inline void* _gapy_malloc(size_t bytes, int align, char *name):
 *     """Wrapper around C stdlib malloc()."""
 *     return malloc(bytes)             # <<<<<<<<<<<<<<
 * 
 * cdef inline void _gapy_free(void *ptr):
 */
  __pyx_r = malloc(__pyx_v_bytes);
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":118
 *     return dtype(gatype)
 * 
 * cdef inline void* _gapy_malloc(size_t bytes, int align, char *name):             # <<<<<<<<<<<<<<
 *     """Wrapper around C stdlib malloc()."""
 *     return malloc(bytes)
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":122
 *     return malloc(bytes)
 * 
 * cdef inline void _gapy_free(void *ptr):             # <<<<<<<<<<<<<<
 *     """Wrapper around C stdlib free()."""
 *     free(ptr)
 */

static CYTHON_INLINE void __pyx_f_9miniga4py_2ga__gapy_free(void *__pyx_v_ptr) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_gapy_free", 0);

  /* "miniga4py/ga.pyx":124
 * cdef inline void _gapy_free(void *ptr):
 *     """Wrapper around C stdlib free()."""
 *     free(ptr)             # <<<<<<<<<<<<<<
 * 
 * cdef inline np.ndarray[np.int32_t, ndim=1] _inta32(array_like):
 */
  free(__pyx_v_ptr);

  /* "miniga4py/ga.pyx":122
 *     return malloc(bytes)
 * 
 * cdef inline void _gapy_free(void *ptr):             # <<<<<<<<<<<<<<
 *     """Wrapper around C stdlib free()."""
 *     free(ptr)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "miniga4py/ga.pyx":126
 *     free(ptr)
 * 
 * cdef inline np.ndarray[np.int32_t, ndim=1] _inta32(array_like):             # <<<<<<<<<<<<<<
 *     """Converts an integer array-like to an ndarray of 32bit integers.
 * 
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_9miniga4py_2ga__inta32(PyObject *__pyx_v_array_like) {
  PyArrayObject *__pyx_v_array_like_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_array_like_nd;
  __Pyx_Buffer __pyx_pybuffer_array_like_nd;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  __Pyx_RefNannySetupContext("_inta32", 0);
  __pyx_pybuffer_array_like_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_array_like_nd.refcount = 0;
  __pyx_pybuffernd_array_like_nd.data = NULL;
  __pyx_pybuffernd_array_like_nd.rcbuffer = &__pyx_pybuffer_array_like_nd;

  /* "miniga4py/ga.pyx":141
 *     """
 *     cdef np.ndarray[np.int32_t, ndim=1] array_like_nd
 *     try:             # <<<<<<<<<<<<<<
 *         array_like_nd = np.asarray(array_like, dtype=np.int32)
 *     except ValueError: # try again in case array_like is a single value
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "miniga4py/ga.pyx":142
 *     cdef np.ndarray[np.int32_t, ndim=1] array_like_nd
 *     try:
 *         array_like_nd = np.asarray(array_like, dtype=np.int32)             # <<<<<<<<<<<<<<
 *     except ValueError: # try again in case array_like is a single value
 *         array_like_nd = np.asarray([array_like], dtype=np.int32)
 */
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 142, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_array_like);
      __Pyx_GIVEREF(__pyx_v_array_like);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_array_like);
      __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 142, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 142, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_int32); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 142, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 142, __pyx_L3_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 142, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 142, __pyx_L3_error)
      __pyx_t_9 = ((PyArrayObject *)__pyx_t_8);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer);
        __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_10 < 0)) {
          PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_array_like_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          }
          __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
        }
        __pyx_pybuffernd_array_like_nd.diminfo[0].strides = __pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_array_like_nd.diminfo[0].shape = __pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 142, __pyx_L3_error)
      }
      __pyx_t_9 = 0;
      __pyx_v_array_like_nd = ((PyArrayObject *)__pyx_t_8);
      __pyx_t_8 = 0;

      /* "miniga4py/ga.pyx":141
 *     """
 *     cdef np.ndarray[np.int32_t, ndim=1] array_like_nd
 *     try:             # <<<<<<<<<<<<<<
 *         array_like_nd = np.asarray(array_like, dtype=np.int32)
 *     except ValueError: # try again in case array_like is a single value
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "miniga4py/ga.pyx":143
 *     try:
 *         array_like_nd = np.asarray(array_like, dtype=np.int32)
 *     except ValueError: # try again in case array_like is a single value             # <<<<<<<<<<<<<<
 *         array_like_nd = np.asarray([array_like], dtype=np.int32)
 *     return array_like_nd
 */
    __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_10) {
      __Pyx_AddTraceback("miniga4py.ga._inta32", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_6, &__pyx_t_4) < 0) __PYX_ERR(0, 143, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_4);

      /* "miniga4py/ga.pyx":144
 *         array_like_nd = np.asarray(array_like, dtype=np.int32)
 *     except ValueError: # try again in case array_like is a single value
 *         array_like_nd = np.asarray([array_like], dtype=np.int32)             # <<<<<<<<<<<<<<
 *     return array_like_nd
 * 
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 144, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_asarray); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 144, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 144, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_array_like);
      __Pyx_GIVEREF(__pyx_v_array_like);
      PyList_SET_ITEM(__pyx_t_5, 0, __pyx_v_array_like);
      __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 144, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 144, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 144, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_int32); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 144, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_16) < 0) __PYX_ERR(0, 144, __pyx_L5_except_error)
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_14, __pyx_t_5); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 144, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 144, __pyx_L5_except_error)
      __pyx_t_9 = ((PyArrayObject *)__pyx_t_16);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer);
        __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_10 < 0)) {
          PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_array_like_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
          }
          __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
        }
        __pyx_pybuffernd_array_like_nd.diminfo[0].strides = __pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_array_like_nd.diminfo[0].shape = __pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 144, __pyx_L5_except_error)
      }
      __pyx_t_9 = 0;
      __Pyx_XDECREF_SET(__pyx_v_array_like_nd, ((PyArrayObject *)__pyx_t_16));
      __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "miniga4py/ga.pyx":141
 *     """
 *     cdef np.ndarray[np.int32_t, ndim=1] array_like_nd
 *     try:             # <<<<<<<<<<<<<<
 *         array_like_nd = np.asarray(array_like, dtype=np.int32)
 *     except ValueError: # try again in case array_like is a single value
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L8_try_end:;
  }

  /* "miniga4py/ga.pyx":145
 *     except ValueError: # try again in case array_like is a single value
 *         array_like_nd = np.asarray([array_like], dtype=np.int32)
 *     return array_like_nd             # <<<<<<<<<<<<<<
 * 
 * cdef inline np.ndarray[np.int64_t, ndim=1] _inta64(array_like):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_array_like_nd));
  __pyx_r = ((PyArrayObject *)__pyx_v_array_like_nd);
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":126
 *     free(ptr)
 * 
 * cdef inline np.ndarray[np.int32_t, ndim=1] _inta32(array_like):             # <<<<<<<<<<<<<<
 *     """Converts an integer array-like to an ndarray of 32bit integers.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga._inta32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_array_like_nd);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":147
 *     return array_like_nd
 * 
 * cdef inline np.ndarray[np.int64_t, ndim=1] _inta64(array_like):             # <<<<<<<<<<<<<<
 *     """Converts an integer array-like to an ndarray of 64bit integers.
 * 
 */

static CYTHON_INLINE PyArrayObject *__pyx_f_9miniga4py_2ga__inta64(PyObject *__pyx_v_array_like) {
  PyArrayObject *__pyx_v_array_like_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_array_like_nd;
  __Pyx_Buffer __pyx_pybuffer_array_like_nd;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  __Pyx_RefNannySetupContext("_inta64", 0);
  __pyx_pybuffer_array_like_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_array_like_nd.refcount = 0;
  __pyx_pybuffernd_array_like_nd.data = NULL;
  __pyx_pybuffernd_array_like_nd.rcbuffer = &__pyx_pybuffer_array_like_nd;

  /* "miniga4py/ga.pyx":162
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] array_like_nd
 *     try:             # <<<<<<<<<<<<<<
 *         array_like_nd = np.asarray(array_like, dtype=np.int64)
 *     except ValueError: # try again in case array_like is a single value
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "miniga4py/ga.pyx":163
 *     cdef np.ndarray[np.int64_t, ndim=1] array_like_nd
 *     try:
 *         array_like_nd = np.asarray(array_like, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     except ValueError: # try again in case array_like is a single value
 *         array_like_nd = np.asarray([array_like], dtype=np.int64)
 */
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 163, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 163, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 163, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_array_like);
      __Pyx_GIVEREF(__pyx_v_array_like);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_array_like);
      __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 163, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 163, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_int64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 163, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 163, __pyx_L3_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 163, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 163, __pyx_L3_error)
      __pyx_t_9 = ((PyArrayObject *)__pyx_t_8);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer);
        __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_10 < 0)) {
          PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_array_like_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          }
          __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
        }
        __pyx_pybuffernd_array_like_nd.diminfo[0].strides = __pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_array_like_nd.diminfo[0].shape = __pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 163, __pyx_L3_error)
      }
      __pyx_t_9 = 0;
      __pyx_v_array_like_nd = ((PyArrayObject *)__pyx_t_8);
      __pyx_t_8 = 0;

      /* "miniga4py/ga.pyx":162
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] array_like_nd
 *     try:             # <<<<<<<<<<<<<<
 *         array_like_nd = np.asarray(array_like, dtype=np.int64)
 *     except ValueError: # try again in case array_like is a single value
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "miniga4py/ga.pyx":164
 *     try:
 *         array_like_nd = np.asarray(array_like, dtype=np.int64)
 *     except ValueError: # try again in case array_like is a single value             # <<<<<<<<<<<<<<
 *         array_like_nd = np.asarray([array_like], dtype=np.int64)
 *     return array_like_nd
 */
    __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_10) {
      __Pyx_AddTraceback("miniga4py.ga._inta64", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_6, &__pyx_t_4) < 0) __PYX_ERR(0, 164, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_4);

      /* "miniga4py/ga.pyx":165
 *         array_like_nd = np.asarray(array_like, dtype=np.int64)
 *     except ValueError: # try again in case array_like is a single value
 *         array_like_nd = np.asarray([array_like], dtype=np.int64)             # <<<<<<<<<<<<<<
 *     return array_like_nd
 * 
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 165, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_asarray); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 165, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 165, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_array_like);
      __Pyx_GIVEREF(__pyx_v_array_like);
      PyList_SET_ITEM(__pyx_t_5, 0, __pyx_v_array_like);
      __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 165, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 165, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 165, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_int64); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 165, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_16) < 0) __PYX_ERR(0, 165, __pyx_L5_except_error)
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_14, __pyx_t_5); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 165, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 165, __pyx_L5_except_error)
      __pyx_t_9 = ((PyArrayObject *)__pyx_t_16);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer);
        __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_10 < 0)) {
          PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_array_like_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
          }
          __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
        }
        __pyx_pybuffernd_array_like_nd.diminfo[0].strides = __pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_array_like_nd.diminfo[0].shape = __pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 165, __pyx_L5_except_error)
      }
      __pyx_t_9 = 0;
      __Pyx_XDECREF_SET(__pyx_v_array_like_nd, ((PyArrayObject *)__pyx_t_16));
      __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "miniga4py/ga.pyx":162
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] array_like_nd
 *     try:             # <<<<<<<<<<<<<<
 *         array_like_nd = np.asarray(array_like, dtype=np.int64)
 *     except ValueError: # try again in case array_like is a single value
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L8_try_end:;
  }

  /* "miniga4py/ga.pyx":166
 *     except ValueError: # try again in case array_like is a single value
 *         array_like_nd = np.asarray([array_like], dtype=np.int64)
 *     return array_like_nd             # <<<<<<<<<<<<<<
 * 
 * cdef inline _lohi(int g_a, lo, hi):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_array_like_nd));
  __pyx_r = ((PyArrayObject *)__pyx_v_array_like_nd);
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":147
 *     return array_like_nd
 * 
 * cdef inline np.ndarray[np.int64_t, ndim=1] _inta64(array_like):             # <<<<<<<<<<<<<<
 *     """Converts an integer array-like to an ndarray of 64bit integers.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga._inta64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_array_like_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_array_like_nd);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":168
 *     return array_like_nd
 * 
 * cdef inline _lohi(int g_a, lo, hi):             # <<<<<<<<<<<<<<
 *     """Converts and/or prepares a lo/hi combination.
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_9miniga4py_2ga__lohi(int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
  PyArrayObject *__pyx_v_lo_nd = 0;
  PyArrayObject *__pyx_v_hi_nd = 0;
  int __pyx_v_ndim;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_nd;
  __Pyx_Buffer __pyx_pybuffer_hi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lo_nd;
  __Pyx_Buffer __pyx_pybuffer_lo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  Py_ssize_t __pyx_t_14;
  __Pyx_RefNannySetupContext("_lohi", 0);
  __pyx_pybuffer_lo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_lo_nd.refcount = 0;
  __pyx_pybuffernd_lo_nd.data = NULL;
  __pyx_pybuffernd_lo_nd.rcbuffer = &__pyx_pybuffer_lo_nd;
  __pyx_pybuffer_hi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_nd.refcount = 0;
  __pyx_pybuffernd_hi_nd.data = NULL;
  __pyx_pybuffernd_hi_nd.rcbuffer = &__pyx_pybuffer_hi_nd;

  /* "miniga4py/ga.pyx":194
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 *     cdef int ndim = GA_Ndim(g_a)             # <<<<<<<<<<<<<<
 *     if lo is None and hi is None:
 *         lo_nd = np.zeros((ndim), dtype=np.int64)
 */
  __pyx_v_ndim = GA_Ndim(__pyx_v_g_a);

  /* "miniga4py/ga.pyx":195
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 *     cdef int ndim = GA_Ndim(g_a)
 *     if lo is None and hi is None:             # <<<<<<<<<<<<<<
 *         lo_nd = np.zeros((ndim), dtype=np.int64)
 *         hi_nd = inquire_dims(g_a)
 */
  __pyx_t_2 = (__pyx_v_lo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_hi == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":196
 *     cdef int ndim = GA_Ndim(g_a)
 *     if lo is None and hi is None:
 *         lo_nd = np.zeros((ndim), dtype=np.int64)             # <<<<<<<<<<<<<<
 *         hi_nd = inquire_dims(g_a)
 *     elif lo is not None and hi is None:
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_ndim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_int64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 196, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 196, __pyx_L1_error)
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_8);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_lo_nd.diminfo[0].strides = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_nd.diminfo[0].shape = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 196, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_lo_nd = ((PyArrayObject *)__pyx_t_8);
    __pyx_t_8 = 0;

    /* "miniga4py/ga.pyx":197
 *     if lo is None and hi is None:
 *         lo_nd = np.zeros((ndim), dtype=np.int64)
 *         hi_nd = inquire_dims(g_a)             # <<<<<<<<<<<<<<
 *     elif lo is not None and hi is None:
 *         lo_nd = _inta64(lo)
 */
    __pyx_t_8 = ((PyObject *)__pyx_f_9miniga4py_2ga_inquire_dims(__pyx_v_g_a, 0)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 197, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_8), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 197, __pyx_L1_error)
    }
    __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_8);
    __pyx_t_8 = 0;

    /* "miniga4py/ga.pyx":195
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 *     cdef int ndim = GA_Ndim(g_a)
 *     if lo is None and hi is None:             # <<<<<<<<<<<<<<
 *         lo_nd = np.zeros((ndim), dtype=np.int64)
 *         hi_nd = inquire_dims(g_a)
 */
    goto __pyx_L3;
  }

  /* "miniga4py/ga.pyx":198
 *         lo_nd = np.zeros((ndim), dtype=np.int64)
 *         hi_nd = inquire_dims(g_a)
 *     elif lo is not None and hi is None:             # <<<<<<<<<<<<<<
 *         lo_nd = _inta64(lo)
 *         hi_nd = lo_nd+1
 */
  __pyx_t_2 = (__pyx_v_lo != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_hi == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":199
 *         hi_nd = inquire_dims(g_a)
 *     elif lo is not None and hi is None:
 *         lo_nd = _inta64(lo)             # <<<<<<<<<<<<<<
 *         hi_nd = lo_nd+1
 *     elif lo is None and hi is not None:
 */
    __pyx_t_8 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_lo)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 199, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_8), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_lo_nd.diminfo[0].strides = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_nd.diminfo[0].shape = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 199, __pyx_L1_error)
    }
    __pyx_v_lo_nd = ((PyArrayObject *)__pyx_t_8);
    __pyx_t_8 = 0;

    /* "miniga4py/ga.pyx":200
 *     elif lo is not None and hi is None:
 *         lo_nd = _inta64(lo)
 *         hi_nd = lo_nd+1             # <<<<<<<<<<<<<<
 *     elif lo is None and hi is not None:
 *         raise ValueError('lo cannot be None if hi is None')
 */
    __pyx_t_8 = PyNumber_Add(((PyObject *)__pyx_v_lo_nd), __pyx_int_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 200, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 200, __pyx_L1_error)
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_8);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 200, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_8);
    __pyx_t_8 = 0;

    /* "miniga4py/ga.pyx":198
 *         lo_nd = np.zeros((ndim), dtype=np.int64)
 *         hi_nd = inquire_dims(g_a)
 *     elif lo is not None and hi is None:             # <<<<<<<<<<<<<<
 *         lo_nd = _inta64(lo)
 *         hi_nd = lo_nd+1
 */
    goto __pyx_L3;
  }

  /* "miniga4py/ga.pyx":201
 *         lo_nd = _inta64(lo)
 *         hi_nd = lo_nd+1
 *     elif lo is None and hi is not None:             # <<<<<<<<<<<<<<
 *         raise ValueError('lo cannot be None if hi is None')
 *     else: # lo and hi are not None
 */
  __pyx_t_2 = (__pyx_v_lo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_hi != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L8_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "miniga4py/ga.pyx":202
 *         hi_nd = lo_nd+1
 *     elif lo is None and hi is not None:
 *         raise ValueError('lo cannot be None if hi is None')             # <<<<<<<<<<<<<<
 *     else: # lo and hi are not None
 *         lo_nd = _inta64(lo)
 */
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_Raise(__pyx_t_8, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __PYX_ERR(0, 202, __pyx_L1_error)

    /* "miniga4py/ga.pyx":201
 *         lo_nd = _inta64(lo)
 *         hi_nd = lo_nd+1
 *     elif lo is None and hi is not None:             # <<<<<<<<<<<<<<
 *         raise ValueError('lo cannot be None if hi is None')
 *     else: # lo and hi are not None
 */
  }

  /* "miniga4py/ga.pyx":204
 *         raise ValueError('lo cannot be None if hi is None')
 *     else: # lo and hi are not None
 *         lo_nd = _inta64(lo)             # <<<<<<<<<<<<<<
 *         hi_nd = _inta64(hi)
 *     if len(lo_nd) != ndim:
 */
  /*else*/ {
    __pyx_t_8 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_lo)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_8), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_lo_nd.diminfo[0].strides = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_nd.diminfo[0].shape = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 204, __pyx_L1_error)
    }
    __pyx_v_lo_nd = ((PyArrayObject *)__pyx_t_8);
    __pyx_t_8 = 0;

    /* "miniga4py/ga.pyx":205
 *     else: # lo and hi are not None
 *         lo_nd = _inta64(lo)
 *         hi_nd = _inta64(hi)             # <<<<<<<<<<<<<<
 *     if len(lo_nd) != ndim:
 *         raise ValueError('len(lo_nd) != ndim; len(%s) != %s' % (lo_nd,ndim))
 */
    __pyx_t_8 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_hi)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_8), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 205, __pyx_L1_error)
    }
    __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_8);
    __pyx_t_8 = 0;
  }
  __pyx_L3:;

  /* "miniga4py/ga.pyx":206
 *         lo_nd = _inta64(lo)
 *         hi_nd = _inta64(hi)
 *     if len(lo_nd) != ndim:             # <<<<<<<<<<<<<<
 *         raise ValueError('len(lo_nd) != ndim; len(%s) != %s' % (lo_nd,ndim))
 *     if len(hi_nd) != ndim:
 */
  __pyx_t_14 = PyObject_Length(((PyObject *)__pyx_v_lo_nd)); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 206, __pyx_L1_error)
  __pyx_t_1 = ((__pyx_t_14 != __pyx_v_ndim) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "miniga4py/ga.pyx":207
 *         hi_nd = _inta64(hi)
 *     if len(lo_nd) != ndim:
 *         raise ValueError('len(lo_nd) != ndim; len(%s) != %s' % (lo_nd,ndim))             # <<<<<<<<<<<<<<
 *     if len(hi_nd) != ndim:
 *         raise ValueError('len(hi_nd) != ndim; len(%s) != %s' % (hi_nd,ndim))
 */
    __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_ndim); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_v_lo_nd));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_lo_nd));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_lo_nd));
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_len_lo_nd_ndim_len_s_s, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 207, __pyx_L1_error)

    /* "miniga4py/ga.pyx":206
 *         lo_nd = _inta64(lo)
 *         hi_nd = _inta64(hi)
 *     if len(lo_nd) != ndim:             # <<<<<<<<<<<<<<
 *         raise ValueError('len(lo_nd) != ndim; len(%s) != %s' % (lo_nd,ndim))
 *     if len(hi_nd) != ndim:
 */
  }

  /* "miniga4py/ga.pyx":208
 *     if len(lo_nd) != ndim:
 *         raise ValueError('len(lo_nd) != ndim; len(%s) != %s' % (lo_nd,ndim))
 *     if len(hi_nd) != ndim:             # <<<<<<<<<<<<<<
 *         raise ValueError('len(hi_nd) != ndim; len(%s) != %s' % (hi_nd,ndim))
 *     # We must make a copy of hi_nd. If user passes in an ndarray, the
 */
  __pyx_t_14 = PyObject_Length(((PyObject *)__pyx_v_hi_nd)); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 208, __pyx_L1_error)
  __pyx_t_1 = ((__pyx_t_14 != __pyx_v_ndim) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "miniga4py/ga.pyx":209
 *         raise ValueError('len(lo_nd) != ndim; len(%s) != %s' % (lo_nd,ndim))
 *     if len(hi_nd) != ndim:
 *         raise ValueError('len(hi_nd) != ndim; len(%s) != %s' % (hi_nd,ndim))             # <<<<<<<<<<<<<<
 *     # We must make a copy of hi_nd. If user passes in an ndarray, the
 *     # following "prep" operation will change the user's 'hi'.
 */
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_ndim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 209, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 209, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(((PyObject *)__pyx_v_hi_nd));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_hi_nd));
    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_hi_nd));
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_len_hi_nd_ndim_len_s_s, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 209, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 209, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_8, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __PYX_ERR(0, 209, __pyx_L1_error)

    /* "miniga4py/ga.pyx":208
 *     if len(lo_nd) != ndim:
 *         raise ValueError('len(lo_nd) != ndim; len(%s) != %s' % (lo_nd,ndim))
 *     if len(hi_nd) != ndim:             # <<<<<<<<<<<<<<
 *         raise ValueError('len(hi_nd) != ndim; len(%s) != %s' % (hi_nd,ndim))
 *     # We must make a copy of hi_nd. If user passes in an ndarray, the
 */
  }

  /* "miniga4py/ga.pyx":213
 *     # following "prep" operation will change the user's 'hi'.
 *     #hi_nd -= 1 # <----- don't do that!
 *     hi_nd = hi_nd-1 # prep hi for GA's inclusive indexing             # <<<<<<<<<<<<<<
 *     return lo_nd,hi_nd
 * 
 */
  __pyx_t_8 = PyNumber_Subtract(((PyObject *)__pyx_v_hi_nd), __pyx_int_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 213, __pyx_L1_error)
  __pyx_t_9 = ((PyArrayObject *)__pyx_t_8);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_10 < 0)) {
      PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      }
      __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
    }
    __pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 213, __pyx_L1_error)
  }
  __pyx_t_9 = 0;
  __Pyx_DECREF_SET(__pyx_v_hi_nd, ((PyArrayObject *)__pyx_t_8));
  __pyx_t_8 = 0;

  /* "miniga4py/ga.pyx":214
 *     #hi_nd -= 1 # <----- don't do that!
 *     hi_nd = hi_nd-1 # prep hi for GA's inclusive indexing
 *     return lo_nd,hi_nd             # <<<<<<<<<<<<<<
 * 
 * cdef void* _convert_multiplier(int gtype, value,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(((PyObject *)__pyx_v_lo_nd));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lo_nd));
  PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_lo_nd));
  __Pyx_INCREF(((PyObject *)__pyx_v_hi_nd));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_hi_nd));
  PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_v_hi_nd));
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":168
 *     return array_like_nd
 * 
 * cdef inline _lohi(int g_a, lo, hi):             # <<<<<<<<<<<<<<
 *     """Converts and/or prepares a lo/hi combination.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga._lohi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":216
 *     return lo_nd,hi_nd
 * 
 * cdef void* _convert_multiplier(int gtype, value,             # <<<<<<<<<<<<<<
 *         int *iv, long *lv, long long *llv,
 *         float *fv, double *dv, long double *ldv,
 */

static void *__pyx_f_9miniga4py_2ga__convert_multiplier(int __pyx_v_gtype, PyObject *__pyx_v_value, int *__pyx_v_iv, long *__pyx_v_lv, PY_LONG_LONG *__pyx_v_llv, float *__pyx_v_fv, double *__pyx_v_dv, long double *__pyx_v_ldv, SingleComplex *__pyx_v_fcv, DoubleComplex *__pyx_v_dcv) {
  __pyx_t_float_complex __pyx_v_pfcv;
  __pyx_t_double_complex __pyx_v_pdcv;
  void *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  long __pyx_t_7;
  PY_LONG_LONG __pyx_t_8;
  float __pyx_t_9;
  double __pyx_t_10;
  long double __pyx_t_11;
  __pyx_t_float_complex __pyx_t_12;
  __pyx_t_double_complex __pyx_t_13;
  __Pyx_RefNannySetupContext("_convert_multiplier", 0);

  /* "miniga4py/ga.pyx":228
 * 
 *     """
 *     cdef float complex pfcv=1.0             # <<<<<<<<<<<<<<
 *     cdef double complex pdcv=1.0
 *     if value is None:
 */
  __pyx_v_pfcv = __pyx_t_float_complex_from_parts(1.0, 0);

  /* "miniga4py/ga.pyx":229
 *     """
 *     cdef float complex pfcv=1.0
 *     cdef double complex pdcv=1.0             # <<<<<<<<<<<<<<
 *     if value is None:
 *         raise ValueError("cannot convert None")
 */
  __pyx_v_pdcv = __pyx_t_double_complex_from_parts(1.0, 0);

  /* "miniga4py/ga.pyx":230
 *     cdef float complex pfcv=1.0
 *     cdef double complex pdcv=1.0
 *     if value is None:             # <<<<<<<<<<<<<<
 *         raise ValueError("cannot convert None")
 *     if gtype == C_INT:
 */
  __pyx_t_1 = (__pyx_v_value == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (unlikely(__pyx_t_2)) {

    /* "miniga4py/ga.pyx":231
 *     cdef double complex pdcv=1.0
 *     if value is None:
 *         raise ValueError("cannot convert None")             # <<<<<<<<<<<<<<
 *     if gtype == C_INT:
 *         iv[0] = value
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 231, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 231, __pyx_L1_error)

    /* "miniga4py/ga.pyx":230
 *     cdef float complex pfcv=1.0
 *     cdef double complex pdcv=1.0
 *     if value is None:             # <<<<<<<<<<<<<<
 *         raise ValueError("cannot convert None")
 *     if gtype == C_INT:
 */
  }

  /* "miniga4py/ga.pyx":232
 *     if value is None:
 *         raise ValueError("cannot convert None")
 *     if gtype == C_INT:             # <<<<<<<<<<<<<<
 *         iv[0] = value
 *         return iv
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 232, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 232, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_2) {

    /* "miniga4py/ga.pyx":233
 *         raise ValueError("cannot convert None")
 *     if gtype == C_INT:
 *         iv[0] = value             # <<<<<<<<<<<<<<
 *         return iv
 *     elif gtype == C_LONG:
 */
    __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 233, __pyx_L1_error)
    (__pyx_v_iv[0]) = __pyx_t_6;

    /* "miniga4py/ga.pyx":234
 *     if gtype == C_INT:
 *         iv[0] = value
 *         return iv             # <<<<<<<<<<<<<<
 *     elif gtype == C_LONG:
 *         lv[0] = value
 */
    __pyx_r = __pyx_v_iv;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":232
 *     if value is None:
 *         raise ValueError("cannot convert None")
 *     if gtype == C_INT:             # <<<<<<<<<<<<<<
 *         iv[0] = value
 *         return iv
 */
  }

  /* "miniga4py/ga.pyx":235
 *         iv[0] = value
 *         return iv
 *     elif gtype == C_LONG:             # <<<<<<<<<<<<<<
 *         lv[0] = value
 *         return lv
 */
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_2) {

    /* "miniga4py/ga.pyx":236
 *         return iv
 *     elif gtype == C_LONG:
 *         lv[0] = value             # <<<<<<<<<<<<<<
 *         return lv
 *     elif gtype == C_LONGLONG:
 */
    __pyx_t_7 = __Pyx_PyInt_As_long(__pyx_v_value); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L1_error)
    (__pyx_v_lv[0]) = __pyx_t_7;

    /* "miniga4py/ga.pyx":237
 *     elif gtype == C_LONG:
 *         lv[0] = value
 *         return lv             # <<<<<<<<<<<<<<
 *     elif gtype == C_LONGLONG:
 *         llv[0] = value
 */
    __pyx_r = __pyx_v_lv;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":235
 *         iv[0] = value
 *         return iv
 *     elif gtype == C_LONG:             # <<<<<<<<<<<<<<
 *         lv[0] = value
 *         return lv
 */
  }

  /* "miniga4py/ga.pyx":238
 *         lv[0] = value
 *         return lv
 *     elif gtype == C_LONGLONG:             # <<<<<<<<<<<<<<
 *         llv[0] = value
 *         return llv
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 238, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 238, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_2) {

    /* "miniga4py/ga.pyx":239
 *         return lv
 *     elif gtype == C_LONGLONG:
 *         llv[0] = value             # <<<<<<<<<<<<<<
 *         return llv
 *     elif gtype == C_FLOAT:
 */
    __pyx_t_8 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_v_value); if (unlikely((__pyx_t_8 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 239, __pyx_L1_error)
    (__pyx_v_llv[0]) = __pyx_t_8;

    /* "miniga4py/ga.pyx":240
 *     elif gtype == C_LONGLONG:
 *         llv[0] = value
 *         return llv             # <<<<<<<<<<<<<<
 *     elif gtype == C_FLOAT:
 *         fv[0] = value
 */
    __pyx_r = __pyx_v_llv;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":238
 *         lv[0] = value
 *         return lv
 *     elif gtype == C_LONGLONG:             # <<<<<<<<<<<<<<
 *         llv[0] = value
 *         return llv
 */
  }

  /* "miniga4py/ga.pyx":241
 *         llv[0] = value
 *         return llv
 *     elif gtype == C_FLOAT:             # <<<<<<<<<<<<<<
 *         fv[0] = value
 *         return fv
 */
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_2) {

    /* "miniga4py/ga.pyx":242
 *         return llv
 *     elif gtype == C_FLOAT:
 *         fv[0] = value             # <<<<<<<<<<<<<<
 *         return fv
 *     elif gtype == C_DBL:
 */
    __pyx_t_9 = __pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_9 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L1_error)
    (__pyx_v_fv[0]) = __pyx_t_9;

    /* "miniga4py/ga.pyx":243
 *     elif gtype == C_FLOAT:
 *         fv[0] = value
 *         return fv             # <<<<<<<<<<<<<<
 *     elif gtype == C_DBL:
 *         dv[0] = value
 */
    __pyx_r = __pyx_v_fv;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":241
 *         llv[0] = value
 *         return llv
 *     elif gtype == C_FLOAT:             # <<<<<<<<<<<<<<
 *         fv[0] = value
 *         return fv
 */
  }

  /* "miniga4py/ga.pyx":244
 *         fv[0] = value
 *         return fv
 *     elif gtype == C_DBL:             # <<<<<<<<<<<<<<
 *         dv[0] = value
 *         return dv
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_DBL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 244, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 244, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_2) {

    /* "miniga4py/ga.pyx":245
 *         return fv
 *     elif gtype == C_DBL:
 *         dv[0] = value             # <<<<<<<<<<<<<<
 *         return dv
 *     elif gtype == C_LDBL and float128_in_np:
 */
    __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L1_error)
    (__pyx_v_dv[0]) = __pyx_t_10;

    /* "miniga4py/ga.pyx":246
 *     elif gtype == C_DBL:
 *         dv[0] = value
 *         return dv             # <<<<<<<<<<<<<<
 *     elif gtype == C_LDBL and float128_in_np:
 *         ldv[0] = value
 */
    __pyx_r = __pyx_v_dv;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":244
 *         fv[0] = value
 *         return fv
 *     elif gtype == C_DBL:             # <<<<<<<<<<<<<<
 *         dv[0] = value
 *         return dv
 */
  }

  /* "miniga4py/ga.pyx":247
 *         dv[0] = value
 *         return dv
 *     elif gtype == C_LDBL and float128_in_np:             # <<<<<<<<<<<<<<
 *         ldv[0] = value
 *         return ldv
 */
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_LDBL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 247, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_1 = (__pyx_v_9miniga4py_2ga_float128_in_np != 0);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_2) {

    /* "miniga4py/ga.pyx":248
 *         return dv
 *     elif gtype == C_LDBL and float128_in_np:
 *         ldv[0] = value             # <<<<<<<<<<<<<<
 *         return ldv
 *     elif gtype == C_SCPL:
 */
    __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_11 == (long double)-1) && PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L1_error)
    (__pyx_v_ldv[0]) = __pyx_t_11;

    /* "miniga4py/ga.pyx":249
 *     elif gtype == C_LDBL and float128_in_np:
 *         ldv[0] = value
 *         return ldv             # <<<<<<<<<<<<<<
 *     elif gtype == C_SCPL:
 *         pfcv = value
 */
    __pyx_r = __pyx_v_ldv;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":247
 *         dv[0] = value
 *         return dv
 *     elif gtype == C_LDBL and float128_in_np:             # <<<<<<<<<<<<<<
 *         ldv[0] = value
 *         return ldv
 */
  }

  /* "miniga4py/ga.pyx":250
 *         ldv[0] = value
 *         return ldv
 *     elif gtype == C_SCPL:             # <<<<<<<<<<<<<<
 *         pfcv = value
 *         fcv[0].real = pfcv.real
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_SCPL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 250, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 250, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_2) {

    /* "miniga4py/ga.pyx":251
 *         return ldv
 *     elif gtype == C_SCPL:
 *         pfcv = value             # <<<<<<<<<<<<<<
 *         fcv[0].real = pfcv.real
 *         fcv[0].imag = pfcv.imag
 */
    __pyx_t_12 = __Pyx_PyComplex_As___pyx_t_float_complex(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 251, __pyx_L1_error)
    __pyx_v_pfcv = __pyx_t_12;

    /* "miniga4py/ga.pyx":252
 *     elif gtype == C_SCPL:
 *         pfcv = value
 *         fcv[0].real = pfcv.real             # <<<<<<<<<<<<<<
 *         fcv[0].imag = pfcv.imag
 *         return fcv
 */
    __pyx_t_9 = __Pyx_CREAL(__pyx_v_pfcv);
    (__pyx_v_fcv[0]).real = __pyx_t_9;

    /* "miniga4py/ga.pyx":253
 *         pfcv = value
 *         fcv[0].real = pfcv.real
 *         fcv[0].imag = pfcv.imag             # <<<<<<<<<<<<<<
 *         return fcv
 *     elif gtype == C_DCPL:
 */
    __pyx_t_9 = __Pyx_CIMAG(__pyx_v_pfcv);
    (__pyx_v_fcv[0]).imag = __pyx_t_9;

    /* "miniga4py/ga.pyx":254
 *         fcv[0].real = pfcv.real
 *         fcv[0].imag = pfcv.imag
 *         return fcv             # <<<<<<<<<<<<<<
 *     elif gtype == C_DCPL:
 *         pdcv = value
 */
    __pyx_r = __pyx_v_fcv;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":250
 *         ldv[0] = value
 *         return ldv
 *     elif gtype == C_SCPL:             # <<<<<<<<<<<<<<
 *         pfcv = value
 *         fcv[0].real = pfcv.real
 */
  }

  /* "miniga4py/ga.pyx":255
 *         fcv[0].imag = pfcv.imag
 *         return fcv
 *     elif gtype == C_DCPL:             # <<<<<<<<<<<<<<
 *         pdcv = value
 *         dcv[0].real = pdcv.real
 */
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_DCPL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 255, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 255, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (likely(__pyx_t_2)) {

    /* "miniga4py/ga.pyx":256
 *         return fcv
 *     elif gtype == C_DCPL:
 *         pdcv = value             # <<<<<<<<<<<<<<
 *         dcv[0].real = pdcv.real
 *         dcv[0].imag = pdcv.imag
 */
    __pyx_t_13 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 256, __pyx_L1_error)
    __pyx_v_pdcv = __pyx_t_13;

    /* "miniga4py/ga.pyx":257
 *     elif gtype == C_DCPL:
 *         pdcv = value
 *         dcv[0].real = pdcv.real             # <<<<<<<<<<<<<<
 *         dcv[0].imag = pdcv.imag
 *         return dcv
 */
    __pyx_t_10 = __Pyx_CREAL(__pyx_v_pdcv);
    (__pyx_v_dcv[0]).real = __pyx_t_10;

    /* "miniga4py/ga.pyx":258
 *         pdcv = value
 *         dcv[0].real = pdcv.real
 *         dcv[0].imag = pdcv.imag             # <<<<<<<<<<<<<<
 *         return dcv
 *     else:
 */
    __pyx_t_10 = __Pyx_CIMAG(__pyx_v_pdcv);
    (__pyx_v_dcv[0]).imag = __pyx_t_10;

    /* "miniga4py/ga.pyx":259
 *         dcv[0].real = pdcv.real
 *         dcv[0].imag = pdcv.imag
 *         return dcv             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError("type of g_a not recognized")
 */
    __pyx_r = __pyx_v_dcv;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":255
 *         fcv[0].imag = pfcv.imag
 *         return fcv
 *     elif gtype == C_DCPL:             # <<<<<<<<<<<<<<
 *         pdcv = value
 *         dcv[0].real = pdcv.real
 */
  }

  /* "miniga4py/ga.pyx":261
 *         return dcv
 *     else:
 *         raise TypeError("type of g_a not recognized")             # <<<<<<<<<<<<<<
 * 
 * def zip(lo, hi):
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 261, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 261, __pyx_L1_error)
  }

  /* "miniga4py/ga.pyx":216
 *     return lo_nd,hi_nd
 * 
 * cdef void* _convert_multiplier(int gtype, value,             # <<<<<<<<<<<<<<
 *         int *iv, long *lv, long long *llv,
 *         float *fv, double *dv, long double *ldv,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("miniga4py.ga._convert_multiplier", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":263
 *         raise TypeError("type of g_a not recognized")
 * 
 * def zip(lo, hi):             # <<<<<<<<<<<<<<
 *     """Transforms a GA lo,hi combination into a slice list."""
 *     return [slice(l,h) for l,h in __builtin__.zip(lo,hi)]
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_19zip(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_18zip[] = "zip(lo, hi)\nTransforms a GA lo,hi combination into a slice list.";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_19zip = {"zip", (PyCFunction)__pyx_pw_9miniga4py_2ga_19zip, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_18zip};
static PyObject *__pyx_pw_9miniga4py_2ga_19zip(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zip (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lo,&__pyx_n_s_hi,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("zip", 1, 2, 2, 1); __PYX_ERR(0, 263, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zip") < 0)) __PYX_ERR(0, 263, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_lo = values[0];
    __pyx_v_hi = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zip", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 263, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.zip", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_18zip(__pyx_self, __pyx_v_lo, __pyx_v_hi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_18zip(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
  PyObject *__pyx_v_l = NULL;
  PyObject *__pyx_v_h = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  __Pyx_RefNannySetupContext("zip", 0);

  /* "miniga4py/ga.pyx":265
 * def zip(lo, hi):
 *     """Transforms a GA lo,hi combination into a slice list."""
 *     return [slice(l,h) for l,h in __builtin__.zip(lo,hi)]             # <<<<<<<<<<<<<<
 * 
 * #############################################################################
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_builtin); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_lo, __pyx_v_hi};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 265, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_lo, __pyx_v_hi};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 265, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_lo);
    __Pyx_GIVEREF(__pyx_v_lo);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_lo);
    __Pyx_INCREF(__pyx_v_hi);
    __Pyx_GIVEREF(__pyx_v_hi);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_hi);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 265, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 265, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 265, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 265, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 265, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_8(__pyx_t_4);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 265, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 265, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 265, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 265, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 265, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
      index = 0; __pyx_t_6 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_3 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 265, __pyx_L1_error)
      __pyx_t_10 = NULL;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_10 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 265, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_l, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_h, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_2 = PySlice_New(__pyx_v_l, __pyx_v_h, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 265, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":263
 *         raise TypeError("type of g_a not recognized")
 * 
 * def zip(lo, hi):             # <<<<<<<<<<<<<<
 *     """Transforms a GA lo,hi combination into a slice list."""
 *     return [slice(l,h) for l,h in __builtin__.zip(lo,hi)]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("miniga4py.ga.zip", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_l);
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":271
 * #############################################################################
 * 
 * def abs_value(int g_a, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Take element-wise absolute value of the array or patch.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_21abs_value(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_20abs_value[] = "abs_value(int g_a, lo=None, hi=None)\nTake element-wise absolute value of the array or patch.\n    \n    This is a collective operation.\n\n    :Parameters:\n        g_a : int\n            the array handle\n        lo : 1D array-like\n            lower bound patch coordinates, inclusive\n        hi : 1D array-like\n            higher bound patch coordinates, exclusive\n    \n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_21abs_value = {"abs_value", (PyCFunction)__pyx_pw_9miniga4py_2ga_21abs_value, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_20abs_value};
static PyObject *__pyx_pw_9miniga4py_2ga_21abs_value(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("abs_value (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_lo,&__pyx_n_s_hi,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "abs_value") < 0)) __PYX_ERR(0, 271, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L3_error)
    __pyx_v_lo = values[1];
    __pyx_v_hi = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("abs_value", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 271, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.abs_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_20abs_value(__pyx_self, __pyx_v_g_a, __pyx_v_lo, __pyx_v_hi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_20abs_value(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
  PyArrayObject *__pyx_v_lo_nd = 0;
  PyArrayObject *__pyx_v_hi_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_nd;
  __Pyx_Buffer __pyx_pybuffer_hi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lo_nd;
  __Pyx_Buffer __pyx_pybuffer_lo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  __Pyx_RefNannySetupContext("abs_value", 0);
  __pyx_pybuffer_lo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_lo_nd.refcount = 0;
  __pyx_pybuffernd_lo_nd.data = NULL;
  __pyx_pybuffernd_lo_nd.rcbuffer = &__pyx_pybuffer_lo_nd;
  __pyx_pybuffer_hi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_nd.refcount = 0;
  __pyx_pybuffernd_hi_nd.data = NULL;
  __pyx_pybuffernd_hi_nd.rcbuffer = &__pyx_pybuffer_hi_nd;

  /* "miniga4py/ga.pyx":286
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 *     if lo is None and hi is None:             # <<<<<<<<<<<<<<
 *         GA_Abs_value(g_a)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_lo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_hi == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":287
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 *     if lo is None and hi is None:
 *         GA_Abs_value(g_a)             # <<<<<<<<<<<<<<
 *     else:
 *         lo_nd,hi_nd = _lohi(g_a,lo,hi)
 */
    GA_Abs_value(__pyx_v_g_a);

    /* "miniga4py/ga.pyx":286
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 *     if lo is None and hi is None:             # <<<<<<<<<<<<<<
 *         GA_Abs_value(g_a)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "miniga4py/ga.pyx":289
 *         GA_Abs_value(g_a)
 *     else:
 *         lo_nd,hi_nd = _lohi(g_a,lo,hi)             # <<<<<<<<<<<<<<
 *         GA_Abs_value_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_lo, __pyx_v_hi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 289, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 289, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 289, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 289, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 289, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 289, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 289, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 289, __pyx_L1_error)
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_lo_nd.diminfo[0].strides = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_nd.diminfo[0].shape = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 289, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_lo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 289, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":290
 *     else:
 *         lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *         GA_Abs_value_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)             # <<<<<<<<<<<<<<
 * 
 * def acc(int g_a, buffer, lo=None, hi=None, alpha=None):
 */
    GA_Abs_value_patch64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data));
  }
  __pyx_L3:;

  /* "miniga4py/ga.pyx":271
 * #############################################################################
 * 
 * def abs_value(int g_a, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Take element-wise absolute value of the array or patch.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.abs_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":292
 *         GA_Abs_value_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 * def acc(int g_a, buffer, lo=None, hi=None, alpha=None):             # <<<<<<<<<<<<<<
 *     """Combines data from buffer with data in the global array patch.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_23acc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_22acc[] = "acc(int g_a, buffer, lo=None, hi=None, alpha=None)\nCombines data from buffer with data in the global array patch.\n    \n    The buffer array is assumed to be have the same number of\n    dimensions as the global array.  If the buffer is not contiguous, a\n    contiguous copy will be made.\n    \n        global array section (lo[],hi[]) += alpha * buffer\n\n    This is a one-sided and atomic operation.\n\n    :Parameters:\n        g_a : int\n            the array handle\n        buffer : array-like\n            must be contiguous and have same number of elements as patch\n        lo : 1D array-like\n            lower bound patch coordinates, inclusive\n        hi : 1D array-like\n            higher bound patch coordinates, exclusive\n        alpha : object\n            multiplier (converted to appropriate type)\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_23acc = {"acc", (PyCFunction)__pyx_pw_9miniga4py_2ga_23acc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_22acc};
static PyObject *__pyx_pw_9miniga4py_2ga_23acc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_buffer = 0;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_v_alpha = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("acc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_buffer,&__pyx_n_s_lo,&__pyx_n_s_hi,&__pyx_n_s_alpha,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("acc", 0, 2, 5, 1); __PYX_ERR(0, 292, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "acc") < 0)) __PYX_ERR(0, 292, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 292, __pyx_L3_error)
    __pyx_v_buffer = values[1];
    __pyx_v_lo = values[2];
    __pyx_v_hi = values[3];
    __pyx_v_alpha = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("acc", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 292, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.acc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_22acc(__pyx_self, __pyx_v_g_a, __pyx_v_buffer, __pyx_v_lo, __pyx_v_hi, __pyx_v_alpha);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_22acc(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_buffer, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, PyObject *__pyx_v_alpha) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_9miniga4py_2ga__acc_common __pyx_t_2;
  __Pyx_RefNannySetupContext("acc", 0);

  /* "miniga4py/ga.pyx":316
 * 
 *     """
 *     _acc_common(g_a, buffer, lo, hi, alpha)             # <<<<<<<<<<<<<<
 * 
 * cdef _acc_common(int g_a, buffer, lo=None, hi=None, alpha=None,
 */
  __pyx_t_2.__pyx_n = 3;
  __pyx_t_2.lo = __pyx_v_lo;
  __pyx_t_2.hi = __pyx_v_hi;
  __pyx_t_2.alpha = __pyx_v_alpha;
  __pyx_t_1 = __pyx_f_9miniga4py_2ga__acc_common(__pyx_v_g_a, __pyx_v_buffer, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":292
 *         GA_Abs_value_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 * def acc(int g_a, buffer, lo=None, hi=None, alpha=None):             # <<<<<<<<<<<<<<
 *     """Combines data from buffer with data in the global array patch.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.acc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":318
 *     _acc_common(g_a, buffer, lo, hi, alpha)
 * 
 * cdef _acc_common(int g_a, buffer, lo=None, hi=None, alpha=None,             # <<<<<<<<<<<<<<
 *         bint nb=False, bint periodic=False, skip=None):
 *     """Combines data from buffer with data in the global array patch.
 */

static PyObject *__pyx_f_9miniga4py_2ga__acc_common(int __pyx_v_g_a, PyObject *__pyx_v_buffer, struct __pyx_opt_args_9miniga4py_2ga__acc_common *__pyx_optional_args) {
  PyObject *__pyx_v_lo = ((PyObject *)Py_None);
  PyObject *__pyx_v_hi = ((PyObject *)Py_None);
  PyObject *__pyx_v_alpha = ((PyObject *)Py_None);

  /* "miniga4py/ga.pyx":319
 * 
 * cdef _acc_common(int g_a, buffer, lo=None, hi=None, alpha=None,
 *         bint nb=False, bint periodic=False, skip=None):             # <<<<<<<<<<<<<<
 *     """Combines data from buffer with data in the global array patch.
 * 
 */
  int __pyx_v_nb = ((int)0);
  int __pyx_v_periodic = ((int)0);
  PyObject *__pyx_v_skip = ((PyObject *)Py_None);
  PyArrayObject *__pyx_v_lo_nd = 0;
  PyArrayObject *__pyx_v_hi_nd = 0;
  PyArrayObject *__pyx_v_ld_nd = 0;
  PyArrayObject *__pyx_v_shape = 0;
  PyArrayObject *__pyx_v_skip_nd = 0;
  PyArrayObject *__pyx_v_buffer_nd = 0;
  int __pyx_v_gtype;
  int __pyx_v_ialpha;
  long __pyx_v_lalpha;
  PY_LONG_LONG __pyx_v_llalpha;
  float __pyx_v_falpha;
  double __pyx_v_dalpha;
  long double __pyx_v_ldalpha;
  SingleComplex __pyx_v_fcalpha;
  DoubleComplex __pyx_v_dcalpha;
  void *__pyx_v_valpha;
  ga_nbhdl_t __pyx_v_nbhandle;
  PyObject *__pyx_v_dtype = NULL;
  PyObject *__pyx_v_strides = NULL;
  PyObject *__pyx_v_buffer_shape = NULL;
  PyObject *__pyx_v_i = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_nd;
  __Pyx_Buffer __pyx_pybuffer_hi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ld_nd;
  __Pyx_Buffer __pyx_pybuffer_ld_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lo_nd;
  __Pyx_Buffer __pyx_pybuffer_lo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_shape;
  __Pyx_Buffer __pyx_pybuffer_shape;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_skip_nd;
  __Pyx_Buffer __pyx_pybuffer_skip_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  PyObject *(*__pyx_t_14)(PyObject *);
  Py_ssize_t __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  __Pyx_RefNannySetupContext("_acc_common", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_lo = __pyx_optional_args->lo;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_hi = __pyx_optional_args->hi;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_alpha = __pyx_optional_args->alpha;
          if (__pyx_optional_args->__pyx_n > 3) {
            __pyx_v_nb = __pyx_optional_args->nb;
            if (__pyx_optional_args->__pyx_n > 4) {
              __pyx_v_periodic = __pyx_optional_args->periodic;
              if (__pyx_optional_args->__pyx_n > 5) {
                __pyx_v_skip = __pyx_optional_args->skip;
              }
            }
          }
        }
      }
    }
  }
  __Pyx_INCREF(__pyx_v_alpha);
  __pyx_pybuffer_lo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_lo_nd.refcount = 0;
  __pyx_pybuffernd_lo_nd.data = NULL;
  __pyx_pybuffernd_lo_nd.rcbuffer = &__pyx_pybuffer_lo_nd;
  __pyx_pybuffer_hi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_nd.refcount = 0;
  __pyx_pybuffernd_hi_nd.data = NULL;
  __pyx_pybuffernd_hi_nd.rcbuffer = &__pyx_pybuffer_hi_nd;
  __pyx_pybuffer_ld_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_ld_nd.refcount = 0;
  __pyx_pybuffernd_ld_nd.data = NULL;
  __pyx_pybuffernd_ld_nd.rcbuffer = &__pyx_pybuffer_ld_nd;
  __pyx_pybuffer_shape.pybuffer.buf = NULL;
  __pyx_pybuffer_shape.refcount = 0;
  __pyx_pybuffernd_shape.data = NULL;
  __pyx_pybuffernd_shape.rcbuffer = &__pyx_pybuffer_shape;
  __pyx_pybuffer_skip_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_skip_nd.refcount = 0;
  __pyx_pybuffernd_skip_nd.data = NULL;
  __pyx_pybuffernd_skip_nd.rcbuffer = &__pyx_pybuffer_skip_nd;

  /* "miniga4py/ga.pyx":361
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd, ld_nd, shape, skip_nd
 *     cdef np.ndarray buffer_nd
 *     cdef int gtype=inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     cdef int            ialpha
 *     cdef long           lalpha
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":370
 *     cdef SingleComplex  fcalpha
 *     cdef DoubleComplex  dcalpha
 *     cdef void          *valpha=NULL             # <<<<<<<<<<<<<<
 *     cdef ga_nbhdl_t     nbhandle
 *     dtype = _to_dtype[gtype]
 */
  __pyx_v_valpha = NULL;

  /* "miniga4py/ga.pyx":372
 *     cdef void          *valpha=NULL
 *     cdef ga_nbhdl_t     nbhandle
 *     dtype = _to_dtype[gtype]             # <<<<<<<<<<<<<<
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *     shape = hi_nd-lo_nd+1
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_to_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_gtype, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dtype = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "miniga4py/ga.pyx":373
 *     cdef ga_nbhdl_t     nbhandle
 *     dtype = _to_dtype[gtype]
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)             # <<<<<<<<<<<<<<
 *     shape = hi_nd-lo_nd+1
 *     if skip is None:
 */
  __pyx_t_2 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_lo, __pyx_v_hi); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 373, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 373, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 373, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 373, __pyx_L1_error)
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 373, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_lo_nd.diminfo[0].strides = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_nd.diminfo[0].shape = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 373, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_lo_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
      __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
    }
    __pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 373, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "miniga4py/ga.pyx":374
 *     dtype = _to_dtype[gtype]
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *     shape = hi_nd-lo_nd+1             # <<<<<<<<<<<<<<
 *     if skip is None:
 *         skip_nd = None
 */
  __pyx_t_2 = PyNumber_Subtract(((PyObject *)__pyx_v_hi_nd), ((PyObject *)__pyx_v_lo_nd)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 374, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_shape.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_shape.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_shape.rcbuffer->pybuffer, (PyObject*)__pyx_v_shape, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_shape.diminfo[0].strides = __pyx_pybuffernd_shape.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_shape.diminfo[0].shape = __pyx_pybuffernd_shape.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 374, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_shape = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "miniga4py/ga.pyx":375
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *     shape = hi_nd-lo_nd+1
 *     if skip is None:             # <<<<<<<<<<<<<<
 *         skip_nd = None
 *     else:
 */
  __pyx_t_11 = (__pyx_v_skip == Py_None);
  __pyx_t_12 = (__pyx_t_11 != 0);
  if (__pyx_t_12) {

    /* "miniga4py/ga.pyx":376
 *     shape = hi_nd-lo_nd+1
 *     if skip is None:
 *         skip_nd = None             # <<<<<<<<<<<<<<
 *     else:
 *         skip_nd = _inta64(skip)
 */
    __pyx_t_6 = ((PyArrayObject *)Py_None);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_skip_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
        }
        __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
      }
      __pyx_pybuffernd_skip_nd.diminfo[0].strides = __pyx_pybuffernd_skip_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_skip_nd.diminfo[0].shape = __pyx_pybuffernd_skip_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 376, __pyx_L1_error)
    }
    __pyx_t_6 = 0;
    __Pyx_INCREF(Py_None);
    __pyx_v_skip_nd = ((PyArrayObject *)Py_None);

    /* "miniga4py/ga.pyx":375
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *     shape = hi_nd-lo_nd+1
 *     if skip is None:             # <<<<<<<<<<<<<<
 *         skip_nd = None
 *     else:
 */
    goto __pyx_L5;
  }

  /* "miniga4py/ga.pyx":378
 *         skip_nd = None
 *     else:
 *         skip_nd = _inta64(skip)             # <<<<<<<<<<<<<<
 *         shape = (hi_nd-lo_nd)/skip_nd+1
 *     buffer_nd = np.asarray(buffer, dtype=dtype)
 */
  /*else*/ {
    __pyx_t_3 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_skip)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_3), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_skip_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        }
        __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
      }
      __pyx_pybuffernd_skip_nd.diminfo[0].strides = __pyx_pybuffernd_skip_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_skip_nd.diminfo[0].shape = __pyx_pybuffernd_skip_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 378, __pyx_L1_error)
    }
    __pyx_v_skip_nd = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "miniga4py/ga.pyx":379
 *     else:
 *         skip_nd = _inta64(skip)
 *         shape = (hi_nd-lo_nd)/skip_nd+1             # <<<<<<<<<<<<<<
 *     buffer_nd = np.asarray(buffer, dtype=dtype)
 *     if buffer_nd.dtype != dtype:
 */
    __pyx_t_3 = PyNumber_Subtract(((PyObject *)__pyx_v_hi_nd), ((PyObject *)__pyx_v_lo_nd)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_3, ((PyObject *)__pyx_v_skip_nd)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 379, __pyx_L1_error)
    __pyx_t_6 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_shape.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_shape.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_shape.rcbuffer->pybuffer, (PyObject*)__pyx_v_shape, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
        }
        __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
      }
      __pyx_pybuffernd_shape.diminfo[0].strides = __pyx_pybuffernd_shape.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_shape.diminfo[0].shape = __pyx_pybuffernd_shape.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 379, __pyx_L1_error)
    }
    __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_shape, ((PyArrayObject *)__pyx_t_3));
    __pyx_t_3 = 0;
  }
  __pyx_L5:;

  /* "miniga4py/ga.pyx":380
 *         skip_nd = _inta64(skip)
 *         shape = (hi_nd-lo_nd)/skip_nd+1
 *     buffer_nd = np.asarray(buffer, dtype=dtype)             # <<<<<<<<<<<<<<
 *     if buffer_nd.dtype != dtype:
 *         raise ValueError("buffer is wrong type :: buffer=%s != %s" % (
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_buffer);
  __Pyx_GIVEREF(__pyx_v_buffer);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_buffer);
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_dtype) < 0) __PYX_ERR(0, 380, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 380, __pyx_L1_error)
  __pyx_v_buffer_nd = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "miniga4py/ga.pyx":381
 *         shape = (hi_nd-lo_nd)/skip_nd+1
 *     buffer_nd = np.asarray(buffer, dtype=dtype)
 *     if buffer_nd.dtype != dtype:             # <<<<<<<<<<<<<<
 *         raise ValueError("buffer is wrong type :: buffer=%s != %s" % (
 *                 buffer.dtype, dtype))
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buffer_nd), __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_v_dtype, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 381, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_12)) {

    /* "miniga4py/ga.pyx":383
 *     if buffer_nd.dtype != dtype:
 *         raise ValueError("buffer is wrong type :: buffer=%s != %s" % (
 *                 buffer.dtype, dtype))             # <<<<<<<<<<<<<<
 *     # Due to GA restrictions, buffer must not have negative strides
 *     # and buffer's last stride must be same as itemsize
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_buffer, __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 383, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_dtype);
    __Pyx_GIVEREF(__pyx_v_dtype);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_dtype);
    __pyx_t_1 = 0;

    /* "miniga4py/ga.pyx":382
 *     buffer_nd = np.asarray(buffer, dtype=dtype)
 *     if buffer_nd.dtype != dtype:
 *         raise ValueError("buffer is wrong type :: buffer=%s != %s" % (             # <<<<<<<<<<<<<<
 *                 buffer.dtype, dtype))
 *     # Due to GA restrictions, buffer must not have negative strides
 */
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_buffer_is_wrong_type_buffer_s_s, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 382, __pyx_L1_error)

    /* "miniga4py/ga.pyx":381
 *         shape = (hi_nd-lo_nd)/skip_nd+1
 *     buffer_nd = np.asarray(buffer, dtype=dtype)
 *     if buffer_nd.dtype != dtype:             # <<<<<<<<<<<<<<
 *         raise ValueError("buffer is wrong type :: buffer=%s != %s" % (
 *                 buffer.dtype, dtype))
 */
  }

  /* "miniga4py/ga.pyx":386
 *     # Due to GA restrictions, buffer must not have negative strides
 *     # and buffer's last stride must be same as itemsize
 *     strides = [buffer_nd.strides[i]/buffer_nd.itemsize             # <<<<<<<<<<<<<<
 *             for i in range(buffer_nd.ndim)]
 *     if (strides and (strides[-1] != 1 or np.any(np.asarray(strides) < 0))):
 */
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "miniga4py/ga.pyx":387
 *     # and buffer's last stride must be same as itemsize
 *     strides = [buffer_nd.strides[i]/buffer_nd.itemsize
 *             for i in range(buffer_nd.ndim)]             # <<<<<<<<<<<<<<
 *     if (strides and (strides[-1] != 1 or np.any(np.asarray(strides) < 0))):
 *         buffer_nd = np.ascontiguousarray(buffer_nd)
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_buffer_nd->nd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0;
    __pyx_t_14 = NULL;
  } else {
    __pyx_t_13 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_14 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 387, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_14)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 387, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 387, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 387, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 387, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_14(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 387, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "miniga4py/ga.pyx":386
 *     # Due to GA restrictions, buffer must not have negative strides
 *     # and buffer's last stride must be same as itemsize
 *     strides = [buffer_nd.strides[i]/buffer_nd.itemsize             # <<<<<<<<<<<<<<
 *             for i in range(buffer_nd.ndim)]
 *     if (strides and (strides[-1] != 1 or np.any(np.asarray(strides) < 0))):
 */
    __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 386, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_buffer_nd->strides[__pyx_t_15])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 386, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buffer_nd), __pyx_n_s_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 386, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_16 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 386, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_16))) __PYX_ERR(0, 386, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

    /* "miniga4py/ga.pyx":387
 *     # and buffer's last stride must be same as itemsize
 *     strides = [buffer_nd.strides[i]/buffer_nd.itemsize
 *             for i in range(buffer_nd.ndim)]             # <<<<<<<<<<<<<<
 *     if (strides and (strides[-1] != 1 or np.any(np.asarray(strides) < 0))):
 *         buffer_nd = np.ascontiguousarray(buffer_nd)
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_strides = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "miniga4py/ga.pyx":388
 *     strides = [buffer_nd.strides[i]/buffer_nd.itemsize
 *             for i in range(buffer_nd.ndim)]
 *     if (strides and (strides[-1] != 1 or np.any(np.asarray(strides) < 0))):             # <<<<<<<<<<<<<<
 *         buffer_nd = np.ascontiguousarray(buffer_nd)
 *     # we allow 1-d "flat" buffers in addition to buffers matching the shape of
 */
  __pyx_t_11 = (PyList_GET_SIZE(__pyx_v_strides) != 0);
  if (__pyx_t_11) {
  } else {
    __pyx_t_12 = __pyx_t_11;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_strides, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_int_1, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_11) {
  } else {
    __pyx_t_12 = __pyx_t_11;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_any); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_strides); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_strides};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_strides};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_17 = PyTuple_New(1+1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_v_strides);
      __Pyx_GIVEREF(__pyx_v_strides);
      PyTuple_SET_ITEM(__pyx_t_17, 0+1, __pyx_v_strides);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_17, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_16);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_16, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_17 = PyTuple_New(1+1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_17, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_12 = __pyx_t_11;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_12) {

    /* "miniga4py/ga.pyx":389
 *             for i in range(buffer_nd.ndim)]
 *     if (strides and (strides[-1] != 1 or np.any(np.asarray(strides) < 0))):
 *         buffer_nd = np.ascontiguousarray(buffer_nd)             # <<<<<<<<<<<<<<
 *     # we allow 1-d "flat" buffers in addition to buffers matching the shape of
 *     # the requested region
 */
    __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_17);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_17, function);
      }
    }
    if (!__pyx_t_16) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_17, ((PyObject *)__pyx_v_buffer_nd)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 389, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_17)) {
        PyObject *__pyx_temp[2] = {__pyx_t_16, ((PyObject *)__pyx_v_buffer_nd)};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 389, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) {
        PyObject *__pyx_temp[2] = {__pyx_t_16, ((PyObject *)__pyx_v_buffer_nd)};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 389, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 389, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_16); __pyx_t_16 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_v_buffer_nd));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_buffer_nd));
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, ((PyObject *)__pyx_v_buffer_nd));
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 389, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 389, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_buffer_nd, ((PyArrayObject *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "miniga4py/ga.pyx":388
 *     strides = [buffer_nd.strides[i]/buffer_nd.itemsize
 *             for i in range(buffer_nd.ndim)]
 *     if (strides and (strides[-1] != 1 or np.any(np.asarray(strides) < 0))):             # <<<<<<<<<<<<<<
 *         buffer_nd = np.ascontiguousarray(buffer_nd)
 *     # we allow 1-d "flat" buffers in addition to buffers matching the shape of
 */
  }

  /* "miniga4py/ga.pyx":392
 *     # we allow 1-d "flat" buffers in addition to buffers matching the shape of
 *     # the requested region
 *     if buffer_nd.ndim == 1:             # <<<<<<<<<<<<<<
 *         if buffer_nd.size != np.prod(shape):
 *             raise ValueError('buffer size does not match shape :: '
 */
  __pyx_t_12 = ((__pyx_v_buffer_nd->nd == 1) != 0);
  if (__pyx_t_12) {

    /* "miniga4py/ga.pyx":393
 *     # the requested region
 *     if buffer_nd.ndim == 1:
 *         if buffer_nd.size != np.prod(shape):             # <<<<<<<<<<<<<<
 *             raise ValueError('buffer size does not match shape :: '
 *                     'buffer.size=%s != np.prod(shape)=%s' % (
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buffer_nd), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 393, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 393, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_prod); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 393, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_16);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_16, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_17 = __Pyx_PyObject_CallOneArg(__pyx_t_16, ((PyObject *)__pyx_v_shape)); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 393, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_16)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, ((PyObject *)__pyx_v_shape)};
        __pyx_t_17 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 393, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_17);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, ((PyObject *)__pyx_v_shape)};
        __pyx_t_17 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 393, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_17);
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 393, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_v_shape));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_shape));
        PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_shape));
        __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_4, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 393, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = PyObject_RichCompare(__pyx_t_1, __pyx_t_17, Py_NE); __Pyx_XGOTREF(__pyx_t_16); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 393, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_16); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 393, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    if (unlikely(__pyx_t_12)) {

      /* "miniga4py/ga.pyx":396
 *             raise ValueError('buffer size does not match shape :: '
 *                     'buffer.size=%s != np.prod(shape)=%s' % (
 *                     buffer_nd.size, np.prod(shape)))             # <<<<<<<<<<<<<<
 *         ld_nd = shape[1:]
 *     else:
 */
      __pyx_t_16 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buffer_nd), __pyx_n_s_size); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_prod); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_1) {
        __pyx_t_17 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_v_shape)); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 396, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_1, ((PyObject *)__pyx_v_shape)};
          __pyx_t_17 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 396, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_17);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_1, ((PyObject *)__pyx_v_shape)};
          __pyx_t_17 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 396, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_17);
        } else
        #endif
        {
          __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 396, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
          __Pyx_INCREF(((PyObject *)__pyx_v_shape));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_shape));
          PyTuple_SET_ITEM(__pyx_t_3, 0+1, ((PyObject *)__pyx_v_shape));
          __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 396, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_17);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_16);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_16);
      __Pyx_GIVEREF(__pyx_t_17);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_17);
      __pyx_t_16 = 0;
      __pyx_t_17 = 0;

      /* "miniga4py/ga.pyx":395
 *         if buffer_nd.size != np.prod(shape):
 *             raise ValueError('buffer size does not match shape :: '
 *                     'buffer.size=%s != np.prod(shape)=%s' % (             # <<<<<<<<<<<<<<
 *                     buffer_nd.size, np.prod(shape)))
 *         ld_nd = shape[1:]
 */
      __pyx_t_17 = __Pyx_PyString_Format(__pyx_kp_s_buffer_size_does_not_match_shape, __pyx_t_4); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 395, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "miniga4py/ga.pyx":394
 *     if buffer_nd.ndim == 1:
 *         if buffer_nd.size != np.prod(shape):
 *             raise ValueError('buffer size does not match shape :: '             # <<<<<<<<<<<<<<
 *                     'buffer.size=%s != np.prod(shape)=%s' % (
 *                     buffer_nd.size, np.prod(shape)))
 */
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_17); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 394, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 394, __pyx_L1_error)

      /* "miniga4py/ga.pyx":393
 *     # the requested region
 *     if buffer_nd.ndim == 1:
 *         if buffer_nd.size != np.prod(shape):             # <<<<<<<<<<<<<<
 *             raise ValueError('buffer size does not match shape :: '
 *                     'buffer.size=%s != np.prod(shape)=%s' % (
 */
    }

    /* "miniga4py/ga.pyx":397
 *                     'buffer.size=%s != np.prod(shape)=%s' % (
 *                     buffer_nd.size, np.prod(shape)))
 *         ld_nd = shape[1:]             # <<<<<<<<<<<<<<
 *     else:
 *         buffer_shape = [buffer_nd.shape[i] for i in range(buffer_nd.ndim)]
 */
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_shape), __pyx_slice__4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 397, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 397, __pyx_L1_error)
    __pyx_t_6 = ((PyArrayObject *)__pyx_t_4);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ld_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        }
        __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
      }
      __pyx_pybuffernd_ld_nd.diminfo[0].strides = __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ld_nd.diminfo[0].shape = __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 397, __pyx_L1_error)
    }
    __pyx_t_6 = 0;
    __pyx_v_ld_nd = ((PyArrayObject *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "miniga4py/ga.pyx":392
 *     # we allow 1-d "flat" buffers in addition to buffers matching the shape of
 *     # the requested region
 *     if buffer_nd.ndim == 1:             # <<<<<<<<<<<<<<
 *         if buffer_nd.size != np.prod(shape):
 *             raise ValueError('buffer size does not match shape :: '
 */
    goto __pyx_L13;
  }

  /* "miniga4py/ga.pyx":399
 *         ld_nd = shape[1:]
 *     else:
 *         buffer_shape = [buffer_nd.shape[i] for i in range(buffer_nd.ndim)]             # <<<<<<<<<<<<<<
 *         if not np.all(buffer_shape == shape):
 *             raise ValueError('buffer shape does not match request shape :: '
 */
  /*else*/ {
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_buffer_nd->nd); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    if (likely(PyList_CheckExact(__pyx_t_16)) || PyTuple_CheckExact(__pyx_t_16)) {
      __pyx_t_17 = __pyx_t_16; __Pyx_INCREF(__pyx_t_17); __pyx_t_13 = 0;
      __pyx_t_14 = NULL;
    } else {
      __pyx_t_13 = -1; __pyx_t_17 = PyObject_GetIter(__pyx_t_16); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 399, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_14 = Py_TYPE(__pyx_t_17)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 399, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    for (;;) {
      if (likely(!__pyx_t_14)) {
        if (likely(PyList_CheckExact(__pyx_t_17))) {
          if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_17)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_16 = PyList_GET_ITEM(__pyx_t_17, __pyx_t_13); __Pyx_INCREF(__pyx_t_16); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 399, __pyx_L1_error)
          #else
          __pyx_t_16 = PySequence_ITEM(__pyx_t_17, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 399, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_16);
          #endif
        } else {
          if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_17)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_16 = PyTuple_GET_ITEM(__pyx_t_17, __pyx_t_13); __Pyx_INCREF(__pyx_t_16); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 399, __pyx_L1_error)
          #else
          __pyx_t_16 = PySequence_ITEM(__pyx_t_17, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 399, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_16);
          #endif
        }
      } else {
        __pyx_t_16 = __pyx_t_14(__pyx_t_17);
        if (unlikely(!__pyx_t_16)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 399, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_16);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_16);
      __pyx_t_16 = 0;
      __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 399, __pyx_L1_error)
      __pyx_t_16 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_buffer_nd->dimensions[__pyx_t_15])); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 399, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_16))) __PYX_ERR(0, 399, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    }
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __pyx_v_buffer_shape = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "miniga4py/ga.pyx":400
 *     else:
 *         buffer_shape = [buffer_nd.shape[i] for i in range(buffer_nd.ndim)]
 *         if not np.all(buffer_shape == shape):             # <<<<<<<<<<<<<<
 *             raise ValueError('buffer shape does not match request shape :: '
 *                     'buffer_shape=%s != shape=%s' % (
 */
    __pyx_t_17 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 400, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_all); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 400, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __pyx_t_17 = PyObject_RichCompare(__pyx_v_buffer_shape, ((PyObject *)__pyx_v_shape), Py_EQ); __Pyx_XGOTREF(__pyx_t_17); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 400, __pyx_L1_error)
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_16);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_16, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_17); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 400, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_16)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_17};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 400, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_17};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 400, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      } else
      #endif
      {
        __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_GIVEREF(__pyx_t_17);
        PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_17);
        __pyx_t_17 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 400, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 400, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_11 = ((!__pyx_t_12) != 0);
    if (unlikely(__pyx_t_11)) {

      /* "miniga4py/ga.pyx":403
 *             raise ValueError('buffer shape does not match request shape :: '
 *                     'buffer_shape=%s != shape=%s' % (
 *                     buffer_shape, shape))             # <<<<<<<<<<<<<<
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)
 */
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 403, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_buffer_shape);
      __Pyx_GIVEREF(__pyx_v_buffer_shape);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_buffer_shape);
      __Pyx_INCREF(((PyObject *)__pyx_v_shape));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_shape));
      PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_shape));

      /* "miniga4py/ga.pyx":402
 *         if not np.all(buffer_shape == shape):
 *             raise ValueError('buffer shape does not match request shape :: '
 *                     'buffer_shape=%s != shape=%s' % (             # <<<<<<<<<<<<<<
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 */
      __pyx_t_16 = __Pyx_PyString_Format(__pyx_kp_s_buffer_shape_does_not_match_requ, __pyx_t_4); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 402, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "miniga4py/ga.pyx":401
 *         buffer_shape = [buffer_nd.shape[i] for i in range(buffer_nd.ndim)]
 *         if not np.all(buffer_shape == shape):
 *             raise ValueError('buffer shape does not match request shape :: '             # <<<<<<<<<<<<<<
 *                     'buffer_shape=%s != shape=%s' % (
 *                     buffer_shape, shape))
 */
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 401, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 401, __pyx_L1_error)

      /* "miniga4py/ga.pyx":400
 *     else:
 *         buffer_shape = [buffer_nd.shape[i] for i in range(buffer_nd.ndim)]
 *         if not np.all(buffer_shape == shape):             # <<<<<<<<<<<<<<
 *             raise ValueError('buffer shape does not match request shape :: '
 *                     'buffer_shape=%s != shape=%s' % (
 */
    }

    /* "miniga4py/ga.pyx":404
 *                     'buffer_shape=%s != shape=%s' % (
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]             # <<<<<<<<<<<<<<
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)
 *     if alpha is None:
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 404, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 404, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 404, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "miniga4py/ga.pyx":405
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)             # <<<<<<<<<<<<<<
 *     if alpha is None:
 *         alpha = 1
 */
    __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_buffer_nd->nd - 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 405, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_17 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 405, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (likely(PyList_CheckExact(__pyx_t_17)) || PyTuple_CheckExact(__pyx_t_17)) {
      __pyx_t_1 = __pyx_t_17; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0;
      __pyx_t_14 = NULL;
    } else {
      __pyx_t_13 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_17); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 405, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_14 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 405, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    for (;;) {
      if (likely(!__pyx_t_14)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_17 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_17); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 405, __pyx_L1_error)
          #else
          __pyx_t_17 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 405, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_17);
          #endif
        } else {
          if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_17 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_17); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 405, __pyx_L1_error)
          #else
          __pyx_t_17 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 405, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_17);
          #endif
        }
      } else {
        __pyx_t_17 = __pyx_t_14(__pyx_t_1);
        if (unlikely(!__pyx_t_17)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 405, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_17);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_17);
      __pyx_t_17 = 0;

      /* "miniga4py/ga.pyx":404
 *                     'buffer_shape=%s != shape=%s' % (
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]             # <<<<<<<<<<<<<<
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)
 *     if alpha is None:
 */
      __pyx_t_17 = __Pyx_PyObject_GetItem(__pyx_v_strides, __pyx_v_i); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 404, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 404, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_strides, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 404, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_17, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 404, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 404, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "miniga4py/ga.pyx":405
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)             # <<<<<<<<<<<<<<
 *     if alpha is None:
 *         alpha = 1
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "miniga4py/ga.pyx":404
 *                     'buffer_shape=%s != shape=%s' % (
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]             # <<<<<<<<<<<<<<
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)
 *     if alpha is None:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 404, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "miniga4py/ga.pyx":405
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)             # <<<<<<<<<<<<<<
 *     if alpha is None:
 *         alpha = 1
 */
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 405, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 405, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 405, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 405, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "miniga4py/ga.pyx":404
 *                     'buffer_shape=%s != shape=%s' % (
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]             # <<<<<<<<<<<<<<
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)
 *     if alpha is None:
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 404, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 404, __pyx_L1_error)
    __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ld_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
        }
        __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
      }
      __pyx_pybuffernd_ld_nd.diminfo[0].strides = __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ld_nd.diminfo[0].shape = __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 404, __pyx_L1_error)
    }
    __pyx_t_6 = 0;
    __pyx_v_ld_nd = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L13:;

  /* "miniga4py/ga.pyx":406
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)
 *     if alpha is None:             # <<<<<<<<<<<<<<
 *         alpha = 1
 *     valpha = _convert_multiplier(gtype, alpha,
 */
  __pyx_t_11 = (__pyx_v_alpha == Py_None);
  __pyx_t_12 = (__pyx_t_11 != 0);
  if (__pyx_t_12) {

    /* "miniga4py/ga.pyx":407
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)
 *     if alpha is None:
 *         alpha = 1             # <<<<<<<<<<<<<<
 *     valpha = _convert_multiplier(gtype, alpha,
 *             &ialpha,  &lalpha,  &llalpha,
 */
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_DECREF_SET(__pyx_v_alpha, __pyx_int_1);

    /* "miniga4py/ga.pyx":406
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)
 *     if alpha is None:             # <<<<<<<<<<<<<<
 *         alpha = 1
 *     valpha = _convert_multiplier(gtype, alpha,
 */
  }

  /* "miniga4py/ga.pyx":408
 *     if alpha is None:
 *         alpha = 1
 *     valpha = _convert_multiplier(gtype, alpha,             # <<<<<<<<<<<<<<
 *             &ialpha,  &lalpha,  &llalpha,
 *             &falpha,  &dalpha,  &ldalpha,
 */
  __pyx_v_valpha = __pyx_f_9miniga4py_2ga__convert_multiplier(__pyx_v_gtype, __pyx_v_alpha, (&__pyx_v_ialpha), (&__pyx_v_lalpha), (&__pyx_v_llalpha), (&__pyx_v_falpha), (&__pyx_v_dalpha), (&__pyx_v_ldalpha), (&__pyx_v_fcalpha), (&__pyx_v_dcalpha));

  /* "miniga4py/ga.pyx":412
 *             &falpha,  &dalpha,  &ldalpha,
 *             &fcalpha, &dcalpha)
 *     if nb:             # <<<<<<<<<<<<<<
 *         NGA_NbAcc64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, valpha, &nbhandle)
 */
  __pyx_t_12 = (__pyx_v_nb != 0);
  if (__pyx_t_12) {

    /* "miniga4py/ga.pyx":413
 *             &fcalpha, &dcalpha)
 *     if nb:
 *         NGA_NbAcc64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,             # <<<<<<<<<<<<<<
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, valpha, &nbhandle)
 *         return nbhandle
 */
    NGA_NbAcc64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data), ((void *)__pyx_v_buffer_nd->data), ((int64_t *)__pyx_v_ld_nd->data), __pyx_v_valpha, (&__pyx_v_nbhandle));

    /* "miniga4py/ga.pyx":415
 *         NGA_NbAcc64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, valpha, &nbhandle)
 *         return nbhandle             # <<<<<<<<<<<<<<
 *     elif periodic:
 *         NGA_Periodic_acc64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_Integer(__pyx_v_nbhandle); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":412
 *             &falpha,  &dalpha,  &ldalpha,
 *             &fcalpha, &dcalpha)
 *     if nb:             # <<<<<<<<<<<<<<
 *         NGA_NbAcc64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, valpha, &nbhandle)
 */
  }

  /* "miniga4py/ga.pyx":416
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, valpha, &nbhandle)
 *         return nbhandle
 *     elif periodic:             # <<<<<<<<<<<<<<
 *         NGA_Periodic_acc64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, valpha)
 */
  __pyx_t_12 = (__pyx_v_periodic != 0);
  if (__pyx_t_12) {

    /* "miniga4py/ga.pyx":417
 *         return nbhandle
 *     elif periodic:
 *         NGA_Periodic_acc64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,             # <<<<<<<<<<<<<<
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, valpha)
 *     elif skip is not None:
 */
    NGA_Periodic_acc64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data), ((void *)__pyx_v_buffer_nd->data), ((int64_t *)__pyx_v_ld_nd->data), __pyx_v_valpha);

    /* "miniga4py/ga.pyx":416
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, valpha, &nbhandle)
 *         return nbhandle
 *     elif periodic:             # <<<<<<<<<<<<<<
 *         NGA_Periodic_acc64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, valpha)
 */
    goto __pyx_L21;
  }

  /* "miniga4py/ga.pyx":419
 *         NGA_Periodic_acc64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, valpha)
 *     elif skip is not None:             # <<<<<<<<<<<<<<
 *         NGA_Strided_acc64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <int64_t*>skip_nd.data,
 */
  __pyx_t_12 = (__pyx_v_skip != Py_None);
  __pyx_t_11 = (__pyx_t_12 != 0);
  if (__pyx_t_11) {

    /* "miniga4py/ga.pyx":420
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, valpha)
 *     elif skip is not None:
 *         NGA_Strided_acc64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,             # <<<<<<<<<<<<<<
 *                 <int64_t*>skip_nd.data,
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, valpha)
 */
    NGA_Strided_acc64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data), ((int64_t *)__pyx_v_skip_nd->data), ((void *)__pyx_v_buffer_nd->data), ((int64_t *)__pyx_v_ld_nd->data), __pyx_v_valpha);

    /* "miniga4py/ga.pyx":419
 *         NGA_Periodic_acc64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, valpha)
 *     elif skip is not None:             # <<<<<<<<<<<<<<
 *         NGA_Strided_acc64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <int64_t*>skip_nd.data,
 */
    goto __pyx_L21;
  }

  /* "miniga4py/ga.pyx":424
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, valpha)
 *     else:
 *         NGA_Acc64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,             # <<<<<<<<<<<<<<
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, valpha)
 * 
 */
  /*else*/ {

    /* "miniga4py/ga.pyx":425
 *     else:
 *         NGA_Acc64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, valpha)             # <<<<<<<<<<<<<<
 * 
 * def access(int g_a, lo=None, hi=None, int proc=-1):
 */
    NGA_Acc64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data), ((void *)__pyx_v_buffer_nd->data), ((int64_t *)__pyx_v_ld_nd->data), __pyx_v_valpha);
  }
  __pyx_L21:;

  /* "miniga4py/ga.pyx":318
 *     _acc_common(g_a, buffer, lo, hi, alpha)
 * 
 * cdef _acc_common(int g_a, buffer, lo=None, hi=None, alpha=None,             # <<<<<<<<<<<<<<
 *         bint nb=False, bint periodic=False, skip=None):
 *     """Combines data from buffer with data in the global array patch.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_shape.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga._acc_common", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_shape.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_ld_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_shape);
  __Pyx_XDECREF((PyObject *)__pyx_v_skip_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_buffer_nd);
  __Pyx_XDECREF(__pyx_v_dtype);
  __Pyx_XDECREF(__pyx_v_strides);
  __Pyx_XDECREF(__pyx_v_buffer_shape);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_alpha);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":427
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, valpha)
 * 
 * def access(int g_a, lo=None, hi=None, int proc=-1):             # <<<<<<<<<<<<<<
 *     """Returns local array patch.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_25access(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_24access[] = "access(int g_a, lo=None, hi=None, int proc=-1)\nReturns local array patch.\n    \n    This routine allows to access directly, in place elements in the local\n    section of a global array. It useful for writing new GA operations.\n    If no patch is specified, the entire local patch is returned.  If this\n    process does not own any data, None is returned.\n    \n    Note: The entire local data is always accessed, but if a smaller patch is\n    requested, an appropriately sliced ndarray is returned.\n\n    If proc is not specified, then ga.nodeid() is used.\n\n    Each call to ga.access has to be followed by a call to either ga.release\n    or ga.release_update. You can access in this fashion only local data.\n    Since the data is shared with other processes, you need to consider issues\n    of mutual exclusion.\n\n    This operation is local. \n\n    :Parameters:\n        g_a : int\n            the array handle\n        lo : 1D array-like\n            lower bound patch coordinates, inclusive\n        hi : 1D array-like\n            higher bound patch coordinates, exclusive\n        proc : int\n            defaults to ga.nodeid(), but can specify a proc within the same\n            SMP node to access its data instead\n    \n    :returns: ndarray representing local patch\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_25access = {"access", (PyCFunction)__pyx_pw_9miniga4py_2ga_25access, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_24access};
static PyObject *__pyx_pw_9miniga4py_2ga_25access(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  int __pyx_v_proc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("access (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_lo,&__pyx_n_s_hi,&__pyx_n_s_proc,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_proc);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "access") < 0)) __PYX_ERR(0, 427, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 427, __pyx_L3_error)
    __pyx_v_lo = values[1];
    __pyx_v_hi = values[2];
    if (values[3]) {
      __pyx_v_proc = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_proc == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 427, __pyx_L3_error)
    } else {
      __pyx_v_proc = ((int)-1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("access", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 427, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.access", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_24access(__pyx_self, __pyx_v_g_a, __pyx_v_lo, __pyx_v_hi, __pyx_v_proc);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_24access(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, int __pyx_v_proc) {
  PyArrayObject *__pyx_v_lo_nd = 0;
  PyArrayObject *__pyx_v_hi_nd = 0;
  PyArrayObject *__pyx_v_ld_nd = 0;
  PyArrayObject *__pyx_v_lo_dst = 0;
  PyArrayObject *__pyx_v_hi_dst = 0;
  PyArrayObject *__pyx_v_dims_nd = 0;
  int __pyx_v_i;
  int __pyx_v_gtype;
  int __pyx_v_dimlen;
  PyArray_Descr *__pyx_v_dtype = 0;
  void *__pyx_v_ptr;
  npy_intp *__pyx_v_dims;
  npy_intp *__pyx_v_strides;
  PyObject *__pyx_v_array = NULL;
  PyObject *__pyx_v_slices = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dims_nd;
  __Pyx_Buffer __pyx_pybuffer_dims_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_dst;
  __Pyx_Buffer __pyx_pybuffer_hi_dst;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_nd;
  __Pyx_Buffer __pyx_pybuffer_hi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ld_nd;
  __Pyx_Buffer __pyx_pybuffer_ld_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lo_dst;
  __Pyx_Buffer __pyx_pybuffer_lo_dst;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lo_nd;
  __Pyx_Buffer __pyx_pybuffer_lo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  struct __pyx_opt_args_9miniga4py_2ga_distribution __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyArrayObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  Py_ssize_t __pyx_t_13;
  int __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  long __pyx_t_17;
  long __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  int __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  int __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  int __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  int __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  int __pyx_t_31;
  __Pyx_RefNannySetupContext("access", 0);
  __pyx_pybuffer_lo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_lo_nd.refcount = 0;
  __pyx_pybuffernd_lo_nd.data = NULL;
  __pyx_pybuffernd_lo_nd.rcbuffer = &__pyx_pybuffer_lo_nd;
  __pyx_pybuffer_hi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_nd.refcount = 0;
  __pyx_pybuffernd_hi_nd.data = NULL;
  __pyx_pybuffernd_hi_nd.rcbuffer = &__pyx_pybuffer_hi_nd;
  __pyx_pybuffer_ld_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_ld_nd.refcount = 0;
  __pyx_pybuffernd_ld_nd.data = NULL;
  __pyx_pybuffernd_ld_nd.rcbuffer = &__pyx_pybuffer_ld_nd;
  __pyx_pybuffer_lo_dst.pybuffer.buf = NULL;
  __pyx_pybuffer_lo_dst.refcount = 0;
  __pyx_pybuffernd_lo_dst.data = NULL;
  __pyx_pybuffernd_lo_dst.rcbuffer = &__pyx_pybuffer_lo_dst;
  __pyx_pybuffer_hi_dst.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_dst.refcount = 0;
  __pyx_pybuffernd_hi_dst.data = NULL;
  __pyx_pybuffernd_hi_dst.rcbuffer = &__pyx_pybuffer_hi_dst;
  __pyx_pybuffer_dims_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_dims_nd.refcount = 0;
  __pyx_pybuffernd_dims_nd.data = NULL;
  __pyx_pybuffernd_dims_nd.rcbuffer = &__pyx_pybuffer_dims_nd;

  /* "miniga4py/ga.pyx":463
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] ld_nd, lo_dst, hi_dst, dims_nd
 *     cdef int i, gtype=inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     cdef int dimlen=GA_Ndim(g_a)
 *     cdef np.dtype dtype = _to_dtype[gtype]
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":464
 *     cdef np.ndarray[np.int64_t, ndim=1] ld_nd, lo_dst, hi_dst, dims_nd
 *     cdef int i, gtype=inquire_type(g_a)
 *     cdef int dimlen=GA_Ndim(g_a)             # <<<<<<<<<<<<<<
 *     cdef np.dtype dtype = _to_dtype[gtype]
 *     cdef void *ptr
 */
  __pyx_v_dimlen = GA_Ndim(__pyx_v_g_a);

  /* "miniga4py/ga.pyx":465
 *     cdef int i, gtype=inquire_type(g_a)
 *     cdef int dimlen=GA_Ndim(g_a)
 *     cdef np.dtype dtype = _to_dtype[gtype]             # <<<<<<<<<<<<<<
 *     cdef void *ptr
 *     cdef np.npy_intp *dims = NULL
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_to_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_gtype, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(0, 465, __pyx_L1_error)
  __pyx_v_dtype = ((PyArray_Descr *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "miniga4py/ga.pyx":467
 *     cdef np.dtype dtype = _to_dtype[gtype]
 *     cdef void *ptr
 *     cdef np.npy_intp *dims = NULL             # <<<<<<<<<<<<<<
 *     cdef np.npy_intp *strides = NULL
 *     if proc < 0:
 */
  __pyx_v_dims = NULL;

  /* "miniga4py/ga.pyx":468
 *     cdef void *ptr
 *     cdef np.npy_intp *dims = NULL
 *     cdef np.npy_intp *strides = NULL             # <<<<<<<<<<<<<<
 *     if proc < 0:
 *         proc = GA_Nodeid()
 */
  __pyx_v_strides = NULL;

  /* "miniga4py/ga.pyx":469
 *     cdef np.npy_intp *dims = NULL
 *     cdef np.npy_intp *strides = NULL
 *     if proc < 0:             # <<<<<<<<<<<<<<
 *         proc = GA_Nodeid()
 *     # first things first, if no data is owned, return None
 */
  __pyx_t_3 = ((__pyx_v_proc < 0) != 0);
  if (__pyx_t_3) {

    /* "miniga4py/ga.pyx":470
 *     cdef np.npy_intp *strides = NULL
 *     if proc < 0:
 *         proc = GA_Nodeid()             # <<<<<<<<<<<<<<
 *     # first things first, if no data is owned, return None
 *     lo_dst,hi_dst = distribution(g_a, proc)
 */
    __pyx_v_proc = GA_Nodeid();

    /* "miniga4py/ga.pyx":469
 *     cdef np.npy_intp *dims = NULL
 *     cdef np.npy_intp *strides = NULL
 *     if proc < 0:             # <<<<<<<<<<<<<<
 *         proc = GA_Nodeid()
 *     # first things first, if no data is owned, return None
 */
  }

  /* "miniga4py/ga.pyx":472
 *         proc = GA_Nodeid()
 *     # first things first, if no data is owned, return None
 *     lo_dst,hi_dst = distribution(g_a, proc)             # <<<<<<<<<<<<<<
 *     if lo_dst[0] < 0 or hi_dst[0] < 0:
 *         return None
 */
  __pyx_t_4.__pyx_n = 1;
  __pyx_t_4.proc = __pyx_v_proc;
  __pyx_t_2 = __pyx_f_9miniga4py_2ga_distribution(__pyx_v_g_a, 0, &__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 472, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 472, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 472, __pyx_L1_error)
    __pyx_L5_unpacking_done:;
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 472, __pyx_L1_error)
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 472, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_dst.rcbuffer->pybuffer);
    __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_dst.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_9 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_dst.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_dst, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __pyx_t_10 = __pyx_t_11 = __pyx_t_12 = 0;
    }
    __pyx_pybuffernd_lo_dst.diminfo[0].strides = __pyx_pybuffernd_lo_dst.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_dst.diminfo[0].shape = __pyx_pybuffernd_lo_dst.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 472, __pyx_L1_error)
  }
  __pyx_t_8 = 0;
  __pyx_v_lo_dst = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer);
    __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_9 < 0)) {
      PyErr_Fetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_dst, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      }
      __pyx_t_12 = __pyx_t_11 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_hi_dst.diminfo[0].strides = __pyx_pybuffernd_hi_dst.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_dst.diminfo[0].shape = __pyx_pybuffernd_hi_dst.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 472, __pyx_L1_error)
  }
  __pyx_t_8 = 0;
  __pyx_v_hi_dst = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":473
 *     # first things first, if no data is owned, return None
 *     lo_dst,hi_dst = distribution(g_a, proc)
 *     if lo_dst[0] < 0 or hi_dst[0] < 0:             # <<<<<<<<<<<<<<
 *         return None
 *     # always access the entire local data
 */
  __pyx_t_13 = 0;
  __pyx_t_9 = -1;
  if (__pyx_t_13 < 0) {
    __pyx_t_13 += __pyx_pybuffernd_lo_dst.diminfo[0].shape;
    if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 0;
  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_lo_dst.diminfo[0].shape)) __pyx_t_9 = 0;
  if (unlikely(__pyx_t_9 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_9);
    __PYX_ERR(0, 473, __pyx_L1_error)
  }
  __pyx_t_14 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lo_dst.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_lo_dst.diminfo[0].strides)) < 0) != 0);
  if (!__pyx_t_14) {
  } else {
    __pyx_t_3 = __pyx_t_14;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_15 = 0;
  __pyx_t_9 = -1;
  if (__pyx_t_15 < 0) {
    __pyx_t_15 += __pyx_pybuffernd_hi_dst.diminfo[0].shape;
    if (unlikely(__pyx_t_15 < 0)) __pyx_t_9 = 0;
  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_hi_dst.diminfo[0].shape)) __pyx_t_9 = 0;
  if (unlikely(__pyx_t_9 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_9);
    __PYX_ERR(0, 473, __pyx_L1_error)
  }
  __pyx_t_14 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_hi_dst.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_hi_dst.diminfo[0].strides)) < 0) != 0);
  __pyx_t_3 = __pyx_t_14;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_3) {

    /* "miniga4py/ga.pyx":474
 *     lo_dst,hi_dst = distribution(g_a, proc)
 *     if lo_dst[0] < 0 or hi_dst[0] < 0:
 *         return None             # <<<<<<<<<<<<<<
 *     # always access the entire local data
 *     ld_nd = np.ones(dimlen, dtype=np.int64)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":473
 *     # first things first, if no data is owned, return None
 *     lo_dst,hi_dst = distribution(g_a, proc)
 *     if lo_dst[0] < 0 or hi_dst[0] < 0:             # <<<<<<<<<<<<<<
 *         return None
 *     # always access the entire local data
 */
  }

  /* "miniga4py/ga.pyx":476
 *         return None
 *     # always access the entire local data
 *     ld_nd = np.ones(dimlen, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     # put hi_dst back to GA inclusive indexing convention
 *     hi_dst -= 1
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ones); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_dimlen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int64); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_16) < 0) __PYX_ERR(0, 476, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 476, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_16);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
    __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_9 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ld_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __pyx_t_10 = __pyx_t_11 = __pyx_t_12 = 0;
    }
    __pyx_pybuffernd_ld_nd.diminfo[0].strides = __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ld_nd.diminfo[0].shape = __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 476, __pyx_L1_error)
  }
  __pyx_t_8 = 0;
  __pyx_v_ld_nd = ((PyArrayObject *)__pyx_t_16);
  __pyx_t_16 = 0;

  /* "miniga4py/ga.pyx":478
 *     ld_nd = np.ones(dimlen, dtype=np.int64)
 *     # put hi_dst back to GA inclusive indexing convention
 *     hi_dst -= 1             # <<<<<<<<<<<<<<
 *     NGA_Access64(g_a, <int64_t*>lo_dst.data, <int64_t*>hi_dst.data, &ptr,
 *             <int64_t*>ld_nd.data)
 */
  __pyx_t_16 = PyNumber_InPlaceSubtract(((PyObject *)__pyx_v_hi_dst), __pyx_int_1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 478, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_16);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer);
    __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_9 < 0)) {
      PyErr_Fetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_dst, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      }
      __pyx_t_12 = __pyx_t_11 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_hi_dst.diminfo[0].strides = __pyx_pybuffernd_hi_dst.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_dst.diminfo[0].shape = __pyx_pybuffernd_hi_dst.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 478, __pyx_L1_error)
  }
  __pyx_t_8 = 0;
  __Pyx_DECREF_SET(__pyx_v_hi_dst, ((PyArrayObject *)__pyx_t_16));
  __pyx_t_16 = 0;

  /* "miniga4py/ga.pyx":479
 *     # put hi_dst back to GA inclusive indexing convention
 *     hi_dst -= 1
 *     NGA_Access64(g_a, <int64_t*>lo_dst.data, <int64_t*>hi_dst.data, &ptr,             # <<<<<<<<<<<<<<
 *             <int64_t*>ld_nd.data)
 *     # put hi_dst back to Python exclusive indexing convention
 */
  NGA_Access64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_dst->data), ((int64_t *)__pyx_v_hi_dst->data), (&__pyx_v_ptr), ((int64_t *)__pyx_v_ld_nd->data));

  /* "miniga4py/ga.pyx":482
 *             <int64_t*>ld_nd.data)
 *     # put hi_dst back to Python exclusive indexing convention
 *     hi_dst += 1             # <<<<<<<<<<<<<<
 *     dims_nd = hi_dst-lo_dst
 *     # fix the strides, for example if ghost cells are in use
 */
  __pyx_t_16 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_hi_dst), __pyx_int_1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 482, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_16);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer);
    __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_9 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_dst, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __pyx_t_10 = __pyx_t_11 = __pyx_t_12 = 0;
    }
    __pyx_pybuffernd_hi_dst.diminfo[0].strides = __pyx_pybuffernd_hi_dst.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_dst.diminfo[0].shape = __pyx_pybuffernd_hi_dst.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 482, __pyx_L1_error)
  }
  __pyx_t_8 = 0;
  __Pyx_DECREF_SET(__pyx_v_hi_dst, ((PyArrayObject *)__pyx_t_16));
  __pyx_t_16 = 0;

  /* "miniga4py/ga.pyx":483
 *     # put hi_dst back to Python exclusive indexing convention
 *     hi_dst += 1
 *     dims_nd = hi_dst-lo_dst             # <<<<<<<<<<<<<<
 *     # fix the strides, for example if ghost cells are in use
 *     # or if memory is allocated in a non-contiguous way
 */
  __pyx_t_16 = PyNumber_Subtract(((PyObject *)__pyx_v_hi_dst), ((PyObject *)__pyx_v_lo_dst)); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 483, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_16);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
    __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_9 < 0)) {
      PyErr_Fetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_dims_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      }
      __pyx_t_12 = __pyx_t_11 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_dims_nd.diminfo[0].strides = __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dims_nd.diminfo[0].shape = __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 483, __pyx_L1_error)
  }
  __pyx_t_8 = 0;
  __pyx_v_dims_nd = ((PyArrayObject *)__pyx_t_16);
  __pyx_t_16 = 0;

  /* "miniga4py/ga.pyx":486
 *     # fix the strides, for example if ghost cells are in use
 *     # or if memory is allocated in a non-contiguous way
 *     if dimlen >= 3:             # <<<<<<<<<<<<<<
 *         for i in range(-3, -dimlen-1, -1):
 *             ld_nd[i] *= ld_nd[i+1]
 */
  __pyx_t_3 = ((__pyx_v_dimlen >= 3) != 0);
  if (__pyx_t_3) {

    /* "miniga4py/ga.pyx":487
 *     # or if memory is allocated in a non-contiguous way
 *     if dimlen >= 3:
 *         for i in range(-3, -dimlen-1, -1):             # <<<<<<<<<<<<<<
 *             ld_nd[i] *= ld_nd[i+1]
 *     ld_nd *= _to_dtype[gtype].itemsize
 */
    __pyx_t_17 = ((-__pyx_v_dimlen) - 1);
    __pyx_t_18 = __pyx_t_17;
    for (__pyx_t_9 = -3; __pyx_t_9 > __pyx_t_18; __pyx_t_9-=1) {
      __pyx_v_i = __pyx_t_9;

      /* "miniga4py/ga.pyx":488
 *     if dimlen >= 3:
 *         for i in range(-3, -dimlen-1, -1):
 *             ld_nd[i] *= ld_nd[i+1]             # <<<<<<<<<<<<<<
 *     ld_nd *= _to_dtype[gtype].itemsize
 *     # must convert int64_t ndarray shape to npy_intp array
 */
      __pyx_t_19 = (__pyx_v_i + 1);
      __pyx_t_20 = -1;
      if (__pyx_t_19 < 0) {
        __pyx_t_19 += __pyx_pybuffernd_ld_nd.diminfo[0].shape;
        if (unlikely(__pyx_t_19 < 0)) __pyx_t_20 = 0;
      } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_ld_nd.diminfo[0].shape)) __pyx_t_20 = 0;
      if (unlikely(__pyx_t_20 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_20);
        __PYX_ERR(0, 488, __pyx_L1_error)
      }
      __pyx_t_21 = __pyx_v_i;
      __pyx_t_20 = -1;
      if (__pyx_t_21 < 0) {
        __pyx_t_21 += __pyx_pybuffernd_ld_nd.diminfo[0].shape;
        if (unlikely(__pyx_t_21 < 0)) __pyx_t_20 = 0;
      } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_ld_nd.diminfo[0].shape)) __pyx_t_20 = 0;
      if (unlikely(__pyx_t_20 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_20);
        __PYX_ERR(0, 488, __pyx_L1_error)
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_ld_nd.diminfo[0].strides) *= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_ld_nd.diminfo[0].strides));
    }

    /* "miniga4py/ga.pyx":486
 *     # fix the strides, for example if ghost cells are in use
 *     # or if memory is allocated in a non-contiguous way
 *     if dimlen >= 3:             # <<<<<<<<<<<<<<
 *         for i in range(-3, -dimlen-1, -1):
 *             ld_nd[i] *= ld_nd[i+1]
 */
  }

  /* "miniga4py/ga.pyx":489
 *         for i in range(-3, -dimlen-1, -1):
 *             ld_nd[i] *= ld_nd[i+1]
 *     ld_nd *= _to_dtype[gtype].itemsize             # <<<<<<<<<<<<<<
 *     # must convert int64_t ndarray shape to npy_intp array
 *     dims = <np.npy_intp*>malloc(dimlen*sizeof(np.npy_intp))
 */
  __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_to_dtype); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_16, __pyx_v_gtype, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_InPlaceMultiply(((PyObject *)__pyx_v_ld_nd), __pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 489, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
    __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_9 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ld_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __pyx_t_10 = __pyx_t_11 = __pyx_t_12 = 0;
    }
    __pyx_pybuffernd_ld_nd.diminfo[0].strides = __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ld_nd.diminfo[0].shape = __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 489, __pyx_L1_error)
  }
  __pyx_t_8 = 0;
  __Pyx_DECREF_SET(__pyx_v_ld_nd, ((PyArrayObject *)__pyx_t_2));
  __pyx_t_2 = 0;

  /* "miniga4py/ga.pyx":491
 *     ld_nd *= _to_dtype[gtype].itemsize
 *     # must convert int64_t ndarray shape to npy_intp array
 *     dims = <np.npy_intp*>malloc(dimlen*sizeof(np.npy_intp))             # <<<<<<<<<<<<<<
 *     strides = <np.npy_intp*>malloc(dimlen*sizeof(np.npy_intp))
 *     for i in range(dimlen):
 */
  __pyx_v_dims = ((npy_intp *)malloc((__pyx_v_dimlen * (sizeof(npy_intp)))));

  /* "miniga4py/ga.pyx":492
 *     # must convert int64_t ndarray shape to npy_intp array
 *     dims = <np.npy_intp*>malloc(dimlen*sizeof(np.npy_intp))
 *     strides = <np.npy_intp*>malloc(dimlen*sizeof(np.npy_intp))             # <<<<<<<<<<<<<<
 *     for i in range(dimlen):
 *         dims[i] = dims_nd[i]
 */
  __pyx_v_strides = ((npy_intp *)malloc((__pyx_v_dimlen * (sizeof(npy_intp)))));

  /* "miniga4py/ga.pyx":493
 *     dims = <np.npy_intp*>malloc(dimlen*sizeof(np.npy_intp))
 *     strides = <np.npy_intp*>malloc(dimlen*sizeof(np.npy_intp))
 *     for i in range(dimlen):             # <<<<<<<<<<<<<<
 *         dims[i] = dims_nd[i]
 *         strides[i] = ld_nd[i]
 */
  __pyx_t_9 = __pyx_v_dimlen;
  __pyx_t_20 = __pyx_t_9;
  for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_20; __pyx_t_22+=1) {
    __pyx_v_i = __pyx_t_22;

    /* "miniga4py/ga.pyx":494
 *     strides = <np.npy_intp*>malloc(dimlen*sizeof(np.npy_intp))
 *     for i in range(dimlen):
 *         dims[i] = dims_nd[i]             # <<<<<<<<<<<<<<
 *         strides[i] = ld_nd[i]
 *     Py_INCREF(dtype)
 */
    __pyx_t_23 = __pyx_v_i;
    __pyx_t_24 = -1;
    if (__pyx_t_23 < 0) {
      __pyx_t_23 += __pyx_pybuffernd_dims_nd.diminfo[0].shape;
      if (unlikely(__pyx_t_23 < 0)) __pyx_t_24 = 0;
    } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_dims_nd.diminfo[0].shape)) __pyx_t_24 = 0;
    if (unlikely(__pyx_t_24 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_24);
      __PYX_ERR(0, 494, __pyx_L1_error)
    }
    (__pyx_v_dims[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_dims_nd.diminfo[0].strides));

    /* "miniga4py/ga.pyx":495
 *     for i in range(dimlen):
 *         dims[i] = dims_nd[i]
 *         strides[i] = ld_nd[i]             # <<<<<<<<<<<<<<
 *     Py_INCREF(dtype)
 *     array = PyArray_NewFromDescr(<PyTypeObject*>np.ndarray,
 */
    __pyx_t_25 = __pyx_v_i;
    __pyx_t_24 = -1;
    if (__pyx_t_25 < 0) {
      __pyx_t_25 += __pyx_pybuffernd_ld_nd.diminfo[0].shape;
      if (unlikely(__pyx_t_25 < 0)) __pyx_t_24 = 0;
    } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_ld_nd.diminfo[0].shape)) __pyx_t_24 = 0;
    if (unlikely(__pyx_t_24 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_24);
      __PYX_ERR(0, 495, __pyx_L1_error)
    }
    (__pyx_v_strides[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_ld_nd.diminfo[0].strides));
  }

  /* "miniga4py/ga.pyx":496
 *         dims[i] = dims_nd[i]
 *         strides[i] = ld_nd[i]
 *     Py_INCREF(dtype)             # <<<<<<<<<<<<<<
 *     array = PyArray_NewFromDescr(<PyTypeObject*>np.ndarray,
 *             dtype, dimlen, dims, strides, ptr, np.NPY_WRITEABLE, None)
 */
  Py_INCREF(((PyObject *)__pyx_v_dtype));

  /* "miniga4py/ga.pyx":497
 *         strides[i] = ld_nd[i]
 *     Py_INCREF(dtype)
 *     array = PyArray_NewFromDescr(<PyTypeObject*>np.ndarray,             # <<<<<<<<<<<<<<
 *             dtype, dimlen, dims, strides, ptr, np.NPY_WRITEABLE, None)
 *     free(dims)
 */
  __pyx_t_2 = PyArray_NewFromDescr(((PyTypeObject *)__pyx_ptype_5numpy_ndarray), __pyx_v_dtype, __pyx_v_dimlen, __pyx_v_dims, __pyx_v_strides, __pyx_v_ptr, NPY_WRITEABLE, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_array = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "miniga4py/ga.pyx":499
 *     array = PyArray_NewFromDescr(<PyTypeObject*>np.ndarray,
 *             dtype, dimlen, dims, strides, ptr, np.NPY_WRITEABLE, None)
 *     free(dims)             # <<<<<<<<<<<<<<
 *     free(strides)
 *     if lo is not None or hi is not None:
 */
  free(__pyx_v_dims);

  /* "miniga4py/ga.pyx":500
 *             dtype, dimlen, dims, strides, ptr, np.NPY_WRITEABLE, None)
 *     free(dims)
 *     free(strides)             # <<<<<<<<<<<<<<
 *     if lo is not None or hi is not None:
 *         if lo is not None:
 */
  free(__pyx_v_strides);

  /* "miniga4py/ga.pyx":501
 *     free(dims)
 *     free(strides)
 *     if lo is not None or hi is not None:             # <<<<<<<<<<<<<<
 *         if lo is not None:
 *             lo_nd = _inta64(lo)
 */
  __pyx_t_14 = (__pyx_v_lo != Py_None);
  __pyx_t_26 = (__pyx_t_14 != 0);
  if (!__pyx_t_26) {
  } else {
    __pyx_t_3 = __pyx_t_26;
    goto __pyx_L15_bool_binop_done;
  }
  __pyx_t_26 = (__pyx_v_hi != Py_None);
  __pyx_t_14 = (__pyx_t_26 != 0);
  __pyx_t_3 = __pyx_t_14;
  __pyx_L15_bool_binop_done:;
  if (__pyx_t_3) {

    /* "miniga4py/ga.pyx":502
 *     free(strides)
 *     if lo is not None or hi is not None:
 *         if lo is not None:             # <<<<<<<<<<<<<<
 *             lo_nd = _inta64(lo)
 *         else:
 */
    __pyx_t_3 = (__pyx_v_lo != Py_None);
    __pyx_t_14 = (__pyx_t_3 != 0);
    if (__pyx_t_14) {

      /* "miniga4py/ga.pyx":503
 *     if lo is not None or hi is not None:
 *         if lo is not None:
 *             lo_nd = _inta64(lo)             # <<<<<<<<<<<<<<
 *         else:
 *             lo_nd = lo_dst
 */
      __pyx_t_2 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_lo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
        __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_9 < 0)) {
          PyErr_Fetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_12, __pyx_t_11, __pyx_t_10);
          }
          __pyx_t_12 = __pyx_t_11 = __pyx_t_10 = 0;
        }
        __pyx_pybuffernd_lo_nd.diminfo[0].strides = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_nd.diminfo[0].shape = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 503, __pyx_L1_error)
      }
      __pyx_v_lo_nd = ((PyArrayObject *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "miniga4py/ga.pyx":502
 *     free(strides)
 *     if lo is not None or hi is not None:
 *         if lo is not None:             # <<<<<<<<<<<<<<
 *             lo_nd = _inta64(lo)
 *         else:
 */
      goto __pyx_L17;
    }

    /* "miniga4py/ga.pyx":505
 *             lo_nd = _inta64(lo)
 *         else:
 *             lo_nd = lo_dst             # <<<<<<<<<<<<<<
 *         if hi is not None:
 *             hi_nd = _inta64(hi)
 */
    /*else*/ {
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
        __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_v_lo_dst), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_9 < 0)) {
          PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
          }
          __pyx_t_10 = __pyx_t_11 = __pyx_t_12 = 0;
        }
        __pyx_pybuffernd_lo_nd.diminfo[0].strides = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_nd.diminfo[0].shape = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 505, __pyx_L1_error)
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_lo_dst));
      __pyx_v_lo_nd = ((PyArrayObject *)__pyx_v_lo_dst);
    }
    __pyx_L17:;

    /* "miniga4py/ga.pyx":506
 *         else:
 *             lo_nd = lo_dst
 *         if hi is not None:             # <<<<<<<<<<<<<<
 *             hi_nd = _inta64(hi)
 *         else:
 */
    __pyx_t_14 = (__pyx_v_hi != Py_None);
    __pyx_t_3 = (__pyx_t_14 != 0);
    if (__pyx_t_3) {

      /* "miniga4py/ga.pyx":507
 *             lo_nd = lo_dst
 *         if hi is not None:
 *             hi_nd = _inta64(hi)             # <<<<<<<<<<<<<<
 *         else:
 *             hi_nd = hi_dst
 */
      __pyx_t_2 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_hi)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 507, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
        __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_9 < 0)) {
          PyErr_Fetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_12, __pyx_t_11, __pyx_t_10);
          }
          __pyx_t_12 = __pyx_t_11 = __pyx_t_10 = 0;
        }
        __pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 507, __pyx_L1_error)
      }
      __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "miniga4py/ga.pyx":506
 *         else:
 *             lo_nd = lo_dst
 *         if hi is not None:             # <<<<<<<<<<<<<<
 *             hi_nd = _inta64(hi)
 *         else:
 */
      goto __pyx_L18;
    }

    /* "miniga4py/ga.pyx":509
 *             hi_nd = _inta64(hi)
 *         else:
 *             hi_nd = hi_dst             # <<<<<<<<<<<<<<
 *         # sanity checks
 *         if np.sometrue(lo_nd>hi_nd):
 */
    /*else*/ {
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
        __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_v_hi_dst), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_9 < 0)) {
          PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
          }
          __pyx_t_10 = __pyx_t_11 = __pyx_t_12 = 0;
        }
        __pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 509, __pyx_L1_error)
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_hi_dst));
      __pyx_v_hi_nd = ((PyArrayObject *)__pyx_v_hi_dst);
    }
    __pyx_L18:;

    /* "miniga4py/ga.pyx":511
 *             hi_nd = hi_dst
 *         # sanity checks
 *         if np.sometrue(lo_nd>hi_nd):             # <<<<<<<<<<<<<<
 *             raise ValueError("lo>hi lo=%s hi=%s"%(lo_nd,hi_nd))
 *         if np.sometrue(lo_nd<lo_dst):
 */
    __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 511, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_sometrue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = PyObject_RichCompare(((PyObject *)__pyx_v_lo_nd), ((PyObject *)__pyx_v_hi_nd), Py_GT); __Pyx_XGOTREF(__pyx_t_16); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 511, __pyx_L1_error)
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_16};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_16};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 511, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_GIVEREF(__pyx_t_16);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_16);
        __pyx_t_16 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 511, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(__pyx_t_3)) {

      /* "miniga4py/ga.pyx":512
 *         # sanity checks
 *         if np.sometrue(lo_nd>hi_nd):
 *             raise ValueError("lo>hi lo=%s hi=%s"%(lo_nd,hi_nd))             # <<<<<<<<<<<<<<
 *         if np.sometrue(lo_nd<lo_dst):
 *             raise ValueError("lo out of bounds lo_dst=%s lo=%s"%(lo_dst,lo_nd))
 */
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_lo_nd));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_lo_nd));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_lo_nd));
      __Pyx_INCREF(((PyObject *)__pyx_v_hi_nd));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_hi_nd));
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_hi_nd));
      __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_lo_hi_lo_s_hi_s, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 512, __pyx_L1_error)

      /* "miniga4py/ga.pyx":511
 *             hi_nd = hi_dst
 *         # sanity checks
 *         if np.sometrue(lo_nd>hi_nd):             # <<<<<<<<<<<<<<
 *             raise ValueError("lo>hi lo=%s hi=%s"%(lo_nd,hi_nd))
 *         if np.sometrue(lo_nd<lo_dst):
 */
    }

    /* "miniga4py/ga.pyx":513
 *         if np.sometrue(lo_nd>hi_nd):
 *             raise ValueError("lo>hi lo=%s hi=%s"%(lo_nd,hi_nd))
 *         if np.sometrue(lo_nd<lo_dst):             # <<<<<<<<<<<<<<
 *             raise ValueError("lo out of bounds lo_dst=%s lo=%s"%(lo_dst,lo_nd))
 *         if np.sometrue(hi_nd>hi_dst):
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sometrue); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 513, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_lo_nd), ((PyObject *)__pyx_v_lo_dst), Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error)
    __pyx_t_16 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_16) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_16, __pyx_t_1};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_16, __pyx_t_1};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 513, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_16); __pyx_t_16 = NULL;
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 513, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(__pyx_t_3)) {

      /* "miniga4py/ga.pyx":514
 *             raise ValueError("lo>hi lo=%s hi=%s"%(lo_nd,hi_nd))
 *         if np.sometrue(lo_nd<lo_dst):
 *             raise ValueError("lo out of bounds lo_dst=%s lo=%s"%(lo_dst,lo_nd))             # <<<<<<<<<<<<<<
 *         if np.sometrue(hi_nd>hi_dst):
 *             raise ValueError("hi out of bounds hi_dst=%s hi=%s"%(hi_dst,hi_nd))
 */
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 514, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_lo_dst));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_lo_dst));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_lo_dst));
      __Pyx_INCREF(((PyObject *)__pyx_v_lo_nd));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_lo_nd));
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_lo_nd));
      __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_lo_out_of_bounds_lo_dst_s_lo_s, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 514, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 514, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 514, __pyx_L1_error)

      /* "miniga4py/ga.pyx":513
 *         if np.sometrue(lo_nd>hi_nd):
 *             raise ValueError("lo>hi lo=%s hi=%s"%(lo_nd,hi_nd))
 *         if np.sometrue(lo_nd<lo_dst):             # <<<<<<<<<<<<<<
 *             raise ValueError("lo out of bounds lo_dst=%s lo=%s"%(lo_dst,lo_nd))
 *         if np.sometrue(hi_nd>hi_dst):
 */
    }

    /* "miniga4py/ga.pyx":515
 *         if np.sometrue(lo_nd<lo_dst):
 *             raise ValueError("lo out of bounds lo_dst=%s lo=%s"%(lo_dst,lo_nd))
 *         if np.sometrue(hi_nd>hi_dst):             # <<<<<<<<<<<<<<
 *             raise ValueError("hi out of bounds hi_dst=%s hi=%s"%(hi_dst,hi_nd))
 *         slices = []
 */
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_sometrue); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_v_hi_nd), ((PyObject *)__pyx_v_hi_dst), Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 515, __pyx_L1_error)
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_1) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_6};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_6};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      {
        __pyx_t_16 = PyTuple_New(1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 515, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_1); __pyx_t_1 = NULL;
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_16, 0+1, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_16, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 515, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(__pyx_t_3)) {

      /* "miniga4py/ga.pyx":516
 *             raise ValueError("lo out of bounds lo_dst=%s lo=%s"%(lo_dst,lo_nd))
 *         if np.sometrue(hi_nd>hi_dst):
 *             raise ValueError("hi out of bounds hi_dst=%s hi=%s"%(hi_dst,hi_nd))             # <<<<<<<<<<<<<<
 *         slices = []
 *         for i in range(dimlen):
 */
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 516, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_hi_dst));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_hi_dst));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_hi_dst));
      __Pyx_INCREF(((PyObject *)__pyx_v_hi_nd));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_hi_nd));
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_hi_nd));
      __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_hi_out_of_bounds_hi_dst_s_hi_s, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 516, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 516, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 516, __pyx_L1_error)

      /* "miniga4py/ga.pyx":515
 *         if np.sometrue(lo_nd<lo_dst):
 *             raise ValueError("lo out of bounds lo_dst=%s lo=%s"%(lo_dst,lo_nd))
 *         if np.sometrue(hi_nd>hi_dst):             # <<<<<<<<<<<<<<
 *             raise ValueError("hi out of bounds hi_dst=%s hi=%s"%(hi_dst,hi_nd))
 *         slices = []
 */
    }

    /* "miniga4py/ga.pyx":517
 *         if np.sometrue(hi_nd>hi_dst):
 *             raise ValueError("hi out of bounds hi_dst=%s hi=%s"%(hi_dst,hi_nd))
 *         slices = []             # <<<<<<<<<<<<<<
 *         for i in range(dimlen):
 *             slices.append(slice(lo_nd[i]-lo_dst[i],hi_nd[i]-lo_dst[i]))
 */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 517, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_slices = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "miniga4py/ga.pyx":518
 *             raise ValueError("hi out of bounds hi_dst=%s hi=%s"%(hi_dst,hi_nd))
 *         slices = []
 *         for i in range(dimlen):             # <<<<<<<<<<<<<<
 *             slices.append(slice(lo_nd[i]-lo_dst[i],hi_nd[i]-lo_dst[i]))
 *         return array[slices]
 */
    __pyx_t_9 = __pyx_v_dimlen;
    __pyx_t_20 = __pyx_t_9;
    for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_20; __pyx_t_22+=1) {
      __pyx_v_i = __pyx_t_22;

      /* "miniga4py/ga.pyx":519
 *         slices = []
 *         for i in range(dimlen):
 *             slices.append(slice(lo_nd[i]-lo_dst[i],hi_nd[i]-lo_dst[i]))             # <<<<<<<<<<<<<<
 *         return array[slices]
 *     return array
 */
      __pyx_t_27 = __pyx_v_i;
      __pyx_t_24 = -1;
      if (__pyx_t_27 < 0) {
        __pyx_t_27 += __pyx_pybuffernd_lo_nd.diminfo[0].shape;
        if (unlikely(__pyx_t_27 < 0)) __pyx_t_24 = 0;
      } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_lo_nd.diminfo[0].shape)) __pyx_t_24 = 0;
      if (unlikely(__pyx_t_24 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_24);
        __PYX_ERR(0, 519, __pyx_L1_error)
      }
      __pyx_t_28 = __pyx_v_i;
      __pyx_t_24 = -1;
      if (__pyx_t_28 < 0) {
        __pyx_t_28 += __pyx_pybuffernd_lo_dst.diminfo[0].shape;
        if (unlikely(__pyx_t_28 < 0)) __pyx_t_24 = 0;
      } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_lo_dst.diminfo[0].shape)) __pyx_t_24 = 0;
      if (unlikely(__pyx_t_24 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_24);
        __PYX_ERR(0, 519, __pyx_L1_error)
      }
      __pyx_t_2 = __Pyx_PyInt_From_npy_int64(((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_lo_nd.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lo_dst.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_lo_dst.diminfo[0].strides)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 519, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_29 = __pyx_v_i;
      __pyx_t_24 = -1;
      if (__pyx_t_29 < 0) {
        __pyx_t_29 += __pyx_pybuffernd_hi_nd.diminfo[0].shape;
        if (unlikely(__pyx_t_29 < 0)) __pyx_t_24 = 0;
      } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_hi_nd.diminfo[0].shape)) __pyx_t_24 = 0;
      if (unlikely(__pyx_t_24 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_24);
        __PYX_ERR(0, 519, __pyx_L1_error)
      }
      __pyx_t_30 = __pyx_v_i;
      __pyx_t_24 = -1;
      if (__pyx_t_30 < 0) {
        __pyx_t_30 += __pyx_pybuffernd_lo_dst.diminfo[0].shape;
        if (unlikely(__pyx_t_30 < 0)) __pyx_t_24 = 0;
      } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_lo_dst.diminfo[0].shape)) __pyx_t_24 = 0;
      if (unlikely(__pyx_t_24 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_24);
        __PYX_ERR(0, 519, __pyx_L1_error)
      }
      __pyx_t_5 = __Pyx_PyInt_From_npy_int64(((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_hi_nd.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lo_dst.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_lo_dst.diminfo[0].strides)))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 519, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_16 = PySlice_New(__pyx_t_2, __pyx_t_5, Py_None); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 519, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_31 = __Pyx_PyList_Append(__pyx_v_slices, __pyx_t_16); if (unlikely(__pyx_t_31 == ((int)-1))) __PYX_ERR(0, 519, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    }

    /* "miniga4py/ga.pyx":520
 *         for i in range(dimlen):
 *             slices.append(slice(lo_nd[i]-lo_dst[i],hi_nd[i]-lo_dst[i]))
 *         return array[slices]             # <<<<<<<<<<<<<<
 *     return array
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_v_array, __pyx_v_slices); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_r = __pyx_t_16;
    __pyx_t_16 = 0;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":501
 *     free(dims)
 *     free(strides)
 *     if lo is not None or hi is not None:             # <<<<<<<<<<<<<<
 *         if lo is not None:
 *             lo_nd = _inta64(lo)
 */
  }

  /* "miniga4py/ga.pyx":521
 *             slices.append(slice(lo_nd[i]-lo_dst[i],hi_nd[i]-lo_dst[i]))
 *         return array[slices]
 *     return array             # <<<<<<<<<<<<<<
 * 
 * def access_block(int g_a, int idx):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_array);
  __pyx_r = __pyx_v_array;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":427
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, valpha)
 * 
 * def access(int g_a, lo=None, hi=None, int proc=-1):             # <<<<<<<<<<<<<<
 *     """Returns local array patch.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_16);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_dst.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.access", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_dst.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_ld_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_lo_dst);
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_dst);
  __Pyx_XDECREF((PyObject *)__pyx_v_dims_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_dtype);
  __Pyx_XDECREF(__pyx_v_array);
  __Pyx_XDECREF(__pyx_v_slices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":523
 *     return array
 * 
 * def access_block(int g_a, int idx):             # <<<<<<<<<<<<<<
 *     """Returns local array patch for a block-cyclic distribution.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_27access_block(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_26access_block[] = "access_block(int g_a, int idx)\nReturns local array patch for a block-cyclic distribution.\n    \n    This routine allows to access directly, in place elements in the local\n    section of a global array. It useful for writing new GA operations.\n    \n    Each call to ga.access_block has to be followed by a call to either\n    ga.release_block or ga.release_update_block. You can access in this\n    fashion only local data.  Since the data is shared with other processes,\n    you need to consider issues of mutual exclusion.\n\n    This operation is local. \n\n    :Parameters:\n        g_a : int\n            the array handle\n        idx : int\n            the block index\n\n    :returns: ndarray representing local block\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_27access_block = {"access_block", (PyCFunction)__pyx_pw_9miniga4py_2ga_27access_block, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_26access_block};
static PyObject *__pyx_pw_9miniga4py_2ga_27access_block(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_idx;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("access_block (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_idx,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_idx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("access_block", 1, 2, 2, 1); __PYX_ERR(0, 523, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "access_block") < 0)) __PYX_ERR(0, 523, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 523, __pyx_L3_error)
    __pyx_v_idx = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_idx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 523, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("access_block", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 523, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.access_block", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_26access_block(__pyx_self, __pyx_v_g_a, __pyx_v_idx);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_26access_block(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_idx) {
  PyArrayObject *__pyx_v_ld_nd = 0;
  PyArrayObject *__pyx_v_lo_dst = 0;
  PyArrayObject *__pyx_v_hi_dst = 0;
  PyArrayObject *__pyx_v_dims_nd = 0;
  int __pyx_v_i;
  int __pyx_v_gtype;
  int __pyx_v_dimlen;
  int __pyx_v_typenum;
  void *__pyx_v_ptr;
  npy_intp *__pyx_v_dims;
  PyObject *__pyx_v_array = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dims_nd;
  __Pyx_Buffer __pyx_pybuffer_dims_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_dst;
  __Pyx_Buffer __pyx_pybuffer_hi_dst;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ld_nd;
  __Pyx_Buffer __pyx_pybuffer_ld_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lo_dst;
  __Pyx_Buffer __pyx_pybuffer_lo_dst;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  struct __pyx_opt_args_9miniga4py_2ga_distribution __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyArrayObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  int __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_t_17;
  int __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  int __pyx_t_20;
  __Pyx_RefNannySetupContext("access_block", 0);
  __pyx_pybuffer_ld_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_ld_nd.refcount = 0;
  __pyx_pybuffernd_ld_nd.data = NULL;
  __pyx_pybuffernd_ld_nd.rcbuffer = &__pyx_pybuffer_ld_nd;
  __pyx_pybuffer_lo_dst.pybuffer.buf = NULL;
  __pyx_pybuffer_lo_dst.refcount = 0;
  __pyx_pybuffernd_lo_dst.data = NULL;
  __pyx_pybuffernd_lo_dst.rcbuffer = &__pyx_pybuffer_lo_dst;
  __pyx_pybuffer_hi_dst.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_dst.refcount = 0;
  __pyx_pybuffernd_hi_dst.data = NULL;
  __pyx_pybuffernd_hi_dst.rcbuffer = &__pyx_pybuffer_hi_dst;
  __pyx_pybuffer_dims_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_dims_nd.refcount = 0;
  __pyx_pybuffernd_dims_nd.data = NULL;
  __pyx_pybuffernd_dims_nd.rcbuffer = &__pyx_pybuffer_dims_nd;

  /* "miniga4py/ga.pyx":546
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] ld_nd, lo_dst, hi_dst, dims_nd
 *     cdef int i, gtype=inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     cdef int dimlen=GA_Ndim(g_a), typenum=_to_dtype[gtype].num
 *     cdef void *ptr
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":547
 *     cdef np.ndarray[np.int64_t, ndim=1] ld_nd, lo_dst, hi_dst, dims_nd
 *     cdef int i, gtype=inquire_type(g_a)
 *     cdef int dimlen=GA_Ndim(g_a), typenum=_to_dtype[gtype].num             # <<<<<<<<<<<<<<
 *     cdef void *ptr
 *     cdef np.npy_intp *dims = NULL
 */
  __pyx_v_dimlen = GA_Ndim(__pyx_v_g_a);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_to_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_gtype, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_num); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 547, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_typenum = __pyx_t_3;

  /* "miniga4py/ga.pyx":549
 *     cdef int dimlen=GA_Ndim(g_a), typenum=_to_dtype[gtype].num
 *     cdef void *ptr
 *     cdef np.npy_intp *dims = NULL             # <<<<<<<<<<<<<<
 *     # first things first, if no data is owned, return None
 *     lo_dst,hi_dst = distribution(g_a, idx)
 */
  __pyx_v_dims = NULL;

  /* "miniga4py/ga.pyx":551
 *     cdef np.npy_intp *dims = NULL
 *     # first things first, if no data is owned, return None
 *     lo_dst,hi_dst = distribution(g_a, idx)             # <<<<<<<<<<<<<<
 *     if lo_dst[0] < 0 or hi_dst[0] < 0:
 *         return None
 */
  __pyx_t_4.__pyx_n = 1;
  __pyx_t_4.proc = __pyx_v_idx;
  __pyx_t_1 = __pyx_f_9miniga4py_2ga_distribution(__pyx_v_g_a, 0, &__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 551, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 551, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 551, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 551, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 551, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 551, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 551, __pyx_L1_error)
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 551, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_dst.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_dst.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_dst.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_dst, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __pyx_t_9 = __pyx_t_10 = __pyx_t_11 = 0;
    }
    __pyx_pybuffernd_lo_dst.diminfo[0].strides = __pyx_pybuffernd_lo_dst.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_dst.diminfo[0].shape = __pyx_pybuffernd_lo_dst.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 551, __pyx_L1_error)
  }
  __pyx_t_8 = 0;
  __pyx_v_lo_dst = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_dst, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      }
      __pyx_t_11 = __pyx_t_10 = __pyx_t_9 = 0;
    }
    __pyx_pybuffernd_hi_dst.diminfo[0].strides = __pyx_pybuffernd_hi_dst.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_dst.diminfo[0].shape = __pyx_pybuffernd_hi_dst.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 551, __pyx_L1_error)
  }
  __pyx_t_8 = 0;
  __pyx_v_hi_dst = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":552
 *     # first things first, if no data is owned, return None
 *     lo_dst,hi_dst = distribution(g_a, idx)
 *     if lo_dst[0] < 0 or hi_dst[0] < 0:             # <<<<<<<<<<<<<<
 *         return None
 *     # put hi_dst back to GA inclusive indexing convention
 */
  __pyx_t_13 = 0;
  __pyx_t_3 = -1;
  if (__pyx_t_13 < 0) {
    __pyx_t_13 += __pyx_pybuffernd_lo_dst.diminfo[0].shape;
    if (unlikely(__pyx_t_13 < 0)) __pyx_t_3 = 0;
  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_lo_dst.diminfo[0].shape)) __pyx_t_3 = 0;
  if (unlikely(__pyx_t_3 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_3);
    __PYX_ERR(0, 552, __pyx_L1_error)
  }
  __pyx_t_14 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lo_dst.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_lo_dst.diminfo[0].strides)) < 0) != 0);
  if (!__pyx_t_14) {
  } else {
    __pyx_t_12 = __pyx_t_14;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_15 = 0;
  __pyx_t_3 = -1;
  if (__pyx_t_15 < 0) {
    __pyx_t_15 += __pyx_pybuffernd_hi_dst.diminfo[0].shape;
    if (unlikely(__pyx_t_15 < 0)) __pyx_t_3 = 0;
  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_hi_dst.diminfo[0].shape)) __pyx_t_3 = 0;
  if (unlikely(__pyx_t_3 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_3);
    __PYX_ERR(0, 552, __pyx_L1_error)
  }
  __pyx_t_14 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_hi_dst.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_hi_dst.diminfo[0].strides)) < 0) != 0);
  __pyx_t_12 = __pyx_t_14;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_12) {

    /* "miniga4py/ga.pyx":553
 *     lo_dst,hi_dst = distribution(g_a, idx)
 *     if lo_dst[0] < 0 or hi_dst[0] < 0:
 *         return None             # <<<<<<<<<<<<<<
 *     # put hi_dst back to GA inclusive indexing convention
 *     hi_dst -= 1
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":552
 *     # first things first, if no data is owned, return None
 *     lo_dst,hi_dst = distribution(g_a, idx)
 *     if lo_dst[0] < 0 or hi_dst[0] < 0:             # <<<<<<<<<<<<<<
 *         return None
 *     # put hi_dst back to GA inclusive indexing convention
 */
  }

  /* "miniga4py/ga.pyx":555
 *         return None
 *     # put hi_dst back to GA inclusive indexing convention
 *     hi_dst -= 1             # <<<<<<<<<<<<<<
 *     # always access the entire local data
 *     ld_nd = np.zeros(dimlen-1, dtype=np.int64)
 */
  __pyx_t_1 = PyNumber_InPlaceSubtract(((PyObject *)__pyx_v_hi_dst), __pyx_int_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 555, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_dst, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __pyx_t_9 = __pyx_t_10 = __pyx_t_11 = 0;
    }
    __pyx_pybuffernd_hi_dst.diminfo[0].strides = __pyx_pybuffernd_hi_dst.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_dst.diminfo[0].shape = __pyx_pybuffernd_hi_dst.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 555, __pyx_L1_error)
  }
  __pyx_t_8 = 0;
  __Pyx_DECREF_SET(__pyx_v_hi_dst, ((PyArrayObject *)__pyx_t_1));
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":557
 *     hi_dst -= 1
 *     # always access the entire local data
 *     ld_nd = np.zeros(dimlen-1, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     NGA_Access_block64(g_a, idx, &ptr, <int64_t*>ld_nd.data)
 *     dims_nd = hi_dst-lo_dst+1
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_dimlen - 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int64); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_16) < 0) __PYX_ERR(0, 557, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 557, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_16);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ld_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      }
      __pyx_t_11 = __pyx_t_10 = __pyx_t_9 = 0;
    }
    __pyx_pybuffernd_ld_nd.diminfo[0].strides = __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ld_nd.diminfo[0].shape = __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 557, __pyx_L1_error)
  }
  __pyx_t_8 = 0;
  __pyx_v_ld_nd = ((PyArrayObject *)__pyx_t_16);
  __pyx_t_16 = 0;

  /* "miniga4py/ga.pyx":558
 *     # always access the entire local data
 *     ld_nd = np.zeros(dimlen-1, dtype=np.int64)
 *     NGA_Access_block64(g_a, idx, &ptr, <int64_t*>ld_nd.data)             # <<<<<<<<<<<<<<
 *     dims_nd = hi_dst-lo_dst+1
 *     # must convert int64_t ndarray shape to npy_intp array
 */
  NGA_Access_block64(__pyx_v_g_a, __pyx_v_idx, (&__pyx_v_ptr), ((int64_t *)__pyx_v_ld_nd->data));

  /* "miniga4py/ga.pyx":559
 *     ld_nd = np.zeros(dimlen-1, dtype=np.int64)
 *     NGA_Access_block64(g_a, idx, &ptr, <int64_t*>ld_nd.data)
 *     dims_nd = hi_dst-lo_dst+1             # <<<<<<<<<<<<<<
 *     # must convert int64_t ndarray shape to npy_intp array
 *     dims = <np.npy_intp*>malloc(dimlen*sizeof(np.npy_intp))
 */
  __pyx_t_16 = PyNumber_Subtract(((PyObject *)__pyx_v_hi_dst), ((PyObject *)__pyx_v_lo_dst)); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_16, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 559, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_dims_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __pyx_t_9 = __pyx_t_10 = __pyx_t_11 = 0;
    }
    __pyx_pybuffernd_dims_nd.diminfo[0].strides = __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dims_nd.diminfo[0].shape = __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 559, __pyx_L1_error)
  }
  __pyx_t_8 = 0;
  __pyx_v_dims_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":561
 *     dims_nd = hi_dst-lo_dst+1
 *     # must convert int64_t ndarray shape to npy_intp array
 *     dims = <np.npy_intp*>malloc(dimlen*sizeof(np.npy_intp))             # <<<<<<<<<<<<<<
 *     for i in range(dimlen):
 *         dims[i] = dims_nd[i]
 */
  __pyx_v_dims = ((npy_intp *)malloc((__pyx_v_dimlen * (sizeof(npy_intp)))));

  /* "miniga4py/ga.pyx":562
 *     # must convert int64_t ndarray shape to npy_intp array
 *     dims = <np.npy_intp*>malloc(dimlen*sizeof(np.npy_intp))
 *     for i in range(dimlen):             # <<<<<<<<<<<<<<
 *         dims[i] = dims_nd[i]
 *     array = np.PyArray_SimpleNewFromData(dimlen, dims, typenum, ptr)
 */
  __pyx_t_3 = __pyx_v_dimlen;
  __pyx_t_17 = __pyx_t_3;
  for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
    __pyx_v_i = __pyx_t_18;

    /* "miniga4py/ga.pyx":563
 *     dims = <np.npy_intp*>malloc(dimlen*sizeof(np.npy_intp))
 *     for i in range(dimlen):
 *         dims[i] = dims_nd[i]             # <<<<<<<<<<<<<<
 *     array = np.PyArray_SimpleNewFromData(dimlen, dims, typenum, ptr)
 *     free(dims)
 */
    __pyx_t_19 = __pyx_v_i;
    __pyx_t_20 = -1;
    if (__pyx_t_19 < 0) {
      __pyx_t_19 += __pyx_pybuffernd_dims_nd.diminfo[0].shape;
      if (unlikely(__pyx_t_19 < 0)) __pyx_t_20 = 0;
    } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_dims_nd.diminfo[0].shape)) __pyx_t_20 = 0;
    if (unlikely(__pyx_t_20 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_20);
      __PYX_ERR(0, 563, __pyx_L1_error)
    }
    (__pyx_v_dims[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_dims_nd.diminfo[0].strides));
  }

  /* "miniga4py/ga.pyx":564
 *     for i in range(dimlen):
 *         dims[i] = dims_nd[i]
 *     array = np.PyArray_SimpleNewFromData(dimlen, dims, typenum, ptr)             # <<<<<<<<<<<<<<
 *     free(dims)
 *     return array
 */
  __pyx_t_1 = PyArray_SimpleNewFromData(__pyx_v_dimlen, __pyx_v_dims, __pyx_v_typenum, __pyx_v_ptr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_array = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":565
 *         dims[i] = dims_nd[i]
 *     array = np.PyArray_SimpleNewFromData(dimlen, dims, typenum, ptr)
 *     free(dims)             # <<<<<<<<<<<<<<
 *     return array
 * 
 */
  free(__pyx_v_dims);

  /* "miniga4py/ga.pyx":566
 *     array = np.PyArray_SimpleNewFromData(dimlen, dims, typenum, ptr)
 *     free(dims)
 *     return array             # <<<<<<<<<<<<<<
 * 
 * def access_block_grid(int g_a, subscript):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_array);
  __pyx_r = __pyx_v_array;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":523
 *     return array
 * 
 * def access_block(int g_a, int idx):             # <<<<<<<<<<<<<<
 *     """Returns local array patch for a block-cyclic distribution.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_16);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_dst.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.access_block", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_dst.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ld_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_lo_dst);
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_dst);
  __Pyx_XDECREF((PyObject *)__pyx_v_dims_nd);
  __Pyx_XDECREF(__pyx_v_array);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":568
 *     return array
 * 
 * def access_block_grid(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Returns local array patch for a SCALAPACK block-cyclic distribution.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_29access_block_grid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_28access_block_grid[] = "access_block_grid(int g_a, subscript)\nReturns local array patch for a SCALAPACK block-cyclic distribution.\n\n    The subscript array contains the subscript of the block in the array of\n    blocks. This subscript is based on the location of the block in a grid,\n    each of whose dimensions is equal to the number of blocks that fit along\n    that dimension.\n\n    Each call to ga.access_block_grid has to be followed by a call to either\n    ga.release_block_grid or ga.release_update_block_grid. You can access in\n    this fashion only local data.  Since the data is shared with other\n    processes, you need to consider issues of mutual exclusion.\n\n    This operation is local. \n\n    :Parameters:\n        g_a : int\n            the array handle\n        subscript : 1D array-like\n            subscript of the block in the array\n\n    :returns: ndarray representing local block\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_29access_block_grid = {"access_block_grid", (PyCFunction)__pyx_pw_9miniga4py_2ga_29access_block_grid, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_28access_block_grid};
static PyObject *__pyx_pw_9miniga4py_2ga_29access_block_grid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED int __pyx_v_g_a;
  CYTHON_UNUSED PyObject *__pyx_v_subscript = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("access_block_grid (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_subscript,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_subscript)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("access_block_grid", 1, 2, 2, 1); __PYX_ERR(0, 568, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "access_block_grid") < 0)) __PYX_ERR(0, 568, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 568, __pyx_L3_error)
    __pyx_v_subscript = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("access_block_grid", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 568, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.access_block_grid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_28access_block_grid(__pyx_self, __pyx_v_g_a, __pyx_v_subscript);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_28access_block_grid(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED int __pyx_v_g_a, CYTHON_UNUSED PyObject *__pyx_v_subscript) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("access_block_grid", 0);

  /* "miniga4py/ga.pyx":592
 * 
 *     """
 *     raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 * def access_block_segment(int g_a, int proc):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 592, __pyx_L1_error)

  /* "miniga4py/ga.pyx":568
 *     return array
 * 
 * def access_block_grid(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Returns local array patch for a SCALAPACK block-cyclic distribution.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("miniga4py.ga.access_block_grid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":594
 *     raise NotImplementedError
 * 
 * def access_block_segment(int g_a, int proc):             # <<<<<<<<<<<<<<
 *     """This function can be used to gain access to the all the locally held
 *     data on a particular processor that is associated with a block-cyclic
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_31access_block_segment(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_30access_block_segment[] = "access_block_segment(int g_a, int proc)\nThis function can be used to gain access to the all the locally held\n    data on a particular processor that is associated with a block-cyclic\n    distributed array.\n\n    The data  inside this segment has a lot of additional structure so this\n    function is not generally useful to developers. It is primarily used\n    inside the GA library to implement other GA routines. Each call to\n    ga.access_block_segment should be followed by a call to either\n    ga.release_block_segment or ga.release_update_block_segment.\n\n    This is a local operation.\n\n    :Parameters:\n        g_a : int\n            the array handle\n        proc : int\n            processor ID\n\n    :returns: ndarray representing local block\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_31access_block_segment = {"access_block_segment", (PyCFunction)__pyx_pw_9miniga4py_2ga_31access_block_segment, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_30access_block_segment};
static PyObject *__pyx_pw_9miniga4py_2ga_31access_block_segment(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_proc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("access_block_segment (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_proc,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_proc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("access_block_segment", 1, 2, 2, 1); __PYX_ERR(0, 594, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "access_block_segment") < 0)) __PYX_ERR(0, 594, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 594, __pyx_L3_error)
    __pyx_v_proc = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_proc == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 594, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("access_block_segment", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 594, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.access_block_segment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_30access_block_segment(__pyx_self, __pyx_v_g_a, __pyx_v_proc);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_30access_block_segment(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_proc) {
  int64_t __pyx_v_elems;
  int __pyx_v_gtype;
  int __pyx_v_typenum;
  void *__pyx_v_ptr;
  npy_intp *__pyx_v_dims;
  PyObject *__pyx_v_array = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("access_block_segment", 0);

  /* "miniga4py/ga.pyx":617
 *     """
 *     cdef int64_t elems
 *     cdef int gtype=inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     cdef int typenum=_to_dtype[gtype].num
 *     cdef void *ptr
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":618
 *     cdef int64_t elems
 *     cdef int gtype=inquire_type(g_a)
 *     cdef int typenum=_to_dtype[gtype].num             # <<<<<<<<<<<<<<
 *     cdef void *ptr
 *     cdef np.npy_intp *dims = NULL
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_to_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_gtype, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_num); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 618, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_typenum = __pyx_t_3;

  /* "miniga4py/ga.pyx":620
 *     cdef int typenum=_to_dtype[gtype].num
 *     cdef void *ptr
 *     cdef np.npy_intp *dims = NULL             # <<<<<<<<<<<<<<
 *     # always access the entire local data
 *     NGA_Access_block_segment64(g_a, proc, &ptr, &elems)
 */
  __pyx_v_dims = NULL;

  /* "miniga4py/ga.pyx":622
 *     cdef np.npy_intp *dims = NULL
 *     # always access the entire local data
 *     NGA_Access_block_segment64(g_a, proc, &ptr, &elems)             # <<<<<<<<<<<<<<
 *     # must convert int64_t ndarray shape to npy_intp array
 *     dims = <np.npy_intp*>malloc(sizeof(np.npy_intp))
 */
  NGA_Access_block_segment64(__pyx_v_g_a, __pyx_v_proc, (&__pyx_v_ptr), (&__pyx_v_elems));

  /* "miniga4py/ga.pyx":624
 *     NGA_Access_block_segment64(g_a, proc, &ptr, &elems)
 *     # must convert int64_t ndarray shape to npy_intp array
 *     dims = <np.npy_intp*>malloc(sizeof(np.npy_intp))             # <<<<<<<<<<<<<<
 *     dims[0] = elems
 *     array = np.PyArray_SimpleNewFromData(1, dims, typenum, ptr)
 */
  __pyx_v_dims = ((npy_intp *)malloc((sizeof(npy_intp))));

  /* "miniga4py/ga.pyx":625
 *     # must convert int64_t ndarray shape to npy_intp array
 *     dims = <np.npy_intp*>malloc(sizeof(np.npy_intp))
 *     dims[0] = elems             # <<<<<<<<<<<<<<
 *     array = np.PyArray_SimpleNewFromData(1, dims, typenum, ptr)
 *     free(dims)
 */
  (__pyx_v_dims[0]) = __pyx_v_elems;

  /* "miniga4py/ga.pyx":626
 *     dims = <np.npy_intp*>malloc(sizeof(np.npy_intp))
 *     dims[0] = elems
 *     array = np.PyArray_SimpleNewFromData(1, dims, typenum, ptr)             # <<<<<<<<<<<<<<
 *     free(dims)
 *     return array
 */
  __pyx_t_1 = PyArray_SimpleNewFromData(1, __pyx_v_dims, __pyx_v_typenum, __pyx_v_ptr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_array = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":627
 *     dims[0] = elems
 *     array = np.PyArray_SimpleNewFromData(1, dims, typenum, ptr)
 *     free(dims)             # <<<<<<<<<<<<<<
 *     return array
 * 
 */
  free(__pyx_v_dims);

  /* "miniga4py/ga.pyx":628
 *     array = np.PyArray_SimpleNewFromData(1, dims, typenum, ptr)
 *     free(dims)
 *     return array             # <<<<<<<<<<<<<<
 * 
 * def access_ghost_element(int g_a, subscript):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_array);
  __pyx_r = __pyx_v_array;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":594
 *     raise NotImplementedError
 * 
 * def access_block_segment(int g_a, int proc):             # <<<<<<<<<<<<<<
 *     """This function can be used to gain access to the all the locally held
 *     data on a particular processor that is associated with a block-cyclic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("miniga4py.ga.access_block_segment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_array);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":630
 *     return array
 * 
 * def access_ghost_element(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Returns a scalar ndarray representing the requested ghost element.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_33access_ghost_element(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_32access_ghost_element[] = "access_ghost_element(int g_a, subscript)\nReturns a scalar ndarray representing the requested ghost element.\n\n    This function can be used to return a pointer to any data element in the\n    locally held portion of the global array and can be used to directly\n    access ghost cell data. The array subscript refers to the local index of\n    the  element relative to the origin of the local patch (which is assumed\n    to be indexed by (0,0,...)).\n\n    This is a  local operation. \n\n    :Parameters:\n        g_a : int\n            the array handle\n        subscript : 1D array-like of integers\n            index of the desired element\n\n    :returns: ndarray scalar representing local block\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_33access_ghost_element = {"access_ghost_element", (PyCFunction)__pyx_pw_9miniga4py_2ga_33access_ghost_element, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_32access_ghost_element};
static PyObject *__pyx_pw_9miniga4py_2ga_33access_ghost_element(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED int __pyx_v_g_a;
  CYTHON_UNUSED PyObject *__pyx_v_subscript = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("access_ghost_element (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_subscript,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_subscript)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("access_ghost_element", 1, 2, 2, 1); __PYX_ERR(0, 630, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "access_ghost_element") < 0)) __PYX_ERR(0, 630, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 630, __pyx_L3_error)
    __pyx_v_subscript = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("access_ghost_element", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 630, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.access_ghost_element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_32access_ghost_element(__pyx_self, __pyx_v_g_a, __pyx_v_subscript);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_32access_ghost_element(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED int __pyx_v_g_a, CYTHON_UNUSED PyObject *__pyx_v_subscript) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("access_ghost_element", 0);

  /* "miniga4py/ga.pyx":650
 * 
 *     """
 *     raise NotImplementedError("use access_ghosts(g_a) instead")             # <<<<<<<<<<<<<<
 * 
 * def access_ghosts(int g_a):
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 650, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(0, 650, __pyx_L1_error)

  /* "miniga4py/ga.pyx":630
 *     return array
 * 
 * def access_ghost_element(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Returns a scalar ndarray representing the requested ghost element.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.access_ghost_element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":652
 *     raise NotImplementedError("use access_ghosts(g_a) instead")
 * 
 * def access_ghosts(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns ndarray representing local patch with ghost cells.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_35access_ghosts(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_34access_ghosts[] = "access_ghosts(int g_a)\nReturns ndarray representing local patch with ghost cells.\n\n    This routine will provide access to the ghost cell data residing on each\n    processor. Calls to NGA_Access_ghosts should normally follow a call to\n    NGA_Distribution  that returns coordinates of the visible data patch\n    associated with a processor. You need to make sure that the coordinates of\n    the patch are valid (test values returned from NGA_Distribution).\n\n    You can only access local data.\n\n    This operation is local.\n\n    :Parameters:\n        g_a : int\n            the array handle\n\n    :returns: ndarray scalar representing local block with ghost cells\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_35access_ghosts = {"access_ghosts", (PyCFunction)__pyx_pw_9miniga4py_2ga_35access_ghosts, METH_O, __pyx_doc_9miniga4py_2ga_34access_ghosts};
static PyObject *__pyx_pw_9miniga4py_2ga_35access_ghosts(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("access_ghosts (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 652, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.access_ghosts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_34access_ghosts(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_34access_ghosts(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyArrayObject *__pyx_v_ld_nd = 0;
  PyArrayObject *__pyx_v_lo_dst = 0;
  PyArrayObject *__pyx_v_hi_dst = 0;
  PyArrayObject *__pyx_v_dims_nd = 0;
  int __pyx_v_i;
  int __pyx_v_gtype;
  int __pyx_v_dimlen;
  int __pyx_v_typenum;
  void *__pyx_v_ptr;
  npy_intp *__pyx_v_dims;
  PyObject *__pyx_v_array = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dims_nd;
  __Pyx_Buffer __pyx_pybuffer_dims_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_dst;
  __Pyx_Buffer __pyx_pybuffer_hi_dst;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ld_nd;
  __Pyx_Buffer __pyx_pybuffer_ld_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lo_dst;
  __Pyx_Buffer __pyx_pybuffer_lo_dst;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyArrayObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  int __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  int __pyx_t_19;
  __Pyx_RefNannySetupContext("access_ghosts", 0);
  __pyx_pybuffer_ld_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_ld_nd.refcount = 0;
  __pyx_pybuffernd_ld_nd.data = NULL;
  __pyx_pybuffernd_ld_nd.rcbuffer = &__pyx_pybuffer_ld_nd;
  __pyx_pybuffer_lo_dst.pybuffer.buf = NULL;
  __pyx_pybuffer_lo_dst.refcount = 0;
  __pyx_pybuffernd_lo_dst.data = NULL;
  __pyx_pybuffernd_lo_dst.rcbuffer = &__pyx_pybuffer_lo_dst;
  __pyx_pybuffer_hi_dst.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_dst.refcount = 0;
  __pyx_pybuffernd_hi_dst.data = NULL;
  __pyx_pybuffernd_hi_dst.rcbuffer = &__pyx_pybuffer_hi_dst;
  __pyx_pybuffer_dims_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_dims_nd.refcount = 0;
  __pyx_pybuffernd_dims_nd.data = NULL;
  __pyx_pybuffernd_dims_nd.rcbuffer = &__pyx_pybuffer_dims_nd;

  /* "miniga4py/ga.pyx":673
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] ld_nd, lo_dst, hi_dst, dims_nd
 *     cdef int i, gtype=inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     cdef int dimlen=GA_Ndim(g_a), typenum=_to_dtype[gtype].num
 *     cdef void *ptr
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":674
 *     cdef np.ndarray[np.int64_t, ndim=1] ld_nd, lo_dst, hi_dst, dims_nd
 *     cdef int i, gtype=inquire_type(g_a)
 *     cdef int dimlen=GA_Ndim(g_a), typenum=_to_dtype[gtype].num             # <<<<<<<<<<<<<<
 *     cdef void *ptr
 *     cdef np.npy_intp *dims = NULL
 */
  __pyx_v_dimlen = GA_Ndim(__pyx_v_g_a);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_to_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 674, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_gtype, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 674, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_num); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 674, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 674, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_typenum = __pyx_t_3;

  /* "miniga4py/ga.pyx":676
 *     cdef int dimlen=GA_Ndim(g_a), typenum=_to_dtype[gtype].num
 *     cdef void *ptr
 *     cdef np.npy_intp *dims = NULL             # <<<<<<<<<<<<<<
 *     # first things first, if no data is owned, return None
 *     lo_dst,hi_dst = distribution(g_a)
 */
  __pyx_v_dims = NULL;

  /* "miniga4py/ga.pyx":678
 *     cdef np.npy_intp *dims = NULL
 *     # first things first, if no data is owned, return None
 *     lo_dst,hi_dst = distribution(g_a)             # <<<<<<<<<<<<<<
 *     if lo_dst[0] < 0 or hi_dst[0] < 0:
 *         return None
 */
  __pyx_t_1 = __pyx_f_9miniga4py_2ga_distribution(__pyx_v_g_a, 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 678, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 678, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 678, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 678, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 678, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 678, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 678, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 678, __pyx_L1_error)
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 678, __pyx_L1_error)
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_dst.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_dst.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_dst.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_dst, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_lo_dst.diminfo[0].strides = __pyx_pybuffernd_lo_dst.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_dst.diminfo[0].shape = __pyx_pybuffernd_lo_dst.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 678, __pyx_L1_error)
  }
  __pyx_t_7 = 0;
  __pyx_v_lo_dst = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_dst, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
      __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
    }
    __pyx_pybuffernd_hi_dst.diminfo[0].strides = __pyx_pybuffernd_hi_dst.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_dst.diminfo[0].shape = __pyx_pybuffernd_hi_dst.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 678, __pyx_L1_error)
  }
  __pyx_t_7 = 0;
  __pyx_v_hi_dst = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "miniga4py/ga.pyx":679
 *     # first things first, if no data is owned, return None
 *     lo_dst,hi_dst = distribution(g_a)
 *     if lo_dst[0] < 0 or hi_dst[0] < 0:             # <<<<<<<<<<<<<<
 *         return None
 *     # always access the entire local data
 */
  __pyx_t_12 = 0;
  __pyx_t_3 = -1;
  if (__pyx_t_12 < 0) {
    __pyx_t_12 += __pyx_pybuffernd_lo_dst.diminfo[0].shape;
    if (unlikely(__pyx_t_12 < 0)) __pyx_t_3 = 0;
  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_lo_dst.diminfo[0].shape)) __pyx_t_3 = 0;
  if (unlikely(__pyx_t_3 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_3);
    __PYX_ERR(0, 679, __pyx_L1_error)
  }
  __pyx_t_13 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lo_dst.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_lo_dst.diminfo[0].strides)) < 0) != 0);
  if (!__pyx_t_13) {
  } else {
    __pyx_t_11 = __pyx_t_13;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_14 = 0;
  __pyx_t_3 = -1;
  if (__pyx_t_14 < 0) {
    __pyx_t_14 += __pyx_pybuffernd_hi_dst.diminfo[0].shape;
    if (unlikely(__pyx_t_14 < 0)) __pyx_t_3 = 0;
  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_hi_dst.diminfo[0].shape)) __pyx_t_3 = 0;
  if (unlikely(__pyx_t_3 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_3);
    __PYX_ERR(0, 679, __pyx_L1_error)
  }
  __pyx_t_13 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_hi_dst.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_hi_dst.diminfo[0].strides)) < 0) != 0);
  __pyx_t_11 = __pyx_t_13;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_11) {

    /* "miniga4py/ga.pyx":680
 *     lo_dst,hi_dst = distribution(g_a)
 *     if lo_dst[0] < 0 or hi_dst[0] < 0:
 *         return None             # <<<<<<<<<<<<<<
 *     # always access the entire local data
 *     dims_nd = np.zeros(dimlen, dtype=np.int64)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":679
 *     # first things first, if no data is owned, return None
 *     lo_dst,hi_dst = distribution(g_a)
 *     if lo_dst[0] < 0 or hi_dst[0] < 0:             # <<<<<<<<<<<<<<
 *         return None
 *     # always access the entire local data
 */
  }

  /* "miniga4py/ga.pyx":682
 *         return None
 *     # always access the entire local data
 *     dims_nd = np.zeros(dimlen, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     ld_nd = np.zeros(dimlen-1, dtype=np.int64)
 *     NGA_Access_ghosts64(g_a, <int64_t*>dims_nd.data, &ptr, <int64_t*>ld_nd.data)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_dimlen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int64); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_15) < 0) __PYX_ERR(0, 682, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 682, __pyx_L1_error)
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_15);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_dims_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_dims_nd.diminfo[0].strides = __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dims_nd.diminfo[0].shape = __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 682, __pyx_L1_error)
  }
  __pyx_t_7 = 0;
  __pyx_v_dims_nd = ((PyArrayObject *)__pyx_t_15);
  __pyx_t_15 = 0;

  /* "miniga4py/ga.pyx":683
 *     # always access the entire local data
 *     dims_nd = np.zeros(dimlen, dtype=np.int64)
 *     ld_nd = np.zeros(dimlen-1, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     NGA_Access_ghosts64(g_a, <int64_t*>dims_nd.data, &ptr, <int64_t*>ld_nd.data)
 *     # must convert int64_t ndarray shape to npy_intp array
 */
  __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_t_15 = __Pyx_PyInt_From_long((__pyx_v_dimlen - 1)); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_15);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_15);
  __pyx_t_15 = 0;
  __pyx_t_15 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 683, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 683, __pyx_L1_error)
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ld_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
      __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
    }
    __pyx_pybuffernd_ld_nd.diminfo[0].strides = __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ld_nd.diminfo[0].shape = __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 683, __pyx_L1_error)
  }
  __pyx_t_7 = 0;
  __pyx_v_ld_nd = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":684
 *     dims_nd = np.zeros(dimlen, dtype=np.int64)
 *     ld_nd = np.zeros(dimlen-1, dtype=np.int64)
 *     NGA_Access_ghosts64(g_a, <int64_t*>dims_nd.data, &ptr, <int64_t*>ld_nd.data)             # <<<<<<<<<<<<<<
 *     # must convert int64_t ndarray shape to npy_intp array
 *     dims = <np.npy_intp*>malloc(dimlen*sizeof(np.npy_intp))
 */
  NGA_Access_ghosts64(__pyx_v_g_a, ((int64_t *)__pyx_v_dims_nd->data), (&__pyx_v_ptr), ((int64_t *)__pyx_v_ld_nd->data));

  /* "miniga4py/ga.pyx":686
 *     NGA_Access_ghosts64(g_a, <int64_t*>dims_nd.data, &ptr, <int64_t*>ld_nd.data)
 *     # must convert int64_t ndarray shape to npy_intp array
 *     dims = <np.npy_intp*>malloc(dimlen*sizeof(np.npy_intp))             # <<<<<<<<<<<<<<
 *     for i in range(dimlen):
 *         dims[i] = dims_nd[i]
 */
  __pyx_v_dims = ((npy_intp *)malloc((__pyx_v_dimlen * (sizeof(npy_intp)))));

  /* "miniga4py/ga.pyx":687
 *     # must convert int64_t ndarray shape to npy_intp array
 *     dims = <np.npy_intp*>malloc(dimlen*sizeof(np.npy_intp))
 *     for i in range(dimlen):             # <<<<<<<<<<<<<<
 *         dims[i] = dims_nd[i]
 *     array = np.PyArray_SimpleNewFromData(dimlen, dims, typenum, ptr)
 */
  __pyx_t_3 = __pyx_v_dimlen;
  __pyx_t_16 = __pyx_t_3;
  for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
    __pyx_v_i = __pyx_t_17;

    /* "miniga4py/ga.pyx":688
 *     dims = <np.npy_intp*>malloc(dimlen*sizeof(np.npy_intp))
 *     for i in range(dimlen):
 *         dims[i] = dims_nd[i]             # <<<<<<<<<<<<<<
 *     array = np.PyArray_SimpleNewFromData(dimlen, dims, typenum, ptr)
 *     free(dims)
 */
    __pyx_t_18 = __pyx_v_i;
    __pyx_t_19 = -1;
    if (__pyx_t_18 < 0) {
      __pyx_t_18 += __pyx_pybuffernd_dims_nd.diminfo[0].shape;
      if (unlikely(__pyx_t_18 < 0)) __pyx_t_19 = 0;
    } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_dims_nd.diminfo[0].shape)) __pyx_t_19 = 0;
    if (unlikely(__pyx_t_19 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_19);
      __PYX_ERR(0, 688, __pyx_L1_error)
    }
    (__pyx_v_dims[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_dims_nd.diminfo[0].strides));
  }

  /* "miniga4py/ga.pyx":689
 *     for i in range(dimlen):
 *         dims[i] = dims_nd[i]
 *     array = np.PyArray_SimpleNewFromData(dimlen, dims, typenum, ptr)             # <<<<<<<<<<<<<<
 *     free(dims)
 *     return array
 */
  __pyx_t_5 = PyArray_SimpleNewFromData(__pyx_v_dimlen, __pyx_v_dims, __pyx_v_typenum, __pyx_v_ptr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_array = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":690
 *         dims[i] = dims_nd[i]
 *     array = np.PyArray_SimpleNewFromData(dimlen, dims, typenum, ptr)
 *     free(dims)             # <<<<<<<<<<<<<<
 *     return array
 * 
 */
  free(__pyx_v_dims);

  /* "miniga4py/ga.pyx":691
 *     array = np.PyArray_SimpleNewFromData(dimlen, dims, typenum, ptr)
 *     free(dims)
 *     return array             # <<<<<<<<<<<<<<
 * 
 * def add(int g_a, int g_b, int g_c, alpha=None, beta=None, alo=None, ahi=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_array);
  __pyx_r = __pyx_v_array;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":652
 *     raise NotImplementedError("use access_ghosts(g_a) instead")
 * 
 * def access_ghosts(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns ndarray representing local patch with ghost cells.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_15);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_dst.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.access_ghosts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_dst.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ld_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_lo_dst);
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_dst);
  __Pyx_XDECREF((PyObject *)__pyx_v_dims_nd);
  __Pyx_XDECREF(__pyx_v_array);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":693
 *     return array
 * 
 * def add(int g_a, int g_b, int g_c, alpha=None, beta=None, alo=None, ahi=None,             # <<<<<<<<<<<<<<
 *         blo=None, bhi=None, clo=None, chi=None):
 *     """Element-wise addition of two arrays.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_37add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_36add[] = "add(int g_a, int g_b, int g_c, alpha=None, beta=None, alo=None, ahi=None, blo=None, bhi=None, clo=None, chi=None)\nElement-wise addition of two arrays.\n\n    The arrays must be the same shape and identically aligned.\n    The result (c) may replace one of the input arrays (a/b).\n    Patches of arrays (which must have the same number of elements) may also\n    be added together elementw=-wise, if patch coordinates are specified.\n    c = alpha*a + beta*b\n\n    This is a collective operation. \n\n    :Parameters:\n        g_a : int\n            the array handle\n        g_b : int\n            the array handle\n        g_c : int\n            the array handle\n        alpha : object\n            multiplier (converted to appropriate type)\n        beta : object\n            multiplier (converted to appropriate type)\n        alo : 1D array-like of integers\n            lower bound patch coordinates of g_a, inclusive\n        ahi : 1D array-like of integers\n            higher bound patch coordinates of g_a, exclusive\n        blo : 1D array-like of integers\n            lower bound patch coordinates of g_b, inclusive\n        bhi : 1D array-like of integers\n            higher bound patch coordinates of g_b, exclusive\n        clo : 1D array-like of integers\n            lower bound patch coordinates of g_c, inclusive\n        chi : 1D array-like of integers\n            higher bound patch coordinates of g_c, exclusive\n\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_37add = {"add", (PyCFunction)__pyx_pw_9miniga4py_2ga_37add, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_36add};
static PyObject *__pyx_pw_9miniga4py_2ga_37add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_b;
  int __pyx_v_g_c;
  PyObject *__pyx_v_alpha = 0;
  PyObject *__pyx_v_beta = 0;
  PyObject *__pyx_v_alo = 0;
  PyObject *__pyx_v_ahi = 0;
  PyObject *__pyx_v_blo = 0;
  PyObject *__pyx_v_bhi = 0;
  PyObject *__pyx_v_clo = 0;
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_b,&__pyx_n_s_g_c,&__pyx_n_s_alpha,&__pyx_n_s_beta,&__pyx_n_s_alo,&__pyx_n_s_ahi,&__pyx_n_s_blo,&__pyx_n_s_bhi,&__pyx_n_s_clo,&__pyx_n_s_chi,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);

    /* "miniga4py/ga.pyx":694
 * 
 * def add(int g_a, int g_b, int g_c, alpha=None, beta=None, alo=None, ahi=None,
 *         blo=None, bhi=None, clo=None, chi=None):             # <<<<<<<<<<<<<<
 *     """Element-wise addition of two arrays.
 * 
 */
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)Py_None);
    values[9] = ((PyObject *)Py_None);
    values[10] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add", 0, 3, 11, 1); __PYX_ERR(0, 693, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_c)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add", 0, 3, 11, 2); __PYX_ERR(0, 693, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alo);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ahi);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_blo);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bhi);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clo);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chi);
          if (value) { values[10] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add") < 0)) __PYX_ERR(0, 693, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 693, __pyx_L3_error)
    __pyx_v_g_b = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_b == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 693, __pyx_L3_error)
    __pyx_v_g_c = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_g_c == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 693, __pyx_L3_error)
    __pyx_v_alpha = values[3];
    __pyx_v_beta = values[4];
    __pyx_v_alo = values[5];
    __pyx_v_ahi = values[6];
    __pyx_v_blo = values[7];
    __pyx_v_bhi = values[8];
    __pyx_v_clo = values[9];
    __pyx_v_chi = values[10];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add", 0, 3, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 693, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_36add(__pyx_self, __pyx_v_g_a, __pyx_v_g_b, __pyx_v_g_c, __pyx_v_alpha, __pyx_v_beta, __pyx_v_alo, __pyx_v_ahi, __pyx_v_blo, __pyx_v_bhi, __pyx_v_clo, __pyx_v_chi);

  /* "miniga4py/ga.pyx":693
 *     return array
 * 
 * def add(int g_a, int g_b, int g_c, alpha=None, beta=None, alo=None, ahi=None,             # <<<<<<<<<<<<<<
 *         blo=None, bhi=None, clo=None, chi=None):
 *     """Element-wise addition of two arrays.
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_36add(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b, int __pyx_v_g_c, PyObject *__pyx_v_alpha, PyObject *__pyx_v_beta, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi, PyObject *__pyx_v_clo, PyObject *__pyx_v_chi) {
  PyArrayObject *__pyx_v_alo_nd = 0;
  PyArrayObject *__pyx_v_ahi_nd = 0;
  PyArrayObject *__pyx_v_blo_nd = 0;
  PyArrayObject *__pyx_v_bhi_nd = 0;
  PyArrayObject *__pyx_v_clo_nd = 0;
  PyArrayObject *__pyx_v_chi_nd = 0;
  int __pyx_v_gtype;
  int __pyx_v_ialpha;
  int __pyx_v_ibeta;
  long __pyx_v_lalpha;
  long __pyx_v_lbeta;
  PY_LONG_LONG __pyx_v_llalpha;
  PY_LONG_LONG __pyx_v_llbeta;
  float __pyx_v_falpha;
  float __pyx_v_fbeta;
  double __pyx_v_dalpha;
  double __pyx_v_dbeta;
  long double __pyx_v_ldalpha;
  long double __pyx_v_ldbeta;
  SingleComplex __pyx_v_fcalpha;
  SingleComplex __pyx_v_fcbeta;
  DoubleComplex __pyx_v_dcalpha;
  DoubleComplex __pyx_v_dcbeta;
  void *__pyx_v_valpha;
  void *__pyx_v_vbeta;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ahi_nd;
  __Pyx_Buffer __pyx_pybuffer_ahi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_alo_nd;
  __Pyx_Buffer __pyx_pybuffer_alo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bhi_nd;
  __Pyx_Buffer __pyx_pybuffer_bhi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_blo_nd;
  __Pyx_Buffer __pyx_pybuffer_blo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_chi_nd;
  __Pyx_Buffer __pyx_pybuffer_chi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_clo_nd;
  __Pyx_Buffer __pyx_pybuffer_clo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyArrayObject *__pyx_t_14 = NULL;
  PyArrayObject *__pyx_t_15 = NULL;
  __Pyx_RefNannySetupContext("add", 0);
  __Pyx_INCREF(__pyx_v_alpha);
  __Pyx_INCREF(__pyx_v_beta);
  __pyx_pybuffer_alo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_alo_nd.refcount = 0;
  __pyx_pybuffernd_alo_nd.data = NULL;
  __pyx_pybuffernd_alo_nd.rcbuffer = &__pyx_pybuffer_alo_nd;
  __pyx_pybuffer_ahi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_ahi_nd.refcount = 0;
  __pyx_pybuffernd_ahi_nd.data = NULL;
  __pyx_pybuffernd_ahi_nd.rcbuffer = &__pyx_pybuffer_ahi_nd;
  __pyx_pybuffer_blo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_blo_nd.refcount = 0;
  __pyx_pybuffernd_blo_nd.data = NULL;
  __pyx_pybuffernd_blo_nd.rcbuffer = &__pyx_pybuffer_blo_nd;
  __pyx_pybuffer_bhi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_bhi_nd.refcount = 0;
  __pyx_pybuffernd_bhi_nd.data = NULL;
  __pyx_pybuffernd_bhi_nd.rcbuffer = &__pyx_pybuffer_bhi_nd;
  __pyx_pybuffer_clo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_clo_nd.refcount = 0;
  __pyx_pybuffernd_clo_nd.data = NULL;
  __pyx_pybuffernd_clo_nd.rcbuffer = &__pyx_pybuffer_clo_nd;
  __pyx_pybuffer_chi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_chi_nd.refcount = 0;
  __pyx_pybuffernd_chi_nd.data = NULL;
  __pyx_pybuffernd_chi_nd.rcbuffer = &__pyx_pybuffer_chi_nd;

  /* "miniga4py/ga.pyx":734
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     cdef int gtype=inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     cdef int            ialpha,  ibeta
 *     cdef long           lalpha,  lbeta
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":745
 *     cdef void          *valpha
 *     cdef void          *vbeta
 *     if alpha is None:             # <<<<<<<<<<<<<<
 *         alpha = 1
 *     valpha = _convert_multiplier(gtype, alpha,
 */
  __pyx_t_1 = (__pyx_v_alpha == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "miniga4py/ga.pyx":746
 *     cdef void          *vbeta
 *     if alpha is None:
 *         alpha = 1             # <<<<<<<<<<<<<<
 *     valpha = _convert_multiplier(gtype, alpha,
 *             &ialpha,  &lalpha,  &llalpha,
 */
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_DECREF_SET(__pyx_v_alpha, __pyx_int_1);

    /* "miniga4py/ga.pyx":745
 *     cdef void          *valpha
 *     cdef void          *vbeta
 *     if alpha is None:             # <<<<<<<<<<<<<<
 *         alpha = 1
 *     valpha = _convert_multiplier(gtype, alpha,
 */
  }

  /* "miniga4py/ga.pyx":747
 *     if alpha is None:
 *         alpha = 1
 *     valpha = _convert_multiplier(gtype, alpha,             # <<<<<<<<<<<<<<
 *             &ialpha,  &lalpha,  &llalpha,
 *             &falpha,  &dalpha,  &ldalpha,
 */
  __pyx_v_valpha = __pyx_f_9miniga4py_2ga__convert_multiplier(__pyx_v_gtype, __pyx_v_alpha, (&__pyx_v_ialpha), (&__pyx_v_lalpha), (&__pyx_v_llalpha), (&__pyx_v_falpha), (&__pyx_v_dalpha), (&__pyx_v_ldalpha), (&__pyx_v_fcalpha), (&__pyx_v_dcalpha));

  /* "miniga4py/ga.pyx":751
 *             &falpha,  &dalpha,  &ldalpha,
 *             &fcalpha, &dcalpha)
 *     if beta is None:             # <<<<<<<<<<<<<<
 *         beta = 1
 *     vbeta = _convert_multiplier(gtype, beta,
 */
  __pyx_t_2 = (__pyx_v_beta == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":752
 *             &fcalpha, &dcalpha)
 *     if beta is None:
 *         beta = 1             # <<<<<<<<<<<<<<
 *     vbeta = _convert_multiplier(gtype, beta,
 *             &ibeta,  &lbeta,  &llbeta,
 */
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_DECREF_SET(__pyx_v_beta, __pyx_int_1);

    /* "miniga4py/ga.pyx":751
 *             &falpha,  &dalpha,  &ldalpha,
 *             &fcalpha, &dcalpha)
 *     if beta is None:             # <<<<<<<<<<<<<<
 *         beta = 1
 *     vbeta = _convert_multiplier(gtype, beta,
 */
  }

  /* "miniga4py/ga.pyx":753
 *     if beta is None:
 *         beta = 1
 *     vbeta = _convert_multiplier(gtype, beta,             # <<<<<<<<<<<<<<
 *             &ibeta,  &lbeta,  &llbeta,
 *             &fbeta,  &dbeta,  &ldbeta,
 */
  __pyx_v_vbeta = __pyx_f_9miniga4py_2ga__convert_multiplier(__pyx_v_gtype, __pyx_v_beta, (&__pyx_v_ibeta), (&__pyx_v_lbeta), (&__pyx_v_llbeta), (&__pyx_v_fbeta), (&__pyx_v_dbeta), (&__pyx_v_ldbeta), (&__pyx_v_fcbeta), (&__pyx_v_dcbeta));

  /* "miniga4py/ga.pyx":757
 *             &fbeta,  &dbeta,  &ldbeta,
 *             &fcbeta, &dcbeta)
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 */
  __pyx_t_2 = (__pyx_v_alo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L6_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":758
 *             &fcbeta, &dcbeta)
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None             # <<<<<<<<<<<<<<
 *             and clo is None and chi is None):
 *         GA_Add(valpha, g_a, vbeta, g_b, g_c)
 */
  __pyx_t_3 = (__pyx_v_ahi == Py_None);

  /* "miniga4py/ga.pyx":757
 *             &fbeta,  &dbeta,  &ldbeta,
 *             &fcbeta, &dcbeta)
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 */
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L6_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":758
 *             &fcbeta, &dcbeta)
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None             # <<<<<<<<<<<<<<
 *             and clo is None and chi is None):
 *         GA_Add(valpha, g_a, vbeta, g_b, g_c)
 */
  __pyx_t_2 = (__pyx_v_blo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L6_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":759
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):             # <<<<<<<<<<<<<<
 *         GA_Add(valpha, g_a, vbeta, g_b, g_c)
 *     else:
 */
  __pyx_t_3 = (__pyx_v_bhi == Py_None);

  /* "miniga4py/ga.pyx":758
 *             &fcbeta, &dcbeta)
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None             # <<<<<<<<<<<<<<
 *             and clo is None and chi is None):
 *         GA_Add(valpha, g_a, vbeta, g_b, g_c)
 */
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L6_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":759
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):             # <<<<<<<<<<<<<<
 *         GA_Add(valpha, g_a, vbeta, g_b, g_c)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_clo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_chi == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L6_bool_binop_done:;

  /* "miniga4py/ga.pyx":757
 *             &fbeta,  &dbeta,  &ldbeta,
 *             &fcbeta, &dcbeta)
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 */
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":760
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 *         GA_Add(valpha, g_a, vbeta, g_b, g_c)             # <<<<<<<<<<<<<<
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 */
    GA_Add(__pyx_v_valpha, __pyx_v_g_a, __pyx_v_vbeta, __pyx_v_g_b, __pyx_v_g_c);

    /* "miniga4py/ga.pyx":757
 *             &fbeta,  &dbeta,  &ldbeta,
 *             &fcbeta, &dcbeta)
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 */
    goto __pyx_L5;
  }

  /* "miniga4py/ga.pyx":762
 *         GA_Add(valpha, g_a, vbeta, g_b, g_c)
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)             # <<<<<<<<<<<<<<
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_alo, __pyx_v_ahi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 762, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 762, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 762, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 762, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 762, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 762, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L13_unpacking_done;
      __pyx_L12_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 762, __pyx_L1_error)
      __pyx_L13_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 762, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 762, __pyx_L1_error)
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_alo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_alo_nd.diminfo[0].strides = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alo_nd.diminfo[0].shape = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 762, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_alo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ahi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_ahi_nd.diminfo[0].strides = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ahi_nd.diminfo[0].shape = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 762, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_ahi_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":763
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)             # <<<<<<<<<<<<<<
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)
 *         NGA_Add_patch64(
 */
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_b, __pyx_v_blo, __pyx_v_bhi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 763, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 763, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 763, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 763, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 763, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L14_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L14_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 763, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L15_unpacking_done;
      __pyx_L14_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 763, __pyx_L1_error)
      __pyx_L15_unpacking_done:;
    }
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 763, __pyx_L1_error)
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 763, __pyx_L1_error)
    __pyx_t_14 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_blo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_blo_nd.diminfo[0].strides = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_blo_nd.diminfo[0].shape = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 763, __pyx_L1_error)
    }
    __pyx_t_14 = 0;
    __pyx_v_blo_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_14 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_bhi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_bhi_nd.diminfo[0].strides = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bhi_nd.diminfo[0].shape = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 763, __pyx_L1_error)
    }
    __pyx_t_14 = 0;
    __pyx_v_bhi_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "miniga4py/ga.pyx":764
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)             # <<<<<<<<<<<<<<
 *         NGA_Add_patch64(
 *                 valpha, g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_c, __pyx_v_clo, __pyx_v_chi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 764, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 764, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 764, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 764, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 764, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L16_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L16_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 764, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L17_unpacking_done;
      __pyx_L16_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 764, __pyx_L1_error)
      __pyx_L17_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 764, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 764, __pyx_L1_error)
    __pyx_t_15 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_clo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_clo_nd.diminfo[0].strides = __pyx_pybuffernd_clo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_clo_nd.diminfo[0].shape = __pyx_pybuffernd_clo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 764, __pyx_L1_error)
    }
    __pyx_t_15 = 0;
    __pyx_v_clo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_15 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_chi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_chi_nd.diminfo[0].strides = __pyx_pybuffernd_chi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_chi_nd.diminfo[0].shape = __pyx_pybuffernd_chi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 764, __pyx_L1_error)
    }
    __pyx_t_15 = 0;
    __pyx_v_chi_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":765
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)
 *         NGA_Add_patch64(             # <<<<<<<<<<<<<<
 *                 valpha, g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                  vbeta, g_b, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data,
 */
    NGA_Add_patch64(__pyx_v_valpha, __pyx_v_g_a, ((int64_t *)__pyx_v_alo_nd->data), ((int64_t *)__pyx_v_ahi_nd->data), __pyx_v_vbeta, __pyx_v_g_b, ((int64_t *)__pyx_v_blo_nd->data), ((int64_t *)__pyx_v_bhi_nd->data), __pyx_v_g_c, ((int64_t *)__pyx_v_clo_nd->data), ((int64_t *)__pyx_v_chi_nd->data));
  }
  __pyx_L5:;

  /* "miniga4py/ga.pyx":693
 *     return array
 * 
 * def add(int g_a, int g_b, int g_c, alpha=None, beta=None, alo=None, ahi=None,             # <<<<<<<<<<<<<<
 *         blo=None, bhi=None, clo=None, chi=None):
 *     """Element-wise addition of two arrays.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_alo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_ahi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_blo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_bhi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_clo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_chi_nd);
  __Pyx_XDECREF(__pyx_v_alpha);
  __Pyx_XDECREF(__pyx_v_beta);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":770
 *                         g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def add_constant(int g_a, alpha, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Adds the constant alpha to each element of the array.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_39add_constant(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_38add_constant[] = "add_constant(int g_a, alpha, lo=None, hi=None)\nAdds the constant alpha to each element of the array. \n\n    This operation is collective.\n\n    :Parameters:\n        g_a : int\n            the array handle\n        alpha : object\n            the constant to add (converted to appropriate type)\n        lo : 1D array-like of integers\n            lower bound patch coordinates, inclusive\n        hi : 1D array-like of integers\n            higher bound patch coordinates, exclusive\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_39add_constant = {"add_constant", (PyCFunction)__pyx_pw_9miniga4py_2ga_39add_constant, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_38add_constant};
static PyObject *__pyx_pw_9miniga4py_2ga_39add_constant(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_alpha = 0;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_constant (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_alpha,&__pyx_n_s_lo,&__pyx_n_s_hi,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_constant", 0, 2, 4, 1); __PYX_ERR(0, 770, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_constant") < 0)) __PYX_ERR(0, 770, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 770, __pyx_L3_error)
    __pyx_v_alpha = values[1];
    __pyx_v_lo = values[2];
    __pyx_v_hi = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_constant", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 770, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.add_constant", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_38add_constant(__pyx_self, __pyx_v_g_a, __pyx_v_alpha, __pyx_v_lo, __pyx_v_hi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_38add_constant(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_alpha, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
  PyArrayObject *__pyx_v_lo_nd = 0;
  PyArrayObject *__pyx_v_hi_nd = 0;
  int __pyx_v_gtype;
  int __pyx_v_ialpha;
  long __pyx_v_lalpha;
  PY_LONG_LONG __pyx_v_llalpha;
  float __pyx_v_falpha;
  double __pyx_v_dalpha;
  long double __pyx_v_ldalpha;
  SingleComplex __pyx_v_fcalpha;
  DoubleComplex __pyx_v_dcalpha;
  void *__pyx_v_valpha;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_nd;
  __Pyx_Buffer __pyx_pybuffer_hi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lo_nd;
  __Pyx_Buffer __pyx_pybuffer_lo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  __Pyx_RefNannySetupContext("add_constant", 0);
  __pyx_pybuffer_lo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_lo_nd.refcount = 0;
  __pyx_pybuffernd_lo_nd.data = NULL;
  __pyx_pybuffernd_lo_nd.rcbuffer = &__pyx_pybuffer_lo_nd;
  __pyx_pybuffer_hi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_nd.refcount = 0;
  __pyx_pybuffernd_hi_nd.data = NULL;
  __pyx_pybuffernd_hi_nd.rcbuffer = &__pyx_pybuffer_hi_nd;

  /* "miniga4py/ga.pyx":787
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 *     cdef int gtype=inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     cdef int            ialpha
 *     cdef long           lalpha
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":797
 *     cdef DoubleComplex  dcalpha
 *     cdef void          *valpha
 *     valpha = _convert_multiplier(gtype, alpha,             # <<<<<<<<<<<<<<
 *             &ialpha,  &lalpha,  &llalpha,
 *             &falpha,  &dalpha,  &ldalpha,
 */
  __pyx_v_valpha = __pyx_f_9miniga4py_2ga__convert_multiplier(__pyx_v_gtype, __pyx_v_alpha, (&__pyx_v_ialpha), (&__pyx_v_lalpha), (&__pyx_v_llalpha), (&__pyx_v_falpha), (&__pyx_v_dalpha), (&__pyx_v_ldalpha), (&__pyx_v_fcalpha), (&__pyx_v_dcalpha));

  /* "miniga4py/ga.pyx":801
 *             &falpha,  &dalpha,  &ldalpha,
 *             &fcalpha, &dcalpha)
 *     if lo is None and hi is None:             # <<<<<<<<<<<<<<
 *         GA_Add_constant(g_a, valpha)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_lo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_hi == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":802
 *             &fcalpha, &dcalpha)
 *     if lo is None and hi is None:
 *         GA_Add_constant(g_a, valpha)             # <<<<<<<<<<<<<<
 *     else:
 *         lo_nd,hi_nd = _lohi(g_a,lo,hi)
 */
    GA_Add_constant(__pyx_v_g_a, __pyx_v_valpha);

    /* "miniga4py/ga.pyx":801
 *             &falpha,  &dalpha,  &ldalpha,
 *             &fcalpha, &dcalpha)
 *     if lo is None and hi is None:             # <<<<<<<<<<<<<<
 *         GA_Add_constant(g_a, valpha)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "miniga4py/ga.pyx":804
 *         GA_Add_constant(g_a, valpha)
 *     else:
 *         lo_nd,hi_nd = _lohi(g_a,lo,hi)             # <<<<<<<<<<<<<<
 *         GA_Add_constant_patch64(
 *                 g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, valpha)
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_lo, __pyx_v_hi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 804, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 804, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 804, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 804, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 804, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 804, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 804, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 804, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 804, __pyx_L1_error)
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_lo_nd.diminfo[0].strides = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_nd.diminfo[0].shape = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 804, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_lo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 804, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":805
 *     else:
 *         lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *         GA_Add_constant_patch64(             # <<<<<<<<<<<<<<
 *                 g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, valpha)
 * 
 */
    GA_Add_constant_patch64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data), __pyx_v_valpha);
  }
  __pyx_L3:;

  /* "miniga4py/ga.pyx":770
 *                         g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def add_constant(int g_a, alpha, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Adds the constant alpha to each element of the array.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.add_constant", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":808
 *                 g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, valpha)
 * 
 * def add_diagonal(int g_a, int g_v):             # <<<<<<<<<<<<<<
 *     """Adds the elements of the vector g_v to the diagonal of matrix g_a.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_41add_diagonal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_40add_diagonal[] = "add_diagonal(int g_a, int g_v)\nAdds the elements of the vector g_v to the diagonal of matrix g_a.\n\n    This operation is collective.\n\n    :Parameters:\n        g_a : int\n            the array handle\n        g_v : int\n            the vector handle\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_41add_diagonal = {"add_diagonal", (PyCFunction)__pyx_pw_9miniga4py_2ga_41add_diagonal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_40add_diagonal};
static PyObject *__pyx_pw_9miniga4py_2ga_41add_diagonal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_v;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_diagonal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_v,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_diagonal", 1, 2, 2, 1); __PYX_ERR(0, 808, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_diagonal") < 0)) __PYX_ERR(0, 808, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 808, __pyx_L3_error)
    __pyx_v_g_v = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 808, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_diagonal", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 808, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.add_diagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_40add_diagonal(__pyx_self, __pyx_v_g_a, __pyx_v_g_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_40add_diagonal(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_v) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_diagonal", 0);

  /* "miniga4py/ga.pyx":820
 * 
 *     """
 *     GA_Add_diagonal(g_a, g_v)             # <<<<<<<<<<<<<<
 * 
 * def allocate(int g_a):
 */
  GA_Add_diagonal(__pyx_v_g_a, __pyx_v_g_v);

  /* "miniga4py/ga.pyx":808
 *                 g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, valpha)
 * 
 * def add_diagonal(int g_a, int g_v):             # <<<<<<<<<<<<<<
 *     """Adds the elements of the vector g_v to the diagonal of matrix g_a.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":822
 *     GA_Add_diagonal(g_a, g_v)
 * 
 * def allocate(int g_a):             # <<<<<<<<<<<<<<
 *     """Allocates memory for the handle obtained using ga.create_handle.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_43allocate(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_42allocate[] = "allocate(int g_a)\nAllocates memory for the handle obtained using ga.create_handle.\n\n    At a minimum, the ga.set_data function must be called before the memory is\n    allocated. Other ga.set_xxx functions can also be called before invoking\n    this function.\n\n    This is a collective operation. \n\n    :Parameters:\n        g_a : int\n            the array handle\n\n    :returns: True if allocation of g_a was successful.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_43allocate = {"allocate", (PyCFunction)__pyx_pw_9miniga4py_2ga_43allocate, METH_O, __pyx_doc_9miniga4py_2ga_42allocate};
static PyObject *__pyx_pw_9miniga4py_2ga_43allocate(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("allocate (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 822, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.allocate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_42allocate(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_42allocate(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("allocate", 0);

  /* "miniga4py/ga.pyx":838
 * 
 *     """
 *     if GA_Allocate(g_a) == 1:             # <<<<<<<<<<<<<<
 *         return True
 *     return False
 */
  __pyx_t_1 = ((GA_Allocate(__pyx_v_g_a) == 1) != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":839
 *     """
 *     if GA_Allocate(g_a) == 1:
 *         return True             # <<<<<<<<<<<<<<
 *     return False
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":838
 * 
 *     """
 *     if GA_Allocate(g_a) == 1:             # <<<<<<<<<<<<<<
 *         return True
 *     return False
 */
  }

  /* "miniga4py/ga.pyx":840
 *     if GA_Allocate(g_a) == 1:
 *         return True
 *     return False             # <<<<<<<<<<<<<<
 * 
 * def brdcst(buffer, int root=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":822
 *     GA_Add_diagonal(g_a, g_v)
 * 
 * def allocate(int g_a):             # <<<<<<<<<<<<<<
 *     """Allocates memory for the handle obtained using ga.create_handle.
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":842
 *     return False
 * 
 * def brdcst(buffer, int root=0):             # <<<<<<<<<<<<<<
 *     """Broadcast from process root to all other processes.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_45brdcst(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_44brdcst[] = "brdcst(buffer, int root=0)\nBroadcast from process root to all other processes.\n\n    If the buffer is not contiguous, an error is raised.  This operation is\n    provided only for convenience purposes: it is available regardless of the\n    message-passing library that GA is running with.\n\n    This is a collective operation. \n\n    :Parameters:\n        buffer : 1D array-like of objects\n            the ndarray message (converted to the appropriate type)\n        root : int\n            the process which is sending\n\n    :returns: The buffer in case a temporary was passed in.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_45brdcst = {"brdcst", (PyCFunction)__pyx_pw_9miniga4py_2ga_45brdcst, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_44brdcst};
static PyObject *__pyx_pw_9miniga4py_2ga_45brdcst(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_buffer = 0;
  int __pyx_v_root;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("brdcst (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_buffer,&__pyx_n_s_root,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_root);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "brdcst") < 0)) __PYX_ERR(0, 842, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_buffer = values[0];
    if (values[1]) {
      __pyx_v_root = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_root == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 842, __pyx_L3_error)
    } else {
      __pyx_v_root = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("brdcst", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 842, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.brdcst", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_44brdcst(__pyx_self, __pyx_v_buffer, __pyx_v_root);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_44brdcst(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, int __pyx_v_root) {
  PyArrayObject *__pyx_v_buffer_nd = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("brdcst", 0);

  /* "miniga4py/ga.pyx":861
 *     """
 *     cdef np.ndarray buffer_nd
 *     buffer_nd = np.asarray(buffer)             # <<<<<<<<<<<<<<
 *     if not buffer_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("the buffer must be contiguous")
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 861, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_buffer};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 861, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_buffer};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 861, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 861, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_v_buffer);
      __Pyx_GIVEREF(__pyx_v_buffer);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_buffer);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 861, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 861, __pyx_L1_error)
  __pyx_v_buffer_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":862
 *     cdef np.ndarray buffer_nd
 *     buffer_nd = np.asarray(buffer)
 *     if not buffer_nd.flags['C_CONTIGUOUS']:             # <<<<<<<<<<<<<<
 *         raise ValueError("the buffer must be contiguous")
 *     #if buffer_nd.ndim != 1:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buffer_nd), __pyx_n_s_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_C_CONTIGUOUS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 862, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = ((!__pyx_t_5) != 0);
  if (unlikely(__pyx_t_6)) {

    /* "miniga4py/ga.pyx":863
 *     buffer_nd = np.asarray(buffer)
 *     if not buffer_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("the buffer must be contiguous")             # <<<<<<<<<<<<<<
 *     #if buffer_nd.ndim != 1:
 *     #    raise ValueError("the buffer must be one-dimensional")
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 863, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 863, __pyx_L1_error)

    /* "miniga4py/ga.pyx":862
 *     cdef np.ndarray buffer_nd
 *     buffer_nd = np.asarray(buffer)
 *     if not buffer_nd.flags['C_CONTIGUOUS']:             # <<<<<<<<<<<<<<
 *         raise ValueError("the buffer must be contiguous")
 *     #if buffer_nd.ndim != 1:
 */
  }

  /* "miniga4py/ga.pyx":866
 *     #if buffer_nd.ndim != 1:
 *     #    raise ValueError("the buffer must be one-dimensional")
 *     GA_Brdcst(buffer_nd.data, buffer_nd.size*buffer_nd.itemsize, root)             # <<<<<<<<<<<<<<
 *     return buffer_nd
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buffer_nd), __pyx_n_s_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buffer_nd), __pyx_n_s_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 866, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  GA_Brdcst(__pyx_v_buffer_nd->data, __pyx_t_7, __pyx_v_root);

  /* "miniga4py/ga.pyx":867
 *     #    raise ValueError("the buffer must be one-dimensional")
 *     GA_Brdcst(buffer_nd.data, buffer_nd.size*buffer_nd.itemsize, root)
 *     return buffer_nd             # <<<<<<<<<<<<<<
 * 
 * def check_handle(int g_a, message):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_buffer_nd));
  __pyx_r = ((PyObject *)__pyx_v_buffer_nd);
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":842
 *     return False
 * 
 * def brdcst(buffer, int root=0):             # <<<<<<<<<<<<<<
 *     """Broadcast from process root to all other processes.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("miniga4py.ga.brdcst", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buffer_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":869
 *     return buffer_nd
 * 
 * def check_handle(int g_a, message):             # <<<<<<<<<<<<<<
 *     """Checks that the array handle g_a is valid.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_47check_handle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_46check_handle[] = "check_handle(int g_a, message)\nChecks that the array handle g_a is valid.\n    \n    If not, calls ga.error withe the provided string.\n\n    This operation is local.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_47check_handle = {"check_handle", (PyCFunction)__pyx_pw_9miniga4py_2ga_47check_handle, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_46check_handle};
static PyObject *__pyx_pw_9miniga4py_2ga_47check_handle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_message = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_handle (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_message,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_message)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("check_handle", 1, 2, 2, 1); __PYX_ERR(0, 869, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "check_handle") < 0)) __PYX_ERR(0, 869, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 869, __pyx_L3_error)
    __pyx_v_message = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("check_handle", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 869, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.check_handle", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_46check_handle(__pyx_self, __pyx_v_g_a, __pyx_v_message);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_46check_handle(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_message) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  char *__pyx_t_5;
  __Pyx_RefNannySetupContext("check_handle", 0);

  /* "miniga4py/ga.pyx":877
 * 
 *     """
 *     GA_Check_handle(g_a, b(message))             # <<<<<<<<<<<<<<
 * 
 * def cluster_nnodes():
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 877, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_message};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 877, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_message};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 877, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 877, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_message);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 877, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_AsWritableString(__pyx_t_1); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 877, __pyx_L1_error)
  GA_Check_handle(__pyx_v_g_a, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":869
 *     return buffer_nd
 * 
 * def check_handle(int g_a, message):             # <<<<<<<<<<<<<<
 *     """Checks that the array handle g_a is valid.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("miniga4py.ga.check_handle", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":879
 *     GA_Check_handle(g_a, b(message))
 * 
 * def cluster_nnodes():             # <<<<<<<<<<<<<<
 *     """Returns the total number of nodes that the program is running on.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_49cluster_nnodes(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_48cluster_nnodes[] = "cluster_nnodes()\nReturns the total number of nodes that the program is running on.\n\n    On SMP architectures, this will be less than or equal to the total number\n    of processors.\n\n    This is a  local operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_49cluster_nnodes = {"cluster_nnodes", (PyCFunction)__pyx_pw_9miniga4py_2ga_49cluster_nnodes, METH_NOARGS, __pyx_doc_9miniga4py_2ga_48cluster_nnodes};
static PyObject *__pyx_pw_9miniga4py_2ga_49cluster_nnodes(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cluster_nnodes (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_48cluster_nnodes(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_48cluster_nnodes(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("cluster_nnodes", 0);

  /* "miniga4py/ga.pyx":888
 * 
 *     """
 *     return GA_Cluster_nnodes()             # <<<<<<<<<<<<<<
 * 
 * def cluster_nodeid(int proc=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Cluster_nnodes()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":879
 *     GA_Check_handle(g_a, b(message))
 * 
 * def cluster_nnodes():             # <<<<<<<<<<<<<<
 *     """Returns the total number of nodes that the program is running on.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.cluster_nnodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":890
 *     return GA_Cluster_nnodes()
 * 
 * def cluster_nodeid(int proc=-1):             # <<<<<<<<<<<<<<
 *     """Returns the node ID of this process or the given process.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_51cluster_nodeid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_50cluster_nodeid[] = "cluster_nodeid(int proc=-1)\nReturns the node ID of this process or the given process.\n\n    On SMP architectures with more than one processor per node, several\n    processes may return the same node id.\n\n    This is a local operation.\n\n    :Parameters:\n        proc : int\n            process ID to lookup\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_51cluster_nodeid = {"cluster_nodeid", (PyCFunction)__pyx_pw_9miniga4py_2ga_51cluster_nodeid, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_50cluster_nodeid};
static PyObject *__pyx_pw_9miniga4py_2ga_51cluster_nodeid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_proc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cluster_nodeid (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_proc,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_proc);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cluster_nodeid") < 0)) __PYX_ERR(0, 890, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_proc = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_proc == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 890, __pyx_L3_error)
    } else {
      __pyx_v_proc = ((int)-1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cluster_nodeid", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 890, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.cluster_nodeid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_50cluster_nodeid(__pyx_self, __pyx_v_proc);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_50cluster_nodeid(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_proc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("cluster_nodeid", 0);

  /* "miniga4py/ga.pyx":903
 * 
 *     """
 *     if proc >= 0:             # <<<<<<<<<<<<<<
 *         return GA_Cluster_proc_nodeid(proc)
 *     return GA_Cluster_nodeid()
 */
  __pyx_t_1 = ((__pyx_v_proc >= 0) != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":904
 *     """
 *     if proc >= 0:
 *         return GA_Cluster_proc_nodeid(proc)             # <<<<<<<<<<<<<<
 *     return GA_Cluster_nodeid()
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_int(GA_Cluster_proc_nodeid(__pyx_v_proc)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 904, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":903
 * 
 *     """
 *     if proc >= 0:             # <<<<<<<<<<<<<<
 *         return GA_Cluster_proc_nodeid(proc)
 *     return GA_Cluster_nodeid()
 */
  }

  /* "miniga4py/ga.pyx":905
 *     if proc >= 0:
 *         return GA_Cluster_proc_nodeid(proc)
 *     return GA_Cluster_nodeid()             # <<<<<<<<<<<<<<
 * 
 * def cluster_proc_nodeid(int proc):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_int(GA_Cluster_nodeid()); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":890
 *     return GA_Cluster_nnodes()
 * 
 * def cluster_nodeid(int proc=-1):             # <<<<<<<<<<<<<<
 *     """Returns the node ID of this process or the given process.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("miniga4py.ga.cluster_nodeid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":907
 *     return GA_Cluster_nodeid()
 * 
 * def cluster_proc_nodeid(int proc):             # <<<<<<<<<<<<<<
 *     """Returns the node ID of the specified process.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_53cluster_proc_nodeid(PyObject *__pyx_self, PyObject *__pyx_arg_proc); /*proto*/
static char __pyx_doc_9miniga4py_2ga_52cluster_proc_nodeid[] = "cluster_proc_nodeid(int proc)\nReturns the node ID of the specified process.\n\n    On SMP architectures with more than one processor per node, several\n    processors may return the same node id.\n\n    This is a local operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_53cluster_proc_nodeid = {"cluster_proc_nodeid", (PyCFunction)__pyx_pw_9miniga4py_2ga_53cluster_proc_nodeid, METH_O, __pyx_doc_9miniga4py_2ga_52cluster_proc_nodeid};
static PyObject *__pyx_pw_9miniga4py_2ga_53cluster_proc_nodeid(PyObject *__pyx_self, PyObject *__pyx_arg_proc) {
  int __pyx_v_proc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cluster_proc_nodeid (wrapper)", 0);
  assert(__pyx_arg_proc); {
    __pyx_v_proc = __Pyx_PyInt_As_int(__pyx_arg_proc); if (unlikely((__pyx_v_proc == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 907, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.cluster_proc_nodeid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_52cluster_proc_nodeid(__pyx_self, ((int)__pyx_v_proc));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_52cluster_proc_nodeid(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_proc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("cluster_proc_nodeid", 0);

  /* "miniga4py/ga.pyx":916
 * 
 *     """
 *     return GA_Cluster_proc_nodeid(proc)             # <<<<<<<<<<<<<<
 * 
 * def cluster_nprocs(int node):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Cluster_proc_nodeid(__pyx_v_proc)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":907
 *     return GA_Cluster_nodeid()
 * 
 * def cluster_proc_nodeid(int proc):             # <<<<<<<<<<<<<<
 *     """Returns the node ID of the specified process.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.cluster_proc_nodeid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":918
 *     return GA_Cluster_proc_nodeid(proc)
 * 
 * def cluster_nprocs(int node):             # <<<<<<<<<<<<<<
 *     """Returns the number of processors available on the given node.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_55cluster_nprocs(PyObject *__pyx_self, PyObject *__pyx_arg_node); /*proto*/
static char __pyx_doc_9miniga4py_2ga_54cluster_nprocs[] = "cluster_nprocs(int node)\nReturns the number of processors available on the given node.\n\n    This is a local operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_55cluster_nprocs = {"cluster_nprocs", (PyCFunction)__pyx_pw_9miniga4py_2ga_55cluster_nprocs, METH_O, __pyx_doc_9miniga4py_2ga_54cluster_nprocs};
static PyObject *__pyx_pw_9miniga4py_2ga_55cluster_nprocs(PyObject *__pyx_self, PyObject *__pyx_arg_node) {
  int __pyx_v_node;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cluster_nprocs (wrapper)", 0);
  assert(__pyx_arg_node); {
    __pyx_v_node = __Pyx_PyInt_As_int(__pyx_arg_node); if (unlikely((__pyx_v_node == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 918, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.cluster_nprocs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_54cluster_nprocs(__pyx_self, ((int)__pyx_v_node));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_54cluster_nprocs(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_node) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("cluster_nprocs", 0);

  /* "miniga4py/ga.pyx":924
 * 
 *     """
 *     return GA_Cluster_nprocs(node)             # <<<<<<<<<<<<<<
 * 
 * def cluster_procid(int node, int proc):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Cluster_nprocs(__pyx_v_node)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":918
 *     return GA_Cluster_proc_nodeid(proc)
 * 
 * def cluster_nprocs(int node):             # <<<<<<<<<<<<<<
 *     """Returns the number of processors available on the given node.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.cluster_nprocs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":926
 *     return GA_Cluster_nprocs(node)
 * 
 * def cluster_procid(int node, int proc):             # <<<<<<<<<<<<<<
 *     """Returns the proc ID associated with node and local proc ID.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_57cluster_procid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_56cluster_procid[] = "cluster_procid(int node, int proc)\nReturns the proc ID associated with node and local proc ID.\n\n    If node has N processors, then the value of proc lies between 0 and\n    N-1.\n\n    This is a  local operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_57cluster_procid = {"cluster_procid", (PyCFunction)__pyx_pw_9miniga4py_2ga_57cluster_procid, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_56cluster_procid};
static PyObject *__pyx_pw_9miniga4py_2ga_57cluster_procid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_node;
  int __pyx_v_proc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cluster_procid (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_node,&__pyx_n_s_proc,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_node)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_proc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("cluster_procid", 1, 2, 2, 1); __PYX_ERR(0, 926, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cluster_procid") < 0)) __PYX_ERR(0, 926, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_node = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_node == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 926, __pyx_L3_error)
    __pyx_v_proc = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_proc == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 926, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cluster_procid", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 926, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.cluster_procid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_56cluster_procid(__pyx_self, __pyx_v_node, __pyx_v_proc);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_56cluster_procid(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_node, int __pyx_v_proc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("cluster_procid", 0);

  /* "miniga4py/ga.pyx":935
 * 
 *     """
 *     return GA_Cluster_procid(node, proc)             # <<<<<<<<<<<<<<
 * 
 * def compare_distr(int g_a, int g_b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Cluster_procid(__pyx_v_node, __pyx_v_proc)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":926
 *     return GA_Cluster_nprocs(node)
 * 
 * def cluster_procid(int node, int proc):             # <<<<<<<<<<<<<<
 *     """Returns the proc ID associated with node and local proc ID.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.cluster_procid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":937
 *     return GA_Cluster_procid(node, proc)
 * 
 * def compare_distr(int g_a, int g_b):             # <<<<<<<<<<<<<<
 *     """Compares the distributions of two global arrays.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_59compare_distr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_58compare_distr[] = "compare_distr(int g_a, int g_b)\nCompares the distributions of two global arrays.\n\n    This is a collective operation.\n\n    :returns: True if distributions are identical and False when they are not\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_59compare_distr = {"compare_distr", (PyCFunction)__pyx_pw_9miniga4py_2ga_59compare_distr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_58compare_distr};
static PyObject *__pyx_pw_9miniga4py_2ga_59compare_distr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_b;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("compare_distr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_b,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compare_distr", 1, 2, 2, 1); __PYX_ERR(0, 937, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compare_distr") < 0)) __PYX_ERR(0, 937, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 937, __pyx_L3_error)
    __pyx_v_g_b = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_b == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 937, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("compare_distr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 937, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.compare_distr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_58compare_distr(__pyx_self, __pyx_v_g_a, __pyx_v_g_b);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_58compare_distr(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("compare_distr", 0);

  /* "miniga4py/ga.pyx":945
 * 
 *     """
 *     if GA_Compare_distr(g_a, g_b) == 0:             # <<<<<<<<<<<<<<
 *         return True
 *     return False
 */
  __pyx_t_1 = ((GA_Compare_distr(__pyx_v_g_a, __pyx_v_g_b) == 0) != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":946
 *     """
 *     if GA_Compare_distr(g_a, g_b) == 0:
 *         return True             # <<<<<<<<<<<<<<
 *     return False
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":945
 * 
 *     """
 *     if GA_Compare_distr(g_a, g_b) == 0:             # <<<<<<<<<<<<<<
 *         return True
 *     return False
 */
  }

  /* "miniga4py/ga.pyx":947
 *     if GA_Compare_distr(g_a, g_b) == 0:
 *         return True
 *     return False             # <<<<<<<<<<<<<<
 * 
 * def copy(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":937
 *     return GA_Cluster_procid(node, proc)
 * 
 * def compare_distr(int g_a, int g_b):             # <<<<<<<<<<<<<<
 *     """Compares the distributions of two global arrays.
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":949
 *     return False
 * 
 * def copy(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None,             # <<<<<<<<<<<<<<
 *         bint trans=False):
 *     """Copies elements from array g_a into array g_b.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_61copy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_60copy[] = "copy(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None, bool trans=False)\nCopies elements from array g_a into array g_b.\n\n    For the operation over the entire arrays, the arrays must be the same\n    type, shape, and identically aligned.  No transpose is allowed in this\n    case.\n\n    For patch operations, the patches of arrays may be of different shapes but\n    must have the same number of elements. Patches must be nonoverlapping (if\n    g_a=g_b).  Transposes are allowed for patch operations.\n\n    This is a collective operation. \n\n    :Parameters:\n        g_a : int\n            the array handle copying from\n        g_b : int\n            the array handle copying to\n        alo : 1D array-like of integers\n            lower bound patch coordinates of g_a, inclusive\n        ahi : 1D array-like of integers\n            higher bound patch coordinates of g_a, exclusive\n        blo : 1D array-like of integers\n            lower bound patch coordinates of g_b, inclusive\n        bhi : 1D array-like of integers\n            higher bound patch coordinates of g_b, exclusive\n        trans : bool\n            whether the transpose operator should be applied True=applied\n             \n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_61copy = {"copy", (PyCFunction)__pyx_pw_9miniga4py_2ga_61copy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_60copy};
static PyObject *__pyx_pw_9miniga4py_2ga_61copy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_b;
  PyObject *__pyx_v_alo = 0;
  PyObject *__pyx_v_ahi = 0;
  PyObject *__pyx_v_blo = 0;
  PyObject *__pyx_v_bhi = 0;
  int __pyx_v_trans;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_b,&__pyx_n_s_alo,&__pyx_n_s_ahi,&__pyx_n_s_blo,&__pyx_n_s_bhi,&__pyx_n_s_trans,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("copy", 0, 2, 7, 1); __PYX_ERR(0, 949, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alo);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ahi);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_blo);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bhi);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_trans);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy") < 0)) __PYX_ERR(0, 949, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 949, __pyx_L3_error)
    __pyx_v_g_b = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_b == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 949, __pyx_L3_error)
    __pyx_v_alo = values[2];
    __pyx_v_ahi = values[3];
    __pyx_v_blo = values[4];
    __pyx_v_bhi = values[5];
    if (values[6]) {
      __pyx_v_trans = __Pyx_PyObject_IsTrue(values[6]); if (unlikely((__pyx_v_trans == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 950, __pyx_L3_error)
    } else {

      /* "miniga4py/ga.pyx":950
 * 
 * def copy(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None,
 *         bint trans=False):             # <<<<<<<<<<<<<<
 *     """Copies elements from array g_a into array g_b.
 * 
 */
      __pyx_v_trans = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 949, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_60copy(__pyx_self, __pyx_v_g_a, __pyx_v_g_b, __pyx_v_alo, __pyx_v_ahi, __pyx_v_blo, __pyx_v_bhi, __pyx_v_trans);

  /* "miniga4py/ga.pyx":949
 *     return False
 * 
 * def copy(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None,             # <<<<<<<<<<<<<<
 *         bint trans=False):
 *     """Copies elements from array g_a into array g_b.
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_60copy(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi, int __pyx_v_trans) {
  PyArrayObject *__pyx_v_alo_nd = 0;
  PyArrayObject *__pyx_v_ahi_nd = 0;
  PyArrayObject *__pyx_v_blo_nd = 0;
  PyArrayObject *__pyx_v_bhi_nd = 0;
  char __pyx_v_trans_c;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ahi_nd;
  __Pyx_Buffer __pyx_pybuffer_ahi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_alo_nd;
  __Pyx_Buffer __pyx_pybuffer_alo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bhi_nd;
  __Pyx_Buffer __pyx_pybuffer_bhi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_blo_nd;
  __Pyx_Buffer __pyx_pybuffer_blo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyArrayObject *__pyx_t_14 = NULL;
  __Pyx_RefNannySetupContext("copy", 0);
  __pyx_pybuffer_alo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_alo_nd.refcount = 0;
  __pyx_pybuffernd_alo_nd.data = NULL;
  __pyx_pybuffernd_alo_nd.rcbuffer = &__pyx_pybuffer_alo_nd;
  __pyx_pybuffer_ahi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_ahi_nd.refcount = 0;
  __pyx_pybuffernd_ahi_nd.data = NULL;
  __pyx_pybuffernd_ahi_nd.rcbuffer = &__pyx_pybuffer_ahi_nd;
  __pyx_pybuffer_blo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_blo_nd.refcount = 0;
  __pyx_pybuffernd_blo_nd.data = NULL;
  __pyx_pybuffernd_blo_nd.rcbuffer = &__pyx_pybuffer_blo_nd;
  __pyx_pybuffer_bhi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_bhi_nd.refcount = 0;
  __pyx_pybuffernd_bhi_nd.data = NULL;
  __pyx_pybuffernd_bhi_nd.rcbuffer = &__pyx_pybuffer_bhi_nd;

  /* "miniga4py/ga.pyx":983
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef char trans_c
 *     if alo is None and ahi is None and blo is None and bhi is None:             # <<<<<<<<<<<<<<
 *         GA_Copy(g_a, g_b)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_alo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_ahi == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_blo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_bhi == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":984
 *     cdef char trans_c
 *     if alo is None and ahi is None and blo is None and bhi is None:
 *         GA_Copy(g_a, g_b)             # <<<<<<<<<<<<<<
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 */
    GA_Copy(__pyx_v_g_a, __pyx_v_g_b);

    /* "miniga4py/ga.pyx":983
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef char trans_c
 *     if alo is None and ahi is None and blo is None and bhi is None:             # <<<<<<<<<<<<<<
 *         GA_Copy(g_a, g_b)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "miniga4py/ga.pyx":986
 *         GA_Copy(g_a, g_b)
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)             # <<<<<<<<<<<<<<
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         if trans:
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_alo, __pyx_v_ahi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 986, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 986, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 986, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 986, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 986, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L9_unpacking_done;
      __pyx_L8_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 986, __pyx_L1_error)
      __pyx_L9_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 986, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 986, __pyx_L1_error)
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_alo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_alo_nd.diminfo[0].strides = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alo_nd.diminfo[0].shape = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 986, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_alo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ahi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_ahi_nd.diminfo[0].strides = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ahi_nd.diminfo[0].shape = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 986, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_ahi_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":987
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)             # <<<<<<<<<<<<<<
 *         if trans:
 *             trans_c = "T"
 */
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_b, __pyx_v_blo, __pyx_v_bhi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 987, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 987, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 987, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 987, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 987, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 987, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L11_unpacking_done;
      __pyx_L10_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 987, __pyx_L1_error)
      __pyx_L11_unpacking_done:;
    }
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 987, __pyx_L1_error)
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 987, __pyx_L1_error)
    __pyx_t_14 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_blo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_blo_nd.diminfo[0].strides = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_blo_nd.diminfo[0].shape = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 987, __pyx_L1_error)
    }
    __pyx_t_14 = 0;
    __pyx_v_blo_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_14 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_bhi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_bhi_nd.diminfo[0].strides = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bhi_nd.diminfo[0].shape = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 987, __pyx_L1_error)
    }
    __pyx_t_14 = 0;
    __pyx_v_bhi_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "miniga4py/ga.pyx":988
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         if trans:             # <<<<<<<<<<<<<<
 *             trans_c = "T"
 *         else:
 */
    __pyx_t_1 = (__pyx_v_trans != 0);
    if (__pyx_t_1) {

      /* "miniga4py/ga.pyx":989
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         if trans:
 *             trans_c = "T"             # <<<<<<<<<<<<<<
 *         else:
 *             trans_c = "N"
 */
      __pyx_v_trans_c = 'T';

      /* "miniga4py/ga.pyx":988
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         if trans:             # <<<<<<<<<<<<<<
 *             trans_c = "T"
 *         else:
 */
      goto __pyx_L12;
    }

    /* "miniga4py/ga.pyx":991
 *             trans_c = "T"
 *         else:
 *             trans_c = "N"             # <<<<<<<<<<<<<<
 *         NGA_Copy_patch64(trans_c,
 *                 g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    /*else*/ {
      __pyx_v_trans_c = 'N';
    }
    __pyx_L12:;

    /* "miniga4py/ga.pyx":992
 *         else:
 *             trans_c = "N"
 *         NGA_Copy_patch64(trans_c,             # <<<<<<<<<<<<<<
 *                 g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                 g_b, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 */
    NGA_Copy_patch64(__pyx_v_trans_c, __pyx_v_g_a, ((int64_t *)__pyx_v_alo_nd->data), ((int64_t *)__pyx_v_ahi_nd->data), __pyx_v_g_b, ((int64_t *)__pyx_v_blo_nd->data), ((int64_t *)__pyx_v_bhi_nd->data));
  }
  __pyx_L3:;

  /* "miniga4py/ga.pyx":949
 *     return False
 * 
 * def copy(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None,             # <<<<<<<<<<<<<<
 *         bint trans=False):
 *     """Copies elements from array g_a into array g_b.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_alo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_ahi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_blo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_bhi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":996
 *                 g_b, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 * 
 * def create(int gtype, dims, name="", chunk=None, int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Creates an n-dimensional array using the regular distribution model.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_63create(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_62create[] = "create(int gtype, dims, name='', chunk=None, int pgroup=-1)\nCreates an n-dimensional array using the regular distribution model.\n\n    The array can be distributed evenly or not. The control over the\n    distribution is accomplished by specifying chunk (block) size for all or\n    some of array dimensions. For example, for a 2-dimensional array, setting\n    chunk[0]=dim[0] gives distribution by vertical strips (chunk[0]*dims[0]);\n    setting chunk[1]=dim[1] gives distribution by horizontal strips\n    (chunk[1]*dims[1]). Actual chunks will be modified so that they are at\n    least the size of the minimum and each process has either zero or one\n    chunk. Specifying chunk[i] as <1 will cause that dimension to be\n    distributed evenly.\n\n    As a convenience, when chunk is omitted or None, the entire array is\n    distributed evenly.\n\n    :Parameters:\n        gtype : int\n            the type of the array\n        dims : 1D array-like of integers\n            shape of the array\n        name : string\n            the name of the array\n        chunk : 1D array-like of integers\n            see above\n        pgroup : int\n            create array only as part of this processor group\n\n    :returns: a non-zero array handle means the call was succesful.\n\n    This is a collective operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_63create = {"create", (PyCFunction)__pyx_pw_9miniga4py_2ga_63create, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_62create};
static PyObject *__pyx_pw_9miniga4py_2ga_63create(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_gtype;
  PyObject *__pyx_v_dims = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_chunk = 0;
  int __pyx_v_pgroup;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gtype,&__pyx_n_s_dims,&__pyx_n_s_name,&__pyx_n_s_chunk,&__pyx_n_s_pgroup,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = ((PyObject *)__pyx_kp_s__7);
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gtype)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dims)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("create", 0, 2, 5, 1); __PYX_ERR(0, 996, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chunk);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pgroup);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create") < 0)) __PYX_ERR(0, 996, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_gtype = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_gtype == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 996, __pyx_L3_error)
    __pyx_v_dims = values[1];
    __pyx_v_name = values[2];
    __pyx_v_chunk = values[3];
    if (values[4]) {
      __pyx_v_pgroup = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 996, __pyx_L3_error)
    } else {
      __pyx_v_pgroup = ((int)-1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 996, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_62create(__pyx_self, __pyx_v_gtype, __pyx_v_dims, __pyx_v_name, __pyx_v_chunk, __pyx_v_pgroup);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_62create(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_gtype, PyObject *__pyx_v_dims, PyObject *__pyx_v_name, PyObject *__pyx_v_chunk, int __pyx_v_pgroup) {
  PyArrayObject *__pyx_v_dims_nd = 0;
  PyArrayObject *__pyx_v_chunk_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_chunk_nd;
  __Pyx_Buffer __pyx_pybuffer_chunk_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dims_nd;
  __Pyx_Buffer __pyx_pybuffer_dims_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyArrayObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  char *__pyx_t_12;
  __Pyx_RefNannySetupContext("create", 0);
  __pyx_pybuffer_dims_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_dims_nd.refcount = 0;
  __pyx_pybuffernd_dims_nd.data = NULL;
  __pyx_pybuffernd_dims_nd.rcbuffer = &__pyx_pybuffer_dims_nd;
  __pyx_pybuffer_chunk_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_chunk_nd.refcount = 0;
  __pyx_pybuffernd_chunk_nd.data = NULL;
  __pyx_pybuffernd_chunk_nd.rcbuffer = &__pyx_pybuffer_chunk_nd;

  /* "miniga4py/ga.pyx":1029
 * 
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] dims_nd, chunk_nd=None             # <<<<<<<<<<<<<<
 *     dims_nd = _inta64(dims)
 *     if pgroup < 0:
 */
  __pyx_t_1 = ((PyArrayObject *)Py_None);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_chunk_nd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1029, __pyx_L1_error)
    } else {__pyx_pybuffernd_chunk_nd.diminfo[0].strides = __pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_chunk_nd.diminfo[0].shape = __pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_1 = 0;
  __Pyx_INCREF(Py_None);
  __pyx_v_chunk_nd = ((PyArrayObject *)Py_None);

  /* "miniga4py/ga.pyx":1030
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] dims_nd, chunk_nd=None
 *     dims_nd = _inta64(dims)             # <<<<<<<<<<<<<<
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_dims)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_dims_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      }
      __pyx_t_4 = __pyx_t_5 = __pyx_t_6 = 0;
    }
    __pyx_pybuffernd_dims_nd.diminfo[0].strides = __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dims_nd.diminfo[0].shape = __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1030, __pyx_L1_error)
  }
  __pyx_v_dims_nd = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "miniga4py/ga.pyx":1031
 *     cdef np.ndarray[np.int64_t, ndim=1] dims_nd, chunk_nd=None
 *     dims_nd = _inta64(dims)
 *     if pgroup < 0:             # <<<<<<<<<<<<<<
 *         pgroup = pgroup_get_default()
 *     if chunk:
 */
  __pyx_t_7 = ((__pyx_v_pgroup < 0) != 0);
  if (__pyx_t_7) {

    /* "miniga4py/ga.pyx":1032
 *     dims_nd = _inta64(dims)
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()             # <<<<<<<<<<<<<<
 *     if chunk:
 *         chunk_nd = _inta64(chunk)
 */
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_pgroup_get_default); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1032, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    if (__pyx_t_9) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1032, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1032, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1032, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_pgroup = __pyx_t_3;

    /* "miniga4py/ga.pyx":1031
 *     cdef np.ndarray[np.int64_t, ndim=1] dims_nd, chunk_nd=None
 *     dims_nd = _inta64(dims)
 *     if pgroup < 0:             # <<<<<<<<<<<<<<
 *         pgroup = pgroup_get_default()
 *     if chunk:
 */
  }

  /* "miniga4py/ga.pyx":1033
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()
 *     if chunk:             # <<<<<<<<<<<<<<
 *         chunk_nd = _inta64(chunk)
 *         return NGA_Create_config64(gtype, len(dims_nd), <int64_t*>dims_nd.data,
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_chunk); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1033, __pyx_L1_error)
  if (__pyx_t_7) {

    /* "miniga4py/ga.pyx":1034
 *         pgroup = pgroup_get_default()
 *     if chunk:
 *         chunk_nd = _inta64(chunk)             # <<<<<<<<<<<<<<
 *         return NGA_Create_config64(gtype, len(dims_nd), <int64_t*>dims_nd.data,
 *                 b(name), <int64_t*>chunk_nd.data, pgroup)
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_chunk)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1034, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer);
      __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_3 < 0)) {
        PyErr_Fetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_chunk_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_6, __pyx_t_5, __pyx_t_4);
        }
        __pyx_t_6 = __pyx_t_5 = __pyx_t_4 = 0;
      }
      __pyx_pybuffernd_chunk_nd.diminfo[0].strides = __pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_chunk_nd.diminfo[0].shape = __pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1034, __pyx_L1_error)
    }
    __Pyx_DECREF_SET(__pyx_v_chunk_nd, ((PyArrayObject *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "miniga4py/ga.pyx":1035
 *     if chunk:
 *         chunk_nd = _inta64(chunk)
 *         return NGA_Create_config64(gtype, len(dims_nd), <int64_t*>dims_nd.data,             # <<<<<<<<<<<<<<
 *                 b(name), <int64_t*>chunk_nd.data, pgroup)
 *     else:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_10 = PyObject_Length(((PyObject *)__pyx_v_dims_nd)); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1035, __pyx_L1_error)

    /* "miniga4py/ga.pyx":1036
 *         chunk_nd = _inta64(chunk)
 *         return NGA_Create_config64(gtype, len(dims_nd), <int64_t*>dims_nd.data,
 *                 b(name), <int64_t*>chunk_nd.data, pgroup)             # <<<<<<<<<<<<<<
 *     else:
 *         return NGA_Create_config64(gtype, len(dims_nd), <int64_t*>dims_nd.data,
 */
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    if (!__pyx_t_9) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1036, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_8)) {
        PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_name};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1036, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
        PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_name};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1036, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1036, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
        __Pyx_INCREF(__pyx_v_name);
        __Pyx_GIVEREF(__pyx_v_name);
        PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_v_name);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1036, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_12 = __Pyx_PyObject_AsWritableString(__pyx_t_2); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 1036, __pyx_L1_error)

    /* "miniga4py/ga.pyx":1035
 *     if chunk:
 *         chunk_nd = _inta64(chunk)
 *         return NGA_Create_config64(gtype, len(dims_nd), <int64_t*>dims_nd.data,             # <<<<<<<<<<<<<<
 *                 b(name), <int64_t*>chunk_nd.data, pgroup)
 *     else:
 */
    __pyx_t_8 = __Pyx_PyInt_From_int(NGA_Create_config64(__pyx_v_gtype, __pyx_t_10, ((int64_t *)__pyx_v_dims_nd->data), __pyx_t_12, ((int64_t *)__pyx_v_chunk_nd->data), __pyx_v_pgroup)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1035, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":1033
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()
 *     if chunk:             # <<<<<<<<<<<<<<
 *         chunk_nd = _inta64(chunk)
 *         return NGA_Create_config64(gtype, len(dims_nd), <int64_t*>dims_nd.data,
 */
  }

  /* "miniga4py/ga.pyx":1038
 *                 b(name), <int64_t*>chunk_nd.data, pgroup)
 *     else:
 *         return NGA_Create_config64(gtype, len(dims_nd), <int64_t*>dims_nd.data,             # <<<<<<<<<<<<<<
 *                 b(name), NULL, pgroup)
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_10 = PyObject_Length(((PyObject *)__pyx_v_dims_nd)); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1038, __pyx_L1_error)

    /* "miniga4py/ga.pyx":1039
 *     else:
 *         return NGA_Create_config64(gtype, len(dims_nd), <int64_t*>dims_nd.data,
 *                 b(name), NULL, pgroup)             # <<<<<<<<<<<<<<
 * 
 * def create_ghosts(int gtype, dims, width, name="", chunk=None,
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_11) {
      __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1039, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_v_name};
        __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1039, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_v_name};
        __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1039, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1039, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_11); __pyx_t_11 = NULL;
        __Pyx_INCREF(__pyx_v_name);
        __Pyx_GIVEREF(__pyx_v_name);
        PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_name);
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1039, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_12 = __Pyx_PyObject_AsWritableString(__pyx_t_8); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 1039, __pyx_L1_error)

    /* "miniga4py/ga.pyx":1038
 *                 b(name), <int64_t*>chunk_nd.data, pgroup)
 *     else:
 *         return NGA_Create_config64(gtype, len(dims_nd), <int64_t*>dims_nd.data,             # <<<<<<<<<<<<<<
 *                 b(name), NULL, pgroup)
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_int(NGA_Create_config64(__pyx_v_gtype, __pyx_t_10, ((int64_t *)__pyx_v_dims_nd->data), __pyx_t_12, NULL, __pyx_v_pgroup)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1038, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "miniga4py/ga.pyx":996
 *                 g_b, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 * 
 * def create(int gtype, dims, name="", chunk=None, int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Creates an n-dimensional array using the regular distribution model.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dims_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_chunk_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1041
 *                 b(name), NULL, pgroup)
 * 
 * def create_ghosts(int gtype, dims, width, name="", chunk=None,             # <<<<<<<<<<<<<<
 *         int pgroup=-1):
 *     """Creates an array with a layer of ghost cells around the visible data.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_65create_ghosts(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_64create_ghosts[] = "create_ghosts(int gtype, dims, width, name='', chunk=None, int pgroup=-1)\nCreates an array with a layer of ghost cells around the visible data.\n\n    The array can be distributed evenly or not evenly. The control over the\n    distribution is accomplished by specifying chunk (block) size for all or\n    some of the array dimensions. For example, for a 2-dimensional array,\n    setting chunk(1)=dim(1) gives distribution by vertical strips\n    (chunk(1)*dims(1)); setting chunk(2)=dim(2) gives distribution by\n    horizontal strips (chunk(2)*dims(2)). Actual chunks will be modified so\n    that they are at least the size of the minimum and each process has either\n    zero or one chunk. Specifying chunk(i) as <1 will cause that dimension\n    (i-th) to be distributed evenly. The  width of the ghost cell layer in\n    each dimension is specified using the array width().  The local data of\n    the global array residing on each processor will have a layer width[n]\n    ghosts cells wide on either side of the visible data along the dimension\n    n.\n\n    :Parameters:\n        gtype : int\n            the type of the array\n        dims : 1D array-like of integers\n            shape of the array\n        width : 1D array-like of integers\n            ghost cell widths\n        name : string\n            the name of the array\n        chunk : 1D array-like of integers\n            see above\n        pgroup : int\n            create array only as part of this processor group\n\n    :returns: a non-zero array handle means the call was successful.\n\n    This is a collective operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_65create_ghosts = {"create_ghosts", (PyCFunction)__pyx_pw_9miniga4py_2ga_65create_ghosts, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_64create_ghosts};
static PyObject *__pyx_pw_9miniga4py_2ga_65create_ghosts(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_gtype;
  PyObject *__pyx_v_dims = 0;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_chunk = 0;
  int __pyx_v_pgroup;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create_ghosts (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gtype,&__pyx_n_s_dims,&__pyx_n_s_width,&__pyx_n_s_name,&__pyx_n_s_chunk,&__pyx_n_s_pgroup,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[3] = ((PyObject *)__pyx_kp_s__7);
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gtype)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dims)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("create_ghosts", 0, 3, 6, 1); __PYX_ERR(0, 1041, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("create_ghosts", 0, 3, 6, 2); __PYX_ERR(0, 1041, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chunk);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pgroup);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create_ghosts") < 0)) __PYX_ERR(0, 1041, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_gtype = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_gtype == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1041, __pyx_L3_error)
    __pyx_v_dims = values[1];
    __pyx_v_width = values[2];
    __pyx_v_name = values[3];
    __pyx_v_chunk = values[4];
    if (values[5]) {
      __pyx_v_pgroup = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1042, __pyx_L3_error)
    } else {
      __pyx_v_pgroup = ((int)-1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create_ghosts", 0, 3, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1041, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.create_ghosts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_64create_ghosts(__pyx_self, __pyx_v_gtype, __pyx_v_dims, __pyx_v_width, __pyx_v_name, __pyx_v_chunk, __pyx_v_pgroup);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_64create_ghosts(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_gtype, PyObject *__pyx_v_dims, PyObject *__pyx_v_width, PyObject *__pyx_v_name, PyObject *__pyx_v_chunk, int __pyx_v_pgroup) {
  PyArrayObject *__pyx_v_dims_nd = 0;
  PyArrayObject *__pyx_v_chunk_nd = 0;
  PyArrayObject *__pyx_v_width_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_chunk_nd;
  __Pyx_Buffer __pyx_pybuffer_chunk_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dims_nd;
  __Pyx_Buffer __pyx_pybuffer_dims_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_width_nd;
  __Pyx_Buffer __pyx_pybuffer_width_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  char *__pyx_t_11;
  __Pyx_RefNannySetupContext("create_ghosts", 0);
  __pyx_pybuffer_dims_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_dims_nd.refcount = 0;
  __pyx_pybuffernd_dims_nd.data = NULL;
  __pyx_pybuffernd_dims_nd.rcbuffer = &__pyx_pybuffer_dims_nd;
  __pyx_pybuffer_chunk_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_chunk_nd.refcount = 0;
  __pyx_pybuffernd_chunk_nd.data = NULL;
  __pyx_pybuffernd_chunk_nd.rcbuffer = &__pyx_pybuffer_chunk_nd;
  __pyx_pybuffer_width_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_width_nd.refcount = 0;
  __pyx_pybuffernd_width_nd.data = NULL;
  __pyx_pybuffernd_width_nd.rcbuffer = &__pyx_pybuffer_width_nd;

  /* "miniga4py/ga.pyx":1079
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] dims_nd, chunk_nd, width_nd
 *     dims_nd = _inta64(dims)             # <<<<<<<<<<<<<<
 *     width_nd = _inta64(width)
 *     if pgroup < 0:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_dims)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_dims_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      }
      __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
    }
    __pyx_pybuffernd_dims_nd.diminfo[0].strides = __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dims_nd.diminfo[0].shape = __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1079, __pyx_L1_error)
  }
  __pyx_v_dims_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":1080
 *     cdef np.ndarray[np.int64_t, ndim=1] dims_nd, chunk_nd, width_nd
 *     dims_nd = _inta64(dims)
 *     width_nd = _inta64(width)             # <<<<<<<<<<<<<<
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_width)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_width_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_width_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_width_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_width_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_5, __pyx_t_4, __pyx_t_3);
      }
      __pyx_t_5 = __pyx_t_4 = __pyx_t_3 = 0;
    }
    __pyx_pybuffernd_width_nd.diminfo[0].strides = __pyx_pybuffernd_width_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_width_nd.diminfo[0].shape = __pyx_pybuffernd_width_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1080, __pyx_L1_error)
  }
  __pyx_v_width_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":1081
 *     dims_nd = _inta64(dims)
 *     width_nd = _inta64(width)
 *     if pgroup < 0:             # <<<<<<<<<<<<<<
 *         pgroup = pgroup_get_default()
 *     if chunk:
 */
  __pyx_t_6 = ((__pyx_v_pgroup < 0) != 0);
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":1082
 *     width_nd = _inta64(width)
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()             # <<<<<<<<<<<<<<
 *     if chunk:
 *         chunk_nd = _inta64(chunk)
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pgroup_get_default); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1082, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (__pyx_t_8) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1082, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1082, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1082, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_pgroup = __pyx_t_2;

    /* "miniga4py/ga.pyx":1081
 *     dims_nd = _inta64(dims)
 *     width_nd = _inta64(width)
 *     if pgroup < 0:             # <<<<<<<<<<<<<<
 *         pgroup = pgroup_get_default()
 *     if chunk:
 */
  }

  /* "miniga4py/ga.pyx":1083
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()
 *     if chunk:             # <<<<<<<<<<<<<<
 *         chunk_nd = _inta64(chunk)
 *         return NGA_Create_ghosts_config64(gtype, len(dims_nd),
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_chunk); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1083, __pyx_L1_error)
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":1084
 *         pgroup = pgroup_get_default()
 *     if chunk:
 *         chunk_nd = _inta64(chunk)             # <<<<<<<<<<<<<<
 *         return NGA_Create_ghosts_config64(gtype, len(dims_nd),
 *                 <int64_t*>dims_nd.data, <int64_t*>width_nd.data, b(name),
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_chunk)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1084, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer);
      __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_2 < 0)) {
        PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_chunk_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
        }
        __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
      }
      __pyx_pybuffernd_chunk_nd.diminfo[0].strides = __pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_chunk_nd.diminfo[0].shape = __pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1084, __pyx_L1_error)
    }
    __pyx_v_chunk_nd = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "miniga4py/ga.pyx":1085
 *     if chunk:
 *         chunk_nd = _inta64(chunk)
 *         return NGA_Create_ghosts_config64(gtype, len(dims_nd),             # <<<<<<<<<<<<<<
 *                 <int64_t*>dims_nd.data, <int64_t*>width_nd.data, b(name),
 *                 <int64_t*>chunk_nd.data, pgroup)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_9 = PyObject_Length(((PyObject *)__pyx_v_dims_nd)); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1085, __pyx_L1_error)

    /* "miniga4py/ga.pyx":1086
 *         chunk_nd = _inta64(chunk)
 *         return NGA_Create_ghosts_config64(gtype, len(dims_nd),
 *                 <int64_t*>dims_nd.data, <int64_t*>width_nd.data, b(name),             # <<<<<<<<<<<<<<
 *                 <int64_t*>chunk_nd.data, pgroup)
 *     else:
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1086, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1086, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_name};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1086, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_name};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1086, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1086, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
        __Pyx_INCREF(__pyx_v_name);
        __Pyx_GIVEREF(__pyx_v_name);
        PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_name);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1086, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_11 = __Pyx_PyObject_AsWritableString(__pyx_t_1); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 1086, __pyx_L1_error)

    /* "miniga4py/ga.pyx":1085
 *     if chunk:
 *         chunk_nd = _inta64(chunk)
 *         return NGA_Create_ghosts_config64(gtype, len(dims_nd),             # <<<<<<<<<<<<<<
 *                 <int64_t*>dims_nd.data, <int64_t*>width_nd.data, b(name),
 *                 <int64_t*>chunk_nd.data, pgroup)
 */
    __pyx_t_7 = __Pyx_PyInt_From_int(NGA_Create_ghosts_config64(__pyx_v_gtype, __pyx_t_9, ((int64_t *)__pyx_v_dims_nd->data), ((int64_t *)__pyx_v_width_nd->data), __pyx_t_11, ((int64_t *)__pyx_v_chunk_nd->data), __pyx_v_pgroup)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1085, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":1083
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()
 *     if chunk:             # <<<<<<<<<<<<<<
 *         chunk_nd = _inta64(chunk)
 *         return NGA_Create_ghosts_config64(gtype, len(dims_nd),
 */
  }

  /* "miniga4py/ga.pyx":1089
 *                 <int64_t*>chunk_nd.data, pgroup)
 *     else:
 *         return NGA_Create_ghosts_config64(gtype, len(dims_nd),             # <<<<<<<<<<<<<<
 *                 <int64_t*>dims_nd.data, <int64_t*>width_nd.data, b(name),
 *                 NULL, pgroup)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_9 = PyObject_Length(((PyObject *)__pyx_v_dims_nd)); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1089, __pyx_L1_error)

    /* "miniga4py/ga.pyx":1090
 *     else:
 *         return NGA_Create_ghosts_config64(gtype, len(dims_nd),
 *                 <int64_t*>dims_nd.data, <int64_t*>width_nd.data, b(name),             # <<<<<<<<<<<<<<
 *                 NULL, pgroup)
 * 
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_10) {
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1090, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_name};
        __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1090, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_name};
        __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1090, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1090, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10); __pyx_t_10 = NULL;
        __Pyx_INCREF(__pyx_v_name);
        __Pyx_GIVEREF(__pyx_v_name);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_name);
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1090, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_11 = __Pyx_PyObject_AsWritableString(__pyx_t_7); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L1_error)

    /* "miniga4py/ga.pyx":1089
 *                 <int64_t*>chunk_nd.data, pgroup)
 *     else:
 *         return NGA_Create_ghosts_config64(gtype, len(dims_nd),             # <<<<<<<<<<<<<<
 *                 <int64_t*>dims_nd.data, <int64_t*>width_nd.data, b(name),
 *                 NULL, pgroup)
 */
    __pyx_t_1 = __Pyx_PyInt_From_int(NGA_Create_ghosts_config64(__pyx_v_gtype, __pyx_t_9, ((int64_t *)__pyx_v_dims_nd->data), ((int64_t *)__pyx_v_width_nd->data), __pyx_t_11, NULL, __pyx_v_pgroup)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1089, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "miniga4py/ga.pyx":1041
 *                 b(name), NULL, pgroup)
 * 
 * def create_ghosts(int gtype, dims, width, name="", chunk=None,             # <<<<<<<<<<<<<<
 *         int pgroup=-1):
 *     """Creates an array with a layer of ghost cells around the visible data.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_width_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.create_ghosts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_width_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dims_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_chunk_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_width_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1093
 *                 NULL, pgroup)
 * 
 * def create_handle():             # <<<<<<<<<<<<<<
 *     """Returns a global array handle that can be used to create a new array.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_67create_handle(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_66create_handle[] = "create_handle()\nReturns a global array handle that can be used to create a new array.\n    \n    The sequence of operations is to begin with a call to ga.create_handle to\n    get a new array handle. The attributes of the array, such as dimension,\n    size, type, etc. can then be set using successive calls to the ga.set_xxx\n    subroutines. When all array attributes have been set, the ga.allocate\n    subroutine is called and the global array is actually created and memory\n    for it is allocated.\n\n    This is a collective operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_67create_handle = {"create_handle", (PyCFunction)__pyx_pw_9miniga4py_2ga_67create_handle, METH_NOARGS, __pyx_doc_9miniga4py_2ga_66create_handle};
static PyObject *__pyx_pw_9miniga4py_2ga_67create_handle(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create_handle (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_66create_handle(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_66create_handle(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("create_handle", 0);

  /* "miniga4py/ga.pyx":1106
 * 
 *     """
 *     return GA_Create_handle()             # <<<<<<<<<<<<<<
 * 
 * def create_irreg(int gtype, dims, block, map, name="", int pgroup=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Create_handle()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":1093
 *                 NULL, pgroup)
 * 
 * def create_handle():             # <<<<<<<<<<<<<<
 *     """Returns a global array handle that can be used to create a new array.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.create_handle", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1108
 *     return GA_Create_handle()
 * 
 * def create_irreg(int gtype, dims, block, map, name="", int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Creates an array by following the user-specified distribution.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_69create_irreg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_68create_irreg[] = "create_irreg(int gtype, dims, block, map, name='', int pgroup=-1)\nCreates an array by following the user-specified distribution.\n\n    The distribution is specified as a Cartesian product of distributions for\n    each dimension. The array indices start at 0. For example, the following\n    figure demonstrates distribution of a 2-dimensional array 8x10 on 6 (or\n    more) processors. nblock[2]=[3,2], the size of map array is s=5 and array\n    map contains the following elements map=[0,2,6, 0, 5]. The distribution is\n    nonuniform because, P1 and P4 get 20 elements each and processors\n    P0,P2,P3, and P5 only 10 elements each.\n\n    This is a collective operation.\n\n    :Parameters:\n        gtype : int\n            the type of the array\n        dims : 1D array-like of integers\n            shape of the array\n        block : 1D array-like of integers\n            the number of blocks each dimension is divided into\n        map : 1D array-like of integers\n            starting index for each block\n            len(map) == sum of all elements of nblock array\n        name : string\n            the name of the array\n        pgroup : int\n            create array only as part of this processor group\n    \n    :returns: integer handle representing the array; a non-zero value indicates success\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_69create_irreg = {"create_irreg", (PyCFunction)__pyx_pw_9miniga4py_2ga_69create_irreg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_68create_irreg};
static PyObject *__pyx_pw_9miniga4py_2ga_69create_irreg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_gtype;
  PyObject *__pyx_v_dims = 0;
  PyObject *__pyx_v_block = 0;
  PyObject *__pyx_v_map = 0;
  PyObject *__pyx_v_name = 0;
  int __pyx_v_pgroup;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create_irreg (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gtype,&__pyx_n_s_dims,&__pyx_n_s_block,&__pyx_n_s_map,&__pyx_n_s_name,&__pyx_n_s_pgroup,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[4] = ((PyObject *)__pyx_kp_s__7);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gtype)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dims)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("create_irreg", 0, 4, 6, 1); __PYX_ERR(0, 1108, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_block)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("create_irreg", 0, 4, 6, 2); __PYX_ERR(0, 1108, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_map)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("create_irreg", 0, 4, 6, 3); __PYX_ERR(0, 1108, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pgroup);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create_irreg") < 0)) __PYX_ERR(0, 1108, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_gtype = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_gtype == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1108, __pyx_L3_error)
    __pyx_v_dims = values[1];
    __pyx_v_block = values[2];
    __pyx_v_map = values[3];
    __pyx_v_name = values[4];
    if (values[5]) {
      __pyx_v_pgroup = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1108, __pyx_L3_error)
    } else {
      __pyx_v_pgroup = ((int)-1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create_irreg", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1108, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.create_irreg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_68create_irreg(__pyx_self, __pyx_v_gtype, __pyx_v_dims, __pyx_v_block, __pyx_v_map, __pyx_v_name, __pyx_v_pgroup);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_68create_irreg(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_gtype, PyObject *__pyx_v_dims, PyObject *__pyx_v_block, PyObject *__pyx_v_map, PyObject *__pyx_v_name, int __pyx_v_pgroup) {
  PyArrayObject *__pyx_v_dims_nd = 0;
  PyArrayObject *__pyx_v_block_nd = 0;
  PyArrayObject *__pyx_v_map_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_block_nd;
  __Pyx_Buffer __pyx_pybuffer_block_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dims_nd;
  __Pyx_Buffer __pyx_pybuffer_dims_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_map_nd;
  __Pyx_Buffer __pyx_pybuffer_map_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  char *__pyx_t_11;
  __Pyx_RefNannySetupContext("create_irreg", 0);
  __pyx_pybuffer_dims_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_dims_nd.refcount = 0;
  __pyx_pybuffernd_dims_nd.data = NULL;
  __pyx_pybuffernd_dims_nd.rcbuffer = &__pyx_pybuffer_dims_nd;
  __pyx_pybuffer_block_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_block_nd.refcount = 0;
  __pyx_pybuffernd_block_nd.data = NULL;
  __pyx_pybuffernd_block_nd.rcbuffer = &__pyx_pybuffer_block_nd;
  __pyx_pybuffer_map_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_map_nd.refcount = 0;
  __pyx_pybuffernd_map_nd.data = NULL;
  __pyx_pybuffernd_map_nd.rcbuffer = &__pyx_pybuffer_map_nd;

  /* "miniga4py/ga.pyx":1140
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] dims_nd, block_nd, map_nd
 *     dims_nd = _inta64(dims)             # <<<<<<<<<<<<<<
 *     block_nd = _inta64(block)
 *     map_nd = _inta64(map)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_dims)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_dims_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      }
      __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
    }
    __pyx_pybuffernd_dims_nd.diminfo[0].strides = __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dims_nd.diminfo[0].shape = __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1140, __pyx_L1_error)
  }
  __pyx_v_dims_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":1141
 *     cdef np.ndarray[np.int64_t, ndim=1] dims_nd, block_nd, map_nd
 *     dims_nd = _inta64(dims)
 *     block_nd = _inta64(block)             # <<<<<<<<<<<<<<
 *     map_nd = _inta64(map)
 *     if pgroup < 0:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_block)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_block_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_block_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_block_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_block_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_5, __pyx_t_4, __pyx_t_3);
      }
      __pyx_t_5 = __pyx_t_4 = __pyx_t_3 = 0;
    }
    __pyx_pybuffernd_block_nd.diminfo[0].strides = __pyx_pybuffernd_block_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_block_nd.diminfo[0].shape = __pyx_pybuffernd_block_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1141, __pyx_L1_error)
  }
  __pyx_v_block_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":1142
 *     dims_nd = _inta64(dims)
 *     block_nd = _inta64(block)
 *     map_nd = _inta64(map)             # <<<<<<<<<<<<<<
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_map)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_map_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_map_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_map_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      }
      __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
    }
    __pyx_pybuffernd_map_nd.diminfo[0].strides = __pyx_pybuffernd_map_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_map_nd.diminfo[0].shape = __pyx_pybuffernd_map_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1142, __pyx_L1_error)
  }
  __pyx_v_map_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":1143
 *     block_nd = _inta64(block)
 *     map_nd = _inta64(map)
 *     if pgroup < 0:             # <<<<<<<<<<<<<<
 *         pgroup = pgroup_get_default()
 *     return NGA_Create_irreg_config64(gtype, len(dims_nd),
 */
  __pyx_t_6 = ((__pyx_v_pgroup < 0) != 0);
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":1144
 *     map_nd = _inta64(map)
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()             # <<<<<<<<<<<<<<
 *     return NGA_Create_irreg_config64(gtype, len(dims_nd),
 *             <int64_t*>dims_nd.data, b(name),
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pgroup_get_default); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (__pyx_t_8) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1144, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1144, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1144, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_pgroup = __pyx_t_2;

    /* "miniga4py/ga.pyx":1143
 *     block_nd = _inta64(block)
 *     map_nd = _inta64(map)
 *     if pgroup < 0:             # <<<<<<<<<<<<<<
 *         pgroup = pgroup_get_default()
 *     return NGA_Create_irreg_config64(gtype, len(dims_nd),
 */
  }

  /* "miniga4py/ga.pyx":1145
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()
 *     return NGA_Create_irreg_config64(gtype, len(dims_nd),             # <<<<<<<<<<<<<<
 *             <int64_t*>dims_nd.data, b(name),
 *             <int64_t*>block_nd.data, <int64_t*>map_nd.data, pgroup)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_9 = PyObject_Length(((PyObject *)__pyx_v_dims_nd)); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1145, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1146
 *         pgroup = pgroup_get_default()
 *     return NGA_Create_irreg_config64(gtype, len(dims_nd),
 *             <int64_t*>dims_nd.data, b(name),             # <<<<<<<<<<<<<<
 *             <int64_t*>block_nd.data, <int64_t*>map_nd.data, pgroup)
 * 
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (!__pyx_t_8) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_name};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1146, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_name};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1146, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1146, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
      __Pyx_INCREF(__pyx_v_name);
      __Pyx_GIVEREF(__pyx_v_name);
      PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_name);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1146, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_11 = __Pyx_PyObject_AsWritableString(__pyx_t_1); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 1146, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1145
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()
 *     return NGA_Create_irreg_config64(gtype, len(dims_nd),             # <<<<<<<<<<<<<<
 *             <int64_t*>dims_nd.data, b(name),
 *             <int64_t*>block_nd.data, <int64_t*>map_nd.data, pgroup)
 */
  __pyx_t_7 = __Pyx_PyInt_From_int(NGA_Create_irreg_config64(__pyx_v_gtype, __pyx_t_9, ((int64_t *)__pyx_v_dims_nd->data), __pyx_t_11, ((int64_t *)__pyx_v_block_nd->data), ((int64_t *)__pyx_v_map_nd->data), __pyx_v_pgroup)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":1108
 *     return GA_Create_handle()
 * 
 * def create_irreg(int gtype, dims, block, map, name="", int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Creates an array by following the user-specified distribution.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_block_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.create_irreg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_block_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dims_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_block_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_map_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1149
 *             <int64_t*>block_nd.data, <int64_t*>map_nd.data, pgroup)
 * 
 * def create_ghosts_irreg(int gtype, dims, width, block, map, name="",             # <<<<<<<<<<<<<<
 *         int pgroup=-1):
 *     """Creates an array with a layer of ghost cells around the visible data.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_71create_ghosts_irreg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_70create_ghosts_irreg[] = "create_ghosts_irreg(int gtype, dims, width, block, map, name='', int pgroup=-1)\nCreates an array with a layer of ghost cells around the visible data.\n\n    The distribution is specified as a Cartesian product of distributions for\n    each dimension. For example, the following figure demonstrates\n    distribution of a 2-dimensional array 8x10 on 6 (or more) processors.\n    nblock(2)=[3,2], the size of map array is s=5 and array map contains the\n    following elements map=[1,3,7, 1, 6]. The distribution is nonuniform\n    because, P1 and P4 get 20 elements each and processors P0,P2,P3, and P5\n    only 10 elements each. \n\n    The array width[] is used to control the width of the ghost cell boundary\n    around the visible data on each processor. The local data of the global\n    array residing on each processor will have a layer width[n] ghosts cells\n    wide on either side of the visible data along the dimension n.\n\n    This is a collective operation. \n\n    :Parameters:\n        gtype : int\n            the type of the array\n        dims : 1D array-like of integers\n            shape of the array\n        width : 1D array-like of integers\n            ghost cell widths\n        block : 1D array-like of integers\n            number of blocks each dimension is divided into\n        map : 1D array-like of integers\n            starting index for each block\n            len(map) == sum of all elements of nblock array\n        name : string\n            the name of the array\n        pgroup : int\n            create array only as part of this processor group\n    \n    :returns: a non-zero array handle means the call was succesful\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_71create_ghosts_irreg = {"create_ghosts_irreg", (PyCFunction)__pyx_pw_9miniga4py_2ga_71create_ghosts_irreg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_70create_ghosts_irreg};
static PyObject *__pyx_pw_9miniga4py_2ga_71create_ghosts_irreg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_gtype;
  PyObject *__pyx_v_dims = 0;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_v_block = 0;
  PyObject *__pyx_v_map = 0;
  PyObject *__pyx_v_name = 0;
  int __pyx_v_pgroup;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create_ghosts_irreg (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gtype,&__pyx_n_s_dims,&__pyx_n_s_width,&__pyx_n_s_block,&__pyx_n_s_map,&__pyx_n_s_name,&__pyx_n_s_pgroup,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[5] = ((PyObject *)__pyx_kp_s__7);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gtype)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dims)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("create_ghosts_irreg", 0, 5, 7, 1); __PYX_ERR(0, 1149, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("create_ghosts_irreg", 0, 5, 7, 2); __PYX_ERR(0, 1149, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_block)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("create_ghosts_irreg", 0, 5, 7, 3); __PYX_ERR(0, 1149, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_map)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("create_ghosts_irreg", 0, 5, 7, 4); __PYX_ERR(0, 1149, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pgroup);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create_ghosts_irreg") < 0)) __PYX_ERR(0, 1149, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_gtype = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_gtype == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1149, __pyx_L3_error)
    __pyx_v_dims = values[1];
    __pyx_v_width = values[2];
    __pyx_v_block = values[3];
    __pyx_v_map = values[4];
    __pyx_v_name = values[5];
    if (values[6]) {
      __pyx_v_pgroup = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1150, __pyx_L3_error)
    } else {
      __pyx_v_pgroup = ((int)-1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create_ghosts_irreg", 0, 5, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1149, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.create_ghosts_irreg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_70create_ghosts_irreg(__pyx_self, __pyx_v_gtype, __pyx_v_dims, __pyx_v_width, __pyx_v_block, __pyx_v_map, __pyx_v_name, __pyx_v_pgroup);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_70create_ghosts_irreg(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_gtype, PyObject *__pyx_v_dims, PyObject *__pyx_v_width, PyObject *__pyx_v_block, PyObject *__pyx_v_map, PyObject *__pyx_v_name, int __pyx_v_pgroup) {
  PyArrayObject *__pyx_v_dims_nd = 0;
  PyArrayObject *__pyx_v_width_nd = 0;
  PyArrayObject *__pyx_v_block_nd = 0;
  PyArrayObject *__pyx_v_map_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_block_nd;
  __Pyx_Buffer __pyx_pybuffer_block_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dims_nd;
  __Pyx_Buffer __pyx_pybuffer_dims_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_map_nd;
  __Pyx_Buffer __pyx_pybuffer_map_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_width_nd;
  __Pyx_Buffer __pyx_pybuffer_width_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  char *__pyx_t_11;
  __Pyx_RefNannySetupContext("create_ghosts_irreg", 0);
  __pyx_pybuffer_dims_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_dims_nd.refcount = 0;
  __pyx_pybuffernd_dims_nd.data = NULL;
  __pyx_pybuffernd_dims_nd.rcbuffer = &__pyx_pybuffer_dims_nd;
  __pyx_pybuffer_width_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_width_nd.refcount = 0;
  __pyx_pybuffernd_width_nd.data = NULL;
  __pyx_pybuffernd_width_nd.rcbuffer = &__pyx_pybuffer_width_nd;
  __pyx_pybuffer_block_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_block_nd.refcount = 0;
  __pyx_pybuffernd_block_nd.data = NULL;
  __pyx_pybuffernd_block_nd.rcbuffer = &__pyx_pybuffer_block_nd;
  __pyx_pybuffer_map_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_map_nd.refcount = 0;
  __pyx_pybuffernd_map_nd.data = NULL;
  __pyx_pybuffernd_map_nd.rcbuffer = &__pyx_pybuffer_map_nd;

  /* "miniga4py/ga.pyx":1189
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] dims_nd, width_nd, block_nd, map_nd
 *     dims_nd = _inta64(dims)             # <<<<<<<<<<<<<<
 *     width_nd = _inta64(width)
 *     block_nd = _inta64(block)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_dims)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_dims_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      }
      __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
    }
    __pyx_pybuffernd_dims_nd.diminfo[0].strides = __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dims_nd.diminfo[0].shape = __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1189, __pyx_L1_error)
  }
  __pyx_v_dims_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":1190
 *     cdef np.ndarray[np.int64_t, ndim=1] dims_nd, width_nd, block_nd, map_nd
 *     dims_nd = _inta64(dims)
 *     width_nd = _inta64(width)             # <<<<<<<<<<<<<<
 *     block_nd = _inta64(block)
 *     map_nd = _inta64(map)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_width)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_width_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_width_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_width_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_width_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_5, __pyx_t_4, __pyx_t_3);
      }
      __pyx_t_5 = __pyx_t_4 = __pyx_t_3 = 0;
    }
    __pyx_pybuffernd_width_nd.diminfo[0].strides = __pyx_pybuffernd_width_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_width_nd.diminfo[0].shape = __pyx_pybuffernd_width_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1190, __pyx_L1_error)
  }
  __pyx_v_width_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":1191
 *     dims_nd = _inta64(dims)
 *     width_nd = _inta64(width)
 *     block_nd = _inta64(block)             # <<<<<<<<<<<<<<
 *     map_nd = _inta64(map)
 *     if pgroup < 0:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_block)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_block_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_block_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_block_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_block_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      }
      __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
    }
    __pyx_pybuffernd_block_nd.diminfo[0].strides = __pyx_pybuffernd_block_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_block_nd.diminfo[0].shape = __pyx_pybuffernd_block_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1191, __pyx_L1_error)
  }
  __pyx_v_block_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":1192
 *     width_nd = _inta64(width)
 *     block_nd = _inta64(block)
 *     map_nd = _inta64(map)             # <<<<<<<<<<<<<<
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_map)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_map_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_map_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_map_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_5, __pyx_t_4, __pyx_t_3);
      }
      __pyx_t_5 = __pyx_t_4 = __pyx_t_3 = 0;
    }
    __pyx_pybuffernd_map_nd.diminfo[0].strides = __pyx_pybuffernd_map_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_map_nd.diminfo[0].shape = __pyx_pybuffernd_map_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1192, __pyx_L1_error)
  }
  __pyx_v_map_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":1193
 *     block_nd = _inta64(block)
 *     map_nd = _inta64(map)
 *     if pgroup < 0:             # <<<<<<<<<<<<<<
 *         pgroup = pgroup_get_default()
 *     return NGA_Create_ghosts_irreg_config64(gtype, len(dims_nd),
 */
  __pyx_t_6 = ((__pyx_v_pgroup < 0) != 0);
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":1194
 *     map_nd = _inta64(map)
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()             # <<<<<<<<<<<<<<
 *     return NGA_Create_ghosts_irreg_config64(gtype, len(dims_nd),
 *             <int64_t*>dims_nd.data, <int64_t*>width_nd.data, b(name),
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pgroup_get_default); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1194, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (__pyx_t_8) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1194, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1194, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1194, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_pgroup = __pyx_t_2;

    /* "miniga4py/ga.pyx":1193
 *     block_nd = _inta64(block)
 *     map_nd = _inta64(map)
 *     if pgroup < 0:             # <<<<<<<<<<<<<<
 *         pgroup = pgroup_get_default()
 *     return NGA_Create_ghosts_irreg_config64(gtype, len(dims_nd),
 */
  }

  /* "miniga4py/ga.pyx":1195
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()
 *     return NGA_Create_ghosts_irreg_config64(gtype, len(dims_nd),             # <<<<<<<<<<<<<<
 *             <int64_t*>dims_nd.data, <int64_t*>width_nd.data, b(name),
 *             <int64_t*>block_nd.data, <int64_t*>map_nd.data, pgroup)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_9 = PyObject_Length(((PyObject *)__pyx_v_dims_nd)); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1195, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1196
 *         pgroup = pgroup_get_default()
 *     return NGA_Create_ghosts_irreg_config64(gtype, len(dims_nd),
 *             <int64_t*>dims_nd.data, <int64_t*>width_nd.data, b(name),             # <<<<<<<<<<<<<<
 *             <int64_t*>block_nd.data, <int64_t*>map_nd.data, pgroup)
 * 
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (!__pyx_t_8) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_name};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_name};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
      __Pyx_INCREF(__pyx_v_name);
      __Pyx_GIVEREF(__pyx_v_name);
      PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_name);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_11 = __Pyx_PyObject_AsWritableString(__pyx_t_1); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 1196, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1195
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()
 *     return NGA_Create_ghosts_irreg_config64(gtype, len(dims_nd),             # <<<<<<<<<<<<<<
 *             <int64_t*>dims_nd.data, <int64_t*>width_nd.data, b(name),
 *             <int64_t*>block_nd.data, <int64_t*>map_nd.data, pgroup)
 */
  __pyx_t_7 = __Pyx_PyInt_From_int(NGA_Create_ghosts_irreg_config64(__pyx_v_gtype, __pyx_t_9, ((int64_t *)__pyx_v_dims_nd->data), ((int64_t *)__pyx_v_width_nd->data), __pyx_t_11, ((int64_t *)__pyx_v_block_nd->data), ((int64_t *)__pyx_v_map_nd->data), __pyx_v_pgroup)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":1149
 *             <int64_t*>block_nd.data, <int64_t*>map_nd.data, pgroup)
 * 
 * def create_ghosts_irreg(int gtype, dims, width, block, map, name="",             # <<<<<<<<<<<<<<
 *         int pgroup=-1):
 *     """Creates an array with a layer of ghost cells around the visible data.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_block_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_width_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.create_ghosts_irreg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_block_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_width_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dims_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_width_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_block_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_map_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1199
 *             <int64_t*>block_nd.data, <int64_t*>map_nd.data, pgroup)
 * 
 * def create_mutexes(int number):             # <<<<<<<<<<<<<<
 *     """Creates a set containing the number of mutexes.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_73create_mutexes(PyObject *__pyx_self, PyObject *__pyx_arg_number); /*proto*/
static char __pyx_doc_9miniga4py_2ga_72create_mutexes[] = "create_mutexes(int number)\nCreates a set containing the number of mutexes.\n\n    Mutex is a simple synchronization object used to protect Critical\n    Sections. Only one set of mutexes can exist at a time. Array of mutexes\n    can be created and destroyed as many times as needed.\n\n    Mutexes are numbered: 0, ..., number -1.\n\n    This is a collective operation. \n\n    :Parameters:\n        number : int\n            the number of mutexes to create\n\n    :returns: True on success, False on failure\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_73create_mutexes = {"create_mutexes", (PyCFunction)__pyx_pw_9miniga4py_2ga_73create_mutexes, METH_O, __pyx_doc_9miniga4py_2ga_72create_mutexes};
static PyObject *__pyx_pw_9miniga4py_2ga_73create_mutexes(PyObject *__pyx_self, PyObject *__pyx_arg_number) {
  int __pyx_v_number;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create_mutexes (wrapper)", 0);
  assert(__pyx_arg_number); {
    __pyx_v_number = __Pyx_PyInt_As_int(__pyx_arg_number); if (unlikely((__pyx_v_number == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1199, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.create_mutexes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_72create_mutexes(__pyx_self, ((int)__pyx_v_number));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_72create_mutexes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_number) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("create_mutexes", 0);

  /* "miniga4py/ga.pyx":1217
 * 
 *     """
 *     if GA_Create_mutexes(number) == 1:             # <<<<<<<<<<<<<<
 *         return True
 *     return False
 */
  __pyx_t_1 = ((GA_Create_mutexes(__pyx_v_number) == 1) != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":1218
 *     """
 *     if GA_Create_mutexes(number) == 1:
 *         return True             # <<<<<<<<<<<<<<
 *     return False
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":1217
 * 
 *     """
 *     if GA_Create_mutexes(number) == 1:             # <<<<<<<<<<<<<<
 *         return True
 *     return False
 */
  }

  /* "miniga4py/ga.pyx":1219
 *     if GA_Create_mutexes(number) == 1:
 *         return True
 *     return False             # <<<<<<<<<<<<<<
 * 
 * def deregister_type(int type):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":1199
 *             <int64_t*>block_nd.data, <int64_t*>map_nd.data, pgroup)
 * 
 * def create_mutexes(int number):             # <<<<<<<<<<<<<<
 *     """Creates a set containing the number of mutexes.
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1221
 *     return False
 * 
 * def deregister_type(int type):             # <<<<<<<<<<<<<<
 *     """Removes the data type previously registered using register_type.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_75deregister_type(PyObject *__pyx_self, PyObject *__pyx_arg_type); /*proto*/
static char __pyx_doc_9miniga4py_2ga_74deregister_type[] = "deregister_type(int type)\nRemoves the data type previously registered using register_type.\n\n    :Parameters:\n        type : int\n            the data type handle\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_75deregister_type = {"deregister_type", (PyCFunction)__pyx_pw_9miniga4py_2ga_75deregister_type, METH_O, __pyx_doc_9miniga4py_2ga_74deregister_type};
static PyObject *__pyx_pw_9miniga4py_2ga_75deregister_type(PyObject *__pyx_self, PyObject *__pyx_arg_type) {
  int __pyx_v_type;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("deregister_type (wrapper)", 0);
  assert(__pyx_arg_type); {
    __pyx_v_type = __Pyx_PyInt_As_int(__pyx_arg_type); if (unlikely((__pyx_v_type == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1221, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.deregister_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_74deregister_type(__pyx_self, ((int)__pyx_v_type));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_74deregister_type(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_type) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("deregister_type", 0);

  /* "miniga4py/ga.pyx":1229
 * 
 *     """
 *     return NGA_Deregister_type(type)             # <<<<<<<<<<<<<<
 * 
 * def destroy(int g_a):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(NGA_Deregister_type(__pyx_v_type)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":1221
 *     return False
 * 
 * def deregister_type(int type):             # <<<<<<<<<<<<<<
 *     """Removes the data type previously registered using register_type.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.deregister_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1231
 *     return NGA_Deregister_type(type)
 * 
 * def destroy(int g_a):             # <<<<<<<<<<<<<<
 *     """Deallocates the array and frees any associated resources.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_77destroy(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_76destroy[] = "destroy(int g_a)\nDeallocates the array and frees any associated resources.\n\n    This is a collective operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_77destroy = {"destroy", (PyCFunction)__pyx_pw_9miniga4py_2ga_77destroy, METH_O, __pyx_doc_9miniga4py_2ga_76destroy};
static PyObject *__pyx_pw_9miniga4py_2ga_77destroy(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1231, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_76destroy(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_76destroy(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy", 0);

  /* "miniga4py/ga.pyx":1237
 * 
 *     """
 *     GA_Destroy(g_a)             # <<<<<<<<<<<<<<
 * 
 * def destroy_mutexes():
 */
  GA_Destroy(__pyx_v_g_a);

  /* "miniga4py/ga.pyx":1231
 *     return NGA_Deregister_type(type)
 * 
 * def destroy(int g_a):             # <<<<<<<<<<<<<<
 *     """Deallocates the array and frees any associated resources.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1239
 *     GA_Destroy(g_a)
 * 
 * def destroy_mutexes():             # <<<<<<<<<<<<<<
 *     """Destroys the set of mutexes created with ga_create_mutexes.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_79destroy_mutexes(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_78destroy_mutexes[] = "destroy_mutexes()\nDestroys the set of mutexes created with ga_create_mutexes.\n    \n    :returns: True if the operation succeeded; False when failed\n\n    This is a collective operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_79destroy_mutexes = {"destroy_mutexes", (PyCFunction)__pyx_pw_9miniga4py_2ga_79destroy_mutexes, METH_NOARGS, __pyx_doc_9miniga4py_2ga_78destroy_mutexes};
static PyObject *__pyx_pw_9miniga4py_2ga_79destroy_mutexes(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("destroy_mutexes (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_78destroy_mutexes(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_78destroy_mutexes(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("destroy_mutexes", 0);

  /* "miniga4py/ga.pyx":1247
 * 
 *     """
 *     if GA_Destroy_mutexes() == 1:             # <<<<<<<<<<<<<<
 *         return True
 *     return False
 */
  __pyx_t_1 = ((GA_Destroy_mutexes() == 1) != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":1248
 *     """
 *     if GA_Destroy_mutexes() == 1:
 *         return True             # <<<<<<<<<<<<<<
 *     return False
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":1247
 * 
 *     """
 *     if GA_Destroy_mutexes() == 1:             # <<<<<<<<<<<<<<
 *         return True
 *     return False
 */
  }

  /* "miniga4py/ga.pyx":1249
 *     if GA_Destroy_mutexes() == 1:
 *         return True
 *     return False             # <<<<<<<<<<<<<<
 * 
 * def diag(int g_a, int g_s, int g_v, evalues=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":1239
 *     GA_Destroy(g_a)
 * 
 * def destroy_mutexes():             # <<<<<<<<<<<<<<
 *     """Destroys the set of mutexes created with ga_create_mutexes.
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1251
 *     return False
 * 
 * def diag(int g_a, int g_s, int g_v, evalues=None):             # <<<<<<<<<<<<<<
 *     """Solve the generalized eigen-value problem.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_81diag(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_80diag[] = "diag(int g_a, int g_s, int g_v, evalues=None)\nSolve the generalized eigen-value problem.\n\n    The input matrices are not overwritten or destroyed.\n    \n    :Parameters:\n        g_a : int\n            the array handle of the matrix to diagonalize\n        g_s : int\n            the array handle of the metric\n        g_v : int\n            the array handle to return evecs\n\n    :returns: All eigen-values as an ndarray in ascending order.\n\n    This is a collective operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_81diag = {"diag", (PyCFunction)__pyx_pw_9miniga4py_2ga_81diag, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_80diag};
static PyObject *__pyx_pw_9miniga4py_2ga_81diag(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_s;
  int __pyx_v_g_v;
  PyObject *__pyx_v_evalues = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("diag (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_s,&__pyx_n_s_g_v,&__pyx_n_s_evalues,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_s)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("diag", 0, 3, 4, 1); __PYX_ERR(0, 1251, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("diag", 0, 3, 4, 2); __PYX_ERR(0, 1251, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evalues);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "diag") < 0)) __PYX_ERR(0, 1251, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1251, __pyx_L3_error)
    __pyx_v_g_s = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_s == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1251, __pyx_L3_error)
    __pyx_v_g_v = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_g_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1251, __pyx_L3_error)
    __pyx_v_evalues = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("diag", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1251, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.diag", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_80diag(__pyx_self, __pyx_v_g_a, __pyx_v_g_s, __pyx_v_g_v, __pyx_v_evalues);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_80diag(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_s, int __pyx_v_g_v, PyObject *__pyx_v_evalues) {
  PyObject *__pyx_v_gtype = NULL;
  PyObject *__pyx_v_dims = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("diag", 0);
  __Pyx_INCREF(__pyx_v_evalues);

  /* "miniga4py/ga.pyx":1269
 * 
 *     """
 *     if evalues is None:             # <<<<<<<<<<<<<<
 *         gtype,dims = inquire(g_a)
 *         evalues = np.ndarray((dims[0]), dtype=_to_dtype(gtype))
 */
  __pyx_t_1 = (__pyx_v_evalues == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "miniga4py/ga.pyx":1270
 *     """
 *     if evalues is None:
 *         gtype,dims = inquire(g_a)             # <<<<<<<<<<<<<<
 *         evalues = np.ndarray((dims[0]), dtype=_to_dtype(gtype))
 *     else:
 */
    __pyx_t_3 = __pyx_f_9miniga4py_2ga_inquire(__pyx_v_g_a, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1270, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1270, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1270, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1270, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1270, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 1270, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L5_unpacking_done;
      __pyx_L4_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1270, __pyx_L1_error)
      __pyx_L5_unpacking_done:;
    }
    __pyx_v_gtype = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_dims = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "miniga4py/ga.pyx":1271
 *     if evalues is None:
 *         gtype,dims = inquire(g_a)
 *         evalues = np.ndarray((dims[0]), dtype=_to_dtype(gtype))             # <<<<<<<<<<<<<<
 *     else:
 *         evalues = np.asarray(evalues)
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_dims, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_to_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_gtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1271, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_gtype};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1271, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_gtype};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1271, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1271, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
        __Pyx_INCREF(__pyx_v_gtype);
        __Pyx_GIVEREF(__pyx_v_gtype);
        PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_gtype);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1271, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 1271, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_ndarray), __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_evalues, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "miniga4py/ga.pyx":1269
 * 
 *     """
 *     if evalues is None:             # <<<<<<<<<<<<<<
 *         gtype,dims = inquire(g_a)
 *         evalues = np.ndarray((dims[0]), dtype=_to_dtype(gtype))
 */
    goto __pyx_L3;
  }

  /* "miniga4py/ga.pyx":1273
 *         evalues = np.ndarray((dims[0]), dtype=_to_dtype(gtype))
 *     else:
 *         evalues = np.asarray(evalues)             # <<<<<<<<<<<<<<
 *     GA_Diag(g_a, g_s, g_v, <void*>evalues.data)
 *     return evalues
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_evalues); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1273, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_evalues};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1273, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_evalues};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1273, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1273, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_v_evalues);
        __Pyx_GIVEREF(__pyx_v_evalues);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_evalues);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1273, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_evalues, __pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "miniga4py/ga.pyx":1274
 *     else:
 *         evalues = np.asarray(evalues)
 *     GA_Diag(g_a, g_s, g_v, <void*>evalues.data)             # <<<<<<<<<<<<<<
 *     return evalues
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_evalues, __pyx_n_s_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  GA_Diag(__pyx_v_g_a, __pyx_v_g_s, __pyx_v_g_v, ((void *)__pyx_t_4));
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "miniga4py/ga.pyx":1275
 *         evalues = np.asarray(evalues)
 *     GA_Diag(g_a, g_s, g_v, <void*>evalues.data)
 *     return evalues             # <<<<<<<<<<<<<<
 * 
 * def diag_reuse(int control, int g_a, int g_s, int g_v, evalues=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_evalues);
  __pyx_r = __pyx_v_evalues;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":1251
 *     return False
 * 
 * def diag(int g_a, int g_s, int g_v, evalues=None):             # <<<<<<<<<<<<<<
 *     """Solve the generalized eigen-value problem.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("miniga4py.ga.diag", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gtype);
  __Pyx_XDECREF(__pyx_v_dims);
  __Pyx_XDECREF(__pyx_v_evalues);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1277
 *     return evalues
 * 
 * def diag_reuse(int control, int g_a, int g_s, int g_v, evalues=None):             # <<<<<<<<<<<<<<
 *     """Solve the generalized eigen-value problem.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_83diag_reuse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_82diag_reuse[] = "diag_reuse(int control, int g_a, int g_s, int g_v, evalues=None)\nSolve the generalized eigen-value problem.\n\n    Recommended for REPEATED calls if g_s is unchanged.\n    The input matrices are not overwritten or destroyed.\n    \n    :Parameters:\n        control : int\n            0 indicates first call to the eigensolver;\n            >0 consecutive calls (reuses factored g_s);\n            <0 only erases factorized g_s; g_v and eval unchanged\n            (should be called after previous use if another\n            eigenproblem, i.e., different g_a and g_s, is to\n            be solved) \n        g_a : int\n            the array handle of the matrix to diagonalize\n        g_s : int\n            the array handle of the metric\n        g_v : int\n            the array handle to return evecs\n\n    :returns: All eigen-values as an ndarray in ascending order.\n\n    This is a collective operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_83diag_reuse = {"diag_reuse", (PyCFunction)__pyx_pw_9miniga4py_2ga_83diag_reuse, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_82diag_reuse};
static PyObject *__pyx_pw_9miniga4py_2ga_83diag_reuse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_control;
  int __pyx_v_g_a;
  int __pyx_v_g_s;
  int __pyx_v_g_v;
  PyObject *__pyx_v_evalues = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("diag_reuse (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_control,&__pyx_n_s_g_a,&__pyx_n_s_g_s,&__pyx_n_s_g_v,&__pyx_n_s_evalues,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_control)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("diag_reuse", 0, 4, 5, 1); __PYX_ERR(0, 1277, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_s)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("diag_reuse", 0, 4, 5, 2); __PYX_ERR(0, 1277, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("diag_reuse", 0, 4, 5, 3); __PYX_ERR(0, 1277, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evalues);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "diag_reuse") < 0)) __PYX_ERR(0, 1277, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_control = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_control == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1277, __pyx_L3_error)
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1277, __pyx_L3_error)
    __pyx_v_g_s = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_g_s == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1277, __pyx_L3_error)
    __pyx_v_g_v = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_g_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1277, __pyx_L3_error)
    __pyx_v_evalues = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("diag_reuse", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1277, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.diag_reuse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_82diag_reuse(__pyx_self, __pyx_v_control, __pyx_v_g_a, __pyx_v_g_s, __pyx_v_g_v, __pyx_v_evalues);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_82diag_reuse(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_control, int __pyx_v_g_a, int __pyx_v_g_s, int __pyx_v_g_v, PyObject *__pyx_v_evalues) {
  PyObject *__pyx_v_gtype = NULL;
  PyObject *__pyx_v_dims = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("diag_reuse", 0);
  __Pyx_INCREF(__pyx_v_evalues);

  /* "miniga4py/ga.pyx":1303
 * 
 *     """
 *     if evalues is None:             # <<<<<<<<<<<<<<
 *         gtype,dims = inquire(g_a)
 *         evalues = np.ndarray((dims[0]), dtype=_to_dtype(gtype))
 */
  __pyx_t_1 = (__pyx_v_evalues == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "miniga4py/ga.pyx":1304
 *     """
 *     if evalues is None:
 *         gtype,dims = inquire(g_a)             # <<<<<<<<<<<<<<
 *         evalues = np.ndarray((dims[0]), dtype=_to_dtype(gtype))
 *     else:
 */
    __pyx_t_3 = __pyx_f_9miniga4py_2ga_inquire(__pyx_v_g_a, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1304, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 1304, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L5_unpacking_done;
      __pyx_L4_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1304, __pyx_L1_error)
      __pyx_L5_unpacking_done:;
    }
    __pyx_v_gtype = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_dims = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "miniga4py/ga.pyx":1305
 *     if evalues is None:
 *         gtype,dims = inquire(g_a)
 *         evalues = np.ndarray((dims[0]), dtype=_to_dtype(gtype))             # <<<<<<<<<<<<<<
 *     else:
 *         evalues = np.asarray(evalues)
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_dims, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_to_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_gtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1305, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_gtype};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1305, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_gtype};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1305, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1305, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
        __Pyx_INCREF(__pyx_v_gtype);
        __Pyx_GIVEREF(__pyx_v_gtype);
        PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_gtype);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1305, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 1305, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_ndarray), __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_evalues, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "miniga4py/ga.pyx":1303
 * 
 *     """
 *     if evalues is None:             # <<<<<<<<<<<<<<
 *         gtype,dims = inquire(g_a)
 *         evalues = np.ndarray((dims[0]), dtype=_to_dtype(gtype))
 */
    goto __pyx_L3;
  }

  /* "miniga4py/ga.pyx":1307
 *         evalues = np.ndarray((dims[0]), dtype=_to_dtype(gtype))
 *     else:
 *         evalues = np.asarray(evalues)             # <<<<<<<<<<<<<<
 *     GA_Diag_reuse(control, g_a, g_s, g_v, <void*>evalues.data)
 *     return evalues
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1307, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1307, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_evalues); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1307, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_evalues};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1307, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_evalues};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1307, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1307, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_v_evalues);
        __Pyx_GIVEREF(__pyx_v_evalues);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_evalues);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1307, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_evalues, __pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "miniga4py/ga.pyx":1308
 *     else:
 *         evalues = np.asarray(evalues)
 *     GA_Diag_reuse(control, g_a, g_s, g_v, <void*>evalues.data)             # <<<<<<<<<<<<<<
 *     return evalues
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_evalues, __pyx_n_s_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  GA_Diag_reuse(__pyx_v_control, __pyx_v_g_a, __pyx_v_g_s, __pyx_v_g_v, ((void *)__pyx_t_4));
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "miniga4py/ga.pyx":1309
 *         evalues = np.asarray(evalues)
 *     GA_Diag_reuse(control, g_a, g_s, g_v, <void*>evalues.data)
 *     return evalues             # <<<<<<<<<<<<<<
 * 
 * def diag_std(int g_a, int g_v, evalues=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_evalues);
  __pyx_r = __pyx_v_evalues;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":1277
 *     return evalues
 * 
 * def diag_reuse(int control, int g_a, int g_s, int g_v, evalues=None):             # <<<<<<<<<<<<<<
 *     """Solve the generalized eigen-value problem.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("miniga4py.ga.diag_reuse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gtype);
  __Pyx_XDECREF(__pyx_v_dims);
  __Pyx_XDECREF(__pyx_v_evalues);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1311
 *     return evalues
 * 
 * def diag_std(int g_a, int g_v, evalues=None):             # <<<<<<<<<<<<<<
 *     """Solve the standard (non-generalized) eigenvalue problem.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_85diag_std(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_84diag_std[] = "diag_std(int g_a, int g_v, evalues=None)\nSolve the standard (non-generalized) eigenvalue problem.\n\n    The input matrix is neither overwritten nor destroyed.\n    \n    :Parameters:\n        g_a : int\n            the array handle of the matrix to diagonalize\n        g_v : int\n            the array handle to return evecs\n\n    :returns: all eigenvectors via the g_v global array, and eigenvalues as an ndarray in ascending order\n\n    This is a collective operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_85diag_std = {"diag_std", (PyCFunction)__pyx_pw_9miniga4py_2ga_85diag_std, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_84diag_std};
static PyObject *__pyx_pw_9miniga4py_2ga_85diag_std(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_v;
  PyObject *__pyx_v_evalues = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("diag_std (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_v,&__pyx_n_s_evalues,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("diag_std", 0, 2, 3, 1); __PYX_ERR(0, 1311, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evalues);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "diag_std") < 0)) __PYX_ERR(0, 1311, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1311, __pyx_L3_error)
    __pyx_v_g_v = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1311, __pyx_L3_error)
    __pyx_v_evalues = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("diag_std", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1311, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.diag_std", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_84diag_std(__pyx_self, __pyx_v_g_a, __pyx_v_g_v, __pyx_v_evalues);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_84diag_std(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_v, PyObject *__pyx_v_evalues) {
  PyObject *__pyx_v_gtype = NULL;
  PyObject *__pyx_v_dims = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("diag_std", 0);
  __Pyx_INCREF(__pyx_v_evalues);

  /* "miniga4py/ga.pyx":1327
 * 
 *     """
 *     if evalues is None:             # <<<<<<<<<<<<<<
 *         gtype,dims = inquire(g_a)
 *         evalues = np.ndarray((dims[0]), dtype=_to_dtype(gtype))
 */
  __pyx_t_1 = (__pyx_v_evalues == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "miniga4py/ga.pyx":1328
 *     """
 *     if evalues is None:
 *         gtype,dims = inquire(g_a)             # <<<<<<<<<<<<<<
 *         evalues = np.ndarray((dims[0]), dtype=_to_dtype(gtype))
 *     else:
 */
    __pyx_t_3 = __pyx_f_9miniga4py_2ga_inquire(__pyx_v_g_a, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1328, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1328, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1328, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1328, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1328, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 1328, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L5_unpacking_done;
      __pyx_L4_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1328, __pyx_L1_error)
      __pyx_L5_unpacking_done:;
    }
    __pyx_v_gtype = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_dims = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "miniga4py/ga.pyx":1329
 *     if evalues is None:
 *         gtype,dims = inquire(g_a)
 *         evalues = np.ndarray((dims[0]), dtype=_to_dtype(gtype))             # <<<<<<<<<<<<<<
 *     else:
 *         evalues = np.asarray(evalues)
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_dims, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_to_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_gtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1329, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_gtype};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1329, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_gtype};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1329, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1329, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
        __Pyx_INCREF(__pyx_v_gtype);
        __Pyx_GIVEREF(__pyx_v_gtype);
        PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_gtype);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1329, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 1329, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_ndarray), __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_evalues, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "miniga4py/ga.pyx":1327
 * 
 *     """
 *     if evalues is None:             # <<<<<<<<<<<<<<
 *         gtype,dims = inquire(g_a)
 *         evalues = np.ndarray((dims[0]), dtype=_to_dtype(gtype))
 */
    goto __pyx_L3;
  }

  /* "miniga4py/ga.pyx":1331
 *         evalues = np.ndarray((dims[0]), dtype=_to_dtype(gtype))
 *     else:
 *         evalues = np.asarray(evalues)             # <<<<<<<<<<<<<<
 *     GA_Diag_std(g_a, g_v, <void*>evalues.data)
 *     return evalues
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_evalues); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1331, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_evalues};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1331, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_evalues};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1331, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1331, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_v_evalues);
        __Pyx_GIVEREF(__pyx_v_evalues);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_evalues);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1331, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_evalues, __pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "miniga4py/ga.pyx":1332
 *     else:
 *         evalues = np.asarray(evalues)
 *     GA_Diag_std(g_a, g_v, <void*>evalues.data)             # <<<<<<<<<<<<<<
 *     return evalues
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_evalues, __pyx_n_s_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  GA_Diag_std(__pyx_v_g_a, __pyx_v_g_v, ((void *)__pyx_t_4));
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "miniga4py/ga.pyx":1333
 *         evalues = np.asarray(evalues)
 *     GA_Diag_std(g_a, g_v, <void*>evalues.data)
 *     return evalues             # <<<<<<<<<<<<<<
 * 
 * cpdef distribution(int g_a, int proc=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_evalues);
  __pyx_r = __pyx_v_evalues;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":1311
 *     return evalues
 * 
 * def diag_std(int g_a, int g_v, evalues=None):             # <<<<<<<<<<<<<<
 *     """Solve the standard (non-generalized) eigenvalue problem.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("miniga4py.ga.diag_std", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gtype);
  __Pyx_XDECREF(__pyx_v_dims);
  __Pyx_XDECREF(__pyx_v_evalues);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1335
 *     return evalues
 * 
 * cpdef distribution(int g_a, int proc=-1):             # <<<<<<<<<<<<<<
 *     """Return the distribution given to proc.
 * 
 */

static PyObject *__pyx_pw_9miniga4py_2ga_87distribution(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_9miniga4py_2ga_distribution(int __pyx_v_g_a, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9miniga4py_2ga_distribution *__pyx_optional_args) {
  int __pyx_v_proc = ((int)-1);
  int __pyx_v_ndim;
  PyArrayObject *__pyx_v_lo = 0;
  PyArrayObject *__pyx_v_hi = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi;
  __Pyx_Buffer __pyx_pybuffer_hi;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lo;
  __Pyx_Buffer __pyx_pybuffer_lo;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("distribution", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_proc = __pyx_optional_args->proc;
    }
  }
  __pyx_pybuffer_lo.pybuffer.buf = NULL;
  __pyx_pybuffer_lo.refcount = 0;
  __pyx_pybuffernd_lo.data = NULL;
  __pyx_pybuffernd_lo.rcbuffer = &__pyx_pybuffer_lo;
  __pyx_pybuffer_hi.pybuffer.buf = NULL;
  __pyx_pybuffer_hi.refcount = 0;
  __pyx_pybuffernd_hi.data = NULL;
  __pyx_pybuffernd_hi.rcbuffer = &__pyx_pybuffer_hi;

  /* "miniga4py/ga.pyx":1343
 * 
 *     """
 *     cdef int ndim = GA_Ndim(g_a)             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[np.int64_t, ndim=1] lo = np.zeros((ndim), dtype=np.int64)
 *     cdef np.ndarray[np.int64_t, ndim=1] hi = np.zeros((ndim), dtype=np.int64)
 */
  __pyx_v_ndim = GA_Ndim(__pyx_v_g_a);

  /* "miniga4py/ga.pyx":1344
 *     """
 *     cdef int ndim = GA_Ndim(g_a)
 *     cdef np.ndarray[np.int64_t, ndim=1] lo = np.zeros((ndim), dtype=np.int64)             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[np.int64_t, ndim=1] hi = np.zeros((ndim), dtype=np.int64)
 *     if proc < 0:
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 1344, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1344, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_lo = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_lo.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1344, __pyx_L1_error)
    } else {__pyx_pybuffernd_lo.diminfo[0].strides = __pyx_pybuffernd_lo.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo.diminfo[0].shape = __pyx_pybuffernd_lo.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_lo = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":1345
 *     cdef int ndim = GA_Ndim(g_a)
 *     cdef np.ndarray[np.int64_t, ndim=1] lo = np.zeros((ndim), dtype=np.int64)
 *     cdef np.ndarray[np.int64_t, ndim=1] hi = np.zeros((ndim), dtype=np.int64)             # <<<<<<<<<<<<<<
 *     if proc < 0:
 *         proc = GA_Nodeid()
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_ndim); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1345, __pyx_L1_error)
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_hi = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_hi.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1345, __pyx_L1_error)
    } else {__pyx_pybuffernd_hi.diminfo[0].strides = __pyx_pybuffernd_hi.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi.diminfo[0].shape = __pyx_pybuffernd_hi.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_7 = 0;
  __pyx_v_hi = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "miniga4py/ga.pyx":1346
 *     cdef np.ndarray[np.int64_t, ndim=1] lo = np.zeros((ndim), dtype=np.int64)
 *     cdef np.ndarray[np.int64_t, ndim=1] hi = np.zeros((ndim), dtype=np.int64)
 *     if proc < 0:             # <<<<<<<<<<<<<<
 *         proc = GA_Nodeid()
 *     NGA_Distribution64(g_a, proc, <int64_t*>lo.data, <int64_t*>hi.data)
 */
  __pyx_t_8 = ((__pyx_v_proc < 0) != 0);
  if (__pyx_t_8) {

    /* "miniga4py/ga.pyx":1347
 *     cdef np.ndarray[np.int64_t, ndim=1] hi = np.zeros((ndim), dtype=np.int64)
 *     if proc < 0:
 *         proc = GA_Nodeid()             # <<<<<<<<<<<<<<
 *     NGA_Distribution64(g_a, proc, <int64_t*>lo.data, <int64_t*>hi.data)
 *     # convert hi to python exclusive indexing convetion
 */
    __pyx_v_proc = GA_Nodeid();

    /* "miniga4py/ga.pyx":1346
 *     cdef np.ndarray[np.int64_t, ndim=1] lo = np.zeros((ndim), dtype=np.int64)
 *     cdef np.ndarray[np.int64_t, ndim=1] hi = np.zeros((ndim), dtype=np.int64)
 *     if proc < 0:             # <<<<<<<<<<<<<<
 *         proc = GA_Nodeid()
 *     NGA_Distribution64(g_a, proc, <int64_t*>lo.data, <int64_t*>hi.data)
 */
  }

  /* "miniga4py/ga.pyx":1348
 *     if proc < 0:
 *         proc = GA_Nodeid()
 *     NGA_Distribution64(g_a, proc, <int64_t*>lo.data, <int64_t*>hi.data)             # <<<<<<<<<<<<<<
 *     # convert hi to python exclusive indexing convetion
 *     hi += 1
 */
  NGA_Distribution64(__pyx_v_g_a, __pyx_v_proc, ((int64_t *)__pyx_v_lo->data), ((int64_t *)__pyx_v_hi->data));

  /* "miniga4py/ga.pyx":1350
 *     NGA_Distribution64(g_a, proc, <int64_t*>lo.data, <int64_t*>hi.data)
 *     # convert hi to python exclusive indexing convetion
 *     hi += 1             # <<<<<<<<<<<<<<
 *     return lo,hi
 * 
 */
  __pyx_t_4 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_hi), __pyx_int_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1350, __pyx_L1_error)
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi.rcbuffer->pybuffer);
    __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_9 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __pyx_t_10 = __pyx_t_11 = __pyx_t_12 = 0;
    }
    __pyx_pybuffernd_hi.diminfo[0].strides = __pyx_pybuffernd_hi.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi.diminfo[0].shape = __pyx_pybuffernd_hi.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1350, __pyx_L1_error)
  }
  __pyx_t_7 = 0;
  __Pyx_DECREF_SET(__pyx_v_hi, ((PyArrayObject *)__pyx_t_4));
  __pyx_t_4 = 0;

  /* "miniga4py/ga.pyx":1351
 *     # convert hi to python exclusive indexing convetion
 *     hi += 1
 *     return lo,hi             # <<<<<<<<<<<<<<
 * 
 * def dot(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_lo));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lo));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_lo));
  __Pyx_INCREF(((PyObject *)__pyx_v_hi));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_hi));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_hi));
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":1335
 *     return evalues
 * 
 * cpdef distribution(int g_a, int proc=-1):             # <<<<<<<<<<<<<<
 *     """Return the distribution given to proc.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.distribution", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lo);
  __Pyx_XDECREF((PyObject *)__pyx_v_hi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_87distribution(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_86distribution[] = "distribution(int g_a, int proc=-1)\nReturn the distribution given to proc.\n\n    If proc is not specified, then ga.nodeid() is used.  The range is\n    returned as -1 for lo and -2 for hi if no elements are owned by\n    proc.\n    \n    ";
static PyObject *__pyx_pw_9miniga4py_2ga_87distribution(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_proc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("distribution (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_proc,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_proc);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "distribution") < 0)) __PYX_ERR(0, 1335, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1335, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_proc = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_proc == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1335, __pyx_L3_error)
    } else {
      __pyx_v_proc = ((int)-1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("distribution", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1335, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.distribution", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_86distribution(__pyx_self, __pyx_v_g_a, __pyx_v_proc);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_86distribution(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_proc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_9miniga4py_2ga_distribution __pyx_t_2;
  __Pyx_RefNannySetupContext("distribution", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.proc = __pyx_v_proc;
  __pyx_t_1 = __pyx_f_9miniga4py_2ga_distribution(__pyx_v_g_a, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.distribution", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1353
 *     return lo,hi
 * 
 * def dot(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None,             # <<<<<<<<<<<<<<
 *         bint ta=False, bint tb=False):
 *     """Computes the element-wise dot product of two arrays.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_89dot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_88dot[] = "dot(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None, bool ta=False, bool tb=False)\nComputes the element-wise dot product of two arrays.\n\n    Arrays must be of the same type and same number of elements.\n    Patch operation allows for possibly transposed patches.\n\n    This is a collective operation.\n\n    :Parameters:\n        g_a : int\n            the array handle\n        g_b : int\n            the array handle\n        alo : 1D array-like of integers\n            lower bound patch coordinates of g_a, inclusive\n        ahi : 1D array-like of integers\n            higher bound patch coordinates of g_a, exclusive\n        blo : 1D array-like of integers\n            lower bound patch coordinates of g_b, inclusive\n        bhi : 1D array-like of integers\n            higher bound patch coordinates of g_b, exclusive\n        ta : bool\n            whether the transpose operator should be applied to g_a True=applied\n        tb : bool\n            whether the transpose operator should be applied to g_b True=applied\n\n    :returns: SUM_ij a(i,j)*b(i,j)\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_89dot = {"dot", (PyCFunction)__pyx_pw_9miniga4py_2ga_89dot, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_88dot};
static PyObject *__pyx_pw_9miniga4py_2ga_89dot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_b;
  PyObject *__pyx_v_alo = 0;
  PyObject *__pyx_v_ahi = 0;
  PyObject *__pyx_v_blo = 0;
  PyObject *__pyx_v_bhi = 0;
  int __pyx_v_ta;
  int __pyx_v_tb;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dot (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_b,&__pyx_n_s_alo,&__pyx_n_s_ahi,&__pyx_n_s_blo,&__pyx_n_s_bhi,&__pyx_n_s_ta,&__pyx_n_s_tb,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dot", 0, 2, 8, 1); __PYX_ERR(0, 1353, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alo);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ahi);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_blo);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bhi);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ta);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tb);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dot") < 0)) __PYX_ERR(0, 1353, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1353, __pyx_L3_error)
    __pyx_v_g_b = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_b == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1353, __pyx_L3_error)
    __pyx_v_alo = values[2];
    __pyx_v_ahi = values[3];
    __pyx_v_blo = values[4];
    __pyx_v_bhi = values[5];
    if (values[6]) {
      __pyx_v_ta = __Pyx_PyObject_IsTrue(values[6]); if (unlikely((__pyx_v_ta == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1354, __pyx_L3_error)
    } else {

      /* "miniga4py/ga.pyx":1354
 * 
 * def dot(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None,
 *         bint ta=False, bint tb=False):             # <<<<<<<<<<<<<<
 *     """Computes the element-wise dot product of two arrays.
 * 
 */
      __pyx_v_ta = ((int)0);
    }
    if (values[7]) {
      __pyx_v_tb = __Pyx_PyObject_IsTrue(values[7]); if (unlikely((__pyx_v_tb == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1354, __pyx_L3_error)
    } else {
      __pyx_v_tb = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dot", 0, 2, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1353, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.dot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_88dot(__pyx_self, __pyx_v_g_a, __pyx_v_g_b, __pyx_v_alo, __pyx_v_ahi, __pyx_v_blo, __pyx_v_bhi, __pyx_v_ta, __pyx_v_tb);

  /* "miniga4py/ga.pyx":1353
 *     return lo,hi
 * 
 * def dot(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None,             # <<<<<<<<<<<<<<
 *         bint ta=False, bint tb=False):
 *     """Computes the element-wise dot product of two arrays.
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_88dot(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi, int __pyx_v_ta, int __pyx_v_tb) {
  PyArrayObject *__pyx_v_alo_nd = 0;
  PyArrayObject *__pyx_v_ahi_nd = 0;
  PyArrayObject *__pyx_v_blo_nd = 0;
  PyArrayObject *__pyx_v_bhi_nd = 0;
  char __pyx_v_ta_c;
  char __pyx_v_tb_c;
  int __pyx_v_gtype;
  __pyx_t_float_complex __pyx_v_pfcv;
  __pyx_t_double_complex __pyx_v_pdcv;
  SingleComplex __pyx_v_gfcv;
  DoubleComplex __pyx_v_gdcv;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ahi_nd;
  __Pyx_Buffer __pyx_pybuffer_ahi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_alo_nd;
  __Pyx_Buffer __pyx_pybuffer_alo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bhi_nd;
  __Pyx_Buffer __pyx_pybuffer_bhi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_blo_nd;
  __Pyx_Buffer __pyx_pybuffer_blo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Real __pyx_t_7;
  Real __pyx_t_8;
  DoublePrecision __pyx_t_9;
  DoublePrecision __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  PyArrayObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyArrayObject *__pyx_t_18 = NULL;
  Real __pyx_t_19;
  Real __pyx_t_20;
  DoublePrecision __pyx_t_21;
  DoublePrecision __pyx_t_22;
  __Pyx_RefNannySetupContext("dot", 0);
  __pyx_pybuffer_alo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_alo_nd.refcount = 0;
  __pyx_pybuffernd_alo_nd.data = NULL;
  __pyx_pybuffernd_alo_nd.rcbuffer = &__pyx_pybuffer_alo_nd;
  __pyx_pybuffer_ahi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_ahi_nd.refcount = 0;
  __pyx_pybuffernd_ahi_nd.data = NULL;
  __pyx_pybuffernd_ahi_nd.rcbuffer = &__pyx_pybuffer_ahi_nd;
  __pyx_pybuffer_blo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_blo_nd.refcount = 0;
  __pyx_pybuffernd_blo_nd.data = NULL;
  __pyx_pybuffernd_blo_nd.rcbuffer = &__pyx_pybuffer_blo_nd;
  __pyx_pybuffer_bhi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_bhi_nd.refcount = 0;
  __pyx_pybuffernd_bhi_nd.data = NULL;
  __pyx_pybuffernd_bhi_nd.rcbuffer = &__pyx_pybuffer_bhi_nd;

  /* "miniga4py/ga.pyx":1386
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef char ta_c, tb_c
 *     cdef int gtype=inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     cdef float complex pfcv
 *     cdef double complex pdcv
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":1391
 *     cdef SingleComplex gfcv
 *     cdef DoubleComplex gdcv
 *     if alo is None and ahi is None and blo is None and bhi is None:             # <<<<<<<<<<<<<<
 *         if gtype == C_INT:
 *             return GA_Idot(g_a, g_b)
 */
  __pyx_t_2 = (__pyx_v_alo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_ahi == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_blo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_bhi == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":1392
 *     cdef DoubleComplex gdcv
 *     if alo is None and ahi is None and blo is None and bhi is None:
 *         if gtype == C_INT:             # <<<<<<<<<<<<<<
 *             return GA_Idot(g_a, g_b)
 *         elif gtype == C_LONG:
 */
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1392, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_INT); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1392, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1392, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1392, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_1) {

      /* "miniga4py/ga.pyx":1393
 *     if alo is None and ahi is None and blo is None and bhi is None:
 *         if gtype == C_INT:
 *             return GA_Idot(g_a, g_b)             # <<<<<<<<<<<<<<
 *         elif gtype == C_LONG:
 *             return GA_Ldot(g_a, g_b)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6 = __Pyx_PyInt_From_int(GA_Idot(__pyx_v_g_a, __pyx_v_g_b)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1393, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L0;

      /* "miniga4py/ga.pyx":1392
 *     cdef DoubleComplex gdcv
 *     if alo is None and ahi is None and blo is None and bhi is None:
 *         if gtype == C_INT:             # <<<<<<<<<<<<<<
 *             return GA_Idot(g_a, g_b)
 *         elif gtype == C_LONG:
 */
    }

    /* "miniga4py/ga.pyx":1394
 *         if gtype == C_INT:
 *             return GA_Idot(g_a, g_b)
 *         elif gtype == C_LONG:             # <<<<<<<<<<<<<<
 *             return GA_Ldot(g_a, g_b)
 *         elif gtype == C_LONGLONG:
 */
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_LONG); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1394, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1394, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "miniga4py/ga.pyx":1395
 *             return GA_Idot(g_a, g_b)
 *         elif gtype == C_LONG:
 *             return GA_Ldot(g_a, g_b)             # <<<<<<<<<<<<<<
 *         elif gtype == C_LONGLONG:
 *             return GA_Lldot(g_a, g_b)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyInt_From_long(GA_Ldot(__pyx_v_g_a, __pyx_v_g_b)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1395, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      /* "miniga4py/ga.pyx":1394
 *         if gtype == C_INT:
 *             return GA_Idot(g_a, g_b)
 *         elif gtype == C_LONG:             # <<<<<<<<<<<<<<
 *             return GA_Ldot(g_a, g_b)
 *         elif gtype == C_LONGLONG:
 */
    }

    /* "miniga4py/ga.pyx":1396
 *         elif gtype == C_LONG:
 *             return GA_Ldot(g_a, g_b)
 *         elif gtype == C_LONGLONG:             # <<<<<<<<<<<<<<
 *             return GA_Lldot(g_a, g_b)
 *         elif gtype == C_FLOAT:
 */
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_LONGLONG); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1396, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1396, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_1) {

      /* "miniga4py/ga.pyx":1397
 *             return GA_Ldot(g_a, g_b)
 *         elif gtype == C_LONGLONG:
 *             return GA_Lldot(g_a, g_b)             # <<<<<<<<<<<<<<
 *         elif gtype == C_FLOAT:
 *             return GA_Fdot(g_a, g_b)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6 = __Pyx_PyInt_From_PY_LONG_LONG(GA_Lldot(__pyx_v_g_a, __pyx_v_g_b)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1397, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L0;

      /* "miniga4py/ga.pyx":1396
 *         elif gtype == C_LONG:
 *             return GA_Ldot(g_a, g_b)
 *         elif gtype == C_LONGLONG:             # <<<<<<<<<<<<<<
 *             return GA_Lldot(g_a, g_b)
 *         elif gtype == C_FLOAT:
 */
    }

    /* "miniga4py/ga.pyx":1398
 *         elif gtype == C_LONGLONG:
 *             return GA_Lldot(g_a, g_b)
 *         elif gtype == C_FLOAT:             # <<<<<<<<<<<<<<
 *             return GA_Fdot(g_a, g_b)
 *         elif gtype == C_DBL:
 */
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1398, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_FLOAT); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1398, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1398, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1398, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "miniga4py/ga.pyx":1399
 *             return GA_Lldot(g_a, g_b)
 *         elif gtype == C_FLOAT:
 *             return GA_Fdot(g_a, g_b)             # <<<<<<<<<<<<<<
 *         elif gtype == C_DBL:
 *             return GA_Ddot(g_a, g_b)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = PyFloat_FromDouble(GA_Fdot(__pyx_v_g_a, __pyx_v_g_b)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1399, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      /* "miniga4py/ga.pyx":1398
 *         elif gtype == C_LONGLONG:
 *             return GA_Lldot(g_a, g_b)
 *         elif gtype == C_FLOAT:             # <<<<<<<<<<<<<<
 *             return GA_Fdot(g_a, g_b)
 *         elif gtype == C_DBL:
 */
    }

    /* "miniga4py/ga.pyx":1400
 *         elif gtype == C_FLOAT:
 *             return GA_Fdot(g_a, g_b)
 *         elif gtype == C_DBL:             # <<<<<<<<<<<<<<
 *             return GA_Ddot(g_a, g_b)
 *         elif gtype == C_SCPL:
 */
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1400, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_DBL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1400, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1400, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1400, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_1) {

      /* "miniga4py/ga.pyx":1401
 *             return GA_Fdot(g_a, g_b)
 *         elif gtype == C_DBL:
 *             return GA_Ddot(g_a, g_b)             # <<<<<<<<<<<<<<
 *         elif gtype == C_SCPL:
 *             gfcv = GA_Cdot(g_a, g_b)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6 = PyFloat_FromDouble(GA_Ddot(__pyx_v_g_a, __pyx_v_g_b)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1401, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L0;

      /* "miniga4py/ga.pyx":1400
 *         elif gtype == C_FLOAT:
 *             return GA_Fdot(g_a, g_b)
 *         elif gtype == C_DBL:             # <<<<<<<<<<<<<<
 *             return GA_Ddot(g_a, g_b)
 *         elif gtype == C_SCPL:
 */
    }

    /* "miniga4py/ga.pyx":1402
 *         elif gtype == C_DBL:
 *             return GA_Ddot(g_a, g_b)
 *         elif gtype == C_SCPL:             # <<<<<<<<<<<<<<
 *             gfcv = GA_Cdot(g_a, g_b)
 *             pfcv.real = gfcv.real
 */
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1402, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_SCPL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1402, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1402, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1402, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "miniga4py/ga.pyx":1403
 *             return GA_Ddot(g_a, g_b)
 *         elif gtype == C_SCPL:
 *             gfcv = GA_Cdot(g_a, g_b)             # <<<<<<<<<<<<<<
 *             pfcv.real = gfcv.real
 *             pfcv.imag = gfcv.imag
 */
      __pyx_v_gfcv = GA_Cdot(__pyx_v_g_a, __pyx_v_g_b);

      /* "miniga4py/ga.pyx":1404
 *         elif gtype == C_SCPL:
 *             gfcv = GA_Cdot(g_a, g_b)
 *             pfcv.real = gfcv.real             # <<<<<<<<<<<<<<
 *             pfcv.imag = gfcv.imag
 *             return pfcv
 */
      __pyx_t_7 = __pyx_v_gfcv.real;
      __Pyx_SET_CREAL(__pyx_v_pfcv, __pyx_t_7);

      /* "miniga4py/ga.pyx":1405
 *             gfcv = GA_Cdot(g_a, g_b)
 *             pfcv.real = gfcv.real
 *             pfcv.imag = gfcv.imag             # <<<<<<<<<<<<<<
 *             return pfcv
 *         elif gtype == C_DCPL:
 */
      __pyx_t_8 = __pyx_v_gfcv.imag;
      __Pyx_SET_CIMAG(__pyx_v_pfcv, __pyx_t_8);

      /* "miniga4py/ga.pyx":1406
 *             pfcv.real = gfcv.real
 *             pfcv.imag = gfcv.imag
 *             return pfcv             # <<<<<<<<<<<<<<
 *         elif gtype == C_DCPL:
 *             gdcv = GA_Zdot(g_a, g_b)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __pyx_PyComplex_FromComplex(__pyx_v_pfcv); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1406, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      /* "miniga4py/ga.pyx":1402
 *         elif gtype == C_DBL:
 *             return GA_Ddot(g_a, g_b)
 *         elif gtype == C_SCPL:             # <<<<<<<<<<<<<<
 *             gfcv = GA_Cdot(g_a, g_b)
 *             pfcv.real = gfcv.real
 */
    }

    /* "miniga4py/ga.pyx":1407
 *             pfcv.imag = gfcv.imag
 *             return pfcv
 *         elif gtype == C_DCPL:             # <<<<<<<<<<<<<<
 *             gdcv = GA_Zdot(g_a, g_b)
 *             pdcv.real = gdcv.real
 */
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1407, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_DCPL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1407, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1407, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1407, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (likely(__pyx_t_1)) {

      /* "miniga4py/ga.pyx":1408
 *             return pfcv
 *         elif gtype == C_DCPL:
 *             gdcv = GA_Zdot(g_a, g_b)             # <<<<<<<<<<<<<<
 *             pdcv.real = gdcv.real
 *             pdcv.imag = gdcv.imag
 */
      __pyx_v_gdcv = GA_Zdot(__pyx_v_g_a, __pyx_v_g_b);

      /* "miniga4py/ga.pyx":1409
 *         elif gtype == C_DCPL:
 *             gdcv = GA_Zdot(g_a, g_b)
 *             pdcv.real = gdcv.real             # <<<<<<<<<<<<<<
 *             pdcv.imag = gdcv.imag
 *             return pdcv
 */
      __pyx_t_9 = __pyx_v_gdcv.real;
      __Pyx_SET_CREAL(__pyx_v_pdcv, __pyx_t_9);

      /* "miniga4py/ga.pyx":1410
 *             gdcv = GA_Zdot(g_a, g_b)
 *             pdcv.real = gdcv.real
 *             pdcv.imag = gdcv.imag             # <<<<<<<<<<<<<<
 *             return pdcv
 *         else:
 */
      __pyx_t_10 = __pyx_v_gdcv.imag;
      __Pyx_SET_CIMAG(__pyx_v_pdcv, __pyx_t_10);

      /* "miniga4py/ga.pyx":1411
 *             pdcv.real = gdcv.real
 *             pdcv.imag = gdcv.imag
 *             return pdcv             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6 = __pyx_PyComplex_FromComplex(__pyx_v_pdcv); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1411, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L0;

      /* "miniga4py/ga.pyx":1407
 *             pfcv.imag = gfcv.imag
 *             return pfcv
 *         elif gtype == C_DCPL:             # <<<<<<<<<<<<<<
 *             gdcv = GA_Zdot(g_a, g_b)
 *             pdcv.real = gdcv.real
 */
    }

    /* "miniga4py/ga.pyx":1413
 *             return pdcv
 *         else:
 *             raise TypeError             # <<<<<<<<<<<<<<
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 */
    /*else*/ {
      __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
      __PYX_ERR(0, 1413, __pyx_L1_error)
    }

    /* "miniga4py/ga.pyx":1391
 *     cdef SingleComplex gfcv
 *     cdef DoubleComplex gdcv
 *     if alo is None and ahi is None and blo is None and bhi is None:             # <<<<<<<<<<<<<<
 *         if gtype == C_INT:
 *             return GA_Idot(g_a, g_b)
 */
  }

  /* "miniga4py/ga.pyx":1415
 *             raise TypeError
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)             # <<<<<<<<<<<<<<
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         if ta:
 */
  /*else*/ {
    __pyx_t_6 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_alo, __pyx_v_ahi); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
      PyObject* sequence = __pyx_t_6;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1415, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_11 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_5)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_4 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_4)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) __PYX_ERR(0, 1415, __pyx_L1_error)
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L10_unpacking_done;
      __pyx_L9_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1415, __pyx_L1_error)
      __pyx_L10_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1415, __pyx_L1_error)
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1415, __pyx_L1_error)
    __pyx_t_13 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_alo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_15, __pyx_t_16, __pyx_t_17);
        }
        __pyx_t_15 = __pyx_t_16 = __pyx_t_17 = 0;
      }
      __pyx_pybuffernd_alo_nd.diminfo[0].strides = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alo_nd.diminfo[0].shape = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1415, __pyx_L1_error)
    }
    __pyx_t_13 = 0;
    __pyx_v_alo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_13 = ((PyArrayObject *)__pyx_t_4);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_17, &__pyx_t_16, &__pyx_t_15);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ahi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_15);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_17, __pyx_t_16, __pyx_t_15);
        }
        __pyx_t_17 = __pyx_t_16 = __pyx_t_15 = 0;
      }
      __pyx_pybuffernd_ahi_nd.diminfo[0].strides = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ahi_nd.diminfo[0].shape = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1415, __pyx_L1_error)
    }
    __pyx_t_13 = 0;
    __pyx_v_ahi_nd = ((PyArrayObject *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "miniga4py/ga.pyx":1416
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)             # <<<<<<<<<<<<<<
 *         if ta:
 *             ta_c = "T"
 */
    __pyx_t_6 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_b, __pyx_v_blo, __pyx_v_bhi); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1416, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
      PyObject* sequence = __pyx_t_6;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1416, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_11 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_4)) goto __pyx_L11_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_5)) goto __pyx_L11_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) __PYX_ERR(0, 1416, __pyx_L1_error)
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L12_unpacking_done;
      __pyx_L11_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1416, __pyx_L1_error)
      __pyx_L12_unpacking_done:;
    }
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1416, __pyx_L1_error)
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1416, __pyx_L1_error)
    __pyx_t_18 = ((PyArrayObject *)__pyx_t_4);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_blo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_15, __pyx_t_16, __pyx_t_17);
        }
        __pyx_t_15 = __pyx_t_16 = __pyx_t_17 = 0;
      }
      __pyx_pybuffernd_blo_nd.diminfo[0].strides = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_blo_nd.diminfo[0].shape = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1416, __pyx_L1_error)
    }
    __pyx_t_18 = 0;
    __pyx_v_blo_nd = ((PyArrayObject *)__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_18 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_17, &__pyx_t_16, &__pyx_t_15);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_bhi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_15);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_17, __pyx_t_16, __pyx_t_15);
        }
        __pyx_t_17 = __pyx_t_16 = __pyx_t_15 = 0;
      }
      __pyx_pybuffernd_bhi_nd.diminfo[0].strides = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bhi_nd.diminfo[0].shape = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1416, __pyx_L1_error)
    }
    __pyx_t_18 = 0;
    __pyx_v_bhi_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "miniga4py/ga.pyx":1417
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         if ta:             # <<<<<<<<<<<<<<
 *             ta_c = "T"
 *         else:
 */
    __pyx_t_1 = (__pyx_v_ta != 0);
    if (__pyx_t_1) {

      /* "miniga4py/ga.pyx":1418
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         if ta:
 *             ta_c = "T"             # <<<<<<<<<<<<<<
 *         else:
 *             ta_c = "N"
 */
      __pyx_v_ta_c = 'T';

      /* "miniga4py/ga.pyx":1417
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         if ta:             # <<<<<<<<<<<<<<
 *             ta_c = "T"
 *         else:
 */
      goto __pyx_L13;
    }

    /* "miniga4py/ga.pyx":1420
 *             ta_c = "T"
 *         else:
 *             ta_c = "N"             # <<<<<<<<<<<<<<
 *         if tb:
 *             tb_c = "T"
 */
    /*else*/ {
      __pyx_v_ta_c = 'N';
    }
    __pyx_L13:;

    /* "miniga4py/ga.pyx":1421
 *         else:
 *             ta_c = "N"
 *         if tb:             # <<<<<<<<<<<<<<
 *             tb_c = "T"
 *         else:
 */
    __pyx_t_1 = (__pyx_v_tb != 0);
    if (__pyx_t_1) {

      /* "miniga4py/ga.pyx":1422
 *             ta_c = "N"
 *         if tb:
 *             tb_c = "T"             # <<<<<<<<<<<<<<
 *         else:
 *             tb_c = "N"
 */
      __pyx_v_tb_c = 'T';

      /* "miniga4py/ga.pyx":1421
 *         else:
 *             ta_c = "N"
 *         if tb:             # <<<<<<<<<<<<<<
 *             tb_c = "T"
 *         else:
 */
      goto __pyx_L14;
    }

    /* "miniga4py/ga.pyx":1424
 *             tb_c = "T"
 *         else:
 *             tb_c = "N"             # <<<<<<<<<<<<<<
 *         if gtype == C_INT:
 *             return NGA_Idot_patch64(
 */
    /*else*/ {
      __pyx_v_tb_c = 'N';
    }
    __pyx_L14:;

    /* "miniga4py/ga.pyx":1425
 *         else:
 *             tb_c = "N"
 *         if gtype == C_INT:             # <<<<<<<<<<<<<<
 *             return NGA_Idot_patch64(
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_INT); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1425, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1425, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "miniga4py/ga.pyx":1426
 *             tb_c = "N"
 *         if gtype == C_INT:
 *             return NGA_Idot_patch64(             # <<<<<<<<<<<<<<
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 */
      __Pyx_XDECREF(__pyx_r);

      /* "miniga4py/ga.pyx":1428
 *             return NGA_Idot_patch64(
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)             # <<<<<<<<<<<<<<
 *         elif gtype == C_LONG:
 *             return NGA_Ldot_patch64(
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(NGA_Idot_patch64(__pyx_v_g_a, __pyx_v_ta_c, ((int64_t *)__pyx_v_alo_nd->data), ((int64_t *)__pyx_v_ahi_nd->data), __pyx_v_g_b, __pyx_v_tb_c, ((int64_t *)__pyx_v_blo_nd->data), ((int64_t *)__pyx_v_bhi_nd->data))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      /* "miniga4py/ga.pyx":1425
 *         else:
 *             tb_c = "N"
 *         if gtype == C_INT:             # <<<<<<<<<<<<<<
 *             return NGA_Idot_patch64(
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    }

    /* "miniga4py/ga.pyx":1429
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 *         elif gtype == C_LONG:             # <<<<<<<<<<<<<<
 *             return NGA_Ldot_patch64(
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1429, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_LONG); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1429, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1429, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1429, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_1) {

      /* "miniga4py/ga.pyx":1430
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 *         elif gtype == C_LONG:
 *             return NGA_Ldot_patch64(             # <<<<<<<<<<<<<<
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 */
      __Pyx_XDECREF(__pyx_r);

      /* "miniga4py/ga.pyx":1432
 *             return NGA_Ldot_patch64(
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)             # <<<<<<<<<<<<<<
 *         elif gtype == C_LONGLONG:
 *             return NGA_Lldot_patch64(
 */
      __pyx_t_6 = __Pyx_PyInt_From_long(NGA_Ldot_patch64(__pyx_v_g_a, __pyx_v_ta_c, ((int64_t *)__pyx_v_alo_nd->data), ((int64_t *)__pyx_v_ahi_nd->data), __pyx_v_g_b, __pyx_v_tb_c, ((int64_t *)__pyx_v_blo_nd->data), ((int64_t *)__pyx_v_bhi_nd->data))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1430, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L0;

      /* "miniga4py/ga.pyx":1429
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 *         elif gtype == C_LONG:             # <<<<<<<<<<<<<<
 *             return NGA_Ldot_patch64(
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    }

    /* "miniga4py/ga.pyx":1433
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 *         elif gtype == C_LONGLONG:             # <<<<<<<<<<<<<<
 *             return NGA_Lldot_patch64(
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_LONGLONG); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "miniga4py/ga.pyx":1434
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 *         elif gtype == C_LONGLONG:
 *             return NGA_Lldot_patch64(             # <<<<<<<<<<<<<<
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 */
      __Pyx_XDECREF(__pyx_r);

      /* "miniga4py/ga.pyx":1436
 *             return NGA_Lldot_patch64(
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)             # <<<<<<<<<<<<<<
 *         elif gtype == C_FLOAT:
 *             return NGA_Fdot_patch64(
 */
      __pyx_t_4 = __Pyx_PyInt_From_PY_LONG_LONG(NGA_Lldot_patch64(__pyx_v_g_a, __pyx_v_ta_c, ((int64_t *)__pyx_v_alo_nd->data), ((int64_t *)__pyx_v_ahi_nd->data), __pyx_v_g_b, __pyx_v_tb_c, ((int64_t *)__pyx_v_blo_nd->data), ((int64_t *)__pyx_v_bhi_nd->data))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1434, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      /* "miniga4py/ga.pyx":1433
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 *         elif gtype == C_LONGLONG:             # <<<<<<<<<<<<<<
 *             return NGA_Lldot_patch64(
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    }

    /* "miniga4py/ga.pyx":1437
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 *         elif gtype == C_FLOAT:             # <<<<<<<<<<<<<<
 *             return NGA_Fdot_patch64(
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1437, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_FLOAT); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1437, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1437, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1437, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_1) {

      /* "miniga4py/ga.pyx":1438
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 *         elif gtype == C_FLOAT:
 *             return NGA_Fdot_patch64(             # <<<<<<<<<<<<<<
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 */
      __Pyx_XDECREF(__pyx_r);

      /* "miniga4py/ga.pyx":1440
 *             return NGA_Fdot_patch64(
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)             # <<<<<<<<<<<<<<
 *         elif gtype == C_DBL:
 *             return NGA_Ddot_patch64(
 */
      __pyx_t_6 = PyFloat_FromDouble(NGA_Fdot_patch64(__pyx_v_g_a, __pyx_v_ta_c, ((int64_t *)__pyx_v_alo_nd->data), ((int64_t *)__pyx_v_ahi_nd->data), __pyx_v_g_b, __pyx_v_tb_c, ((int64_t *)__pyx_v_blo_nd->data), ((int64_t *)__pyx_v_bhi_nd->data))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1438, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L0;

      /* "miniga4py/ga.pyx":1437
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 *         elif gtype == C_FLOAT:             # <<<<<<<<<<<<<<
 *             return NGA_Fdot_patch64(
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    }

    /* "miniga4py/ga.pyx":1441
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 *         elif gtype == C_DBL:             # <<<<<<<<<<<<<<
 *             return NGA_Ddot_patch64(
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_DBL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1441, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1441, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "miniga4py/ga.pyx":1442
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 *         elif gtype == C_DBL:
 *             return NGA_Ddot_patch64(             # <<<<<<<<<<<<<<
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 */
      __Pyx_XDECREF(__pyx_r);

      /* "miniga4py/ga.pyx":1444
 *             return NGA_Ddot_patch64(
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)             # <<<<<<<<<<<<<<
 *         elif gtype == C_SCPL:
 *             gfcv = NGA_Cdot_patch64(
 */
      __pyx_t_4 = PyFloat_FromDouble(NGA_Ddot_patch64(__pyx_v_g_a, __pyx_v_ta_c, ((int64_t *)__pyx_v_alo_nd->data), ((int64_t *)__pyx_v_ahi_nd->data), __pyx_v_g_b, __pyx_v_tb_c, ((int64_t *)__pyx_v_blo_nd->data), ((int64_t *)__pyx_v_bhi_nd->data))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1442, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      /* "miniga4py/ga.pyx":1441
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 *         elif gtype == C_DBL:             # <<<<<<<<<<<<<<
 *             return NGA_Ddot_patch64(
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    }

    /* "miniga4py/ga.pyx":1445
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 *         elif gtype == C_SCPL:             # <<<<<<<<<<<<<<
 *             gfcv = NGA_Cdot_patch64(
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1445, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_SCPL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1445, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1445, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1445, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_1) {

      /* "miniga4py/ga.pyx":1446
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 *         elif gtype == C_SCPL:
 *             gfcv = NGA_Cdot_patch64(             # <<<<<<<<<<<<<<
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 */
      __pyx_v_gfcv = NGA_Cdot_patch64(__pyx_v_g_a, __pyx_v_ta_c, ((int64_t *)__pyx_v_alo_nd->data), ((int64_t *)__pyx_v_ahi_nd->data), __pyx_v_g_b, __pyx_v_tb_c, ((int64_t *)__pyx_v_blo_nd->data), ((int64_t *)__pyx_v_bhi_nd->data));

      /* "miniga4py/ga.pyx":1449
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 *             pfcv.real = gfcv.real             # <<<<<<<<<<<<<<
 *             pfcv.imag = gfcv.imag
 *             return pfcv
 */
      __pyx_t_19 = __pyx_v_gfcv.real;
      __Pyx_SET_CREAL(__pyx_v_pfcv, __pyx_t_19);

      /* "miniga4py/ga.pyx":1450
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 *             pfcv.real = gfcv.real
 *             pfcv.imag = gfcv.imag             # <<<<<<<<<<<<<<
 *             return pfcv
 *         elif gtype == C_DCPL:
 */
      __pyx_t_20 = __pyx_v_gfcv.imag;
      __Pyx_SET_CIMAG(__pyx_v_pfcv, __pyx_t_20);

      /* "miniga4py/ga.pyx":1451
 *             pfcv.real = gfcv.real
 *             pfcv.imag = gfcv.imag
 *             return pfcv             # <<<<<<<<<<<<<<
 *         elif gtype == C_DCPL:
 *             gdcv = NGA_Zdot_patch64(
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6 = __pyx_PyComplex_FromComplex(__pyx_v_pfcv); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1451, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L0;

      /* "miniga4py/ga.pyx":1445
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 *         elif gtype == C_SCPL:             # <<<<<<<<<<<<<<
 *             gfcv = NGA_Cdot_patch64(
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    }

    /* "miniga4py/ga.pyx":1452
 *             pfcv.imag = gfcv.imag
 *             return pfcv
 *         elif gtype == C_DCPL:             # <<<<<<<<<<<<<<
 *             gdcv = NGA_Zdot_patch64(
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1452, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_DCPL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1452, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1452, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1452, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (likely(__pyx_t_1)) {

      /* "miniga4py/ga.pyx":1453
 *             return pfcv
 *         elif gtype == C_DCPL:
 *             gdcv = NGA_Zdot_patch64(             # <<<<<<<<<<<<<<
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 */
      __pyx_v_gdcv = NGA_Zdot_patch64(__pyx_v_g_a, __pyx_v_ta_c, ((int64_t *)__pyx_v_alo_nd->data), ((int64_t *)__pyx_v_ahi_nd->data), __pyx_v_g_b, __pyx_v_tb_c, ((int64_t *)__pyx_v_blo_nd->data), ((int64_t *)__pyx_v_bhi_nd->data));

      /* "miniga4py/ga.pyx":1456
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 *             pdcv.real = gdcv.real             # <<<<<<<<<<<<<<
 *             pdcv.imag = gdcv.imag
 *             return pdcv
 */
      __pyx_t_21 = __pyx_v_gdcv.real;
      __Pyx_SET_CREAL(__pyx_v_pdcv, __pyx_t_21);

      /* "miniga4py/ga.pyx":1457
 *                     g_b, tb_c, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 *             pdcv.real = gdcv.real
 *             pdcv.imag = gdcv.imag             # <<<<<<<<<<<<<<
 *             return pdcv
 *         else:
 */
      __pyx_t_22 = __pyx_v_gdcv.imag;
      __Pyx_SET_CIMAG(__pyx_v_pdcv, __pyx_t_22);

      /* "miniga4py/ga.pyx":1458
 *             pdcv.real = gdcv.real
 *             pdcv.imag = gdcv.imag
 *             return pdcv             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __pyx_PyComplex_FromComplex(__pyx_v_pdcv); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1458, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      /* "miniga4py/ga.pyx":1452
 *             pfcv.imag = gfcv.imag
 *             return pfcv
 *         elif gtype == C_DCPL:             # <<<<<<<<<<<<<<
 *             gdcv = NGA_Zdot_patch64(
 *                     g_a, ta_c, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    }

    /* "miniga4py/ga.pyx":1460
 *             return pdcv
 *         else:
 *             raise TypeError             # <<<<<<<<<<<<<<
 * 
 * def duplicate(int g_a, name=""):
 */
    /*else*/ {
      __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
      __PYX_ERR(0, 1460, __pyx_L1_error)
    }
  }

  /* "miniga4py/ga.pyx":1353
 *     return lo,hi
 * 
 * def dot(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None,             # <<<<<<<<<<<<<<
 *         bint ta=False, bint tb=False):
 *     """Computes the element-wise dot product of two arrays.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_11);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.dot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_alo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_ahi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_blo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_bhi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1462
 *             raise TypeError
 * 
 * def duplicate(int g_a, name=""):             # <<<<<<<<<<<<<<
 *     """Creates a new array by applying all the properties of another existing
 *     array.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_91duplicate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_90duplicate[] = "duplicate(int g_a, name='')\nCreates a new array by applying all the properties of another existing\n    array.\n    \n    :Parameters:\n        g_a : int\n            the array handle\n        name : string\n            the new name of the created array\n\n    :returns: a non-zero array handle means the call was succesful.\n\n    This is a collective operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_91duplicate = {"duplicate", (PyCFunction)__pyx_pw_9miniga4py_2ga_91duplicate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_90duplicate};
static PyObject *__pyx_pw_9miniga4py_2ga_91duplicate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("duplicate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_name,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_kp_s__7);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "duplicate") < 0)) __PYX_ERR(0, 1462, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1462, __pyx_L3_error)
    __pyx_v_name = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("duplicate", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1462, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.duplicate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_90duplicate(__pyx_self, __pyx_v_g_a, __pyx_v_name);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_90duplicate(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  char *__pyx_t_5;
  __Pyx_RefNannySetupContext("duplicate", 0);

  /* "miniga4py/ga.pyx":1477
 * 
 *     """
 *     return GA_Duplicate(g_a, b(name))             # <<<<<<<<<<<<<<
 * 
 * def elem_divide(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1477, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_name};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1477, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_name};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1477, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1477, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_name);
      __Pyx_GIVEREF(__pyx_v_name);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_name);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1477, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_AsWritableString(__pyx_t_1); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 1477, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_int(GA_Duplicate(__pyx_v_g_a, __pyx_t_5)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":1462
 *             raise TypeError
 * 
 * def duplicate(int g_a, name=""):             # <<<<<<<<<<<<<<
 *     """Creates a new array by applying all the properties of another existing
 *     array.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("miniga4py.ga.duplicate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1479
 *     return GA_Duplicate(g_a, b(name))
 * 
 * def elem_divide(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,             # <<<<<<<<<<<<<<
 *         bhi=None, clo=None, chi=None):
 *     """Computes the element-wise quotient of the two arrays.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_93elem_divide(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_92elem_divide[] = "elem_divide(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None, bhi=None, clo=None, chi=None)\nComputes the element-wise quotient of the two arrays.\n\n    Arrays or array patches must be of the same types and same number of\n    elements. For two-dimensional arrays:\n\n                c(i, j)  = a(i,j)/b(i,j)\n\n    The result (c) may replace one of the input arrays (a/b).\n    If one of the elements of array g_b is zero, the quotient for the element\n    of g_c will be set to GA_NEGATIVE_INFINITY. \n\n    This is a collective operation. \n\n    :Parameters:\n        g_a : int\n            the array handle\n        g_b : int\n            the array handle\n        g_c : int\n            the array handle\n        alo : 1D array-like of integers\n            lower bound patch coordinates of g_a, inclusive\n        ahi : 1D array-like of integers\n            higher bound patch coordinates of g_a, exclusive\n        blo : 1D array-like of integers\n            lower bound patch coordinates of g_b, inclusive\n        bhi : 1D array-like of integers\n            higher bound patch coordinates of g_b, exclusive\n        clo : 1D array-like of integers\n            lower bound patch coordinates of g_c, inclusive\n        chi : 1D array-like of integers\n            higher bound patch coordinates of g_c, exclusive\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_93elem_divide = {"elem_divide", (PyCFunction)__pyx_pw_9miniga4py_2ga_93elem_divide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_92elem_divide};
static PyObject *__pyx_pw_9miniga4py_2ga_93elem_divide(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_b;
  int __pyx_v_g_c;
  PyObject *__pyx_v_alo = 0;
  PyObject *__pyx_v_ahi = 0;
  PyObject *__pyx_v_blo = 0;
  PyObject *__pyx_v_bhi = 0;
  PyObject *__pyx_v_clo = 0;
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elem_divide (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_b,&__pyx_n_s_g_c,&__pyx_n_s_alo,&__pyx_n_s_ahi,&__pyx_n_s_blo,&__pyx_n_s_bhi,&__pyx_n_s_clo,&__pyx_n_s_chi,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);

    /* "miniga4py/ga.pyx":1480
 * 
 * def elem_divide(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,
 *         bhi=None, clo=None, chi=None):             # <<<<<<<<<<<<<<
 *     """Computes the element-wise quotient of the two arrays.
 * 
 */
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elem_divide", 0, 3, 9, 1); __PYX_ERR(0, 1479, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_c)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elem_divide", 0, 3, 9, 2); __PYX_ERR(0, 1479, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alo);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ahi);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_blo);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bhi);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clo);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chi);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elem_divide") < 0)) __PYX_ERR(0, 1479, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1479, __pyx_L3_error)
    __pyx_v_g_b = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_b == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1479, __pyx_L3_error)
    __pyx_v_g_c = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_g_c == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1479, __pyx_L3_error)
    __pyx_v_alo = values[3];
    __pyx_v_ahi = values[4];
    __pyx_v_blo = values[5];
    __pyx_v_bhi = values[6];
    __pyx_v_clo = values[7];
    __pyx_v_chi = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elem_divide", 0, 3, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1479, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.elem_divide", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_92elem_divide(__pyx_self, __pyx_v_g_a, __pyx_v_g_b, __pyx_v_g_c, __pyx_v_alo, __pyx_v_ahi, __pyx_v_blo, __pyx_v_bhi, __pyx_v_clo, __pyx_v_chi);

  /* "miniga4py/ga.pyx":1479
 *     return GA_Duplicate(g_a, b(name))
 * 
 * def elem_divide(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,             # <<<<<<<<<<<<<<
 *         bhi=None, clo=None, chi=None):
 *     """Computes the element-wise quotient of the two arrays.
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_92elem_divide(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b, int __pyx_v_g_c, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi, PyObject *__pyx_v_clo, PyObject *__pyx_v_chi) {
  PyArrayObject *__pyx_v_alo_nd = 0;
  PyArrayObject *__pyx_v_ahi_nd = 0;
  PyArrayObject *__pyx_v_blo_nd = 0;
  PyArrayObject *__pyx_v_bhi_nd = 0;
  PyArrayObject *__pyx_v_clo_nd = 0;
  PyArrayObject *__pyx_v_chi_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ahi_nd;
  __Pyx_Buffer __pyx_pybuffer_ahi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_alo_nd;
  __Pyx_Buffer __pyx_pybuffer_alo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bhi_nd;
  __Pyx_Buffer __pyx_pybuffer_bhi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_blo_nd;
  __Pyx_Buffer __pyx_pybuffer_blo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_chi_nd;
  __Pyx_Buffer __pyx_pybuffer_chi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_clo_nd;
  __Pyx_Buffer __pyx_pybuffer_clo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyArrayObject *__pyx_t_14 = NULL;
  PyArrayObject *__pyx_t_15 = NULL;
  __Pyx_RefNannySetupContext("elem_divide", 0);
  __pyx_pybuffer_alo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_alo_nd.refcount = 0;
  __pyx_pybuffernd_alo_nd.data = NULL;
  __pyx_pybuffernd_alo_nd.rcbuffer = &__pyx_pybuffer_alo_nd;
  __pyx_pybuffer_ahi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_ahi_nd.refcount = 0;
  __pyx_pybuffernd_ahi_nd.data = NULL;
  __pyx_pybuffernd_ahi_nd.rcbuffer = &__pyx_pybuffer_ahi_nd;
  __pyx_pybuffer_blo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_blo_nd.refcount = 0;
  __pyx_pybuffernd_blo_nd.data = NULL;
  __pyx_pybuffernd_blo_nd.rcbuffer = &__pyx_pybuffer_blo_nd;
  __pyx_pybuffer_bhi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_bhi_nd.refcount = 0;
  __pyx_pybuffernd_bhi_nd.data = NULL;
  __pyx_pybuffernd_bhi_nd.rcbuffer = &__pyx_pybuffer_bhi_nd;
  __pyx_pybuffer_clo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_clo_nd.refcount = 0;
  __pyx_pybuffernd_clo_nd.data = NULL;
  __pyx_pybuffernd_clo_nd.rcbuffer = &__pyx_pybuffer_clo_nd;
  __pyx_pybuffer_chi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_chi_nd.refcount = 0;
  __pyx_pybuffernd_chi_nd.data = NULL;
  __pyx_pybuffernd_chi_nd.rcbuffer = &__pyx_pybuffer_chi_nd;

  /* "miniga4py/ga.pyx":1518
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 */
  __pyx_t_2 = (__pyx_v_alo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":1519
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None             # <<<<<<<<<<<<<<
 *             and clo is None and chi is None):
 *         GA_Elem_divide(g_a, g_b, g_c)
 */
  __pyx_t_3 = (__pyx_v_ahi == Py_None);

  /* "miniga4py/ga.pyx":1518
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 */
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":1519
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None             # <<<<<<<<<<<<<<
 *             and clo is None and chi is None):
 *         GA_Elem_divide(g_a, g_b, g_c)
 */
  __pyx_t_2 = (__pyx_v_blo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":1520
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):             # <<<<<<<<<<<<<<
 *         GA_Elem_divide(g_a, g_b, g_c)
 *     else:
 */
  __pyx_t_3 = (__pyx_v_bhi == Py_None);

  /* "miniga4py/ga.pyx":1519
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None             # <<<<<<<<<<<<<<
 *             and clo is None and chi is None):
 *         GA_Elem_divide(g_a, g_b, g_c)
 */
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":1520
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):             # <<<<<<<<<<<<<<
 *         GA_Elem_divide(g_a, g_b, g_c)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_clo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_chi == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "miniga4py/ga.pyx":1518
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 */
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":1521
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 *         GA_Elem_divide(g_a, g_b, g_c)             # <<<<<<<<<<<<<<
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 */
    GA_Elem_divide(__pyx_v_g_a, __pyx_v_g_b, __pyx_v_g_c);

    /* "miniga4py/ga.pyx":1518
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 */
    goto __pyx_L3;
  }

  /* "miniga4py/ga.pyx":1523
 *         GA_Elem_divide(g_a, g_b, g_c)
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)             # <<<<<<<<<<<<<<
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_alo, __pyx_v_ahi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1523, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1523, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1523, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1523, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1523, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L11_unpacking_done;
      __pyx_L10_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1523, __pyx_L1_error)
      __pyx_L11_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1523, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1523, __pyx_L1_error)
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_alo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_alo_nd.diminfo[0].strides = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alo_nd.diminfo[0].shape = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1523, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_alo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ahi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_ahi_nd.diminfo[0].strides = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ahi_nd.diminfo[0].shape = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1523, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_ahi_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":1524
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)             # <<<<<<<<<<<<<<
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)
 *         GA_Elem_divide_patch64(
 */
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_b, __pyx_v_blo, __pyx_v_bhi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1524, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1524, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1524, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1524, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1524, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L13_unpacking_done;
      __pyx_L12_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1524, __pyx_L1_error)
      __pyx_L13_unpacking_done:;
    }
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1524, __pyx_L1_error)
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1524, __pyx_L1_error)
    __pyx_t_14 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_blo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_blo_nd.diminfo[0].strides = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_blo_nd.diminfo[0].shape = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1524, __pyx_L1_error)
    }
    __pyx_t_14 = 0;
    __pyx_v_blo_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_14 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_bhi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_bhi_nd.diminfo[0].strides = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bhi_nd.diminfo[0].shape = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1524, __pyx_L1_error)
    }
    __pyx_t_14 = 0;
    __pyx_v_bhi_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "miniga4py/ga.pyx":1525
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)             # <<<<<<<<<<<<<<
 *         GA_Elem_divide_patch64(
 *                 g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_c, __pyx_v_clo, __pyx_v_chi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1525, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1525, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1525, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1525, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L14_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L14_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1525, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L15_unpacking_done;
      __pyx_L14_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1525, __pyx_L1_error)
      __pyx_L15_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1525, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1525, __pyx_L1_error)
    __pyx_t_15 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_clo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_clo_nd.diminfo[0].strides = __pyx_pybuffernd_clo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_clo_nd.diminfo[0].shape = __pyx_pybuffernd_clo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1525, __pyx_L1_error)
    }
    __pyx_t_15 = 0;
    __pyx_v_clo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_15 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_chi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_chi_nd.diminfo[0].strides = __pyx_pybuffernd_chi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_chi_nd.diminfo[0].shape = __pyx_pybuffernd_chi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1525, __pyx_L1_error)
    }
    __pyx_t_15 = 0;
    __pyx_v_chi_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":1526
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)
 *         GA_Elem_divide_patch64(             # <<<<<<<<<<<<<<
 *                 g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                 g_b, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data,
 */
    GA_Elem_divide_patch64(__pyx_v_g_a, ((int64_t *)__pyx_v_alo_nd->data), ((int64_t *)__pyx_v_ahi_nd->data), __pyx_v_g_b, ((int64_t *)__pyx_v_blo_nd->data), ((int64_t *)__pyx_v_bhi_nd->data), __pyx_v_g_c, ((int64_t *)__pyx_v_clo_nd->data), ((int64_t *)__pyx_v_chi_nd->data));
  }
  __pyx_L3:;

  /* "miniga4py/ga.pyx":1479
 *     return GA_Duplicate(g_a, b(name))
 * 
 * def elem_divide(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,             # <<<<<<<<<<<<<<
 *         bhi=None, clo=None, chi=None):
 *     """Computes the element-wise quotient of the two arrays.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.elem_divide", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_alo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_ahi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_blo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_bhi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_clo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_chi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1531
 *                 g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def elem_maximum(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,             # <<<<<<<<<<<<<<
 *         bhi=None, clo=None, chi=None):
 *     """Computes the element-wise maximum of the two arrays.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_95elem_maximum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_94elem_maximum[] = "elem_maximum(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None, bhi=None, clo=None, chi=None)\nComputes the element-wise maximum of the two arrays.\n\n    Arrays or array patches must be of the same types and same number of\n    elements. For two-dimensional arrays::\n\n        c(i,j) = max(a(i,j),b(i,j))\n\n    If the data type is complex, then::\n\n        c(i,j).real = max{ |a(i,j)|, |b(i,j)|} while c(i,j).image = 0\n\n    The result (c) may replace one of the input arrays (a/b).\n\n    This is a collective operation. \n\n    :Parameters:\n        g_a : int\n            the array handle\n        g_b : int\n            the array handle\n        g_c : int\n            the array handle\n        alo : 1D array-like of integers\n            lower bound patch coordinates of g_a, inclusive\n        ahi : 1D array-like of integers\n            higher bound patch coordinates of g_a, exclusive\n        blo : 1D array-like of integers\n            lower bound patch coordinates of g_b, inclusive\n        bhi : 1D array-like of integers\n            higher bound patch coordinates of g_b, exclusive\n        clo : 1D array-like of integers\n            lower bound patch coordinates of g_c, inclusive\n        chi : 1D array-like of integers\n            higher bound patch coordinates of g_c, exclusive\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_95elem_maximum = {"elem_maximum", (PyCFunction)__pyx_pw_9miniga4py_2ga_95elem_maximum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_94elem_maximum};
static PyObject *__pyx_pw_9miniga4py_2ga_95elem_maximum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_b;
  int __pyx_v_g_c;
  PyObject *__pyx_v_alo = 0;
  PyObject *__pyx_v_ahi = 0;
  PyObject *__pyx_v_blo = 0;
  PyObject *__pyx_v_bhi = 0;
  PyObject *__pyx_v_clo = 0;
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elem_maximum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_b,&__pyx_n_s_g_c,&__pyx_n_s_alo,&__pyx_n_s_ahi,&__pyx_n_s_blo,&__pyx_n_s_bhi,&__pyx_n_s_clo,&__pyx_n_s_chi,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);

    /* "miniga4py/ga.pyx":1532
 * 
 * def elem_maximum(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,
 *         bhi=None, clo=None, chi=None):             # <<<<<<<<<<<<<<
 *     """Computes the element-wise maximum of the two arrays.
 * 
 */
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elem_maximum", 0, 3, 9, 1); __PYX_ERR(0, 1531, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_c)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elem_maximum", 0, 3, 9, 2); __PYX_ERR(0, 1531, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alo);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ahi);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_blo);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bhi);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clo);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chi);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elem_maximum") < 0)) __PYX_ERR(0, 1531, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1531, __pyx_L3_error)
    __pyx_v_g_b = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_b == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1531, __pyx_L3_error)
    __pyx_v_g_c = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_g_c == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1531, __pyx_L3_error)
    __pyx_v_alo = values[3];
    __pyx_v_ahi = values[4];
    __pyx_v_blo = values[5];
    __pyx_v_bhi = values[6];
    __pyx_v_clo = values[7];
    __pyx_v_chi = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elem_maximum", 0, 3, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1531, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.elem_maximum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_94elem_maximum(__pyx_self, __pyx_v_g_a, __pyx_v_g_b, __pyx_v_g_c, __pyx_v_alo, __pyx_v_ahi, __pyx_v_blo, __pyx_v_bhi, __pyx_v_clo, __pyx_v_chi);

  /* "miniga4py/ga.pyx":1531
 *                 g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def elem_maximum(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,             # <<<<<<<<<<<<<<
 *         bhi=None, clo=None, chi=None):
 *     """Computes the element-wise maximum of the two arrays.
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_94elem_maximum(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b, int __pyx_v_g_c, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi, PyObject *__pyx_v_clo, PyObject *__pyx_v_chi) {
  PyArrayObject *__pyx_v_alo_nd = 0;
  PyArrayObject *__pyx_v_ahi_nd = 0;
  PyArrayObject *__pyx_v_blo_nd = 0;
  PyArrayObject *__pyx_v_bhi_nd = 0;
  PyArrayObject *__pyx_v_clo_nd = 0;
  PyArrayObject *__pyx_v_chi_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ahi_nd;
  __Pyx_Buffer __pyx_pybuffer_ahi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_alo_nd;
  __Pyx_Buffer __pyx_pybuffer_alo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bhi_nd;
  __Pyx_Buffer __pyx_pybuffer_bhi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_blo_nd;
  __Pyx_Buffer __pyx_pybuffer_blo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_chi_nd;
  __Pyx_Buffer __pyx_pybuffer_chi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_clo_nd;
  __Pyx_Buffer __pyx_pybuffer_clo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyArrayObject *__pyx_t_14 = NULL;
  PyArrayObject *__pyx_t_15 = NULL;
  __Pyx_RefNannySetupContext("elem_maximum", 0);
  __pyx_pybuffer_alo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_alo_nd.refcount = 0;
  __pyx_pybuffernd_alo_nd.data = NULL;
  __pyx_pybuffernd_alo_nd.rcbuffer = &__pyx_pybuffer_alo_nd;
  __pyx_pybuffer_ahi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_ahi_nd.refcount = 0;
  __pyx_pybuffernd_ahi_nd.data = NULL;
  __pyx_pybuffernd_ahi_nd.rcbuffer = &__pyx_pybuffer_ahi_nd;
  __pyx_pybuffer_blo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_blo_nd.refcount = 0;
  __pyx_pybuffernd_blo_nd.data = NULL;
  __pyx_pybuffernd_blo_nd.rcbuffer = &__pyx_pybuffer_blo_nd;
  __pyx_pybuffer_bhi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_bhi_nd.refcount = 0;
  __pyx_pybuffernd_bhi_nd.data = NULL;
  __pyx_pybuffernd_bhi_nd.rcbuffer = &__pyx_pybuffer_bhi_nd;
  __pyx_pybuffer_clo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_clo_nd.refcount = 0;
  __pyx_pybuffernd_clo_nd.data = NULL;
  __pyx_pybuffernd_clo_nd.rcbuffer = &__pyx_pybuffer_clo_nd;
  __pyx_pybuffer_chi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_chi_nd.refcount = 0;
  __pyx_pybuffernd_chi_nd.data = NULL;
  __pyx_pybuffernd_chi_nd.rcbuffer = &__pyx_pybuffer_chi_nd;

  /* "miniga4py/ga.pyx":1572
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 */
  __pyx_t_2 = (__pyx_v_alo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":1573
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None             # <<<<<<<<<<<<<<
 *             and clo is None and chi is None):
 *         GA_Elem_maximum(g_a, g_b, g_c)
 */
  __pyx_t_3 = (__pyx_v_ahi == Py_None);

  /* "miniga4py/ga.pyx":1572
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 */
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":1573
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None             # <<<<<<<<<<<<<<
 *             and clo is None and chi is None):
 *         GA_Elem_maximum(g_a, g_b, g_c)
 */
  __pyx_t_2 = (__pyx_v_blo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":1574
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):             # <<<<<<<<<<<<<<
 *         GA_Elem_maximum(g_a, g_b, g_c)
 *     else:
 */
  __pyx_t_3 = (__pyx_v_bhi == Py_None);

  /* "miniga4py/ga.pyx":1573
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None             # <<<<<<<<<<<<<<
 *             and clo is None and chi is None):
 *         GA_Elem_maximum(g_a, g_b, g_c)
 */
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":1574
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):             # <<<<<<<<<<<<<<
 *         GA_Elem_maximum(g_a, g_b, g_c)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_clo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_chi == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "miniga4py/ga.pyx":1572
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 */
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":1575
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 *         GA_Elem_maximum(g_a, g_b, g_c)             # <<<<<<<<<<<<<<
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 */
    GA_Elem_maximum(__pyx_v_g_a, __pyx_v_g_b, __pyx_v_g_c);

    /* "miniga4py/ga.pyx":1572
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 */
    goto __pyx_L3;
  }

  /* "miniga4py/ga.pyx":1577
 *         GA_Elem_maximum(g_a, g_b, g_c)
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)             # <<<<<<<<<<<<<<
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_alo, __pyx_v_ahi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1577, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1577, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1577, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1577, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1577, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L11_unpacking_done;
      __pyx_L10_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1577, __pyx_L1_error)
      __pyx_L11_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1577, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1577, __pyx_L1_error)
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_alo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_alo_nd.diminfo[0].strides = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alo_nd.diminfo[0].shape = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1577, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_alo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ahi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_ahi_nd.diminfo[0].strides = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ahi_nd.diminfo[0].shape = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1577, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_ahi_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":1578
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)             # <<<<<<<<<<<<<<
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)
 *         GA_Elem_maximum_patch64(
 */
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_b, __pyx_v_blo, __pyx_v_bhi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1578, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1578, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1578, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1578, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1578, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L13_unpacking_done;
      __pyx_L12_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1578, __pyx_L1_error)
      __pyx_L13_unpacking_done:;
    }
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1578, __pyx_L1_error)
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1578, __pyx_L1_error)
    __pyx_t_14 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_blo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_blo_nd.diminfo[0].strides = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_blo_nd.diminfo[0].shape = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1578, __pyx_L1_error)
    }
    __pyx_t_14 = 0;
    __pyx_v_blo_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_14 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_bhi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_bhi_nd.diminfo[0].strides = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bhi_nd.diminfo[0].shape = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1578, __pyx_L1_error)
    }
    __pyx_t_14 = 0;
    __pyx_v_bhi_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "miniga4py/ga.pyx":1579
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)             # <<<<<<<<<<<<<<
 *         GA_Elem_maximum_patch64(
 *                 g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_c, __pyx_v_clo, __pyx_v_chi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1579, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1579, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1579, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1579, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1579, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L14_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L14_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1579, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L15_unpacking_done;
      __pyx_L14_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1579, __pyx_L1_error)
      __pyx_L15_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1579, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1579, __pyx_L1_error)
    __pyx_t_15 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_clo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_clo_nd.diminfo[0].strides = __pyx_pybuffernd_clo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_clo_nd.diminfo[0].shape = __pyx_pybuffernd_clo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1579, __pyx_L1_error)
    }
    __pyx_t_15 = 0;
    __pyx_v_clo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_15 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_chi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_chi_nd.diminfo[0].strides = __pyx_pybuffernd_chi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_chi_nd.diminfo[0].shape = __pyx_pybuffernd_chi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1579, __pyx_L1_error)
    }
    __pyx_t_15 = 0;
    __pyx_v_chi_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":1580
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)
 *         GA_Elem_maximum_patch64(             # <<<<<<<<<<<<<<
 *                 g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                 g_b, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data,
 */
    GA_Elem_maximum_patch64(__pyx_v_g_a, ((int64_t *)__pyx_v_alo_nd->data), ((int64_t *)__pyx_v_ahi_nd->data), __pyx_v_g_b, ((int64_t *)__pyx_v_blo_nd->data), ((int64_t *)__pyx_v_bhi_nd->data), __pyx_v_g_c, ((int64_t *)__pyx_v_clo_nd->data), ((int64_t *)__pyx_v_chi_nd->data));
  }
  __pyx_L3:;

  /* "miniga4py/ga.pyx":1531
 *                 g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def elem_maximum(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,             # <<<<<<<<<<<<<<
 *         bhi=None, clo=None, chi=None):
 *     """Computes the element-wise maximum of the two arrays.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.elem_maximum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_alo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_ahi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_blo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_bhi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_clo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_chi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1585
 *                 g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def elem_minimum(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,             # <<<<<<<<<<<<<<
 *         bhi=None, clo=None, chi=None):
 *     """Computes the element-wise minimum of the two arrays.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_97elem_minimum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_96elem_minimum[] = "elem_minimum(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None, bhi=None, clo=None, chi=None)\nComputes the element-wise minimum of the two arrays.\n\n    Arrays or array patches must be of the same types and same number of\n    elements. For two-dimensional arrays::\n\n        c(i,j)  = min(a(i,j),b(i,j))\n\n    If the data type is complex, then::\n\n        c(i,j).real = min{ |a(i,j)|, |b(i,j)|} while c(i,j).image = 0\n\n    The result (c) may replace one of the input arrays (a/b).\n\n    This is a collective operation. \n\n    :Parameters:\n        g_a : int\n            the array handle\n        g_b : int\n            the array handle\n        g_c : int\n            the array handle\n        alo : 1D array-like of integers\n            lower bound patch coordinates of g_a, inclusive\n        ahi : 1D array-like of integers\n            higher bound patch coordinates of g_a, exclusive\n        blo : 1D array-like of integers\n            lower bound patch coordinates of g_b, inclusive\n        bhi : 1D array-like of integers\n            higher bound patch coordinates of g_b, exclusive\n        clo : 1D array-like of integers\n            lower bound patch coordinates of g_c, inclusive\n        chi : 1D array-like of integers\n            higher bound patch coordinates of g_c, exclusive\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_97elem_minimum = {"elem_minimum", (PyCFunction)__pyx_pw_9miniga4py_2ga_97elem_minimum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_96elem_minimum};
static PyObject *__pyx_pw_9miniga4py_2ga_97elem_minimum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_b;
  int __pyx_v_g_c;
  PyObject *__pyx_v_alo = 0;
  PyObject *__pyx_v_ahi = 0;
  PyObject *__pyx_v_blo = 0;
  PyObject *__pyx_v_bhi = 0;
  PyObject *__pyx_v_clo = 0;
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elem_minimum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_b,&__pyx_n_s_g_c,&__pyx_n_s_alo,&__pyx_n_s_ahi,&__pyx_n_s_blo,&__pyx_n_s_bhi,&__pyx_n_s_clo,&__pyx_n_s_chi,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);

    /* "miniga4py/ga.pyx":1586
 * 
 * def elem_minimum(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,
 *         bhi=None, clo=None, chi=None):             # <<<<<<<<<<<<<<
 *     """Computes the element-wise minimum of the two arrays.
 * 
 */
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elem_minimum", 0, 3, 9, 1); __PYX_ERR(0, 1585, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_c)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elem_minimum", 0, 3, 9, 2); __PYX_ERR(0, 1585, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alo);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ahi);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_blo);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bhi);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clo);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chi);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elem_minimum") < 0)) __PYX_ERR(0, 1585, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1585, __pyx_L3_error)
    __pyx_v_g_b = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_b == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1585, __pyx_L3_error)
    __pyx_v_g_c = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_g_c == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1585, __pyx_L3_error)
    __pyx_v_alo = values[3];
    __pyx_v_ahi = values[4];
    __pyx_v_blo = values[5];
    __pyx_v_bhi = values[6];
    __pyx_v_clo = values[7];
    __pyx_v_chi = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elem_minimum", 0, 3, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1585, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.elem_minimum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_96elem_minimum(__pyx_self, __pyx_v_g_a, __pyx_v_g_b, __pyx_v_g_c, __pyx_v_alo, __pyx_v_ahi, __pyx_v_blo, __pyx_v_bhi, __pyx_v_clo, __pyx_v_chi);

  /* "miniga4py/ga.pyx":1585
 *                 g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def elem_minimum(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,             # <<<<<<<<<<<<<<
 *         bhi=None, clo=None, chi=None):
 *     """Computes the element-wise minimum of the two arrays.
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_96elem_minimum(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b, int __pyx_v_g_c, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi, PyObject *__pyx_v_clo, PyObject *__pyx_v_chi) {
  PyArrayObject *__pyx_v_alo_nd = 0;
  PyArrayObject *__pyx_v_ahi_nd = 0;
  PyArrayObject *__pyx_v_blo_nd = 0;
  PyArrayObject *__pyx_v_bhi_nd = 0;
  PyArrayObject *__pyx_v_clo_nd = 0;
  PyArrayObject *__pyx_v_chi_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ahi_nd;
  __Pyx_Buffer __pyx_pybuffer_ahi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_alo_nd;
  __Pyx_Buffer __pyx_pybuffer_alo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bhi_nd;
  __Pyx_Buffer __pyx_pybuffer_bhi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_blo_nd;
  __Pyx_Buffer __pyx_pybuffer_blo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_chi_nd;
  __Pyx_Buffer __pyx_pybuffer_chi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_clo_nd;
  __Pyx_Buffer __pyx_pybuffer_clo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyArrayObject *__pyx_t_14 = NULL;
  PyArrayObject *__pyx_t_15 = NULL;
  __Pyx_RefNannySetupContext("elem_minimum", 0);
  __pyx_pybuffer_alo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_alo_nd.refcount = 0;
  __pyx_pybuffernd_alo_nd.data = NULL;
  __pyx_pybuffernd_alo_nd.rcbuffer = &__pyx_pybuffer_alo_nd;
  __pyx_pybuffer_ahi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_ahi_nd.refcount = 0;
  __pyx_pybuffernd_ahi_nd.data = NULL;
  __pyx_pybuffernd_ahi_nd.rcbuffer = &__pyx_pybuffer_ahi_nd;
  __pyx_pybuffer_blo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_blo_nd.refcount = 0;
  __pyx_pybuffernd_blo_nd.data = NULL;
  __pyx_pybuffernd_blo_nd.rcbuffer = &__pyx_pybuffer_blo_nd;
  __pyx_pybuffer_bhi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_bhi_nd.refcount = 0;
  __pyx_pybuffernd_bhi_nd.data = NULL;
  __pyx_pybuffernd_bhi_nd.rcbuffer = &__pyx_pybuffer_bhi_nd;
  __pyx_pybuffer_clo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_clo_nd.refcount = 0;
  __pyx_pybuffernd_clo_nd.data = NULL;
  __pyx_pybuffernd_clo_nd.rcbuffer = &__pyx_pybuffer_clo_nd;
  __pyx_pybuffer_chi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_chi_nd.refcount = 0;
  __pyx_pybuffernd_chi_nd.data = NULL;
  __pyx_pybuffernd_chi_nd.rcbuffer = &__pyx_pybuffer_chi_nd;

  /* "miniga4py/ga.pyx":1626
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 */
  __pyx_t_2 = (__pyx_v_alo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":1627
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None             # <<<<<<<<<<<<<<
 *             and clo is None and chi is None):
 *         GA_Elem_minimum(g_a, g_b, g_c)
 */
  __pyx_t_3 = (__pyx_v_ahi == Py_None);

  /* "miniga4py/ga.pyx":1626
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 */
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":1627
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None             # <<<<<<<<<<<<<<
 *             and clo is None and chi is None):
 *         GA_Elem_minimum(g_a, g_b, g_c)
 */
  __pyx_t_2 = (__pyx_v_blo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":1628
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):             # <<<<<<<<<<<<<<
 *         GA_Elem_minimum(g_a, g_b, g_c)
 *     else:
 */
  __pyx_t_3 = (__pyx_v_bhi == Py_None);

  /* "miniga4py/ga.pyx":1627
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None             # <<<<<<<<<<<<<<
 *             and clo is None and chi is None):
 *         GA_Elem_minimum(g_a, g_b, g_c)
 */
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":1628
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):             # <<<<<<<<<<<<<<
 *         GA_Elem_minimum(g_a, g_b, g_c)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_clo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_chi == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "miniga4py/ga.pyx":1626
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 */
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":1629
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 *         GA_Elem_minimum(g_a, g_b, g_c)             # <<<<<<<<<<<<<<
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 */
    GA_Elem_minimum(__pyx_v_g_a, __pyx_v_g_b, __pyx_v_g_c);

    /* "miniga4py/ga.pyx":1626
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 */
    goto __pyx_L3;
  }

  /* "miniga4py/ga.pyx":1631
 *         GA_Elem_minimum(g_a, g_b, g_c)
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)             # <<<<<<<<<<<<<<
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_alo, __pyx_v_ahi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1631, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1631, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1631, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1631, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1631, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1631, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L11_unpacking_done;
      __pyx_L10_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1631, __pyx_L1_error)
      __pyx_L11_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1631, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1631, __pyx_L1_error)
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_alo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_alo_nd.diminfo[0].strides = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alo_nd.diminfo[0].shape = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1631, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_alo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ahi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_ahi_nd.diminfo[0].strides = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ahi_nd.diminfo[0].shape = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1631, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_ahi_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":1632
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)             # <<<<<<<<<<<<<<
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)
 *         GA_Elem_minimum_patch64(
 */
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_b, __pyx_v_blo, __pyx_v_bhi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1632, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1632, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1632, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1632, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1632, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L13_unpacking_done;
      __pyx_L12_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1632, __pyx_L1_error)
      __pyx_L13_unpacking_done:;
    }
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1632, __pyx_L1_error)
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1632, __pyx_L1_error)
    __pyx_t_14 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_blo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_blo_nd.diminfo[0].strides = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_blo_nd.diminfo[0].shape = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1632, __pyx_L1_error)
    }
    __pyx_t_14 = 0;
    __pyx_v_blo_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_14 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_bhi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_bhi_nd.diminfo[0].strides = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bhi_nd.diminfo[0].shape = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1632, __pyx_L1_error)
    }
    __pyx_t_14 = 0;
    __pyx_v_bhi_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "miniga4py/ga.pyx":1633
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)             # <<<<<<<<<<<<<<
 *         GA_Elem_minimum_patch64(
 *                 g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_c, __pyx_v_clo, __pyx_v_chi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1633, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1633, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1633, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1633, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1633, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L14_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L14_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1633, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L15_unpacking_done;
      __pyx_L14_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1633, __pyx_L1_error)
      __pyx_L15_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1633, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1633, __pyx_L1_error)
    __pyx_t_15 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_clo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_clo_nd.diminfo[0].strides = __pyx_pybuffernd_clo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_clo_nd.diminfo[0].shape = __pyx_pybuffernd_clo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1633, __pyx_L1_error)
    }
    __pyx_t_15 = 0;
    __pyx_v_clo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_15 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_chi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_chi_nd.diminfo[0].strides = __pyx_pybuffernd_chi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_chi_nd.diminfo[0].shape = __pyx_pybuffernd_chi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1633, __pyx_L1_error)
    }
    __pyx_t_15 = 0;
    __pyx_v_chi_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":1634
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)
 *         GA_Elem_minimum_patch64(             # <<<<<<<<<<<<<<
 *                 g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                 g_b, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data,
 */
    GA_Elem_minimum_patch64(__pyx_v_g_a, ((int64_t *)__pyx_v_alo_nd->data), ((int64_t *)__pyx_v_ahi_nd->data), __pyx_v_g_b, ((int64_t *)__pyx_v_blo_nd->data), ((int64_t *)__pyx_v_bhi_nd->data), __pyx_v_g_c, ((int64_t *)__pyx_v_clo_nd->data), ((int64_t *)__pyx_v_chi_nd->data));
  }
  __pyx_L3:;

  /* "miniga4py/ga.pyx":1585
 *                 g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def elem_minimum(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,             # <<<<<<<<<<<<<<
 *         bhi=None, clo=None, chi=None):
 *     """Computes the element-wise minimum of the two arrays.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.elem_minimum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_alo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_ahi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_blo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_bhi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_clo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_chi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1639
 *                 g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def elem_multiply(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,             # <<<<<<<<<<<<<<
 *         bhi=None, clo=None, chi=None):
 *     """Computes the element-wise product of the two arrays.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_99elem_multiply(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_98elem_multiply[] = "elem_multiply(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None, bhi=None, clo=None, chi=None)\nComputes the element-wise product of the two arrays.\n\n    Arrays or array patches must be of the same types and same number of\n    elements. For two-dimensional arrays:\n\n                c(i, j)  = a(i,j)*b(i,j)\n\n    The result (c) may replace one of the input arrays (a/b).\n\n    This is a collective operation. \n\n    :Parameters:\n        g_a : int\n            the array handle\n        g_b : int\n            the array handle\n        g_c : int\n            the array handle\n        alo : 1D array-like of integers\n            lower bound patch coordinates of g_a, inclusive\n        ahi : 1D array-like of integers\n            higher bound patch coordinates of g_a, exclusive\n        blo : 1D array-like of integers\n            lower bound patch coordinates of g_b, inclusive\n        bhi : 1D array-like of integers\n            higher bound patch coordinates of g_b, exclusive\n        clo : 1D array-like of integers\n            lower bound patch coordinates of g_c, inclusive\n        chi : 1D array-like of integers\n            higher bound patch coordinates of g_c, exclusive\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_99elem_multiply = {"elem_multiply", (PyCFunction)__pyx_pw_9miniga4py_2ga_99elem_multiply, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_98elem_multiply};
static PyObject *__pyx_pw_9miniga4py_2ga_99elem_multiply(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_b;
  int __pyx_v_g_c;
  PyObject *__pyx_v_alo = 0;
  PyObject *__pyx_v_ahi = 0;
  PyObject *__pyx_v_blo = 0;
  PyObject *__pyx_v_bhi = 0;
  PyObject *__pyx_v_clo = 0;
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elem_multiply (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_b,&__pyx_n_s_g_c,&__pyx_n_s_alo,&__pyx_n_s_ahi,&__pyx_n_s_blo,&__pyx_n_s_bhi,&__pyx_n_s_clo,&__pyx_n_s_chi,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);

    /* "miniga4py/ga.pyx":1640
 * 
 * def elem_multiply(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,
 *         bhi=None, clo=None, chi=None):             # <<<<<<<<<<<<<<
 *     """Computes the element-wise product of the two arrays.
 * 
 */
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elem_multiply", 0, 3, 9, 1); __PYX_ERR(0, 1639, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_c)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elem_multiply", 0, 3, 9, 2); __PYX_ERR(0, 1639, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alo);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ahi);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_blo);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bhi);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clo);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chi);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elem_multiply") < 0)) __PYX_ERR(0, 1639, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1639, __pyx_L3_error)
    __pyx_v_g_b = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_b == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1639, __pyx_L3_error)
    __pyx_v_g_c = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_g_c == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1639, __pyx_L3_error)
    __pyx_v_alo = values[3];
    __pyx_v_ahi = values[4];
    __pyx_v_blo = values[5];
    __pyx_v_bhi = values[6];
    __pyx_v_clo = values[7];
    __pyx_v_chi = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elem_multiply", 0, 3, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1639, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.elem_multiply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_98elem_multiply(__pyx_self, __pyx_v_g_a, __pyx_v_g_b, __pyx_v_g_c, __pyx_v_alo, __pyx_v_ahi, __pyx_v_blo, __pyx_v_bhi, __pyx_v_clo, __pyx_v_chi);

  /* "miniga4py/ga.pyx":1639
 *                 g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def elem_multiply(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,             # <<<<<<<<<<<<<<
 *         bhi=None, clo=None, chi=None):
 *     """Computes the element-wise product of the two arrays.
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_98elem_multiply(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b, int __pyx_v_g_c, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi, PyObject *__pyx_v_clo, PyObject *__pyx_v_chi) {
  PyArrayObject *__pyx_v_alo_nd = 0;
  PyArrayObject *__pyx_v_ahi_nd = 0;
  PyArrayObject *__pyx_v_blo_nd = 0;
  PyArrayObject *__pyx_v_bhi_nd = 0;
  PyArrayObject *__pyx_v_clo_nd = 0;
  PyArrayObject *__pyx_v_chi_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ahi_nd;
  __Pyx_Buffer __pyx_pybuffer_ahi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_alo_nd;
  __Pyx_Buffer __pyx_pybuffer_alo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bhi_nd;
  __Pyx_Buffer __pyx_pybuffer_bhi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_blo_nd;
  __Pyx_Buffer __pyx_pybuffer_blo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_chi_nd;
  __Pyx_Buffer __pyx_pybuffer_chi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_clo_nd;
  __Pyx_Buffer __pyx_pybuffer_clo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyArrayObject *__pyx_t_14 = NULL;
  PyArrayObject *__pyx_t_15 = NULL;
  __Pyx_RefNannySetupContext("elem_multiply", 0);
  __pyx_pybuffer_alo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_alo_nd.refcount = 0;
  __pyx_pybuffernd_alo_nd.data = NULL;
  __pyx_pybuffernd_alo_nd.rcbuffer = &__pyx_pybuffer_alo_nd;
  __pyx_pybuffer_ahi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_ahi_nd.refcount = 0;
  __pyx_pybuffernd_ahi_nd.data = NULL;
  __pyx_pybuffernd_ahi_nd.rcbuffer = &__pyx_pybuffer_ahi_nd;
  __pyx_pybuffer_blo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_blo_nd.refcount = 0;
  __pyx_pybuffernd_blo_nd.data = NULL;
  __pyx_pybuffernd_blo_nd.rcbuffer = &__pyx_pybuffer_blo_nd;
  __pyx_pybuffer_bhi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_bhi_nd.refcount = 0;
  __pyx_pybuffernd_bhi_nd.data = NULL;
  __pyx_pybuffernd_bhi_nd.rcbuffer = &__pyx_pybuffer_bhi_nd;
  __pyx_pybuffer_clo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_clo_nd.refcount = 0;
  __pyx_pybuffernd_clo_nd.data = NULL;
  __pyx_pybuffernd_clo_nd.rcbuffer = &__pyx_pybuffer_clo_nd;
  __pyx_pybuffer_chi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_chi_nd.refcount = 0;
  __pyx_pybuffernd_chi_nd.data = NULL;
  __pyx_pybuffernd_chi_nd.rcbuffer = &__pyx_pybuffer_chi_nd;

  /* "miniga4py/ga.pyx":1676
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 */
  __pyx_t_2 = (__pyx_v_alo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":1677
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None             # <<<<<<<<<<<<<<
 *             and clo is None and chi is None):
 *         GA_Elem_multiply(g_a, g_b, g_c)
 */
  __pyx_t_3 = (__pyx_v_ahi == Py_None);

  /* "miniga4py/ga.pyx":1676
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 */
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":1677
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None             # <<<<<<<<<<<<<<
 *             and clo is None and chi is None):
 *         GA_Elem_multiply(g_a, g_b, g_c)
 */
  __pyx_t_2 = (__pyx_v_blo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":1678
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):             # <<<<<<<<<<<<<<
 *         GA_Elem_multiply(g_a, g_b, g_c)
 *     else:
 */
  __pyx_t_3 = (__pyx_v_bhi == Py_None);

  /* "miniga4py/ga.pyx":1677
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None             # <<<<<<<<<<<<<<
 *             and clo is None and chi is None):
 *         GA_Elem_multiply(g_a, g_b, g_c)
 */
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":1678
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):             # <<<<<<<<<<<<<<
 *         GA_Elem_multiply(g_a, g_b, g_c)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_clo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_chi == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "miniga4py/ga.pyx":1676
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 */
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":1679
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 *         GA_Elem_multiply(g_a, g_b, g_c)             # <<<<<<<<<<<<<<
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 */
    GA_Elem_multiply(__pyx_v_g_a, __pyx_v_g_b, __pyx_v_g_c);

    /* "miniga4py/ga.pyx":1676
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None):
 */
    goto __pyx_L3;
  }

  /* "miniga4py/ga.pyx":1681
 *         GA_Elem_multiply(g_a, g_b, g_c)
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)             # <<<<<<<<<<<<<<
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_alo, __pyx_v_ahi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1681, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1681, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1681, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1681, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1681, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1681, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L11_unpacking_done;
      __pyx_L10_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1681, __pyx_L1_error)
      __pyx_L11_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1681, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1681, __pyx_L1_error)
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_alo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_alo_nd.diminfo[0].strides = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alo_nd.diminfo[0].shape = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1681, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_alo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ahi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_ahi_nd.diminfo[0].strides = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ahi_nd.diminfo[0].shape = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1681, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_ahi_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":1682
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)             # <<<<<<<<<<<<<<
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)
 *         GA_Elem_multiply_patch64(
 */
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_b, __pyx_v_blo, __pyx_v_bhi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1682, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1682, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1682, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1682, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1682, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1682, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L13_unpacking_done;
      __pyx_L12_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1682, __pyx_L1_error)
      __pyx_L13_unpacking_done:;
    }
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1682, __pyx_L1_error)
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1682, __pyx_L1_error)
    __pyx_t_14 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_blo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_blo_nd.diminfo[0].strides = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_blo_nd.diminfo[0].shape = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1682, __pyx_L1_error)
    }
    __pyx_t_14 = 0;
    __pyx_v_blo_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_14 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_bhi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_bhi_nd.diminfo[0].strides = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bhi_nd.diminfo[0].shape = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1682, __pyx_L1_error)
    }
    __pyx_t_14 = 0;
    __pyx_v_bhi_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "miniga4py/ga.pyx":1683
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)             # <<<<<<<<<<<<<<
 *         GA_Elem_multiply_patch64(
 *                 g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_c, __pyx_v_clo, __pyx_v_chi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1683, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1683, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1683, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1683, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1683, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L14_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L14_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1683, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L15_unpacking_done;
      __pyx_L14_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1683, __pyx_L1_error)
      __pyx_L15_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1683, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1683, __pyx_L1_error)
    __pyx_t_15 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_clo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_clo_nd.diminfo[0].strides = __pyx_pybuffernd_clo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_clo_nd.diminfo[0].shape = __pyx_pybuffernd_clo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1683, __pyx_L1_error)
    }
    __pyx_t_15 = 0;
    __pyx_v_clo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_15 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_chi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_chi_nd.diminfo[0].strides = __pyx_pybuffernd_chi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_chi_nd.diminfo[0].shape = __pyx_pybuffernd_chi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1683, __pyx_L1_error)
    }
    __pyx_t_15 = 0;
    __pyx_v_chi_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":1684
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)
 *         GA_Elem_multiply_patch64(             # <<<<<<<<<<<<<<
 *                 g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                 g_b, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data,
 */
    GA_Elem_multiply_patch64(__pyx_v_g_a, ((int64_t *)__pyx_v_alo_nd->data), ((int64_t *)__pyx_v_ahi_nd->data), __pyx_v_g_b, ((int64_t *)__pyx_v_blo_nd->data), ((int64_t *)__pyx_v_bhi_nd->data), __pyx_v_g_c, ((int64_t *)__pyx_v_clo_nd->data), ((int64_t *)__pyx_v_chi_nd->data));
  }
  __pyx_L3:;

  /* "miniga4py/ga.pyx":1639
 *                 g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def elem_multiply(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,             # <<<<<<<<<<<<<<
 *         bhi=None, clo=None, chi=None):
 *     """Computes the element-wise product of the two arrays.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.elem_multiply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_alo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_ahi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_blo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_bhi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_clo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_chi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1689
 *                 g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def error(message, int code=1):             # <<<<<<<<<<<<<<
 *     """Prints message and aborts safely with code."""
 *     GA_Error(b(message), code)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_101error(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_100error[] = "error(message, int code=1)\nPrints message and aborts safely with code.";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_101error = {"error", (PyCFunction)__pyx_pw_9miniga4py_2ga_101error, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_100error};
static PyObject *__pyx_pw_9miniga4py_2ga_101error(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_message = 0;
  int __pyx_v_code;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("error (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_message,&__pyx_n_s_code,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_message)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_code);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "error") < 0)) __PYX_ERR(0, 1689, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_message = values[0];
    if (values[1]) {
      __pyx_v_code = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_code == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1689, __pyx_L3_error)
    } else {
      __pyx_v_code = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("error", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1689, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_100error(__pyx_self, __pyx_v_message, __pyx_v_code);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_100error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_message, int __pyx_v_code) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  char *__pyx_t_5;
  __Pyx_RefNannySetupContext("error", 0);

  /* "miniga4py/ga.pyx":1691
 * def error(message, int code=1):
 *     """Prints message and aborts safely with code."""
 *     GA_Error(b(message), code)             # <<<<<<<<<<<<<<
 * 
 * def fence():
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1691, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_message};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1691, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_message};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1691, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1691, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_message);
      __Pyx_GIVEREF(__pyx_v_message);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_message);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1691, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_AsWritableString(__pyx_t_1); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 1691, __pyx_L1_error)
  GA_Error(__pyx_t_5, __pyx_v_code);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":1689
 *                 g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def error(message, int code=1):             # <<<<<<<<<<<<<<
 *     """Prints message and aborts safely with code."""
 *     GA_Error(b(message), code)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("miniga4py.ga.error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1693
 *     GA_Error(b(message), code)
 * 
 * def fence():             # <<<<<<<<<<<<<<
 *     """Blocks the calling process until all the data transfers corresponding
 *     to GA operations called after ga.init_fence() complete.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_103fence(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_102fence[] = "fence()\nBlocks the calling process until all the data transfers corresponding\n    to GA operations called after ga.init_fence() complete.\n    \n    For example, since ga.put might return before the data reaches the final\n    destination, ga_init_fence and ga_fence allow processes to wait until the\n    data tranfer is fully completed:\n\n        ga.init_fence()\n        ga.put(g_a, ...)\n        ga.fence()\n\n    ga.fence() must be called after ga.init_fence(). A barrier, ga.sync(),\n    assures completion of all data transfers and implicitly cancels all\n    outstanding ga.init_fence() calls. ga.init_fence() and ga.fence() must be\n    used in pairs, multiple calls to ga.fence() require the same number of\n    corresponding ga.init_fence() calls. ga.init_fence()/ga_fence() pairs can\n    be nested.\n\n    ga.fence() works for multiple GA operations. For example:\n\n        ga.init_fence()\n        ga.put(g_a, ...)\n        ga.scatter(g_a, ...)\n        ga.put(g_b, ...)\n        ga.fence()\n\n    The calling process will be blocked until data movements initiated by two\n    calls to ga_put and one ga_scatter complete.\n    \n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_103fence = {"fence", (PyCFunction)__pyx_pw_9miniga4py_2ga_103fence, METH_NOARGS, __pyx_doc_9miniga4py_2ga_102fence};
static PyObject *__pyx_pw_9miniga4py_2ga_103fence(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fence (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_102fence(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_102fence(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fence", 0);

  /* "miniga4py/ga.pyx":1724
 * 
 *     """
 *     GA_Fence()             # <<<<<<<<<<<<<<
 * 
 * def fill(int g_a, value, lo=None, hi=None):
 */
  GA_Fence();

  /* "miniga4py/ga.pyx":1693
 *     GA_Error(b(message), code)
 * 
 * def fence():             # <<<<<<<<<<<<<<
 *     """Blocks the calling process until all the data transfers corresponding
 *     to GA operations called after ga.init_fence() complete.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1726
 *     GA_Fence()
 * 
 * def fill(int g_a, value, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Assign a single value to all elements in the array or patch.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_105fill(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_104fill[] = "fill(int g_a, value, lo=None, hi=None)\nAssign a single value to all elements in the array or patch.\n    \n    :Parameters:\n        g_a : int\n            the array handle\n        lo : 1D array-like of integers\n            lower bound patch coordinates, inclusive\n        hi : 1D array-like of integers\n            higher bound patch coordinates, exclusive\n    \n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_105fill = {"fill", (PyCFunction)__pyx_pw_9miniga4py_2ga_105fill, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_104fill};
static PyObject *__pyx_pw_9miniga4py_2ga_105fill(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fill (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_value,&__pyx_n_s_lo,&__pyx_n_s_hi,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fill", 0, 2, 4, 1); __PYX_ERR(0, 1726, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fill") < 0)) __PYX_ERR(0, 1726, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1726, __pyx_L3_error)
    __pyx_v_value = values[1];
    __pyx_v_lo = values[2];
    __pyx_v_hi = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fill", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1726, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.fill", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_104fill(__pyx_self, __pyx_v_g_a, __pyx_v_value, __pyx_v_lo, __pyx_v_hi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_104fill(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_value, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
  PyArrayObject *__pyx_v_lo_nd = 0;
  PyArrayObject *__pyx_v_hi_nd = 0;
  int __pyx_v_ivalue;
  long __pyx_v_lvalue;
  PY_LONG_LONG __pyx_v_llvalue;
  float __pyx_v_fvalue;
  double __pyx_v_dvalue;
  long double __pyx_v_ldvalue;
  SingleComplex __pyx_v_fcvalue;
  DoubleComplex __pyx_v_dcvalue;
  void *__pyx_v_vvalue;
  int __pyx_v_gtype;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_nd;
  __Pyx_Buffer __pyx_pybuffer_hi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lo_nd;
  __Pyx_Buffer __pyx_pybuffer_lo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  __Pyx_RefNannySetupContext("fill", 0);
  __pyx_pybuffer_lo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_lo_nd.refcount = 0;
  __pyx_pybuffernd_lo_nd.data = NULL;
  __pyx_pybuffernd_lo_nd.rcbuffer = &__pyx_pybuffer_lo_nd;
  __pyx_pybuffer_hi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_nd.refcount = 0;
  __pyx_pybuffernd_hi_nd.data = NULL;
  __pyx_pybuffernd_hi_nd.rcbuffer = &__pyx_pybuffer_hi_nd;

  /* "miniga4py/ga.pyx":1748
 *     cdef DoubleComplex  dcvalue
 *     cdef void          *vvalue
 *     cdef int gtype=inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     vvalue = _convert_multiplier(gtype, value,
 *             &ivalue,  &lvalue,  &llvalue,
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":1749
 *     cdef void          *vvalue
 *     cdef int gtype=inquire_type(g_a)
 *     vvalue = _convert_multiplier(gtype, value,             # <<<<<<<<<<<<<<
 *             &ivalue,  &lvalue,  &llvalue,
 *             &fvalue,  &dvalue,  &ldvalue,
 */
  __pyx_v_vvalue = __pyx_f_9miniga4py_2ga__convert_multiplier(__pyx_v_gtype, __pyx_v_value, (&__pyx_v_ivalue), (&__pyx_v_lvalue), (&__pyx_v_llvalue), (&__pyx_v_fvalue), (&__pyx_v_dvalue), (&__pyx_v_ldvalue), (&__pyx_v_fcvalue), (&__pyx_v_dcvalue));

  /* "miniga4py/ga.pyx":1753
 *             &fvalue,  &dvalue,  &ldvalue,
 *             &fcvalue, &dcvalue)
 *     if lo is None and hi is None:             # <<<<<<<<<<<<<<
 *         GA_Fill(g_a, vvalue)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_lo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_hi == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":1754
 *             &fcvalue, &dcvalue)
 *     if lo is None and hi is None:
 *         GA_Fill(g_a, vvalue)             # <<<<<<<<<<<<<<
 *     else:
 *         lo_nd,hi_nd = _lohi(g_a,lo,hi)
 */
    GA_Fill(__pyx_v_g_a, __pyx_v_vvalue);

    /* "miniga4py/ga.pyx":1753
 *             &fvalue,  &dvalue,  &ldvalue,
 *             &fcvalue, &dcvalue)
 *     if lo is None and hi is None:             # <<<<<<<<<<<<<<
 *         GA_Fill(g_a, vvalue)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "miniga4py/ga.pyx":1756
 *         GA_Fill(g_a, vvalue)
 *     else:
 *         lo_nd,hi_nd = _lohi(g_a,lo,hi)             # <<<<<<<<<<<<<<
 *         NGA_Fill_patch64(
 *                 g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, vvalue)
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_lo, __pyx_v_hi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1756, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1756, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1756, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1756, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1756, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1756, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1756, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1756, __pyx_L1_error)
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_lo_nd.diminfo[0].strides = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_nd.diminfo[0].shape = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1756, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_lo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1756, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":1757
 *     else:
 *         lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *         NGA_Fill_patch64(             # <<<<<<<<<<<<<<
 *                 g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, vvalue)
 * 
 */
    NGA_Fill_patch64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data), __pyx_v_vvalue);
  }
  __pyx_L3:;

  /* "miniga4py/ga.pyx":1726
 *     GA_Fence()
 * 
 * def fill(int g_a, value, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Assign a single value to all elements in the array or patch.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.fill", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1760
 *                 g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, vvalue)
 * 
 * def gather(int g_a, subsarray, np.ndarray values=None):             # <<<<<<<<<<<<<<
 *     """Gathers array elements from a global array into a local array.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_107gather(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_106gather[] = "gather(int g_a, subsarray, ndarray values=None)\nGathers array elements from a global array into a local array.\n\n    subsarray will be converted to an ndarray if it is not one already.  A\n    two-dimensional array is allowed so long as its shape is (n,ndim) where n\n    is the number of elements to gather and ndim is the number of dimensions\n    of the target array.  Also, subsarray must be contiguous.\n\n    For example, if the subsarray were two-dimensional::\n\n        for k in range(n):\n            v[k] = g_a[subsarray[k,0],subsarray[k,1],subsarray[k,2]...]\n\n    For example, if the subsarray were one-dimensional::\n\n        for k in range(n):\n            base = n*ndim\n            v[k] = g_a[subsarray[base+0],subsarray[base+1],subsarray[base+2]...]\n\n    This is a one-sided operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_107gather = {"gather", (PyCFunction)__pyx_pw_9miniga4py_2ga_107gather, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_106gather};
static PyObject *__pyx_pw_9miniga4py_2ga_107gather(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_subsarray = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gather (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_subsarray,&__pyx_n_s_values,0};
    PyObject* values[3] = {0,0,0};
    values[2] = (PyObject *)((PyArrayObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_subsarray)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("gather", 0, 2, 3, 1); __PYX_ERR(0, 1760, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_values);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gather") < 0)) __PYX_ERR(0, 1760, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1760, __pyx_L3_error)
    __pyx_v_subsarray = values[1];
    __pyx_v_values = ((PyArrayObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gather", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1760, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.gather", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) __PYX_ERR(0, 1760, __pyx_L1_error)
  __pyx_r = __pyx_pf_9miniga4py_2ga_106gather(__pyx_self, __pyx_v_g_a, __pyx_v_subsarray, __pyx_v_values);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_106gather(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_subsarray, PyArrayObject *__pyx_v_values) {
  PyArrayObject *__pyx_v_subsarray1_nd = 0;
  PyArrayObject *__pyx_v_subsarray2_nd = 0;
  int __pyx_v_gtype;
  int __pyx_v_ndim;
  int64_t __pyx_v_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_subsarray1_nd;
  __Pyx_Buffer __pyx_pybuffer_subsarray1_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_subsarray2_nd;
  __Pyx_Buffer __pyx_pybuffer_subsarray2_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyArrayObject *__pyx_t_1 = NULL;
  PyArrayObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  Py_ssize_t __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  int __pyx_t_22;
  int __pyx_t_23;
  __Pyx_RefNannySetupContext("gather", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_values);
  __pyx_pybuffer_subsarray1_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_subsarray1_nd.refcount = 0;
  __pyx_pybuffernd_subsarray1_nd.data = NULL;
  __pyx_pybuffernd_subsarray1_nd.rcbuffer = &__pyx_pybuffer_subsarray1_nd;
  __pyx_pybuffer_subsarray2_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_subsarray2_nd.refcount = 0;
  __pyx_pybuffernd_subsarray2_nd.data = NULL;
  __pyx_pybuffernd_subsarray2_nd.rcbuffer = &__pyx_pybuffer_subsarray2_nd;

  /* "miniga4py/ga.pyx":1782
 * 
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] subsarray1_nd = None             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[np.int64_t, ndim=2] subsarray2_nd = None
 *     cdef int gtype = inquire_type(g_a)
 */
  __pyx_t_1 = ((PyArrayObject *)Py_None);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_subsarray1_nd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1782, __pyx_L1_error)
    } else {__pyx_pybuffernd_subsarray1_nd.diminfo[0].strides = __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subsarray1_nd.diminfo[0].shape = __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_1 = 0;
  __Pyx_INCREF(Py_None);
  __pyx_v_subsarray1_nd = ((PyArrayObject *)Py_None);

  /* "miniga4py/ga.pyx":1783
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] subsarray1_nd = None
 *     cdef np.ndarray[np.int64_t, ndim=2] subsarray2_nd = None             # <<<<<<<<<<<<<<
 *     cdef int gtype = inquire_type(g_a)
 *     cdef int ndim = GA_Ndim(g_a)
 */
  __pyx_t_2 = ((PyArrayObject *)Py_None);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_subsarray2_nd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1783, __pyx_L1_error)
    } else {__pyx_pybuffernd_subsarray2_nd.diminfo[0].strides = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subsarray2_nd.diminfo[0].shape = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_subsarray2_nd.diminfo[1].strides = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_subsarray2_nd.diminfo[1].shape = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_2 = 0;
  __Pyx_INCREF(Py_None);
  __pyx_v_subsarray2_nd = ((PyArrayObject *)Py_None);

  /* "miniga4py/ga.pyx":1784
 *     cdef np.ndarray[np.int64_t, ndim=1] subsarray1_nd = None
 *     cdef np.ndarray[np.int64_t, ndim=2] subsarray2_nd = None
 *     cdef int gtype = inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     cdef int ndim = GA_Ndim(g_a)
 *     cdef int64_t n
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":1785
 *     cdef np.ndarray[np.int64_t, ndim=2] subsarray2_nd = None
 *     cdef int gtype = inquire_type(g_a)
 *     cdef int ndim = GA_Ndim(g_a)             # <<<<<<<<<<<<<<
 *     cdef int64_t n
 *     # prepare subsarray
 */
  __pyx_v_ndim = GA_Ndim(__pyx_v_g_a);

  /* "miniga4py/ga.pyx":1788
 *     cdef int64_t n
 *     # prepare subsarray
 *     try:             # <<<<<<<<<<<<<<
 *         subsarray1_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *         n = len(subsarray1_nd) / ndim
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "miniga4py/ga.pyx":1789
 *     # prepare subsarray
 *     try:
 *         subsarray1_nd = np.ascontiguousarray(subsarray, dtype=np.int64)             # <<<<<<<<<<<<<<
 *         n = len(subsarray1_nd) / ndim
 *     except ValueError:
 */
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1789, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1789, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1789, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_subsarray);
      __Pyx_GIVEREF(__pyx_v_subsarray);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_subsarray);
      __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1789, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1789, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_int64); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1789, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 1789, __pyx_L3_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1789, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1789, __pyx_L3_error)
      __pyx_t_1 = ((PyArrayObject *)__pyx_t_10);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer);
        __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_11 < 0)) {
          PyErr_Fetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_subsarray1_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
          }
          __pyx_t_12 = __pyx_t_13 = __pyx_t_14 = 0;
        }
        __pyx_pybuffernd_subsarray1_nd.diminfo[0].strides = __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subsarray1_nd.diminfo[0].shape = __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1789, __pyx_L3_error)
      }
      __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_subsarray1_nd, ((PyArrayObject *)__pyx_t_10));
      __pyx_t_10 = 0;

      /* "miniga4py/ga.pyx":1790
 *     try:
 *         subsarray1_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *         n = len(subsarray1_nd) / ndim             # <<<<<<<<<<<<<<
 *     except ValueError:
 *         subsarray1_nd = None
 */
      __pyx_t_15 = PyObject_Length(((PyObject *)__pyx_v_subsarray1_nd)); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1790, __pyx_L3_error)
      if (unlikely(__pyx_v_ndim == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
        __PYX_ERR(0, 1790, __pyx_L3_error)
      }
      else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_ndim == (int)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_15))) {
        PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
        __PYX_ERR(0, 1790, __pyx_L3_error)
      }
      __pyx_v_n = __Pyx_div_Py_ssize_t(__pyx_t_15, __pyx_v_ndim);

      /* "miniga4py/ga.pyx":1788
 *     cdef int64_t n
 *     # prepare subsarray
 *     try:             # <<<<<<<<<<<<<<
 *         subsarray1_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *         n = len(subsarray1_nd) / ndim
 */
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "miniga4py/ga.pyx":1791
 *         subsarray1_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *         n = len(subsarray1_nd) / ndim
 *     except ValueError:             # <<<<<<<<<<<<<<
 *         subsarray1_nd = None
 *         try:
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_11) {
      __Pyx_AddTraceback("miniga4py.ga.gather", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(0, 1791, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_6);

      /* "miniga4py/ga.pyx":1792
 *         n = len(subsarray1_nd) / ndim
 *     except ValueError:
 *         subsarray1_nd = None             # <<<<<<<<<<<<<<
 *         try:
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 */
      __pyx_t_1 = ((PyArrayObject *)Py_None);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer);
        __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_11 < 0)) {
          PyErr_Fetch(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_subsarray1_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_14, __pyx_t_13, __pyx_t_12);
          }
          __pyx_t_14 = __pyx_t_13 = __pyx_t_12 = 0;
        }
        __pyx_pybuffernd_subsarray1_nd.diminfo[0].strides = __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subsarray1_nd.diminfo[0].shape = __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1792, __pyx_L5_except_error)
      }
      __pyx_t_1 = 0;
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF_SET(__pyx_v_subsarray1_nd, ((PyArrayObject *)Py_None));

      /* "miniga4py/ga.pyx":1793
 *     except ValueError:
 *         subsarray1_nd = None
 *         try:             # <<<<<<<<<<<<<<
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
        __Pyx_XGOTREF(__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_13);
        __Pyx_XGOTREF(__pyx_t_14);
        /*try:*/ {

          /* "miniga4py/ga.pyx":1794
 *         subsarray1_nd = None
 *         try:
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)             # <<<<<<<<<<<<<<
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 *         except ValueError:
 */
          __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1794, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1794, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1794, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_INCREF(__pyx_v_subsarray);
          __Pyx_GIVEREF(__pyx_v_subsarray);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_subsarray);
          __pyx_t_16 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1794, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_16);
          __pyx_t_17 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1794, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_17);
          __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_int64); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1794, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_18);
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_dtype, __pyx_t_18) < 0) __PYX_ERR(0, 1794, __pyx_L11_error)
          __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
          __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, __pyx_t_16); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1794, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_18);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          if (!(likely(((__pyx_t_18) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_18, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1794, __pyx_L11_error)
          __pyx_t_2 = ((PyArrayObject *)__pyx_t_18);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer);
            __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_11 < 0)) {
              PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_subsarray2_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
              }
              __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
            }
            __pyx_pybuffernd_subsarray2_nd.diminfo[0].strides = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subsarray2_nd.diminfo[0].shape = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_subsarray2_nd.diminfo[1].strides = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_subsarray2_nd.diminfo[1].shape = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1794, __pyx_L11_error)
          }
          __pyx_t_2 = 0;
          __Pyx_DECREF_SET(__pyx_v_subsarray2_nd, ((PyArrayObject *)__pyx_t_18));
          __pyx_t_18 = 0;

          /* "miniga4py/ga.pyx":1795
 *         try:
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd             # <<<<<<<<<<<<<<
 *         except ValueError:
 *             raise ValueError("subsarray must be either 1- or 2-dimensional")
 */
          __pyx_t_15 = PyObject_Length(((PyObject *)__pyx_v_subsarray2_nd)); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1795, __pyx_L11_error)
          __pyx_v_n = __pyx_t_15;

          /* "miniga4py/ga.pyx":1793
 *     except ValueError:
 *         subsarray1_nd = None
 *         try:             # <<<<<<<<<<<<<<
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 */
        }
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        goto __pyx_L18_try_end;
        __pyx_L11_error:;
        __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;

        /* "miniga4py/ga.pyx":1796
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 *         except ValueError:             # <<<<<<<<<<<<<<
 *             raise ValueError("subsarray must be either 1- or 2-dimensional")
 *     # prepare values array
 */
        __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
        if (__pyx_t_11) {
          __Pyx_AddTraceback("miniga4py.ga.gather", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_18, &__pyx_t_16, &__pyx_t_7) < 0) __PYX_ERR(0, 1796, __pyx_L13_except_error)
          __Pyx_GOTREF(__pyx_t_18);
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_GOTREF(__pyx_t_7);

          /* "miniga4py/ga.pyx":1797
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 *         except ValueError:
 *             raise ValueError("subsarray must be either 1- or 2-dimensional")             # <<<<<<<<<<<<<<
 *     # prepare values array
 *     if values is None:
 */
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1797, __pyx_L13_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_Raise(__pyx_t_9, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __PYX_ERR(0, 1797, __pyx_L13_except_error)
        }
        goto __pyx_L13_except_error;
        __pyx_L13_except_error:;

        /* "miniga4py/ga.pyx":1793
 *     except ValueError:
 *         subsarray1_nd = None
 *         try:             # <<<<<<<<<<<<<<
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 */
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
        goto __pyx_L5_except_error;
        __pyx_L18_try_end:;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "miniga4py/ga.pyx":1788
 *     cdef int64_t n
 *     # prepare subsarray
 *     try:             # <<<<<<<<<<<<<<
 *         subsarray1_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *         n = len(subsarray1_nd) / ndim
 */
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    __pyx_L8_try_end:;
  }

  /* "miniga4py/ga.pyx":1799
 *             raise ValueError("subsarray must be either 1- or 2-dimensional")
 *     # prepare values array
 *     if values is None:             # <<<<<<<<<<<<<<
 *         values = np.ndarray(n, dtype=_to_dtype[gtype])
 *     else:
 */
  __pyx_t_22 = (((PyObject *)__pyx_v_values) == Py_None);
  __pyx_t_23 = (__pyx_t_22 != 0);
  if (__pyx_t_23) {

    /* "miniga4py/ga.pyx":1800
 *     # prepare values array
 *     if values is None:
 *         values = np.ndarray(n, dtype=_to_dtype[gtype])             # <<<<<<<<<<<<<<
 *     else:
 *         if values.ndim != 1:
 */
    __pyx_t_6 = __Pyx_PyInt_From_int64_t(__pyx_v_n); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_to_dtype); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_10, __pyx_v_gtype, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 1800, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_ndarray), __pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_values, ((PyArrayObject *)__pyx_t_7));
    __pyx_t_7 = 0;

    /* "miniga4py/ga.pyx":1799
 *             raise ValueError("subsarray must be either 1- or 2-dimensional")
 *     # prepare values array
 *     if values is None:             # <<<<<<<<<<<<<<
 *         values = np.ndarray(n, dtype=_to_dtype[gtype])
 *     else:
 */
    goto __pyx_L21;
  }

  /* "miniga4py/ga.pyx":1802
 *         values = np.ndarray(n, dtype=_to_dtype[gtype])
 *     else:
 *         if values.ndim != 1:             # <<<<<<<<<<<<<<
 *             raise ValueError("values must be one-dimensional")
 *         if not values.flags['C_CONTIGUOUS']:
 */
  /*else*/ {
    __pyx_t_23 = ((__pyx_v_values->nd != 1) != 0);
    if (unlikely(__pyx_t_23)) {

      /* "miniga4py/ga.pyx":1803
 *     else:
 *         if values.ndim != 1:
 *             raise ValueError("values must be one-dimensional")             # <<<<<<<<<<<<<<
 *         if not values.flags['C_CONTIGUOUS']:
 *             raise ValueError("values must be contiguous")
 */
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1803, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_Raise(__pyx_t_7, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __PYX_ERR(0, 1803, __pyx_L1_error)

      /* "miniga4py/ga.pyx":1802
 *         values = np.ndarray(n, dtype=_to_dtype[gtype])
 *     else:
 *         if values.ndim != 1:             # <<<<<<<<<<<<<<
 *             raise ValueError("values must be one-dimensional")
 *         if not values.flags['C_CONTIGUOUS']:
 */
    }

    /* "miniga4py/ga.pyx":1804
 *         if values.ndim != 1:
 *             raise ValueError("values must be one-dimensional")
 *         if not values.flags['C_CONTIGUOUS']:             # <<<<<<<<<<<<<<
 *             raise ValueError("values must be contiguous")
 *         if len(values) < n:
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_values), __pyx_n_s_flags); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1804, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_t_7, __pyx_n_s_C_CONTIGUOUS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1804, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_23 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_23 < 0)) __PYX_ERR(0, 1804, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_22 = ((!__pyx_t_23) != 0);
    if (unlikely(__pyx_t_22)) {

      /* "miniga4py/ga.pyx":1805
 *             raise ValueError("values must be one-dimensional")
 *         if not values.flags['C_CONTIGUOUS']:
 *             raise ValueError("values must be contiguous")             # <<<<<<<<<<<<<<
 *         if len(values) < n:
 *             raise ValueError("values was not large enough")
 */
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1805, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(0, 1805, __pyx_L1_error)

      /* "miniga4py/ga.pyx":1804
 *         if values.ndim != 1:
 *             raise ValueError("values must be one-dimensional")
 *         if not values.flags['C_CONTIGUOUS']:             # <<<<<<<<<<<<<<
 *             raise ValueError("values must be contiguous")
 *         if len(values) < n:
 */
    }

    /* "miniga4py/ga.pyx":1806
 *         if not values.flags['C_CONTIGUOUS']:
 *             raise ValueError("values must be contiguous")
 *         if len(values) < n:             # <<<<<<<<<<<<<<
 *             raise ValueError("values was not large enough")
 *     # call the wrapped function
 */
    __pyx_t_15 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1806, __pyx_L1_error)
    __pyx_t_22 = ((__pyx_t_15 < __pyx_v_n) != 0);
    if (unlikely(__pyx_t_22)) {

      /* "miniga4py/ga.pyx":1807
 *             raise ValueError("values must be contiguous")
 *         if len(values) < n:
 *             raise ValueError("values was not large enough")             # <<<<<<<<<<<<<<
 *     # call the wrapped function
 *     if subsarray1_nd is not None:
 */
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1807, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(0, 1807, __pyx_L1_error)

      /* "miniga4py/ga.pyx":1806
 *         if not values.flags['C_CONTIGUOUS']:
 *             raise ValueError("values must be contiguous")
 *         if len(values) < n:             # <<<<<<<<<<<<<<
 *             raise ValueError("values was not large enough")
 *     # call the wrapped function
 */
    }
  }
  __pyx_L21:;

  /* "miniga4py/ga.pyx":1809
 *             raise ValueError("values was not large enough")
 *     # call the wrapped function
 *     if subsarray1_nd is not None:             # <<<<<<<<<<<<<<
 *         NGA_Gather_flat64(g_a, <void*>values.data,
 *                 <int64_t*>subsarray1_nd.data, n)
 */
  __pyx_t_22 = (((PyObject *)__pyx_v_subsarray1_nd) != Py_None);
  __pyx_t_23 = (__pyx_t_22 != 0);
  if (__pyx_t_23) {

    /* "miniga4py/ga.pyx":1810
 *     # call the wrapped function
 *     if subsarray1_nd is not None:
 *         NGA_Gather_flat64(g_a, <void*>values.data,             # <<<<<<<<<<<<<<
 *                 <int64_t*>subsarray1_nd.data, n)
 *     elif subsarray2_nd is not None:
 */
    NGA_Gather_flat64(__pyx_v_g_a, ((void *)__pyx_v_values->data), ((int64_t *)__pyx_v_subsarray1_nd->data), __pyx_v_n);

    /* "miniga4py/ga.pyx":1809
 *             raise ValueError("values was not large enough")
 *     # call the wrapped function
 *     if subsarray1_nd is not None:             # <<<<<<<<<<<<<<
 *         NGA_Gather_flat64(g_a, <void*>values.data,
 *                 <int64_t*>subsarray1_nd.data, n)
 */
    goto __pyx_L25;
  }

  /* "miniga4py/ga.pyx":1812
 *         NGA_Gather_flat64(g_a, <void*>values.data,
 *                 <int64_t*>subsarray1_nd.data, n)
 *     elif subsarray2_nd is not None:             # <<<<<<<<<<<<<<
 *         NGA_Gather_flat64(g_a, <void*>values.data,
 *                 <int64_t*>subsarray2_nd.data, n)
 */
  __pyx_t_23 = (((PyObject *)__pyx_v_subsarray2_nd) != Py_None);
  __pyx_t_22 = (__pyx_t_23 != 0);
  if (likely(__pyx_t_22)) {

    /* "miniga4py/ga.pyx":1813
 *                 <int64_t*>subsarray1_nd.data, n)
 *     elif subsarray2_nd is not None:
 *         NGA_Gather_flat64(g_a, <void*>values.data,             # <<<<<<<<<<<<<<
 *                 <int64_t*>subsarray2_nd.data, n)
 *     else:
 */
    NGA_Gather_flat64(__pyx_v_g_a, ((void *)__pyx_v_values->data), ((int64_t *)__pyx_v_subsarray2_nd->data), __pyx_v_n);

    /* "miniga4py/ga.pyx":1812
 *         NGA_Gather_flat64(g_a, <void*>values.data,
 *                 <int64_t*>subsarray1_nd.data, n)
 *     elif subsarray2_nd is not None:             # <<<<<<<<<<<<<<
 *         NGA_Gather_flat64(g_a, <void*>values.data,
 *                 <int64_t*>subsarray2_nd.data, n)
 */
    goto __pyx_L25;
  }

  /* "miniga4py/ga.pyx":1816
 *                 <int64_t*>subsarray2_nd.data, n)
 *     else:
 *         raise ValueError("how did this happen?")             # <<<<<<<<<<<<<<
 *     return values
 * 
 */
  /*else*/ {
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1816, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_Raise(__pyx_t_6, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __PYX_ERR(0, 1816, __pyx_L1_error)
  }
  __pyx_L25:;

  /* "miniga4py/ga.pyx":1817
 *     else:
 *         raise ValueError("how did this happen?")
 *     return values             # <<<<<<<<<<<<<<
 * 
 * def gemm(bint ta, bint tb, int64_t m, int64_t n, int64_t k,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_values));
  __pyx_r = ((PyObject *)__pyx_v_values);
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":1760
 *                 g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, vvalue)
 * 
 * def gather(int g_a, subsarray, np.ndarray values=None):             # <<<<<<<<<<<<<<
 *     """Gathers array elements from a global array into a local array.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.gather", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_subsarray1_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_subsarray2_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_values);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1819
 *     return values
 * 
 * def gemm(bint ta, bint tb, int64_t m, int64_t n, int64_t k,             # <<<<<<<<<<<<<<
 *         alpha, int g_a, int g_b, beta, int g_c):
 *     """Performs one of the matrix-matrix operations.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_109gemm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_108gemm[] = "gemm(bool ta, bool tb, int64_t m, int64_t n, int64_t k, alpha, int g_a, int g_b, beta, int g_c)\nPerforms one of the matrix-matrix operations.\n    \n    C := alpha*op( A )*op( B ) + beta*C\n\n    where op( X ) is one of op(X)=X or op(X) = X', alpha and beta are scalars,\n    and A, B and C are matrices, with op(A) an m by k matrix, op(B) a k by n\n    matrix, and C an m by n matrix.\n\n    On entry, ta specifies the form of op( A ) to be used in the\n    matrix multiplication as follows::\n\n        ta = False, op(A) = A.\n        ta = True,  op(A) = A'.\n\n    This is a collective operation. \n    \n    :Parameters:\n        ta : bool\n            transpose operator\n        tb : bool\n            transpose operator\n        m : int\n            number of rows of op(A) and of matrix C\n        n : int\n            number of columns of op(B) and of matrix C\n        k : int\n            number of columns of op(A) and rows of matrix op(B)\n        alpha : object\n            scale factor\n        g_a : int\n            handle to input array\n        g_b : int\n            handle to input array\n        beta : object\n            scale factor\n        g_c : int\n            handle to output array\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_109gemm = {"gemm", (PyCFunction)__pyx_pw_9miniga4py_2ga_109gemm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_108gemm};
static PyObject *__pyx_pw_9miniga4py_2ga_109gemm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_ta;
  int __pyx_v_tb;
  int64_t __pyx_v_m;
  int64_t __pyx_v_n;
  int64_t __pyx_v_k;
  PyObject *__pyx_v_alpha = 0;
  int __pyx_v_g_a;
  int __pyx_v_g_b;
  PyObject *__pyx_v_beta = 0;
  int __pyx_v_g_c;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gemm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ta,&__pyx_n_s_tb,&__pyx_n_s_m,&__pyx_n_s_n,&__pyx_n_s_k,&__pyx_n_s_alpha,&__pyx_n_s_g_a,&__pyx_n_s_g_b,&__pyx_n_s_beta,&__pyx_n_s_g_c,0};
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tb)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("gemm", 1, 10, 10, 1); __PYX_ERR(0, 1819, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("gemm", 1, 10, 10, 2); __PYX_ERR(0, 1819, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("gemm", 1, 10, 10, 3); __PYX_ERR(0, 1819, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("gemm", 1, 10, 10, 4); __PYX_ERR(0, 1819, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("gemm", 1, 10, 10, 5); __PYX_ERR(0, 1819, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("gemm", 1, 10, 10, 6); __PYX_ERR(0, 1819, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("gemm", 1, 10, 10, 7); __PYX_ERR(0, 1819, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("gemm", 1, 10, 10, 8); __PYX_ERR(0, 1819, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_c)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("gemm", 1, 10, 10, 9); __PYX_ERR(0, 1819, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gemm") < 0)) __PYX_ERR(0, 1819, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 10) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
    }
    __pyx_v_ta = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_ta == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1819, __pyx_L3_error)
    __pyx_v_tb = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_tb == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1819, __pyx_L3_error)
    __pyx_v_m = __Pyx_PyInt_As_int64_t(values[2]); if (unlikely((__pyx_v_m == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1819, __pyx_L3_error)
    __pyx_v_n = __Pyx_PyInt_As_int64_t(values[3]); if (unlikely((__pyx_v_n == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1819, __pyx_L3_error)
    __pyx_v_k = __Pyx_PyInt_As_int64_t(values[4]); if (unlikely((__pyx_v_k == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1819, __pyx_L3_error)
    __pyx_v_alpha = values[5];
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1820, __pyx_L3_error)
    __pyx_v_g_b = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_g_b == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1820, __pyx_L3_error)
    __pyx_v_beta = values[8];
    __pyx_v_g_c = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_g_c == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1820, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gemm", 1, 10, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1819, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.gemm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_108gemm(__pyx_self, __pyx_v_ta, __pyx_v_tb, __pyx_v_m, __pyx_v_n, __pyx_v_k, __pyx_v_alpha, __pyx_v_g_a, __pyx_v_g_b, __pyx_v_beta, __pyx_v_g_c);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_108gemm(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_ta, int __pyx_v_tb, int64_t __pyx_v_m, int64_t __pyx_v_n, int64_t __pyx_v_k, PyObject *__pyx_v_alpha, int __pyx_v_g_a, int __pyx_v_g_b, PyObject *__pyx_v_beta, int __pyx_v_g_c) {
  int __pyx_v_gtype;
  float __pyx_v_falpha;
  float __pyx_v_fbeta;
  double __pyx_v_dalpha;
  double __pyx_v_dbeta;
  __pyx_t_float_complex __pyx_v_fcalpha;
  __pyx_t_float_complex __pyx_v_fcbeta;
  __pyx_t_double_complex __pyx_v_dcalpha;
  __pyx_t_double_complex __pyx_v_dcbeta;
  SingleComplex __pyx_v_ga_fcalpha;
  SingleComplex __pyx_v_ga_fcbeta;
  DoubleComplex __pyx_v_ga_dcalpha;
  DoubleComplex __pyx_v_ga_dcbeta;
  char __pyx_v_ta_char;
  char __pyx_v_tb_char;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  float __pyx_t_5;
  double __pyx_t_6;
  __pyx_t_float_complex __pyx_t_7;
  __pyx_t_double_complex __pyx_t_8;
  __Pyx_RefNannySetupContext("gemm", 0);

  /* "miniga4py/ga.pyx":1860
 * 
 *     """
 *     cdef int gtype=inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     #cdef int                 ialpha=1, ibeta=1
 *     #cdef long                lalpha=1, lbeta=1
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":1864
 *     #cdef long                lalpha=1, lbeta=1
 *     #cdef long long           llalpha=1, llbeta=1
 *     cdef float               falpha=1.0, fbeta=1.0             # <<<<<<<<<<<<<<
 *     cdef double              dalpha=1.0, dbeta=1.0
 *     #cdef long double         ldalpha=1.0, ldbeta=1.0
 */
  __pyx_v_falpha = 1.0;
  __pyx_v_fbeta = 1.0;

  /* "miniga4py/ga.pyx":1865
 *     #cdef long long           llalpha=1, llbeta=1
 *     cdef float               falpha=1.0, fbeta=1.0
 *     cdef double              dalpha=1.0, dbeta=1.0             # <<<<<<<<<<<<<<
 *     #cdef long double         ldalpha=1.0, ldbeta=1.0
 *     cdef float complex       fcalpha=1.0, fcbeta=1.0
 */
  __pyx_v_dalpha = 1.0;
  __pyx_v_dbeta = 1.0;

  /* "miniga4py/ga.pyx":1867
 *     cdef double              dalpha=1.0, dbeta=1.0
 *     #cdef long double         ldalpha=1.0, ldbeta=1.0
 *     cdef float complex       fcalpha=1.0, fcbeta=1.0             # <<<<<<<<<<<<<<
 *     cdef double complex      dcalpha=1.0, dcbeta=1.0
 *     #cdef long double complex ldalpha=1.0, ldbeta=1.0
 */
  __pyx_v_fcalpha = __pyx_t_float_complex_from_parts(1.0, 0);
  __pyx_v_fcbeta = __pyx_t_float_complex_from_parts(1.0, 0);

  /* "miniga4py/ga.pyx":1868
 *     #cdef long double         ldalpha=1.0, ldbeta=1.0
 *     cdef float complex       fcalpha=1.0, fcbeta=1.0
 *     cdef double complex      dcalpha=1.0, dcbeta=1.0             # <<<<<<<<<<<<<<
 *     #cdef long double complex ldalpha=1.0, ldbeta=1.0
 *     cdef SingleComplex       ga_fcalpha, ga_fcbeta
 */
  __pyx_v_dcalpha = __pyx_t_double_complex_from_parts(1.0, 0);
  __pyx_v_dcbeta = __pyx_t_double_complex_from_parts(1.0, 0);

  /* "miniga4py/ga.pyx":1872
 *     cdef SingleComplex       ga_fcalpha, ga_fcbeta
 *     cdef DoubleComplex       ga_dcalpha, ga_dcbeta
 *     cdef char ta_char = 'N'             # <<<<<<<<<<<<<<
 *     cdef char tb_char = 'N'
 *     if ta:
 */
  __pyx_v_ta_char = 'N';

  /* "miniga4py/ga.pyx":1873
 *     cdef DoubleComplex       ga_dcalpha, ga_dcbeta
 *     cdef char ta_char = 'N'
 *     cdef char tb_char = 'N'             # <<<<<<<<<<<<<<
 *     if ta:
 *         ta_char = 'T'
 */
  __pyx_v_tb_char = 'N';

  /* "miniga4py/ga.pyx":1874
 *     cdef char ta_char = 'N'
 *     cdef char tb_char = 'N'
 *     if ta:             # <<<<<<<<<<<<<<
 *         ta_char = 'T'
 *     if tb:
 */
  __pyx_t_1 = (__pyx_v_ta != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":1875
 *     cdef char tb_char = 'N'
 *     if ta:
 *         ta_char = 'T'             # <<<<<<<<<<<<<<
 *     if tb:
 *         tb_char = 'T'
 */
    __pyx_v_ta_char = 'T';

    /* "miniga4py/ga.pyx":1874
 *     cdef char ta_char = 'N'
 *     cdef char tb_char = 'N'
 *     if ta:             # <<<<<<<<<<<<<<
 *         ta_char = 'T'
 *     if tb:
 */
  }

  /* "miniga4py/ga.pyx":1876
 *     if ta:
 *         ta_char = 'T'
 *     if tb:             # <<<<<<<<<<<<<<
 *         tb_char = 'T'
 *     if gtype == C_INT:
 */
  __pyx_t_1 = (__pyx_v_tb != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":1877
 *         ta_char = 'T'
 *     if tb:
 *         tb_char = 'T'             # <<<<<<<<<<<<<<
 *     if gtype == C_INT:
 *         raise TypeError("C_INT not supported")
 */
    __pyx_v_tb_char = 'T';

    /* "miniga4py/ga.pyx":1876
 *     if ta:
 *         ta_char = 'T'
 *     if tb:             # <<<<<<<<<<<<<<
 *         tb_char = 'T'
 *     if gtype == C_INT:
 */
  }

  /* "miniga4py/ga.pyx":1878
 *     if tb:
 *         tb_char = 'T'
 *     if gtype == C_INT:             # <<<<<<<<<<<<<<
 *         raise TypeError("C_INT not supported")
 *     elif gtype == C_LONG:
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_INT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1878, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1878, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "miniga4py/ga.pyx":1879
 *         tb_char = 'T'
 *     if gtype == C_INT:
 *         raise TypeError("C_INT not supported")             # <<<<<<<<<<<<<<
 *     elif gtype == C_LONG:
 *         raise TypeError("C_LONG not supported")
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1879, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 1879, __pyx_L1_error)

    /* "miniga4py/ga.pyx":1878
 *     if tb:
 *         tb_char = 'T'
 *     if gtype == C_INT:             # <<<<<<<<<<<<<<
 *         raise TypeError("C_INT not supported")
 *     elif gtype == C_LONG:
 */
  }

  /* "miniga4py/ga.pyx":1880
 *     if gtype == C_INT:
 *         raise TypeError("C_INT not supported")
 *     elif gtype == C_LONG:             # <<<<<<<<<<<<<<
 *         raise TypeError("C_LONG not supported")
 *     elif gtype == C_LONGLONG:
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_LONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1880, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1880, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "miniga4py/ga.pyx":1881
 *         raise TypeError("C_INT not supported")
 *     elif gtype == C_LONG:
 *         raise TypeError("C_LONG not supported")             # <<<<<<<<<<<<<<
 *     elif gtype == C_LONGLONG:
 *         raise TypeError("C_LONGLONG not supported")
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1881, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 1881, __pyx_L1_error)

    /* "miniga4py/ga.pyx":1880
 *     if gtype == C_INT:
 *         raise TypeError("C_INT not supported")
 *     elif gtype == C_LONG:             # <<<<<<<<<<<<<<
 *         raise TypeError("C_LONG not supported")
 *     elif gtype == C_LONGLONG:
 */
  }

  /* "miniga4py/ga.pyx":1882
 *     elif gtype == C_LONG:
 *         raise TypeError("C_LONG not supported")
 *     elif gtype == C_LONGLONG:             # <<<<<<<<<<<<<<
 *         raise TypeError("C_LONGLONG not supported")
 *     elif gtype == C_FLOAT:
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_LONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1882, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1882, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "miniga4py/ga.pyx":1883
 *         raise TypeError("C_LONG not supported")
 *     elif gtype == C_LONGLONG:
 *         raise TypeError("C_LONGLONG not supported")             # <<<<<<<<<<<<<<
 *     elif gtype == C_FLOAT:
 *         falpha = alpha
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1883, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 1883, __pyx_L1_error)

    /* "miniga4py/ga.pyx":1882
 *     elif gtype == C_LONG:
 *         raise TypeError("C_LONG not supported")
 *     elif gtype == C_LONGLONG:             # <<<<<<<<<<<<<<
 *         raise TypeError("C_LONGLONG not supported")
 *     elif gtype == C_FLOAT:
 */
  }

  /* "miniga4py/ga.pyx":1884
 *     elif gtype == C_LONGLONG:
 *         raise TypeError("C_LONGLONG not supported")
 *     elif gtype == C_FLOAT:             # <<<<<<<<<<<<<<
 *         falpha = alpha
 *         fbeta = beta
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_FLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1884, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1884, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":1885
 *         raise TypeError("C_LONGLONG not supported")
 *     elif gtype == C_FLOAT:
 *         falpha = alpha             # <<<<<<<<<<<<<<
 *         fbeta = beta
 *         GA_Sgemm64(ta_char, tb_char, m, n, k, falpha, g_a, g_b, fbeta, g_c)
 */
    __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_v_alpha); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1885, __pyx_L1_error)
    __pyx_v_falpha = __pyx_t_5;

    /* "miniga4py/ga.pyx":1886
 *     elif gtype == C_FLOAT:
 *         falpha = alpha
 *         fbeta = beta             # <<<<<<<<<<<<<<
 *         GA_Sgemm64(ta_char, tb_char, m, n, k, falpha, g_a, g_b, fbeta, g_c)
 *     elif gtype == C_DBL:
 */
    __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_v_beta); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1886, __pyx_L1_error)
    __pyx_v_fbeta = __pyx_t_5;

    /* "miniga4py/ga.pyx":1887
 *         falpha = alpha
 *         fbeta = beta
 *         GA_Sgemm64(ta_char, tb_char, m, n, k, falpha, g_a, g_b, fbeta, g_c)             # <<<<<<<<<<<<<<
 *     elif gtype == C_DBL:
 *         dalpha = alpha
 */
    GA_Sgemm64(__pyx_v_ta_char, __pyx_v_tb_char, __pyx_v_m, __pyx_v_n, __pyx_v_k, __pyx_v_falpha, __pyx_v_g_a, __pyx_v_g_b, __pyx_v_fbeta, __pyx_v_g_c);

    /* "miniga4py/ga.pyx":1884
 *     elif gtype == C_LONGLONG:
 *         raise TypeError("C_LONGLONG not supported")
 *     elif gtype == C_FLOAT:             # <<<<<<<<<<<<<<
 *         falpha = alpha
 *         fbeta = beta
 */
    goto __pyx_L5;
  }

  /* "miniga4py/ga.pyx":1888
 *         fbeta = beta
 *         GA_Sgemm64(ta_char, tb_char, m, n, k, falpha, g_a, g_b, fbeta, g_c)
 *     elif gtype == C_DBL:             # <<<<<<<<<<<<<<
 *         dalpha = alpha
 *         dbeta = beta
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_DBL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1888, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1888, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":1889
 *         GA_Sgemm64(ta_char, tb_char, m, n, k, falpha, g_a, g_b, fbeta, g_c)
 *     elif gtype == C_DBL:
 *         dalpha = alpha             # <<<<<<<<<<<<<<
 *         dbeta = beta
 *         GA_Dgemm64(ta_char, tb_char, m, n, k, dalpha, g_a, g_b, dbeta, g_c)
 */
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_alpha); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1889, __pyx_L1_error)
    __pyx_v_dalpha = __pyx_t_6;

    /* "miniga4py/ga.pyx":1890
 *     elif gtype == C_DBL:
 *         dalpha = alpha
 *         dbeta = beta             # <<<<<<<<<<<<<<
 *         GA_Dgemm64(ta_char, tb_char, m, n, k, dalpha, g_a, g_b, dbeta, g_c)
 *     elif gtype == C_LDBL:
 */
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_beta); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1890, __pyx_L1_error)
    __pyx_v_dbeta = __pyx_t_6;

    /* "miniga4py/ga.pyx":1891
 *         dalpha = alpha
 *         dbeta = beta
 *         GA_Dgemm64(ta_char, tb_char, m, n, k, dalpha, g_a, g_b, dbeta, g_c)             # <<<<<<<<<<<<<<
 *     elif gtype == C_LDBL:
 *         raise TypeError("C_LDBL not supported")
 */
    GA_Dgemm64(__pyx_v_ta_char, __pyx_v_tb_char, __pyx_v_m, __pyx_v_n, __pyx_v_k, __pyx_v_dalpha, __pyx_v_g_a, __pyx_v_g_b, __pyx_v_dbeta, __pyx_v_g_c);

    /* "miniga4py/ga.pyx":1888
 *         fbeta = beta
 *         GA_Sgemm64(ta_char, tb_char, m, n, k, falpha, g_a, g_b, fbeta, g_c)
 *     elif gtype == C_DBL:             # <<<<<<<<<<<<<<
 *         dalpha = alpha
 *         dbeta = beta
 */
    goto __pyx_L5;
  }

  /* "miniga4py/ga.pyx":1892
 *         dbeta = beta
 *         GA_Dgemm64(ta_char, tb_char, m, n, k, dalpha, g_a, g_b, dbeta, g_c)
 *     elif gtype == C_LDBL:             # <<<<<<<<<<<<<<
 *         raise TypeError("C_LDBL not supported")
 *     elif gtype == C_SCPL:
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_LDBL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1892, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1892, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "miniga4py/ga.pyx":1893
 *         GA_Dgemm64(ta_char, tb_char, m, n, k, dalpha, g_a, g_b, dbeta, g_c)
 *     elif gtype == C_LDBL:
 *         raise TypeError("C_LDBL not supported")             # <<<<<<<<<<<<<<
 *     elif gtype == C_SCPL:
 *         fcalpha = alpha
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1893, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 1893, __pyx_L1_error)

    /* "miniga4py/ga.pyx":1892
 *         dbeta = beta
 *         GA_Dgemm64(ta_char, tb_char, m, n, k, dalpha, g_a, g_b, dbeta, g_c)
 *     elif gtype == C_LDBL:             # <<<<<<<<<<<<<<
 *         raise TypeError("C_LDBL not supported")
 *     elif gtype == C_SCPL:
 */
  }

  /* "miniga4py/ga.pyx":1894
 *     elif gtype == C_LDBL:
 *         raise TypeError("C_LDBL not supported")
 *     elif gtype == C_SCPL:             # <<<<<<<<<<<<<<
 *         fcalpha = alpha
 *         fcbeta = beta
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_SCPL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1894, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1894, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":1895
 *         raise TypeError("C_LDBL not supported")
 *     elif gtype == C_SCPL:
 *         fcalpha = alpha             # <<<<<<<<<<<<<<
 *         fcbeta = beta
 *         ga_fcalpha.real = fcalpha.real
 */
    __pyx_t_7 = __Pyx_PyComplex_As___pyx_t_float_complex(__pyx_v_alpha); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1895, __pyx_L1_error)
    __pyx_v_fcalpha = __pyx_t_7;

    /* "miniga4py/ga.pyx":1896
 *     elif gtype == C_SCPL:
 *         fcalpha = alpha
 *         fcbeta = beta             # <<<<<<<<<<<<<<
 *         ga_fcalpha.real = fcalpha.real
 *         ga_fcalpha.imag = fcalpha.imag
 */
    __pyx_t_7 = __Pyx_PyComplex_As___pyx_t_float_complex(__pyx_v_beta); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1896, __pyx_L1_error)
    __pyx_v_fcbeta = __pyx_t_7;

    /* "miniga4py/ga.pyx":1897
 *         fcalpha = alpha
 *         fcbeta = beta
 *         ga_fcalpha.real = fcalpha.real             # <<<<<<<<<<<<<<
 *         ga_fcalpha.imag = fcalpha.imag
 *         ga_fcbeta.real = fcbeta.real
 */
    __pyx_t_5 = __Pyx_CREAL(__pyx_v_fcalpha);
    __pyx_v_ga_fcalpha.real = __pyx_t_5;

    /* "miniga4py/ga.pyx":1898
 *         fcbeta = beta
 *         ga_fcalpha.real = fcalpha.real
 *         ga_fcalpha.imag = fcalpha.imag             # <<<<<<<<<<<<<<
 *         ga_fcbeta.real = fcbeta.real
 *         ga_fcbeta.imag = fcbeta.imag
 */
    __pyx_t_5 = __Pyx_CIMAG(__pyx_v_fcalpha);
    __pyx_v_ga_fcalpha.imag = __pyx_t_5;

    /* "miniga4py/ga.pyx":1899
 *         ga_fcalpha.real = fcalpha.real
 *         ga_fcalpha.imag = fcalpha.imag
 *         ga_fcbeta.real = fcbeta.real             # <<<<<<<<<<<<<<
 *         ga_fcbeta.imag = fcbeta.imag
 *         GA_Cgemm64(ta_char, tb_char, m, n, k, ga_fcalpha, g_a, g_b, ga_fcbeta, g_c)
 */
    __pyx_t_5 = __Pyx_CREAL(__pyx_v_fcbeta);
    __pyx_v_ga_fcbeta.real = __pyx_t_5;

    /* "miniga4py/ga.pyx":1900
 *         ga_fcalpha.imag = fcalpha.imag
 *         ga_fcbeta.real = fcbeta.real
 *         ga_fcbeta.imag = fcbeta.imag             # <<<<<<<<<<<<<<
 *         GA_Cgemm64(ta_char, tb_char, m, n, k, ga_fcalpha, g_a, g_b, ga_fcbeta, g_c)
 *     elif gtype == C_DCPL:
 */
    __pyx_t_5 = __Pyx_CIMAG(__pyx_v_fcbeta);
    __pyx_v_ga_fcbeta.imag = __pyx_t_5;

    /* "miniga4py/ga.pyx":1901
 *         ga_fcbeta.real = fcbeta.real
 *         ga_fcbeta.imag = fcbeta.imag
 *         GA_Cgemm64(ta_char, tb_char, m, n, k, ga_fcalpha, g_a, g_b, ga_fcbeta, g_c)             # <<<<<<<<<<<<<<
 *     elif gtype == C_DCPL:
 *         dcalpha = alpha
 */
    GA_Cgemm64(__pyx_v_ta_char, __pyx_v_tb_char, __pyx_v_m, __pyx_v_n, __pyx_v_k, __pyx_v_ga_fcalpha, __pyx_v_g_a, __pyx_v_g_b, __pyx_v_ga_fcbeta, __pyx_v_g_c);

    /* "miniga4py/ga.pyx":1894
 *     elif gtype == C_LDBL:
 *         raise TypeError("C_LDBL not supported")
 *     elif gtype == C_SCPL:             # <<<<<<<<<<<<<<
 *         fcalpha = alpha
 *         fcbeta = beta
 */
    goto __pyx_L5;
  }

  /* "miniga4py/ga.pyx":1902
 *         ga_fcbeta.imag = fcbeta.imag
 *         GA_Cgemm64(ta_char, tb_char, m, n, k, ga_fcalpha, g_a, g_b, ga_fcbeta, g_c)
 *     elif gtype == C_DCPL:             # <<<<<<<<<<<<<<
 *         dcalpha = alpha
 *         dcbeta = beta
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_DCPL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1902, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1902, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":1903
 *         GA_Cgemm64(ta_char, tb_char, m, n, k, ga_fcalpha, g_a, g_b, ga_fcbeta, g_c)
 *     elif gtype == C_DCPL:
 *         dcalpha = alpha             # <<<<<<<<<<<<<<
 *         dcbeta = beta
 *         ga_dcalpha.real = dcalpha.real
 */
    __pyx_t_8 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_v_alpha); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1903, __pyx_L1_error)
    __pyx_v_dcalpha = __pyx_t_8;

    /* "miniga4py/ga.pyx":1904
 *     elif gtype == C_DCPL:
 *         dcalpha = alpha
 *         dcbeta = beta             # <<<<<<<<<<<<<<
 *         ga_dcalpha.real = dcalpha.real
 *         ga_dcalpha.imag = dcalpha.imag
 */
    __pyx_t_8 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_v_beta); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1904, __pyx_L1_error)
    __pyx_v_dcbeta = __pyx_t_8;

    /* "miniga4py/ga.pyx":1905
 *         dcalpha = alpha
 *         dcbeta = beta
 *         ga_dcalpha.real = dcalpha.real             # <<<<<<<<<<<<<<
 *         ga_dcalpha.imag = dcalpha.imag
 *         ga_dcbeta.real = dcbeta.real
 */
    __pyx_t_6 = __Pyx_CREAL(__pyx_v_dcalpha);
    __pyx_v_ga_dcalpha.real = __pyx_t_6;

    /* "miniga4py/ga.pyx":1906
 *         dcbeta = beta
 *         ga_dcalpha.real = dcalpha.real
 *         ga_dcalpha.imag = dcalpha.imag             # <<<<<<<<<<<<<<
 *         ga_dcbeta.real = dcbeta.real
 *         ga_dcbeta.imag = dcbeta.imag
 */
    __pyx_t_6 = __Pyx_CIMAG(__pyx_v_dcalpha);
    __pyx_v_ga_dcalpha.imag = __pyx_t_6;

    /* "miniga4py/ga.pyx":1907
 *         ga_dcalpha.real = dcalpha.real
 *         ga_dcalpha.imag = dcalpha.imag
 *         ga_dcbeta.real = dcbeta.real             # <<<<<<<<<<<<<<
 *         ga_dcbeta.imag = dcbeta.imag
 *         GA_Zgemm64(ta_char, tb_char, m, n, k, ga_dcalpha, g_a, g_b, ga_dcbeta, g_c)
 */
    __pyx_t_6 = __Pyx_CREAL(__pyx_v_dcbeta);
    __pyx_v_ga_dcbeta.real = __pyx_t_6;

    /* "miniga4py/ga.pyx":1908
 *         ga_dcalpha.imag = dcalpha.imag
 *         ga_dcbeta.real = dcbeta.real
 *         ga_dcbeta.imag = dcbeta.imag             # <<<<<<<<<<<<<<
 *         GA_Zgemm64(ta_char, tb_char, m, n, k, ga_dcalpha, g_a, g_b, ga_dcbeta, g_c)
 *     elif gtype == C_LDCPL:
 */
    __pyx_t_6 = __Pyx_CIMAG(__pyx_v_dcbeta);
    __pyx_v_ga_dcbeta.imag = __pyx_t_6;

    /* "miniga4py/ga.pyx":1909
 *         ga_dcbeta.real = dcbeta.real
 *         ga_dcbeta.imag = dcbeta.imag
 *         GA_Zgemm64(ta_char, tb_char, m, n, k, ga_dcalpha, g_a, g_b, ga_dcbeta, g_c)             # <<<<<<<<<<<<<<
 *     elif gtype == C_LDCPL:
 *         raise TypeError("C_LDCPL not supported (yet)")
 */
    GA_Zgemm64(__pyx_v_ta_char, __pyx_v_tb_char, __pyx_v_m, __pyx_v_n, __pyx_v_k, __pyx_v_ga_dcalpha, __pyx_v_g_a, __pyx_v_g_b, __pyx_v_ga_dcbeta, __pyx_v_g_c);

    /* "miniga4py/ga.pyx":1902
 *         ga_fcbeta.imag = fcbeta.imag
 *         GA_Cgemm64(ta_char, tb_char, m, n, k, ga_fcalpha, g_a, g_b, ga_fcbeta, g_c)
 *     elif gtype == C_DCPL:             # <<<<<<<<<<<<<<
 *         dcalpha = alpha
 *         dcbeta = beta
 */
    goto __pyx_L5;
  }

  /* "miniga4py/ga.pyx":1910
 *         ga_dcbeta.imag = dcbeta.imag
 *         GA_Zgemm64(ta_char, tb_char, m, n, k, ga_dcalpha, g_a, g_b, ga_dcbeta, g_c)
 *     elif gtype == C_LDCPL:             # <<<<<<<<<<<<<<
 *         raise TypeError("C_LDCPL not supported (yet)")
 *     else:
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_LDCPL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1910, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1910, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "miniga4py/ga.pyx":1911
 *         GA_Zgemm64(ta_char, tb_char, m, n, k, ga_dcalpha, g_a, g_b, ga_dcbeta, g_c)
 *     elif gtype == C_LDCPL:
 *         raise TypeError("C_LDCPL not supported (yet)")             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1911, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 1911, __pyx_L1_error)

    /* "miniga4py/ga.pyx":1910
 *         ga_dcbeta.imag = dcbeta.imag
 *         GA_Zgemm64(ta_char, tb_char, m, n, k, ga_dcalpha, g_a, g_b, ga_dcbeta, g_c)
 *     elif gtype == C_LDCPL:             # <<<<<<<<<<<<<<
 *         raise TypeError("C_LDCPL not supported (yet)")
 *     else:
 */
  }

  /* "miniga4py/ga.pyx":1913
 *         raise TypeError("C_LDCPL not supported (yet)")
 *     else:
 *         raise TypeError             # <<<<<<<<<<<<<<
 * 
 * def get(int g_a, lo=None, hi=None, np.ndarray buffer=None):
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0);
    __PYX_ERR(0, 1913, __pyx_L1_error)
  }
  __pyx_L5:;

  /* "miniga4py/ga.pyx":1819
 *     return values
 * 
 * def gemm(bint ta, bint tb, int64_t m, int64_t n, int64_t k,             # <<<<<<<<<<<<<<
 *         alpha, int g_a, int g_b, beta, int g_c):
 *     """Performs one of the matrix-matrix operations.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("miniga4py.ga.gemm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1915
 *         raise TypeError
 * 
 * def get(int g_a, lo=None, hi=None, np.ndarray buffer=None):             # <<<<<<<<<<<<<<
 *     """Copies data from global array section to the local array buffer.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_111get(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_110get[] = "get(int g_a, lo=None, hi=None, ndarray buffer=None)\nCopies data from global array section to the local array buffer.\n    \n    The local array is assumed to be have the same number of dimensions as the\n    global array. Any detected inconsitencies/errors in the input arguments\n    are fatal.\n\n    This is a one-sided operation.\n\n    :Parameters:\n        g_a : int\n            the array handle\n        lo : 1D array-like of integers\n            lower bound patch coordinates, inclusive\n        hi : 1D array-like of integers\n            higher bound patch coordinates, exclusive\n        buffer : \n            an ndarray of the appropriate type, large enough to hold lo,hi\n\n    :returns: The local array buffer.\n    \n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_111get = {"get", (PyCFunction)__pyx_pw_9miniga4py_2ga_111get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_110get};
static PyObject *__pyx_pw_9miniga4py_2ga_111get(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyArrayObject *__pyx_v_buffer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_lo,&__pyx_n_s_hi,&__pyx_n_s_buffer,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = (PyObject *)((PyArrayObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) __PYX_ERR(0, 1915, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1915, __pyx_L3_error)
    __pyx_v_lo = values[1];
    __pyx_v_hi = values[2];
    __pyx_v_buffer = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1915, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buffer), __pyx_ptype_5numpy_ndarray, 1, "buffer", 0))) __PYX_ERR(0, 1915, __pyx_L1_error)
  __pyx_r = __pyx_pf_9miniga4py_2ga_110get(__pyx_self, __pyx_v_g_a, __pyx_v_lo, __pyx_v_hi, __pyx_v_buffer);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_110get(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, PyArrayObject *__pyx_v_buffer) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_9miniga4py_2ga__get_common __pyx_t_2;
  __Pyx_RefNannySetupContext("get", 0);

  /* "miniga4py/ga.pyx":1937
 * 
 *     """
 *     return _get_common(g_a, lo, hi, buffer)             # <<<<<<<<<<<<<<
 * 
 * cdef _get_common(int g_a, lo=None, hi=None, np.ndarray buffer=None,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 3;
  __pyx_t_2.lo = __pyx_v_lo;
  __pyx_t_2.hi = __pyx_v_hi;
  __pyx_t_2.buffer = __pyx_v_buffer;
  __pyx_t_1 = __pyx_f_9miniga4py_2ga__get_common(__pyx_v_g_a, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":1915
 *         raise TypeError
 * 
 * def get(int g_a, lo=None, hi=None, np.ndarray buffer=None):             # <<<<<<<<<<<<<<
 *     """Copies data from global array section to the local array buffer.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":1939
 *     return _get_common(g_a, lo, hi, buffer)
 * 
 * cdef _get_common(int g_a, lo=None, hi=None, np.ndarray buffer=None,             # <<<<<<<<<<<<<<
 *         bint nb=False, bint periodic=False, skip=None):
 *     """Copies data from global array section to the local array buffer.
 */

static PyObject *__pyx_f_9miniga4py_2ga__get_common(int __pyx_v_g_a, struct __pyx_opt_args_9miniga4py_2ga__get_common *__pyx_optional_args) {
  PyObject *__pyx_v_lo = ((PyObject *)Py_None);
  PyObject *__pyx_v_hi = ((PyObject *)Py_None);
  PyArrayObject *__pyx_v_buffer = ((PyArrayObject *)Py_None);

  /* "miniga4py/ga.pyx":1940
 * 
 * cdef _get_common(int g_a, lo=None, hi=None, np.ndarray buffer=None,
 *         bint nb=False, bint periodic=False, skip=None):             # <<<<<<<<<<<<<<
 *     """Copies data from global array section to the local array buffer.
 * 
 */
  int __pyx_v_nb = ((int)0);
  int __pyx_v_periodic = ((int)0);
  PyObject *__pyx_v_skip = ((PyObject *)Py_None);
  PyArrayObject *__pyx_v_lo_nd = 0;
  PyArrayObject *__pyx_v_hi_nd = 0;
  PyArrayObject *__pyx_v_ld_nd = 0;
  PyArrayObject *__pyx_v_shape = 0;
  PyArrayObject *__pyx_v_skip_nd = 0;
  int __pyx_v_gtype;
  ga_nbhdl_t __pyx_v_nbhandle;
  PyObject *__pyx_v_dtype = NULL;
  PyObject *__pyx_v_strides = NULL;
  PyObject *__pyx_v_buffer_shape = NULL;
  PyObject *__pyx_v_i = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_nd;
  __Pyx_Buffer __pyx_pybuffer_hi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ld_nd;
  __Pyx_Buffer __pyx_pybuffer_ld_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lo_nd;
  __Pyx_Buffer __pyx_pybuffer_lo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_shape;
  __Pyx_Buffer __pyx_pybuffer_shape;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_skip_nd;
  __Pyx_Buffer __pyx_pybuffer_skip_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  PyObject *(*__pyx_t_14)(PyObject *);
  Py_ssize_t __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  __Pyx_RefNannySetupContext("_get_common", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_lo = __pyx_optional_args->lo;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_hi = __pyx_optional_args->hi;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_buffer = __pyx_optional_args->buffer;
          if (__pyx_optional_args->__pyx_n > 3) {
            __pyx_v_nb = __pyx_optional_args->nb;
            if (__pyx_optional_args->__pyx_n > 4) {
              __pyx_v_periodic = __pyx_optional_args->periodic;
              if (__pyx_optional_args->__pyx_n > 5) {
                __pyx_v_skip = __pyx_optional_args->skip;
              }
            }
          }
        }
      }
    }
  }
  __Pyx_INCREF((PyObject *)__pyx_v_buffer);
  __pyx_pybuffer_lo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_lo_nd.refcount = 0;
  __pyx_pybuffernd_lo_nd.data = NULL;
  __pyx_pybuffernd_lo_nd.rcbuffer = &__pyx_pybuffer_lo_nd;
  __pyx_pybuffer_hi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_nd.refcount = 0;
  __pyx_pybuffernd_hi_nd.data = NULL;
  __pyx_pybuffernd_hi_nd.rcbuffer = &__pyx_pybuffer_hi_nd;
  __pyx_pybuffer_ld_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_ld_nd.refcount = 0;
  __pyx_pybuffernd_ld_nd.data = NULL;
  __pyx_pybuffernd_ld_nd.rcbuffer = &__pyx_pybuffer_ld_nd;
  __pyx_pybuffer_shape.pybuffer.buf = NULL;
  __pyx_pybuffer_shape.refcount = 0;
  __pyx_pybuffernd_shape.data = NULL;
  __pyx_pybuffernd_shape.rcbuffer = &__pyx_pybuffer_shape;
  __pyx_pybuffer_skip_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_skip_nd.refcount = 0;
  __pyx_pybuffernd_skip_nd.data = NULL;
  __pyx_pybuffernd_skip_nd.rcbuffer = &__pyx_pybuffer_skip_nd;

  /* "miniga4py/ga.pyx":1972
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd, ld_nd, shape, skip_nd
 *     cdef int gtype=inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     cdef ga_nbhdl_t nbhandle
 *     dtype = _to_dtype[gtype]
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":1974
 *     cdef int gtype=inquire_type(g_a)
 *     cdef ga_nbhdl_t nbhandle
 *     dtype = _to_dtype[gtype]             # <<<<<<<<<<<<<<
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *     shape = hi_nd-lo_nd+1
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_to_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_gtype, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dtype = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "miniga4py/ga.pyx":1975
 *     cdef ga_nbhdl_t nbhandle
 *     dtype = _to_dtype[gtype]
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)             # <<<<<<<<<<<<<<
 *     shape = hi_nd-lo_nd+1
 *     if skip is None:
 */
  __pyx_t_2 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_lo, __pyx_v_hi); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1975, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1975, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1975, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1975, __pyx_L1_error)
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1975, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_lo_nd.diminfo[0].strides = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_nd.diminfo[0].shape = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1975, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_lo_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
      __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
    }
    __pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1975, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "miniga4py/ga.pyx":1976
 *     dtype = _to_dtype[gtype]
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *     shape = hi_nd-lo_nd+1             # <<<<<<<<<<<<<<
 *     if skip is None:
 *         skip_nd = None
 */
  __pyx_t_2 = PyNumber_Subtract(((PyObject *)__pyx_v_hi_nd), ((PyObject *)__pyx_v_lo_nd)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1976, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_shape.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_shape.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_shape.rcbuffer->pybuffer, (PyObject*)__pyx_v_shape, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_shape.diminfo[0].strides = __pyx_pybuffernd_shape.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_shape.diminfo[0].shape = __pyx_pybuffernd_shape.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1976, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_shape = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "miniga4py/ga.pyx":1977
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *     shape = hi_nd-lo_nd+1
 *     if skip is None:             # <<<<<<<<<<<<<<
 *         skip_nd = None
 *     else:
 */
  __pyx_t_11 = (__pyx_v_skip == Py_None);
  __pyx_t_12 = (__pyx_t_11 != 0);
  if (__pyx_t_12) {

    /* "miniga4py/ga.pyx":1978
 *     shape = hi_nd-lo_nd+1
 *     if skip is None:
 *         skip_nd = None             # <<<<<<<<<<<<<<
 *     else:
 *         skip_nd = _inta64(skip)
 */
    __pyx_t_6 = ((PyArrayObject *)Py_None);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_skip_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
        }
        __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
      }
      __pyx_pybuffernd_skip_nd.diminfo[0].strides = __pyx_pybuffernd_skip_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_skip_nd.diminfo[0].shape = __pyx_pybuffernd_skip_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1978, __pyx_L1_error)
    }
    __pyx_t_6 = 0;
    __Pyx_INCREF(Py_None);
    __pyx_v_skip_nd = ((PyArrayObject *)Py_None);

    /* "miniga4py/ga.pyx":1977
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *     shape = hi_nd-lo_nd+1
 *     if skip is None:             # <<<<<<<<<<<<<<
 *         skip_nd = None
 *     else:
 */
    goto __pyx_L5;
  }

  /* "miniga4py/ga.pyx":1980
 *         skip_nd = None
 *     else:
 *         skip_nd = _inta64(skip)             # <<<<<<<<<<<<<<
 *         shape = (hi_nd-lo_nd)/skip_nd+1
 *     if buffer is None:
 */
  /*else*/ {
    __pyx_t_3 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_skip)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_3), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_skip_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        }
        __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
      }
      __pyx_pybuffernd_skip_nd.diminfo[0].strides = __pyx_pybuffernd_skip_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_skip_nd.diminfo[0].shape = __pyx_pybuffernd_skip_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1980, __pyx_L1_error)
    }
    __pyx_v_skip_nd = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "miniga4py/ga.pyx":1981
 *     else:
 *         skip_nd = _inta64(skip)
 *         shape = (hi_nd-lo_nd)/skip_nd+1             # <<<<<<<<<<<<<<
 *     if buffer is None:
 *         buffer = np.ndarray(shape, dtype=dtype)
 */
    __pyx_t_3 = PyNumber_Subtract(((PyObject *)__pyx_v_hi_nd), ((PyObject *)__pyx_v_lo_nd)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_3, ((PyObject *)__pyx_v_skip_nd)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1981, __pyx_L1_error)
    __pyx_t_6 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_shape.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_shape.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_shape.rcbuffer->pybuffer, (PyObject*)__pyx_v_shape, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
        }
        __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
      }
      __pyx_pybuffernd_shape.diminfo[0].strides = __pyx_pybuffernd_shape.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_shape.diminfo[0].shape = __pyx_pybuffernd_shape.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1981, __pyx_L1_error)
    }
    __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_shape, ((PyArrayObject *)__pyx_t_3));
    __pyx_t_3 = 0;
  }
  __pyx_L5:;

  /* "miniga4py/ga.pyx":1982
 *         skip_nd = _inta64(skip)
 *         shape = (hi_nd-lo_nd)/skip_nd+1
 *     if buffer is None:             # <<<<<<<<<<<<<<
 *         buffer = np.ndarray(shape, dtype=dtype)
 *     elif buffer.dtype != dtype:
 */
  __pyx_t_12 = (((PyObject *)__pyx_v_buffer) == Py_None);
  __pyx_t_11 = (__pyx_t_12 != 0);
  if (__pyx_t_11) {

    /* "miniga4py/ga.pyx":1983
 *         shape = (hi_nd-lo_nd)/skip_nd+1
 *     if buffer is None:
 *         buffer = np.ndarray(shape, dtype=dtype)             # <<<<<<<<<<<<<<
 *     elif buffer.dtype != dtype:
 *         raise ValueError("buffer is wrong type :: buffer=%s != %s" % (
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1983, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_shape));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_shape));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_shape));
    __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1983, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_v_dtype) < 0) __PYX_ERR(0, 1983, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_ndarray), __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1983, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_buffer, ((PyArrayObject *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "miniga4py/ga.pyx":1982
 *         skip_nd = _inta64(skip)
 *         shape = (hi_nd-lo_nd)/skip_nd+1
 *     if buffer is None:             # <<<<<<<<<<<<<<
 *         buffer = np.ndarray(shape, dtype=dtype)
 *     elif buffer.dtype != dtype:
 */
    goto __pyx_L6;
  }

  /* "miniga4py/ga.pyx":1984
 *     if buffer is None:
 *         buffer = np.ndarray(shape, dtype=dtype)
 *     elif buffer.dtype != dtype:             # <<<<<<<<<<<<<<
 *         raise ValueError("buffer is wrong type :: buffer=%s != %s" % (
 *                 buffer.dtype, dtype))
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buffer), __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_v_dtype, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1984, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1984, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_t_11)) {

    /* "miniga4py/ga.pyx":1986
 *     elif buffer.dtype != dtype:
 *         raise ValueError("buffer is wrong type :: buffer=%s != %s" % (
 *                 buffer.dtype, dtype))             # <<<<<<<<<<<<<<
 *     # Due to GA restrictions, buffer must not have negative strides
 *     # and buffer's last stride must be same as itemsize
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buffer), __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __Pyx_INCREF(__pyx_v_dtype);
    __Pyx_GIVEREF(__pyx_v_dtype);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_dtype);
    __pyx_t_2 = 0;

    /* "miniga4py/ga.pyx":1985
 *         buffer = np.ndarray(shape, dtype=dtype)
 *     elif buffer.dtype != dtype:
 *         raise ValueError("buffer is wrong type :: buffer=%s != %s" % (             # <<<<<<<<<<<<<<
 *                 buffer.dtype, dtype))
 *     # Due to GA restrictions, buffer must not have negative strides
 */
    __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_buffer_is_wrong_type_buffer_s_s, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1985, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 1985, __pyx_L1_error)

    /* "miniga4py/ga.pyx":1984
 *     if buffer is None:
 *         buffer = np.ndarray(shape, dtype=dtype)
 *     elif buffer.dtype != dtype:             # <<<<<<<<<<<<<<
 *         raise ValueError("buffer is wrong type :: buffer=%s != %s" % (
 *                 buffer.dtype, dtype))
 */
  }
  __pyx_L6:;

  /* "miniga4py/ga.pyx":1989
 *     # Due to GA restrictions, buffer must not have negative strides
 *     # and buffer's last stride must be same as itemsize
 *     strides = [buffer.strides[i]/buffer.itemsize for i in range(buffer.ndim)]             # <<<<<<<<<<<<<<
 *     if strides[-1] != 1:
 *         raise ValueError("first dimension of buffer cannot be strided")
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_buffer->nd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_13 = 0;
    __pyx_t_14 = NULL;
  } else {
    __pyx_t_13 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_14 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1989, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_14)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 1989, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1989, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 1989, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1989, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_14(__pyx_t_2);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1989, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1989, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_buffer->strides[__pyx_t_15])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buffer), __pyx_n_s_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_16 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_16))) __PYX_ERR(0, 1989, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_strides = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":1990
 *     # and buffer's last stride must be same as itemsize
 *     strides = [buffer.strides[i]/buffer.itemsize for i in range(buffer.ndim)]
 *     if strides[-1] != 1:             # <<<<<<<<<<<<<<
 *         raise ValueError("first dimension of buffer cannot be strided")
 *     if np.any(np.asarray(strides) < 0):
 */
  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_strides, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_1, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1990, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1990, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_t_11)) {

    /* "miniga4py/ga.pyx":1991
 *     strides = [buffer.strides[i]/buffer.itemsize for i in range(buffer.ndim)]
 *     if strides[-1] != 1:
 *         raise ValueError("first dimension of buffer cannot be strided")             # <<<<<<<<<<<<<<
 *     if np.any(np.asarray(strides) < 0):
 *         raise ValueError("buffer cannot have negative strides")
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1991, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 1991, __pyx_L1_error)

    /* "miniga4py/ga.pyx":1990
 *     # and buffer's last stride must be same as itemsize
 *     strides = [buffer.strides[i]/buffer.itemsize for i in range(buffer.ndim)]
 *     if strides[-1] != 1:             # <<<<<<<<<<<<<<
 *         raise ValueError("first dimension of buffer cannot be strided")
 *     if np.any(np.asarray(strides) < 0):
 */
  }

  /* "miniga4py/ga.pyx":1992
 *     if strides[-1] != 1:
 *         raise ValueError("first dimension of buffer cannot be strided")
 *     if np.any(np.asarray(strides) < 0):             # <<<<<<<<<<<<<<
 *         raise ValueError("buffer cannot have negative strides")
 *     # we allow 1-d "flat" buffers in addition to buffers matching the shape of
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1992, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_any); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1992, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1992, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1992, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_strides); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1992, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_strides};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1992, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_strides};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1992, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_17 = PyTuple_New(1+1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1992, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_strides);
      __Pyx_GIVEREF(__pyx_v_strides);
      PyTuple_SET_ITEM(__pyx_t_17, 0+1, __pyx_v_strides);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1992, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1992, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_16);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_16, function);
    }
  }
  if (!__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1992, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_3};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1992, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_3};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1992, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_17 = PyTuple_New(1+1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1992, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_1); __pyx_t_1 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_17, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_17, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1992, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1992, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_t_11)) {

    /* "miniga4py/ga.pyx":1993
 *         raise ValueError("first dimension of buffer cannot be strided")
 *     if np.any(np.asarray(strides) < 0):
 *         raise ValueError("buffer cannot have negative strides")             # <<<<<<<<<<<<<<
 *     # we allow 1-d "flat" buffers in addition to buffers matching the shape of
 *     # requested region
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1993, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 1993, __pyx_L1_error)

    /* "miniga4py/ga.pyx":1992
 *     if strides[-1] != 1:
 *         raise ValueError("first dimension of buffer cannot be strided")
 *     if np.any(np.asarray(strides) < 0):             # <<<<<<<<<<<<<<
 *         raise ValueError("buffer cannot have negative strides")
 *     # we allow 1-d "flat" buffers in addition to buffers matching the shape of
 */
  }

  /* "miniga4py/ga.pyx":1996
 *     # we allow 1-d "flat" buffers in addition to buffers matching the shape of
 *     # requested region
 *     if buffer.ndim == 1:             # <<<<<<<<<<<<<<
 *         if buffer.size != np.prod(shape):
 *             raise ValueError('buffer size does not match shape :: '
 */
  __pyx_t_11 = ((__pyx_v_buffer->nd == 1) != 0);
  if (__pyx_t_11) {

    /* "miniga4py/ga.pyx":1997
 *     # requested region
 *     if buffer.ndim == 1:
 *         if buffer.size != np.prod(shape):             # <<<<<<<<<<<<<<
 *             raise ValueError('buffer size does not match shape :: '
 *                     'buffer.size=%s != np.prod(shape)=%s' % (
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buffer), __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_17 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_prod); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __pyx_t_17 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_17)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_17);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_17) {
      __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_shape)); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1997, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_17, ((PyObject *)__pyx_v_shape)};
        __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1997, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_GOTREF(__pyx_t_16);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_17, ((PyObject *)__pyx_v_shape)};
        __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1997, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_GOTREF(__pyx_t_16);
      } else
      #endif
      {
        __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1997, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_17); __pyx_t_17 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_v_shape));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_shape));
        PyTuple_SET_ITEM(__pyx_t_1, 0+1, ((PyObject *)__pyx_v_shape));
        __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1997, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_16, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1997, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1997, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(__pyx_t_11)) {

      /* "miniga4py/ga.pyx":2000
 *             raise ValueError('buffer size does not match shape :: '
 *                     'buffer.size=%s != np.prod(shape)=%s' % (
 *                     buffer.size, np.prod(shape)))             # <<<<<<<<<<<<<<
 *         ld_nd = shape[1:]
 *     else:
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buffer), __pyx_n_s_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2000, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2000, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_prod); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2000, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (!__pyx_t_2) {
        __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_t_1, ((PyObject *)__pyx_v_shape)); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 2000, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)__pyx_v_shape)};
          __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 2000, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_16);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)__pyx_v_shape)};
          __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 2000, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_16);
        } else
        #endif
        {
          __pyx_t_17 = PyTuple_New(1+1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 2000, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_17);
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_2); __pyx_t_2 = NULL;
          __Pyx_INCREF(((PyObject *)__pyx_v_shape));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_shape));
          PyTuple_SET_ITEM(__pyx_t_17, 0+1, ((PyObject *)__pyx_v_shape));
          __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_17, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 2000, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2000, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_16);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_16);
      __pyx_t_3 = 0;
      __pyx_t_16 = 0;

      /* "miniga4py/ga.pyx":1999
 *         if buffer.size != np.prod(shape):
 *             raise ValueError('buffer size does not match shape :: '
 *                     'buffer.size=%s != np.prod(shape)=%s' % (             # <<<<<<<<<<<<<<
 *                     buffer.size, np.prod(shape)))
 *         ld_nd = shape[1:]
 */
      __pyx_t_16 = __Pyx_PyString_Format(__pyx_kp_s_buffer_size_does_not_match_shape, __pyx_t_1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1999, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "miniga4py/ga.pyx":1998
 *     if buffer.ndim == 1:
 *         if buffer.size != np.prod(shape):
 *             raise ValueError('buffer size does not match shape :: '             # <<<<<<<<<<<<<<
 *                     'buffer.size=%s != np.prod(shape)=%s' % (
 *                     buffer.size, np.prod(shape)))
 */
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1998, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 1998, __pyx_L1_error)

      /* "miniga4py/ga.pyx":1997
 *     # requested region
 *     if buffer.ndim == 1:
 *         if buffer.size != np.prod(shape):             # <<<<<<<<<<<<<<
 *             raise ValueError('buffer size does not match shape :: '
 *                     'buffer.size=%s != np.prod(shape)=%s' % (
 */
    }

    /* "miniga4py/ga.pyx":2001
 *                     'buffer.size=%s != np.prod(shape)=%s' % (
 *                     buffer.size, np.prod(shape)))
 *         ld_nd = shape[1:]             # <<<<<<<<<<<<<<
 *     else:
 *         buffer_shape = [buffer.shape[i] for i in range(buffer.ndim)]
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_shape), __pyx_slice__20); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2001, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2001, __pyx_L1_error)
    __pyx_t_6 = ((PyArrayObject *)__pyx_t_1);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ld_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        }
        __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
      }
      __pyx_pybuffernd_ld_nd.diminfo[0].strides = __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ld_nd.diminfo[0].shape = __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2001, __pyx_L1_error)
    }
    __pyx_t_6 = 0;
    __pyx_v_ld_nd = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "miniga4py/ga.pyx":1996
 *     # we allow 1-d "flat" buffers in addition to buffers matching the shape of
 *     # requested region
 *     if buffer.ndim == 1:             # <<<<<<<<<<<<<<
 *         if buffer.size != np.prod(shape):
 *             raise ValueError('buffer size does not match shape :: '
 */
    goto __pyx_L11;
  }

  /* "miniga4py/ga.pyx":2003
 *         ld_nd = shape[1:]
 *     else:
 *         buffer_shape = [buffer.shape[i] for i in range(buffer.ndim)]             # <<<<<<<<<<<<<<
 *         if not np.all(buffer_shape == shape):
 *             raise ValueError('buffer shape does not match request shape :: '
 */
  /*else*/ {
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2003, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_buffer->nd); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 2003, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2003, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
      __pyx_t_16 = __pyx_t_3; __Pyx_INCREF(__pyx_t_16); __pyx_t_13 = 0;
      __pyx_t_14 = NULL;
    } else {
      __pyx_t_13 = -1; __pyx_t_16 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 2003, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_14 = Py_TYPE(__pyx_t_16)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2003, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      if (likely(!__pyx_t_14)) {
        if (likely(PyList_CheckExact(__pyx_t_16))) {
          if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_16)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_16, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 2003, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_16, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2003, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_16)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_16, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 2003, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_16, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2003, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_14(__pyx_t_16);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 2003, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2003, __pyx_L1_error)
      __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_buffer->dimensions[__pyx_t_15])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2003, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 2003, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_v_buffer_shape = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "miniga4py/ga.pyx":2004
 *     else:
 *         buffer_shape = [buffer.shape[i] for i in range(buffer.ndim)]
 *         if not np.all(buffer_shape == shape):             # <<<<<<<<<<<<<<
 *             raise ValueError('buffer shape does not match request shape :: '
 *                     'buffer_shape=%s != shape=%s' % (
 */
    __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 2004, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_all); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2004, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = PyObject_RichCompare(__pyx_v_buffer_shape, ((PyObject *)__pyx_v_shape), Py_EQ); __Pyx_XGOTREF(__pyx_t_16); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 2004, __pyx_L1_error)
    __pyx_t_17 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_17)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_17);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_17) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2004, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_17, __pyx_t_16};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2004, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_17, __pyx_t_16};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2004, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2004, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_17); __pyx_t_17 = NULL;
        __Pyx_GIVEREF(__pyx_t_16);
        PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_16);
        __pyx_t_16 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2004, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 2004, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_12 = ((!__pyx_t_11) != 0);
    if (unlikely(__pyx_t_12)) {

      /* "miniga4py/ga.pyx":2007
 *             raise ValueError('buffer shape does not match request shape :: '
 *                     'buffer_shape=%s != shape=%s' % (
 *                     buffer_shape, shape))             # <<<<<<<<<<<<<<
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 *                 for i in range(buffer.ndim-1)], dtype=np.int64)
 */
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2007, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_buffer_shape);
      __Pyx_GIVEREF(__pyx_v_buffer_shape);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_buffer_shape);
      __Pyx_INCREF(((PyObject *)__pyx_v_shape));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_shape));
      PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_shape));

      /* "miniga4py/ga.pyx":2006
 *         if not np.all(buffer_shape == shape):
 *             raise ValueError('buffer shape does not match request shape :: '
 *                     'buffer_shape=%s != shape=%s' % (             # <<<<<<<<<<<<<<
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 */
      __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_buffer_shape_does_not_match_requ, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2006, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "miniga4py/ga.pyx":2005
 *         buffer_shape = [buffer.shape[i] for i in range(buffer.ndim)]
 *         if not np.all(buffer_shape == shape):
 *             raise ValueError('buffer shape does not match request shape :: '             # <<<<<<<<<<<<<<
 *                     'buffer_shape=%s != shape=%s' % (
 *                     buffer_shape, shape))
 */
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2005, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 2005, __pyx_L1_error)

      /* "miniga4py/ga.pyx":2004
 *     else:
 *         buffer_shape = [buffer.shape[i] for i in range(buffer.ndim)]
 *         if not np.all(buffer_shape == shape):             # <<<<<<<<<<<<<<
 *             raise ValueError('buffer shape does not match request shape :: '
 *                     'buffer_shape=%s != shape=%s' % (
 */
    }

    /* "miniga4py/ga.pyx":2008
 *                     'buffer_shape=%s != shape=%s' % (
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]             # <<<<<<<<<<<<<<
 *                 for i in range(buffer.ndim-1)], dtype=np.int64)
 *     if nb:
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2008, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2008, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2008, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "miniga4py/ga.pyx":2009
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 *                 for i in range(buffer.ndim-1)], dtype=np.int64)             # <<<<<<<<<<<<<<
 *     if nb:
 *         NGA_NbGet64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 */
    __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_buffer->nd - 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2009, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 2009, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (likely(PyList_CheckExact(__pyx_t_16)) || PyTuple_CheckExact(__pyx_t_16)) {
      __pyx_t_2 = __pyx_t_16; __Pyx_INCREF(__pyx_t_2); __pyx_t_13 = 0;
      __pyx_t_14 = NULL;
    } else {
      __pyx_t_13 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_14 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2009, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    for (;;) {
      if (likely(!__pyx_t_14)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_16 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_13); __Pyx_INCREF(__pyx_t_16); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 2009, __pyx_L1_error)
          #else
          __pyx_t_16 = PySequence_ITEM(__pyx_t_2, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 2009, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_16);
          #endif
        } else {
          if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_16 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_13); __Pyx_INCREF(__pyx_t_16); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 2009, __pyx_L1_error)
          #else
          __pyx_t_16 = PySequence_ITEM(__pyx_t_2, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 2009, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_16);
          #endif
        }
      } else {
        __pyx_t_16 = __pyx_t_14(__pyx_t_2);
        if (unlikely(!__pyx_t_16)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 2009, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_16);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_16);
      __pyx_t_16 = 0;

      /* "miniga4py/ga.pyx":2008
 *                     'buffer_shape=%s != shape=%s' % (
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]             # <<<<<<<<<<<<<<
 *                 for i in range(buffer.ndim-1)], dtype=np.int64)
 *     if nb:
 */
      __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_v_strides, __pyx_v_i); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 2008, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_17 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 2008, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_strides, __pyx_t_17); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2008, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __pyx_t_17 = __Pyx_PyNumber_Divide(__pyx_t_16, __pyx_t_4); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 2008, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_17))) __PYX_ERR(0, 2008, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

      /* "miniga4py/ga.pyx":2009
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 *                 for i in range(buffer.ndim-1)], dtype=np.int64)             # <<<<<<<<<<<<<<
 *     if nb:
 *         NGA_NbGet64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 */
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "miniga4py/ga.pyx":2008
 *                     'buffer_shape=%s != shape=%s' % (
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]             # <<<<<<<<<<<<<<
 *                 for i in range(buffer.ndim-1)], dtype=np.int64)
 *     if nb:
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2008, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "miniga4py/ga.pyx":2009
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 *                 for i in range(buffer.ndim-1)], dtype=np.int64)             # <<<<<<<<<<<<<<
 *     if nb:
 *         NGA_NbGet64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 */
    __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2009, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_17 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 2009, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_int64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2009, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 2009, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "miniga4py/ga.pyx":2008
 *                     'buffer_shape=%s != shape=%s' % (
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]             # <<<<<<<<<<<<<<
 *                 for i in range(buffer.ndim-1)], dtype=np.int64)
 *     if nb:
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2008, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2008, __pyx_L1_error)
    __pyx_t_6 = ((PyArrayObject *)__pyx_t_4);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ld_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
        }
        __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
      }
      __pyx_pybuffernd_ld_nd.diminfo[0].strides = __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ld_nd.diminfo[0].shape = __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2008, __pyx_L1_error)
    }
    __pyx_t_6 = 0;
    __pyx_v_ld_nd = ((PyArrayObject *)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L11:;

  /* "miniga4py/ga.pyx":2010
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 *                 for i in range(buffer.ndim-1)], dtype=np.int64)
 *     if nb:             # <<<<<<<<<<<<<<
 *         NGA_NbGet64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer.data, <int64_t*>ld_nd.data, &nbhandle)
 */
  __pyx_t_12 = (__pyx_v_nb != 0);
  if (__pyx_t_12) {

    /* "miniga4py/ga.pyx":2011
 *                 for i in range(buffer.ndim-1)], dtype=np.int64)
 *     if nb:
 *         NGA_NbGet64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,             # <<<<<<<<<<<<<<
 *                 <void*>buffer.data, <int64_t*>ld_nd.data, &nbhandle)
 *         return buffer,nbhandle
 */
    NGA_NbGet64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data), ((void *)__pyx_v_buffer->data), ((int64_t *)__pyx_v_ld_nd->data), (&__pyx_v_nbhandle));

    /* "miniga4py/ga.pyx":2013
 *         NGA_NbGet64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer.data, <int64_t*>ld_nd.data, &nbhandle)
 *         return buffer,nbhandle             # <<<<<<<<<<<<<<
 *     elif periodic:
 *         NGA_Periodic_get64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyInt_From_Integer(__pyx_v_nbhandle); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2013, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2013, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_v_buffer));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_buffer));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_buffer));
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":2010
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 *                 for i in range(buffer.ndim-1)], dtype=np.int64)
 *     if nb:             # <<<<<<<<<<<<<<
 *         NGA_NbGet64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer.data, <int64_t*>ld_nd.data, &nbhandle)
 */
  }

  /* "miniga4py/ga.pyx":2014
 *                 <void*>buffer.data, <int64_t*>ld_nd.data, &nbhandle)
 *         return buffer,nbhandle
 *     elif periodic:             # <<<<<<<<<<<<<<
 *         NGA_Periodic_get64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer.data, <int64_t*>ld_nd.data)
 */
  __pyx_t_12 = (__pyx_v_periodic != 0);
  if (__pyx_t_12) {

    /* "miniga4py/ga.pyx":2015
 *         return buffer,nbhandle
 *     elif periodic:
 *         NGA_Periodic_get64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,             # <<<<<<<<<<<<<<
 *                 <void*>buffer.data, <int64_t*>ld_nd.data)
 *         return buffer
 */
    NGA_Periodic_get64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data), ((void *)__pyx_v_buffer->data), ((int64_t *)__pyx_v_ld_nd->data));

    /* "miniga4py/ga.pyx":2017
 *         NGA_Periodic_get64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer.data, <int64_t*>ld_nd.data)
 *         return buffer             # <<<<<<<<<<<<<<
 *     elif skip is not None:
 *         NGA_Strided_get64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_buffer));
    __pyx_r = ((PyObject *)__pyx_v_buffer);
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":2014
 *                 <void*>buffer.data, <int64_t*>ld_nd.data, &nbhandle)
 *         return buffer,nbhandle
 *     elif periodic:             # <<<<<<<<<<<<<<
 *         NGA_Periodic_get64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer.data, <int64_t*>ld_nd.data)
 */
  }

  /* "miniga4py/ga.pyx":2018
 *                 <void*>buffer.data, <int64_t*>ld_nd.data)
 *         return buffer
 *     elif skip is not None:             # <<<<<<<<<<<<<<
 *         NGA_Strided_get64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <int64_t*>skip_nd.data,
 */
  __pyx_t_12 = (__pyx_v_skip != Py_None);
  __pyx_t_11 = (__pyx_t_12 != 0);
  if (__pyx_t_11) {

    /* "miniga4py/ga.pyx":2019
 *         return buffer
 *     elif skip is not None:
 *         NGA_Strided_get64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,             # <<<<<<<<<<<<<<
 *                 <int64_t*>skip_nd.data,
 *                 <void*>buffer.data, <int64_t*>ld_nd.data)
 */
    NGA_Strided_get64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data), ((int64_t *)__pyx_v_skip_nd->data), ((void *)__pyx_v_buffer->data), ((int64_t *)__pyx_v_ld_nd->data));

    /* "miniga4py/ga.pyx":2022
 *                 <int64_t*>skip_nd.data,
 *                 <void*>buffer.data, <int64_t*>ld_nd.data)
 *         return buffer             # <<<<<<<<<<<<<<
 *     else:
 *         NGA_Get64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_buffer));
    __pyx_r = ((PyObject *)__pyx_v_buffer);
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":2018
 *                 <void*>buffer.data, <int64_t*>ld_nd.data)
 *         return buffer
 *     elif skip is not None:             # <<<<<<<<<<<<<<
 *         NGA_Strided_get64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <int64_t*>skip_nd.data,
 */
  }

  /* "miniga4py/ga.pyx":2024
 *         return buffer
 *     else:
 *         NGA_Get64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,             # <<<<<<<<<<<<<<
 *                 <void*>buffer.data, <int64_t*>ld_nd.data)
 *         return buffer
 */
  /*else*/ {

    /* "miniga4py/ga.pyx":2025
 *     else:
 *         NGA_Get64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer.data, <int64_t*>ld_nd.data)             # <<<<<<<<<<<<<<
 *         return buffer
 * 
 */
    NGA_Get64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data), ((void *)__pyx_v_buffer->data), ((int64_t *)__pyx_v_ld_nd->data));

    /* "miniga4py/ga.pyx":2026
 *         NGA_Get64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer.data, <int64_t*>ld_nd.data)
 *         return buffer             # <<<<<<<<<<<<<<
 * 
 * def get_block_info(int g_a):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_buffer));
    __pyx_r = ((PyObject *)__pyx_v_buffer);
    goto __pyx_L0;
  }

  /* "miniga4py/ga.pyx":1939
 *     return _get_common(g_a, lo, hi, buffer)
 * 
 * cdef _get_common(int g_a, lo=None, hi=None, np.ndarray buffer=None,             # <<<<<<<<<<<<<<
 *         bint nb=False, bint periodic=False, skip=None):
 *     """Copies data from global array section to the local array buffer.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_shape.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga._get_common", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_shape.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_ld_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_shape);
  __Pyx_XDECREF((PyObject *)__pyx_v_skip_nd);
  __Pyx_XDECREF(__pyx_v_dtype);
  __Pyx_XDECREF(__pyx_v_strides);
  __Pyx_XDECREF(__pyx_v_buffer_shape);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF((PyObject *)__pyx_v_buffer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2028
 *         return buffer
 * 
 * def get_block_info(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns information about the block-cyclic distribution.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_113get_block_info(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_112get_block_info[] = "get_block_info(int g_a)\nReturns information about the block-cyclic distribution.\n\n    The number of blocks along each of the array axes are returned in the\n    array num_blocks and the dimensions of the individual blocks, specified in\n    the ga.set_block_cyclic or ga.set_block_cyclic_proc_grid subroutines, are\n    returned in block_dims.\n\n    This is a local function.\n\n    :Parameters:\n        g_a : int\n            the array handle\n\n    :returns: The number of blocks along each of the array axes and the dimensions of thet individual blocks, in that order, as ndarrays.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_113get_block_info = {"get_block_info", (PyCFunction)__pyx_pw_9miniga4py_2ga_113get_block_info, METH_O, __pyx_doc_9miniga4py_2ga_112get_block_info};
static PyObject *__pyx_pw_9miniga4py_2ga_113get_block_info(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_block_info (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2028, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.get_block_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_112get_block_info(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_112get_block_info(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyArrayObject *__pyx_v_num_blocks = 0;
  PyArrayObject *__pyx_v_block_dims = 0;
  int __pyx_v_ndim;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_block_dims;
  __Pyx_Buffer __pyx_pybuffer_block_dims;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_num_blocks;
  __Pyx_Buffer __pyx_pybuffer_num_blocks;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("get_block_info", 0);
  __pyx_pybuffer_num_blocks.pybuffer.buf = NULL;
  __pyx_pybuffer_num_blocks.refcount = 0;
  __pyx_pybuffernd_num_blocks.data = NULL;
  __pyx_pybuffernd_num_blocks.rcbuffer = &__pyx_pybuffer_num_blocks;
  __pyx_pybuffer_block_dims.pybuffer.buf = NULL;
  __pyx_pybuffer_block_dims.refcount = 0;
  __pyx_pybuffernd_block_dims.data = NULL;
  __pyx_pybuffernd_block_dims.rcbuffer = &__pyx_pybuffer_block_dims;

  /* "miniga4py/ga.pyx":2046
 *     """
 *     cdef np.ndarray[np.int32_t, ndim=1] num_blocks, block_dims
 *     cdef int ndim = GA_Ndim(g_a)             # <<<<<<<<<<<<<<
 *     num_blocks = np.zeros(ndim, dtype=np.int32)
 *     block_dims = np.zeros(ndim, dtype=np.int32)
 */
  __pyx_v_ndim = GA_Ndim(__pyx_v_g_a);

  /* "miniga4py/ga.pyx":2047
 *     cdef np.ndarray[np.int32_t, ndim=1] num_blocks, block_dims
 *     cdef int ndim = GA_Ndim(g_a)
 *     num_blocks = np.zeros(ndim, dtype=np.int32)             # <<<<<<<<<<<<<<
 *     block_dims = np.zeros(ndim, dtype=np.int32)
 *     GA_Get_block_info(g_a, <int*>num_blocks.data, <int*>block_dims.data)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 2047, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2047, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_num_blocks.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_num_blocks.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_num_blocks.rcbuffer->pybuffer, (PyObject*)__pyx_v_num_blocks, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_num_blocks.diminfo[0].strides = __pyx_pybuffernd_num_blocks.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_num_blocks.diminfo[0].shape = __pyx_pybuffernd_num_blocks.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2047, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_num_blocks = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":2048
 *     cdef int ndim = GA_Ndim(g_a)
 *     num_blocks = np.zeros(ndim, dtype=np.int32)
 *     block_dims = np.zeros(ndim, dtype=np.int32)             # <<<<<<<<<<<<<<
 *     GA_Get_block_info(g_a, <int*>num_blocks.data, <int*>block_dims.data)
 *     return num_blocks,block_dims
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2048, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2048, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_ndim); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2048, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2048, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2048, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2048, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2048, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 2048, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2048, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2048, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_block_dims.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_block_dims.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_block_dims.rcbuffer->pybuffer, (PyObject*)__pyx_v_block_dims, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
      __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
    }
    __pyx_pybuffernd_block_dims.diminfo[0].strides = __pyx_pybuffernd_block_dims.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_block_dims.diminfo[0].shape = __pyx_pybuffernd_block_dims.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2048, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_block_dims = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "miniga4py/ga.pyx":2049
 *     num_blocks = np.zeros(ndim, dtype=np.int32)
 *     block_dims = np.zeros(ndim, dtype=np.int32)
 *     GA_Get_block_info(g_a, <int*>num_blocks.data, <int*>block_dims.data)             # <<<<<<<<<<<<<<
 *     return num_blocks,block_dims
 * 
 */
  GA_Get_block_info(__pyx_v_g_a, ((int *)__pyx_v_num_blocks->data), ((int *)__pyx_v_block_dims->data));

  /* "miniga4py/ga.pyx":2050
 *     block_dims = np.zeros(ndim, dtype=np.int32)
 *     GA_Get_block_info(g_a, <int*>num_blocks.data, <int*>block_dims.data)
 *     return num_blocks,block_dims             # <<<<<<<<<<<<<<
 * 
 * def get_diag(int g_a, int g_v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_num_blocks));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_num_blocks));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_num_blocks));
  __Pyx_INCREF(((PyObject *)__pyx_v_block_dims));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_block_dims));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_block_dims));
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2028
 *         return buffer
 * 
 * def get_block_info(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns information about the block-cyclic distribution.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_block_dims.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_num_blocks.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.get_block_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_block_dims.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_num_blocks.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_num_blocks);
  __Pyx_XDECREF((PyObject *)__pyx_v_block_dims);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2052
 *     return num_blocks,block_dims
 * 
 * def get_diag(int g_a, int g_v):             # <<<<<<<<<<<<<<
 *     """Inserts the diagonal elements of this matrix g_a into the vector g_v.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_115get_diag(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_114get_diag[] = "get_diag(int g_a, int g_v)\nInserts the diagonal elements of this matrix g_a into the vector g_v.\n\n    This is a collective operation.\n    \n    :Parameters:\n        g_a : int\n            the array handle\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_115get_diag = {"get_diag", (PyCFunction)__pyx_pw_9miniga4py_2ga_115get_diag, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_114get_diag};
static PyObject *__pyx_pw_9miniga4py_2ga_115get_diag(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_v;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_diag (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_v,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_diag", 1, 2, 2, 1); __PYX_ERR(0, 2052, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_diag") < 0)) __PYX_ERR(0, 2052, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2052, __pyx_L3_error)
    __pyx_v_g_v = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2052, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_diag", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2052, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.get_diag", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_114get_diag(__pyx_self, __pyx_v_g_a, __pyx_v_g_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_114get_diag(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_v) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_diag", 0);

  /* "miniga4py/ga.pyx":2062
 * 
 *     """
 *     GA_Get_diag(g_a, g_v)             # <<<<<<<<<<<<<<
 * 
 * def get_debug():
 */
  GA_Get_diag(__pyx_v_g_a, __pyx_v_g_v);

  /* "miniga4py/ga.pyx":2052
 *     return num_blocks,block_dims
 * 
 * def get_diag(int g_a, int g_v):             # <<<<<<<<<<<<<<
 *     """Inserts the diagonal elements of this matrix g_a into the vector g_v.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2064
 *     GA_Get_diag(g_a, g_v)
 * 
 * def get_debug():             # <<<<<<<<<<<<<<
 *     """Returns the value of an internal flag in the GA library whose value can
 *     be set using the ga.set_debug() subroutine.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_117get_debug(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_116get_debug[] = "get_debug()\nReturns the value of an internal flag in the GA library whose value can\n    be set using the ga.set_debug() subroutine.\n\n    This is a local operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_117get_debug = {"get_debug", (PyCFunction)__pyx_pw_9miniga4py_2ga_117get_debug, METH_NOARGS, __pyx_doc_9miniga4py_2ga_116get_debug};
static PyObject *__pyx_pw_9miniga4py_2ga_117get_debug(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_debug (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_116get_debug(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_116get_debug(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("get_debug", 0);

  /* "miniga4py/ga.pyx":2071
 * 
 *     """
 *     return GA_Get_debug()             # <<<<<<<<<<<<<<
 * 
 * def gop(X, op):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Get_debug()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2064
 *     GA_Get_diag(g_a, g_v)
 * 
 * def get_debug():             # <<<<<<<<<<<<<<
 *     """Returns the value of an internal flag in the GA library whose value can
 *     be set using the ga.set_debug() subroutine.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.get_debug", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2073
 *     return GA_Get_debug()
 * 
 * def gop(X, op):             # <<<<<<<<<<<<<<
 *     """Global operation.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_119gop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_118gop[] = "gop(X, op)\nGlobal operation.\n\n    X(1:N) is a vector present on each process. gop 'sums' elements of X\n    accross all nodes using the commutative operator op. The result is\n    broadcast to all nodes. Supported operations include '+', '*', 'max',\n    'min', 'absmax', 'absmin'. The use of lowerecase for operators is\n    necessary.\n\n    X must be a contiguous array-like.  X is not guaranteed to be modified\n    in-place so use as:\n\n    >>> value = ga.gop((1,2,3), \"+\")\n\n    This operation is provided only for convenience purposes: it is available\n    regardless of the message-passing library that GA is running with.\n\n    This is a collective operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_119gop = {"gop", (PyCFunction)__pyx_pw_9miniga4py_2ga_119gop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_118gop};
static PyObject *__pyx_pw_9miniga4py_2ga_119gop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_op = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_X,&__pyx_n_s_op,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_op)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("gop", 1, 2, 2, 1); __PYX_ERR(0, 2073, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gop") < 0)) __PYX_ERR(0, 2073, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_X = values[0];
    __pyx_v_op = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gop", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2073, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.gop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_118gop(__pyx_self, __pyx_v_X, __pyx_v_op);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_118gop(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_op) {
  PyArrayObject *__pyx_v_X_nd = 0;
  int __pyx_v_size;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  char *__pyx_t_12;
  __Pyx_RefNannySetupContext("gop", 0);

  /* "miniga4py/ga.pyx":2093
 * 
 *     """
 *     cdef np.ndarray X_nd = np.asarray(X)             # <<<<<<<<<<<<<<
 *     cdef int size = 0
 *     if not X_nd.flags['C_CONTIGUOUS']:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_X); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2093, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_X};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2093, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_X};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2093, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2093, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_v_X);
      __Pyx_GIVEREF(__pyx_v_X);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_X);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2093, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2093, __pyx_L1_error)
  __pyx_v_X_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":2094
 *     """
 *     cdef np.ndarray X_nd = np.asarray(X)
 *     cdef int size = 0             # <<<<<<<<<<<<<<
 *     if not X_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("X must be contiguous")
 */
  __pyx_v_size = 0;

  /* "miniga4py/ga.pyx":2095
 *     cdef np.ndarray X_nd = np.asarray(X)
 *     cdef int size = 0
 *     if not X_nd.flags['C_CONTIGUOUS']:             # <<<<<<<<<<<<<<
 *         raise ValueError("X must be contiguous")
 *     try:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X_nd), __pyx_n_s_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_C_CONTIGUOUS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2095, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = ((!__pyx_t_5) != 0);
  if (unlikely(__pyx_t_6)) {

    /* "miniga4py/ga.pyx":2096
 *     cdef int size = 0
 *     if not X_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("X must be contiguous")             # <<<<<<<<<<<<<<
 *     try:
 *         size = len(X_nd)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2096, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 2096, __pyx_L1_error)

    /* "miniga4py/ga.pyx":2095
 *     cdef np.ndarray X_nd = np.asarray(X)
 *     cdef int size = 0
 *     if not X_nd.flags['C_CONTIGUOUS']:             # <<<<<<<<<<<<<<
 *         raise ValueError("X must be contiguous")
 *     try:
 */
  }

  /* "miniga4py/ga.pyx":2097
 *     if not X_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("X must be contiguous")
 *     try:             # <<<<<<<<<<<<<<
 *         size = len(X_nd)
 *     except TypeError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_9);
    /*try:*/ {

      /* "miniga4py/ga.pyx":2098
 *         raise ValueError("X must be contiguous")
 *     try:
 *         size = len(X_nd)             # <<<<<<<<<<<<<<
 *     except TypeError:
 *         size = 1
 */
      __pyx_t_10 = PyObject_Length(((PyObject *)__pyx_v_X_nd)); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2098, __pyx_L4_error)
      __pyx_v_size = __pyx_t_10;

      /* "miniga4py/ga.pyx":2097
 *     if not X_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("X must be contiguous")
 *     try:             # <<<<<<<<<<<<<<
 *         size = len(X_nd)
 *     except TypeError:
 */
    }
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L9_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "miniga4py/ga.pyx":2099
 *     try:
 *         size = len(X_nd)
 *     except TypeError:             # <<<<<<<<<<<<<<
 *         size = 1
 *     if X_nd.dtype == np.dtype(np.intc):
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
    if (__pyx_t_11) {
      __Pyx_AddTraceback("miniga4py.ga.gop", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_4) < 0) __PYX_ERR(0, 2099, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_4);

      /* "miniga4py/ga.pyx":2100
 *         size = len(X_nd)
 *     except TypeError:
 *         size = 1             # <<<<<<<<<<<<<<
 *     if X_nd.dtype == np.dtype(np.intc):
 *         GA_Igop(<int*>X_nd.data, size, b(op))
 */
      __pyx_v_size = 1;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L5_exception_handled;
    }
    goto __pyx_L6_except_error;
    __pyx_L6_except_error:;

    /* "miniga4py/ga.pyx":2097
 *     if not X_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("X must be contiguous")
 *     try:             # <<<<<<<<<<<<<<
 *         size = len(X_nd)
 *     except TypeError:
 */
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    goto __pyx_L1_error;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    __pyx_L9_try_end:;
  }

  /* "miniga4py/ga.pyx":2101
 *     except TypeError:
 *         size = 1
 *     if X_nd.dtype == np.dtype(np.intc):             # <<<<<<<<<<<<<<
 *         GA_Igop(<int*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.long):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X_nd), __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_intc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2101, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 2101, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":2102
 *         size = 1
 *     if X_nd.dtype == np.dtype(np.intc):
 *         GA_Igop(<int*>X_nd.data, size, b(op))             # <<<<<<<<<<<<<<
 *     elif X_nd.dtype == np.dtype(np.long):
 *         GA_Lgop(<long*>X_nd.data, size, b(op))
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_op); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2102, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_op};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2102, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_op};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2102, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2102, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(__pyx_v_op);
        __Pyx_GIVEREF(__pyx_v_op);
        PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_op);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2102, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_12 = __Pyx_PyObject_AsWritableString(__pyx_t_3); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 2102, __pyx_L1_error)
    GA_Igop(((int *)__pyx_v_X_nd->data), __pyx_v_size, __pyx_t_12);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "miniga4py/ga.pyx":2101
 *     except TypeError:
 *         size = 1
 *     if X_nd.dtype == np.dtype(np.intc):             # <<<<<<<<<<<<<<
 *         GA_Igop(<int*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.long):
 */
    goto __pyx_L12;
  }

  /* "miniga4py/ga.pyx":2103
 *     if X_nd.dtype == np.dtype(np.intc):
 *         GA_Igop(<int*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.long):             # <<<<<<<<<<<<<<
 *         GA_Lgop(<long*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.longlong):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X_nd), __pyx_n_s_dtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_long); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2103, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 2103, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":2104
 *         GA_Igop(<int*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.long):
 *         GA_Lgop(<long*>X_nd.data, size, b(op))             # <<<<<<<<<<<<<<
 *     elif X_nd.dtype == np.dtype(np.longlong):
 *         GA_Llgop(<long long*>X_nd.data, size, b(op))
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2104, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_op); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_op};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2104, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_op};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2104, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2104, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_v_op);
        __Pyx_GIVEREF(__pyx_v_op);
        PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_op);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2104, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_12 = __Pyx_PyObject_AsWritableString(__pyx_t_2); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 2104, __pyx_L1_error)
    GA_Lgop(((long *)__pyx_v_X_nd->data), __pyx_v_size, __pyx_t_12);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "miniga4py/ga.pyx":2103
 *     if X_nd.dtype == np.dtype(np.intc):
 *         GA_Igop(<int*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.long):             # <<<<<<<<<<<<<<
 *         GA_Lgop(<long*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.longlong):
 */
    goto __pyx_L12;
  }

  /* "miniga4py/ga.pyx":2105
 *     elif X_nd.dtype == np.dtype(np.long):
 *         GA_Lgop(<long*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.longlong):             # <<<<<<<<<<<<<<
 *         GA_Llgop(<long long*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.single):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X_nd), __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_longlong); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2105, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 2105, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":2106
 *         GA_Lgop(<long*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.longlong):
 *         GA_Llgop(<long long*>X_nd.data, size, b(op))             # <<<<<<<<<<<<<<
 *     elif X_nd.dtype == np.dtype(np.single):
 *         GA_Fgop(<float*>X_nd.data, size, b(op))
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_2) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_op); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2106, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_op};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2106, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_op};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2106, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2106, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
        __Pyx_INCREF(__pyx_v_op);
        __Pyx_GIVEREF(__pyx_v_op);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_op);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2106, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_12 = __Pyx_PyObject_AsWritableString(__pyx_t_4); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 2106, __pyx_L1_error)
    GA_Llgop(((PY_LONG_LONG *)__pyx_v_X_nd->data), __pyx_v_size, __pyx_t_12);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "miniga4py/ga.pyx":2105
 *     elif X_nd.dtype == np.dtype(np.long):
 *         GA_Lgop(<long*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.longlong):             # <<<<<<<<<<<<<<
 *         GA_Llgop(<long long*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.single):
 */
    goto __pyx_L12;
  }

  /* "miniga4py/ga.pyx":2107
 *     elif X_nd.dtype == np.dtype(np.longlong):
 *         GA_Llgop(<long long*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.single):             # <<<<<<<<<<<<<<
 *         GA_Fgop(<float*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.double):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X_nd), __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_single); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2107, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 2107, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":2108
 *         GA_Llgop(<long long*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.single):
 *         GA_Fgop(<float*>X_nd.data, size, b(op))             # <<<<<<<<<<<<<<
 *     elif X_nd.dtype == np.dtype(np.double):
 *         GA_Dgop(<double*>X_nd.data, size, b(op))
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_op); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2108, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_op};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2108, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_op};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2108, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2108, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(__pyx_v_op);
        __Pyx_GIVEREF(__pyx_v_op);
        PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_op);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2108, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_12 = __Pyx_PyObject_AsWritableString(__pyx_t_3); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 2108, __pyx_L1_error)
    GA_Fgop(((float *)__pyx_v_X_nd->data), __pyx_v_size, __pyx_t_12);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "miniga4py/ga.pyx":2107
 *     elif X_nd.dtype == np.dtype(np.longlong):
 *         GA_Llgop(<long long*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.single):             # <<<<<<<<<<<<<<
 *         GA_Fgop(<float*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.double):
 */
    goto __pyx_L12;
  }

  /* "miniga4py/ga.pyx":2109
 *     elif X_nd.dtype == np.dtype(np.single):
 *         GA_Fgop(<float*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.double):             # <<<<<<<<<<<<<<
 *         GA_Dgop(<double*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.complex64):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X_nd), __pyx_n_s_dtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_double); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2109, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 2109, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":2110
 *         GA_Fgop(<float*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.double):
 *         GA_Dgop(<double*>X_nd.data, size, b(op))             # <<<<<<<<<<<<<<
 *     elif X_nd.dtype == np.dtype(np.complex64):
 *         GA_Cgop(<SingleComplex*>X_nd.data, size, b(op))
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_op); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2110, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_op};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2110, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_op};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2110, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_v_op);
        __Pyx_GIVEREF(__pyx_v_op);
        PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_op);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_12 = __Pyx_PyObject_AsWritableString(__pyx_t_2); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 2110, __pyx_L1_error)
    GA_Dgop(((double *)__pyx_v_X_nd->data), __pyx_v_size, __pyx_t_12);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "miniga4py/ga.pyx":2109
 *     elif X_nd.dtype == np.dtype(np.single):
 *         GA_Fgop(<float*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.double):             # <<<<<<<<<<<<<<
 *         GA_Dgop(<double*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.complex64):
 */
    goto __pyx_L12;
  }

  /* "miniga4py/ga.pyx":2111
 *     elif X_nd.dtype == np.dtype(np.double):
 *         GA_Dgop(<double*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.complex64):             # <<<<<<<<<<<<<<
 *         GA_Cgop(<SingleComplex*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.complex128):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X_nd), __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_complex64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2111, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 2111, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":2112
 *         GA_Dgop(<double*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.complex64):
 *         GA_Cgop(<SingleComplex*>X_nd.data, size, b(op))             # <<<<<<<<<<<<<<
 *     elif X_nd.dtype == np.dtype(np.complex128):
 *         GA_Zgop(<DoubleComplex*>X_nd.data, size, b(op))
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_2) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_op); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2112, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_op};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2112, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_op};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2112, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2112, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
        __Pyx_INCREF(__pyx_v_op);
        __Pyx_GIVEREF(__pyx_v_op);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_op);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2112, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_12 = __Pyx_PyObject_AsWritableString(__pyx_t_4); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 2112, __pyx_L1_error)
    GA_Cgop(((SingleComplex *)__pyx_v_X_nd->data), __pyx_v_size, __pyx_t_12);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "miniga4py/ga.pyx":2111
 *     elif X_nd.dtype == np.dtype(np.double):
 *         GA_Dgop(<double*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.complex64):             # <<<<<<<<<<<<<<
 *         GA_Cgop(<SingleComplex*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.complex128):
 */
    goto __pyx_L12;
  }

  /* "miniga4py/ga.pyx":2113
 *     elif X_nd.dtype == np.dtype(np.complex64):
 *         GA_Cgop(<SingleComplex*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.complex128):             # <<<<<<<<<<<<<<
 *         GA_Zgop(<DoubleComplex*>X_nd.data, size, b(op))
 *     else:
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X_nd), __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_complex128); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2113, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 2113, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (likely(__pyx_t_6)) {

    /* "miniga4py/ga.pyx":2114
 *         GA_Cgop(<SingleComplex*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.complex128):
 *         GA_Zgop(<DoubleComplex*>X_nd.data, size, b(op))             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError("type not supported by ga.gop %s" % X_nd.dtype)
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_op); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_op};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2114, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_op};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2114, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2114, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(__pyx_v_op);
        __Pyx_GIVEREF(__pyx_v_op);
        PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_op);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2114, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_12 = __Pyx_PyObject_AsWritableString(__pyx_t_3); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 2114, __pyx_L1_error)
    GA_Zgop(((DoubleComplex *)__pyx_v_X_nd->data), __pyx_v_size, __pyx_t_12);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "miniga4py/ga.pyx":2113
 *     elif X_nd.dtype == np.dtype(np.complex64):
 *         GA_Cgop(<SingleComplex*>X_nd.data, size, b(op))
 *     elif X_nd.dtype == np.dtype(np.complex128):             # <<<<<<<<<<<<<<
 *         GA_Zgop(<DoubleComplex*>X_nd.data, size, b(op))
 *     else:
 */
    goto __pyx_L12;
  }

  /* "miniga4py/ga.pyx":2116
 *         GA_Zgop(<DoubleComplex*>X_nd.data, size, b(op))
 *     else:
 *         raise TypeError("type not supported by ga.gop %s" % X_nd.dtype)             # <<<<<<<<<<<<<<
 *     return X_nd
 * 
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X_nd), __pyx_n_s_dtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_type_not_supported_by_ga_gop_s, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 2116, __pyx_L1_error)
  }
  __pyx_L12:;

  /* "miniga4py/ga.pyx":2117
 *     else:
 *         raise TypeError("type not supported by ga.gop %s" % X_nd.dtype)
 *     return X_nd             # <<<<<<<<<<<<<<
 * 
 * def gop_add(X):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_X_nd));
  __pyx_r = ((PyObject *)__pyx_v_X_nd);
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2073
 *     return GA_Get_debug()
 * 
 * def gop(X, op):             # <<<<<<<<<<<<<<
 *     """Global operation.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("miniga4py.ga.gop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_X_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2119
 *     return X_nd
 * 
 * def gop_add(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "+")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_121gop_add(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/
static char __pyx_doc_9miniga4py_2ga_120gop_add[] = "gop_add(X)";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_121gop_add = {"gop_add", (PyCFunction)__pyx_pw_9miniga4py_2ga_121gop_add, METH_O, __pyx_doc_9miniga4py_2ga_120gop_add};
static PyObject *__pyx_pw_9miniga4py_2ga_121gop_add(PyObject *__pyx_self, PyObject *__pyx_v_X) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gop_add (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_120gop_add(__pyx_self, ((PyObject *)__pyx_v_X));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_120gop_add(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("gop_add", 0);

  /* "miniga4py/ga.pyx":2120
 * 
 * def gop_add(X):
 *     return gop(X, "+")             # <<<<<<<<<<<<<<
 * 
 * def gop_multiply(X):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_gop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_X, __pyx_kp_s__22};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2120, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_X, __pyx_kp_s__22};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2120, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_X);
    __Pyx_GIVEREF(__pyx_v_X);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_X);
    __Pyx_INCREF(__pyx_kp_s__22);
    __Pyx_GIVEREF(__pyx_kp_s__22);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_kp_s__22);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2119
 *     return X_nd
 * 
 * def gop_add(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "+")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("miniga4py.ga.gop_add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2122
 *     return gop(X, "+")
 * 
 * def gop_multiply(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "*")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_123gop_multiply(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/
static char __pyx_doc_9miniga4py_2ga_122gop_multiply[] = "gop_multiply(X)";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_123gop_multiply = {"gop_multiply", (PyCFunction)__pyx_pw_9miniga4py_2ga_123gop_multiply, METH_O, __pyx_doc_9miniga4py_2ga_122gop_multiply};
static PyObject *__pyx_pw_9miniga4py_2ga_123gop_multiply(PyObject *__pyx_self, PyObject *__pyx_v_X) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gop_multiply (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_122gop_multiply(__pyx_self, ((PyObject *)__pyx_v_X));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_122gop_multiply(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("gop_multiply", 0);

  /* "miniga4py/ga.pyx":2123
 * 
 * def gop_multiply(X):
 *     return gop(X, "*")             # <<<<<<<<<<<<<<
 * 
 * def gop_max(X):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_gop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_X, __pyx_kp_s__23};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2123, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_X, __pyx_kp_s__23};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2123, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_X);
    __Pyx_GIVEREF(__pyx_v_X);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_X);
    __Pyx_INCREF(__pyx_kp_s__23);
    __Pyx_GIVEREF(__pyx_kp_s__23);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_kp_s__23);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2122
 *     return gop(X, "+")
 * 
 * def gop_multiply(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "*")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("miniga4py.ga.gop_multiply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2125
 *     return gop(X, "*")
 * 
 * def gop_max(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "max")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_125gop_max(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/
static char __pyx_doc_9miniga4py_2ga_124gop_max[] = "gop_max(X)";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_125gop_max = {"gop_max", (PyCFunction)__pyx_pw_9miniga4py_2ga_125gop_max, METH_O, __pyx_doc_9miniga4py_2ga_124gop_max};
static PyObject *__pyx_pw_9miniga4py_2ga_125gop_max(PyObject *__pyx_self, PyObject *__pyx_v_X) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gop_max (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_124gop_max(__pyx_self, ((PyObject *)__pyx_v_X));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_124gop_max(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("gop_max", 0);

  /* "miniga4py/ga.pyx":2126
 * 
 * def gop_max(X):
 *     return gop(X, "max")             # <<<<<<<<<<<<<<
 * 
 * def gop_min(X):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_gop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_X, __pyx_n_s_max};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2126, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_X, __pyx_n_s_max};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2126, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_X);
    __Pyx_GIVEREF(__pyx_v_X);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_X);
    __Pyx_INCREF(__pyx_n_s_max);
    __Pyx_GIVEREF(__pyx_n_s_max);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_n_s_max);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2125
 *     return gop(X, "*")
 * 
 * def gop_max(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "max")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("miniga4py.ga.gop_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2128
 *     return gop(X, "max")
 * 
 * def gop_min(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "min")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_127gop_min(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/
static char __pyx_doc_9miniga4py_2ga_126gop_min[] = "gop_min(X)";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_127gop_min = {"gop_min", (PyCFunction)__pyx_pw_9miniga4py_2ga_127gop_min, METH_O, __pyx_doc_9miniga4py_2ga_126gop_min};
static PyObject *__pyx_pw_9miniga4py_2ga_127gop_min(PyObject *__pyx_self, PyObject *__pyx_v_X) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gop_min (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_126gop_min(__pyx_self, ((PyObject *)__pyx_v_X));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_126gop_min(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("gop_min", 0);

  /* "miniga4py/ga.pyx":2129
 * 
 * def gop_min(X):
 *     return gop(X, "min")             # <<<<<<<<<<<<<<
 * 
 * def gop_absmax(X):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_gop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_X, __pyx_n_s_min};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2129, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_X, __pyx_n_s_min};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2129, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_X);
    __Pyx_GIVEREF(__pyx_v_X);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_X);
    __Pyx_INCREF(__pyx_n_s_min);
    __Pyx_GIVEREF(__pyx_n_s_min);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_n_s_min);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2128
 *     return gop(X, "max")
 * 
 * def gop_min(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "min")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("miniga4py.ga.gop_min", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2131
 *     return gop(X, "min")
 * 
 * def gop_absmax(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "absmax")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_129gop_absmax(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/
static char __pyx_doc_9miniga4py_2ga_128gop_absmax[] = "gop_absmax(X)";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_129gop_absmax = {"gop_absmax", (PyCFunction)__pyx_pw_9miniga4py_2ga_129gop_absmax, METH_O, __pyx_doc_9miniga4py_2ga_128gop_absmax};
static PyObject *__pyx_pw_9miniga4py_2ga_129gop_absmax(PyObject *__pyx_self, PyObject *__pyx_v_X) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gop_absmax (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_128gop_absmax(__pyx_self, ((PyObject *)__pyx_v_X));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_128gop_absmax(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("gop_absmax", 0);

  /* "miniga4py/ga.pyx":2132
 * 
 * def gop_absmax(X):
 *     return gop(X, "absmax")             # <<<<<<<<<<<<<<
 * 
 * def gop_absmin(X):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_gop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_X, __pyx_n_s_absmax};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2132, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_X, __pyx_n_s_absmax};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2132, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_X);
    __Pyx_GIVEREF(__pyx_v_X);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_X);
    __Pyx_INCREF(__pyx_n_s_absmax);
    __Pyx_GIVEREF(__pyx_n_s_absmax);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_n_s_absmax);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2131
 *     return gop(X, "min")
 * 
 * def gop_absmax(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "absmax")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("miniga4py.ga.gop_absmax", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2134
 *     return gop(X, "absmax")
 * 
 * def gop_absmin(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "absmin")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_131gop_absmin(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/
static char __pyx_doc_9miniga4py_2ga_130gop_absmin[] = "gop_absmin(X)";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_131gop_absmin = {"gop_absmin", (PyCFunction)__pyx_pw_9miniga4py_2ga_131gop_absmin, METH_O, __pyx_doc_9miniga4py_2ga_130gop_absmin};
static PyObject *__pyx_pw_9miniga4py_2ga_131gop_absmin(PyObject *__pyx_self, PyObject *__pyx_v_X) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gop_absmin (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_130gop_absmin(__pyx_self, ((PyObject *)__pyx_v_X));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_130gop_absmin(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("gop_absmin", 0);

  /* "miniga4py/ga.pyx":2135
 * 
 * def gop_absmin(X):
 *     return gop(X, "absmin")             # <<<<<<<<<<<<<<
 * 
 * def has_ghosts(int g_a):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_gop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_X, __pyx_n_s_absmin};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2135, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_X, __pyx_n_s_absmin};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2135, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_X);
    __Pyx_GIVEREF(__pyx_v_X);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_X);
    __Pyx_INCREF(__pyx_n_s_absmin);
    __Pyx_GIVEREF(__pyx_n_s_absmin);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_n_s_absmin);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2134
 *     return gop(X, "absmax")
 * 
 * def gop_absmin(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "absmin")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("miniga4py.ga.gop_absmin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2137
 *     return gop(X, "absmin")
 * 
 * def has_ghosts(int g_a):             # <<<<<<<<<<<<<<
 *     """Determines whether any dimension of the given array has ghost cells.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_133has_ghosts(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_132has_ghosts[] = "has_ghosts(int g_a)\nDetermines whether any dimension of the given array has ghost cells.\n\n    This is a collective operation. \n\n    :Parameters:\n        g_a : int\n            the array handle\n\n    :returns: True if the global array has some dimensions for which the ghost cell width is greater than zero, it returns False otherwise.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_133has_ghosts = {"has_ghosts", (PyCFunction)__pyx_pw_9miniga4py_2ga_133has_ghosts, METH_O, __pyx_doc_9miniga4py_2ga_132has_ghosts};
static PyObject *__pyx_pw_9miniga4py_2ga_133has_ghosts(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_ghosts (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2137, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.has_ghosts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_132has_ghosts(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_132has_ghosts(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("has_ghosts", 0);

  /* "miniga4py/ga.pyx":2149
 * 
 *     """
 *     if GA_Has_ghosts(g_a) == 1:             # <<<<<<<<<<<<<<
 *         return True
 *     return False
 */
  __pyx_t_1 = ((GA_Has_ghosts(__pyx_v_g_a) == 1) != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":2150
 *     """
 *     if GA_Has_ghosts(g_a) == 1:
 *         return True             # <<<<<<<<<<<<<<
 *     return False
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":2149
 * 
 *     """
 *     if GA_Has_ghosts(g_a) == 1:             # <<<<<<<<<<<<<<
 *         return True
 *     return False
 */
  }

  /* "miniga4py/ga.pyx":2151
 *     if GA_Has_ghosts(g_a) == 1:
 *         return True
 *     return False             # <<<<<<<<<<<<<<
 * 
 * def init_fence():
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2137
 *     return gop(X, "absmin")
 * 
 * def has_ghosts(int g_a):             # <<<<<<<<<<<<<<
 *     """Determines whether any dimension of the given array has ghost cells.
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2153
 *     return False
 * 
 * def init_fence():             # <<<<<<<<<<<<<<
 *     """Initializes tracing of completion status of data movement operations.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_135init_fence(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_134init_fence[] = "init_fence()\nInitializes tracing of completion status of data movement operations.\n\n    This operation is local.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_135init_fence = {"init_fence", (PyCFunction)__pyx_pw_9miniga4py_2ga_135init_fence, METH_NOARGS, __pyx_doc_9miniga4py_2ga_134init_fence};
static PyObject *__pyx_pw_9miniga4py_2ga_135init_fence(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init_fence (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_134init_fence(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_134init_fence(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init_fence", 0);

  /* "miniga4py/ga.pyx":2159
 * 
 *     """
 *     GA_Init_fence()             # <<<<<<<<<<<<<<
 * 
 * def initialize():
 */
  GA_Init_fence();

  /* "miniga4py/ga.pyx":2153
 *     return False
 * 
 * def init_fence():             # <<<<<<<<<<<<<<
 *     """Initializes tracing of completion status of data movement operations.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2161
 *     GA_Init_fence()
 * 
 * def initialize():             # <<<<<<<<<<<<<<
 *     """Allocates and initializes internal data structures in Global Arrays.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_137initialize(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_136initialize[] = "initialize()\nAllocates and initializes internal data structures in Global Arrays.\n\n    This is a collective operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_137initialize = {"initialize", (PyCFunction)__pyx_pw_9miniga4py_2ga_137initialize, METH_NOARGS, __pyx_doc_9miniga4py_2ga_136initialize};
static PyObject *__pyx_pw_9miniga4py_2ga_137initialize(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("initialize (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_136initialize(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_136initialize(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_v_atexit = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("initialize", 0);

  /* "miniga4py/ga.pyx":2167
 * 
 *     """
 *     import atexit             # <<<<<<<<<<<<<<
 *     global _initialized
 *     GA_Initialize()
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_atexit, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_atexit = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":2169
 *     import atexit
 *     global _initialized
 *     GA_Initialize()             # <<<<<<<<<<<<<<
 *     GA_Register_stack_memory(_gapy_malloc, _gapy_free)
 *     atexit.register(terminate)
 */
  GA_Initialize();

  /* "miniga4py/ga.pyx":2170
 *     global _initialized
 *     GA_Initialize()
 *     GA_Register_stack_memory(_gapy_malloc, _gapy_free)             # <<<<<<<<<<<<<<
 *     atexit.register(terminate)
 *     _initialized = True
 */
  GA_Register_stack_memory(__pyx_f_9miniga4py_2ga__gapy_malloc, __pyx_f_9miniga4py_2ga__gapy_free);

  /* "miniga4py/ga.pyx":2171
 *     GA_Initialize()
 *     GA_Register_stack_memory(_gapy_malloc, _gapy_free)
 *     atexit.register(terminate)             # <<<<<<<<<<<<<<
 *     _initialized = True
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_atexit, __pyx_n_s_register); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_terminate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2171, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2171, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2171, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2171, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2171, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":2172
 *     GA_Register_stack_memory(_gapy_malloc, _gapy_free)
 *     atexit.register(terminate)
 *     _initialized = True             # <<<<<<<<<<<<<<
 * 
 * def initialize_ltd(size_t limit):
 */
  __pyx_v_9miniga4py_2ga__initialized = 1;

  /* "miniga4py/ga.pyx":2161
 *     GA_Init_fence()
 * 
 * def initialize():             # <<<<<<<<<<<<<<
 *     """Allocates and initializes internal data structures in Global Arrays.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("miniga4py.ga.initialize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_atexit);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2174
 *     _initialized = True
 * 
 * def initialize_ltd(size_t limit):             # <<<<<<<<<<<<<<
 *     """Allocates and initializes internal data structures and sets limit for
 *     memory used in global arrays.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_139initialize_ltd(PyObject *__pyx_self, PyObject *__pyx_arg_limit); /*proto*/
static char __pyx_doc_9miniga4py_2ga_138initialize_ltd[] = "initialize_ltd(size_t limit)\nAllocates and initializes internal data structures and sets limit for\n    memory used in global arrays.\n    \n    The limit is per process: it is the amount of memory that the given\n    processor can contribute to collective allocation of global arrays. It\n    does not include temporary storage that GA might be allocating (and\n    releasing) during execution of a particular operation.\n\n    limit = 0 means \"allow unlimited memory usage\" in which case this\n    operation is equivalent to GA_initialize.\n\n    This is a collective operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_139initialize_ltd = {"initialize_ltd", (PyCFunction)__pyx_pw_9miniga4py_2ga_139initialize_ltd, METH_O, __pyx_doc_9miniga4py_2ga_138initialize_ltd};
static PyObject *__pyx_pw_9miniga4py_2ga_139initialize_ltd(PyObject *__pyx_self, PyObject *__pyx_arg_limit) {
  size_t __pyx_v_limit;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("initialize_ltd (wrapper)", 0);
  assert(__pyx_arg_limit); {
    __pyx_v_limit = __Pyx_PyInt_As_size_t(__pyx_arg_limit); if (unlikely((__pyx_v_limit == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2174, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.initialize_ltd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_138initialize_ltd(__pyx_self, ((size_t)__pyx_v_limit));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_138initialize_ltd(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_limit) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("initialize_ltd", 0);

  /* "miniga4py/ga.pyx":2190
 *     """
 *     global _initialized
 *     GA_Initialize_ltd(limit)             # <<<<<<<<<<<<<<
 *     _initialized = True
 * 
 */
  GA_Initialize_ltd(__pyx_v_limit);

  /* "miniga4py/ga.pyx":2191
 *     global _initialized
 *     GA_Initialize_ltd(limit)
 *     _initialized = True             # <<<<<<<<<<<<<<
 * 
 * def initialized():
 */
  __pyx_v_9miniga4py_2ga__initialized = 1;

  /* "miniga4py/ga.pyx":2174
 *     _initialized = True
 * 
 * def initialize_ltd(size_t limit):             # <<<<<<<<<<<<<<
 *     """Allocates and initializes internal data structures and sets limit for
 *     memory used in global arrays.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2193
 *     _initialized = True
 * 
 * def initialized():             # <<<<<<<<<<<<<<
 *     """Returns whether ga has been initialized."""
 *     return _initialized
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_141initialized(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_140initialized[] = "initialized()\nReturns whether ga has been initialized.";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_141initialized = {"initialized", (PyCFunction)__pyx_pw_9miniga4py_2ga_141initialized, METH_NOARGS, __pyx_doc_9miniga4py_2ga_140initialized};
static PyObject *__pyx_pw_9miniga4py_2ga_141initialized(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("initialized (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_140initialized(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_140initialized(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("initialized", 0);

  /* "miniga4py/ga.pyx":2195
 * def initialized():
 *     """Returns whether ga has been initialized."""
 *     return _initialized             # <<<<<<<<<<<<<<
 * 
 * cpdef inquire(int g_a):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_9miniga4py_2ga__initialized); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2193
 *     _initialized = True
 * 
 * def initialized():             # <<<<<<<<<<<<<<
 *     """Returns whether ga has been initialized."""
 *     return _initialized
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.initialized", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2197
 *     return _initialized
 * 
 * cpdef inquire(int g_a):             # <<<<<<<<<<<<<<
 *     cdef int gtype
 *     cdef int ndim = GA_Ndim(g_a)
 */

static PyObject *__pyx_pw_9miniga4py_2ga_143inquire(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static PyObject *__pyx_f_9miniga4py_2ga_inquire(int __pyx_v_g_a, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_gtype;
  int __pyx_v_ndim;
  PyArrayObject *__pyx_v_dims = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dims;
  __Pyx_Buffer __pyx_pybuffer_dims;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("inquire", 0);
  __pyx_pybuffer_dims.pybuffer.buf = NULL;
  __pyx_pybuffer_dims.refcount = 0;
  __pyx_pybuffernd_dims.data = NULL;
  __pyx_pybuffernd_dims.rcbuffer = &__pyx_pybuffer_dims;

  /* "miniga4py/ga.pyx":2199
 * cpdef inquire(int g_a):
 *     cdef int gtype
 *     cdef int ndim = GA_Ndim(g_a)             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[np.int64_t, ndim=1] dims=np.zeros((ndim), dtype=np.int64)
 *     NGA_Inquire64(g_a, &gtype, &ndim, <int64_t*>dims.data)
 */
  __pyx_v_ndim = GA_Ndim(__pyx_v_g_a);

  /* "miniga4py/ga.pyx":2200
 *     cdef int gtype
 *     cdef int ndim = GA_Ndim(g_a)
 *     cdef np.ndarray[np.int64_t, ndim=1] dims=np.zeros((ndim), dtype=np.int64)             # <<<<<<<<<<<<<<
 *     NGA_Inquire64(g_a, &gtype, &ndim, <int64_t*>dims.data)
 *     return gtype,dims
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 2200, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2200, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_dims = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_dims.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 2200, __pyx_L1_error)
    } else {__pyx_pybuffernd_dims.diminfo[0].strides = __pyx_pybuffernd_dims.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dims.diminfo[0].shape = __pyx_pybuffernd_dims.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_dims = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":2201
 *     cdef int ndim = GA_Ndim(g_a)
 *     cdef np.ndarray[np.int64_t, ndim=1] dims=np.zeros((ndim), dtype=np.int64)
 *     NGA_Inquire64(g_a, &gtype, &ndim, <int64_t*>dims.data)             # <<<<<<<<<<<<<<
 *     return gtype,dims
 * 
 */
  NGA_Inquire64(__pyx_v_g_a, (&__pyx_v_gtype), (&__pyx_v_ndim), ((int64_t *)__pyx_v_dims->data));

  /* "miniga4py/ga.pyx":2202
 *     cdef np.ndarray[np.int64_t, ndim=1] dims=np.zeros((ndim), dtype=np.int64)
 *     NGA_Inquire64(g_a, &gtype, &ndim, <int64_t*>dims.data)
 *     return gtype,dims             # <<<<<<<<<<<<<<
 * 
 * cpdef np.ndarray[np.int64_t, ndim=1] inquire_dims(int g_a):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_dims));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dims));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_dims));
  __pyx_t_5 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2197
 *     return _initialized
 * 
 * cpdef inquire(int g_a):             # <<<<<<<<<<<<<<
 *     cdef int gtype
 *     cdef int ndim = GA_Ndim(g_a)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.inquire", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dims);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_143inquire(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_142inquire[] = "inquire(int g_a)";
static PyObject *__pyx_pw_9miniga4py_2ga_143inquire(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("inquire (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2197, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.inquire", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_142inquire(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_142inquire(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("inquire", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_9miniga4py_2ga_inquire(__pyx_v_g_a, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.inquire", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2204
 *     return gtype,dims
 * 
 * cpdef np.ndarray[np.int64_t, ndim=1] inquire_dims(int g_a):             # <<<<<<<<<<<<<<
 *     cdef int gtype
 *     cdef np.ndarray[np.int64_t, ndim=1] dims
 */

static PyObject *__pyx_pw_9miniga4py_2ga_145inquire_dims(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static PyArrayObject *__pyx_f_9miniga4py_2ga_inquire_dims(int __pyx_v_g_a, CYTHON_UNUSED int __pyx_skip_dispatch) {
  CYTHON_UNUSED int __pyx_v_gtype;
  PyArrayObject *__pyx_v_dims = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dims;
  __Pyx_Buffer __pyx_pybuffer_dims;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  PyArrayObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("inquire_dims", 0);
  __pyx_pybuffer_dims.pybuffer.buf = NULL;
  __pyx_pybuffer_dims.refcount = 0;
  __pyx_pybuffernd_dims.data = NULL;
  __pyx_pybuffernd_dims.rcbuffer = &__pyx_pybuffer_dims;

  /* "miniga4py/ga.pyx":2207
 *     cdef int gtype
 *     cdef np.ndarray[np.int64_t, ndim=1] dims
 *     gtype,dims = inquire(g_a)             # <<<<<<<<<<<<<<
 *     return dims
 * 
 */
  __pyx_t_1 = __pyx_f_9miniga4py_2ga_inquire(__pyx_v_g_a, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2207, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 2207, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2207, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2207, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2207, __pyx_L1_error)
  __pyx_v_gtype = __pyx_t_6;
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims.rcbuffer->pybuffer);
    __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_6 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims.rcbuffer->pybuffer, (PyObject*)__pyx_v_dims, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_dims.diminfo[0].strides = __pyx_pybuffernd_dims.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dims.diminfo[0].shape = __pyx_pybuffernd_dims.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 2207, __pyx_L1_error)
  }
  __pyx_t_7 = 0;
  __pyx_v_dims = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "miniga4py/ga.pyx":2208
 *     cdef np.ndarray[np.int64_t, ndim=1] dims
 *     gtype,dims = inquire(g_a)
 *     return dims             # <<<<<<<<<<<<<<
 * 
 * def inquire_memory():
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_dims));
  __pyx_r = ((PyArrayObject *)__pyx_v_dims);
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2204
 *     return gtype,dims
 * 
 * cpdef np.ndarray[np.int64_t, ndim=1] inquire_dims(int g_a):             # <<<<<<<<<<<<<<
 *     cdef int gtype
 *     cdef np.ndarray[np.int64_t, ndim=1] dims
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.inquire_dims", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dims);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_145inquire_dims(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_144inquire_dims[] = "inquire_dims(int g_a) -> ndarray";
static PyObject *__pyx_pw_9miniga4py_2ga_145inquire_dims(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("inquire_dims (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2204, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.inquire_dims", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_144inquire_dims(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_144inquire_dims(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("inquire_dims", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga_inquire_dims(__pyx_v_g_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.inquire_dims", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2210
 *     return dims
 * 
 * def inquire_memory():             # <<<<<<<<<<<<<<
 *     """Returns amount of memory (in bytes) used in the allocated global arrays
 *     on the calling processor.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_147inquire_memory(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_146inquire_memory[] = "inquire_memory()\nReturns amount of memory (in bytes) used in the allocated global arrays\n    on the calling processor.\n\n    This operation is local. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_147inquire_memory = {"inquire_memory", (PyCFunction)__pyx_pw_9miniga4py_2ga_147inquire_memory, METH_NOARGS, __pyx_doc_9miniga4py_2ga_146inquire_memory};
static PyObject *__pyx_pw_9miniga4py_2ga_147inquire_memory(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("inquire_memory (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_146inquire_memory(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_146inquire_memory(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("inquire_memory", 0);

  /* "miniga4py/ga.pyx":2217
 * 
 *     """
 *     return GA_Inquire_memory()             # <<<<<<<<<<<<<<
 * 
 * def inquire_name(int g_a):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(GA_Inquire_memory()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2210
 *     return dims
 * 
 * def inquire_memory():             # <<<<<<<<<<<<<<
 *     """Returns amount of memory (in bytes) used in the allocated global arrays
 *     on the calling processor.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.inquire_memory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2219
 *     return GA_Inquire_memory()
 * 
 * def inquire_name(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns the name of an array represented by the handle g_a.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_149inquire_name(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_148inquire_name[] = "inquire_name(int g_a)\nReturns the name of an array represented by the handle g_a.\n\n    This operation is local.\n\n    :Parameters:\n        g_a : int\n            the array handle\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_149inquire_name = {"inquire_name", (PyCFunction)__pyx_pw_9miniga4py_2ga_149inquire_name, METH_O, __pyx_doc_9miniga4py_2ga_148inquire_name};
static PyObject *__pyx_pw_9miniga4py_2ga_149inquire_name(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("inquire_name (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2219, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.inquire_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_148inquire_name(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_148inquire_name(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("inquire_name", 0);

  /* "miniga4py/ga.pyx":2229
 * 
 *     """
 *     return s(GA_Inquire_name(g_a))             # <<<<<<<<<<<<<<
 * 
 * cpdef int inquire_type(int g_a):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_s); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyBytes_FromString(GA_Inquire_name(__pyx_v_g_a)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2229, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2229, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2229, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2229, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2229, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2219
 *     return GA_Inquire_memory()
 * 
 * def inquire_name(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns the name of an array represented by the handle g_a.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("miniga4py.ga.inquire_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2231
 *     return s(GA_Inquire_name(g_a))
 * 
 * cpdef int inquire_type(int g_a):             # <<<<<<<<<<<<<<
 *     cdef int gtype
 *     cdef np.ndarray[np.int64_t, ndim=1] dims
 */

static PyObject *__pyx_pw_9miniga4py_2ga_151inquire_type(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static int __pyx_f_9miniga4py_2ga_inquire_type(int __pyx_v_g_a, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_gtype;
  CYTHON_UNUSED PyArrayObject *__pyx_v_dims = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dims;
  __Pyx_Buffer __pyx_pybuffer_dims;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  PyArrayObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("inquire_type", 0);
  __pyx_pybuffer_dims.pybuffer.buf = NULL;
  __pyx_pybuffer_dims.refcount = 0;
  __pyx_pybuffernd_dims.data = NULL;
  __pyx_pybuffernd_dims.rcbuffer = &__pyx_pybuffer_dims;

  /* "miniga4py/ga.pyx":2234
 *     cdef int gtype
 *     cdef np.ndarray[np.int64_t, ndim=1] dims
 *     gtype,dims = inquire(g_a)             # <<<<<<<<<<<<<<
 *     return gtype
 * 
 */
  __pyx_t_1 = __pyx_f_9miniga4py_2ga_inquire(__pyx_v_g_a, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2234, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 2234, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2234, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2234, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2234, __pyx_L1_error)
  __pyx_v_gtype = __pyx_t_6;
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims.rcbuffer->pybuffer);
    __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_6 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims.rcbuffer->pybuffer, (PyObject*)__pyx_v_dims, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_dims.diminfo[0].strides = __pyx_pybuffernd_dims.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dims.diminfo[0].shape = __pyx_pybuffernd_dims.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 2234, __pyx_L1_error)
  }
  __pyx_t_7 = 0;
  __pyx_v_dims = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "miniga4py/ga.pyx":2235
 *     cdef np.ndarray[np.int64_t, ndim=1] dims
 *     gtype,dims = inquire(g_a)
 *     return gtype             # <<<<<<<<<<<<<<
 * 
 * def is_mirrored(int g_a):
 */
  __pyx_r = __pyx_v_gtype;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2231
 *     return s(GA_Inquire_name(g_a))
 * 
 * cpdef int inquire_type(int g_a):             # <<<<<<<<<<<<<<
 *     cdef int gtype
 *     cdef np.ndarray[np.int64_t, ndim=1] dims
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_WriteUnraisable("miniga4py.ga.inquire_type", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dims);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_151inquire_type(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_150inquire_type[] = "inquire_type(int g_a) -> int";
static PyObject *__pyx_pw_9miniga4py_2ga_151inquire_type(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("inquire_type (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2231, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.inquire_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_150inquire_type(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_150inquire_type(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("inquire_type", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.inquire_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2237
 *     return gtype
 * 
 * def is_mirrored(int g_a):             # <<<<<<<<<<<<<<
 *     """Checks whether the array is mirrored.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_153is_mirrored(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_152is_mirrored[] = "is_mirrored(int g_a)\nChecks whether the array is mirrored.\n    \n    This is a  local  operation. \n\n    :returns: True if it is a mirrored array, else returns False.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_153is_mirrored = {"is_mirrored", (PyCFunction)__pyx_pw_9miniga4py_2ga_153is_mirrored, METH_O, __pyx_doc_9miniga4py_2ga_152is_mirrored};
static PyObject *__pyx_pw_9miniga4py_2ga_153is_mirrored(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_mirrored (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2237, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.is_mirrored", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_152is_mirrored(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_152is_mirrored(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("is_mirrored", 0);

  /* "miniga4py/ga.pyx":2245
 * 
 *     """
 *     if GA_Is_mirrored(g_a) == 1:             # <<<<<<<<<<<<<<
 *         return True
 *     return False
 */
  __pyx_t_1 = ((GA_Is_mirrored(__pyx_v_g_a) == 1) != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":2246
 *     """
 *     if GA_Is_mirrored(g_a) == 1:
 *         return True             # <<<<<<<<<<<<<<
 *     return False
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":2245
 * 
 *     """
 *     if GA_Is_mirrored(g_a) == 1:             # <<<<<<<<<<<<<<
 *         return True
 *     return False
 */
  }

  /* "miniga4py/ga.pyx":2247
 *     if GA_Is_mirrored(g_a) == 1:
 *         return True
 *     return False             # <<<<<<<<<<<<<<
 * 
 * def llt_solve(int g_a, int g_b):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2237
 *     return gtype
 * 
 * def is_mirrored(int g_a):             # <<<<<<<<<<<<<<
 *     """Checks whether the array is mirrored.
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2249
 *     return False
 * 
 * def llt_solve(int g_a, int g_b):             # <<<<<<<<<<<<<<
 *     """Solves a system of linear equations
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_155llt_solve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_154llt_solve[] = "llt_solve(int g_a, int g_b)\nSolves a system of linear equations\n\n        A * X = B\n\n    using the Cholesky factorization of an NxN double precision symmetric\n    positive definite matrix A (epresented by handle g_a). On successful exit\n    B will contain the solution X.\n\n    This is a collective operation. \n\n    :Parameters:\n        g_a : int\n            the coefficient matrix\n        g_b : int\n            the rhs/solution matrix\n\n    :returns: 0 if successful; >0 if the leading minor of this order is not positive definite and the factorization could not be completed\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_155llt_solve = {"llt_solve", (PyCFunction)__pyx_pw_9miniga4py_2ga_155llt_solve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_154llt_solve};
static PyObject *__pyx_pw_9miniga4py_2ga_155llt_solve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_b;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("llt_solve (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_b,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("llt_solve", 1, 2, 2, 1); __PYX_ERR(0, 2249, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "llt_solve") < 0)) __PYX_ERR(0, 2249, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2249, __pyx_L3_error)
    __pyx_v_g_b = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_b == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2249, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("llt_solve", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2249, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.llt_solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_154llt_solve(__pyx_self, __pyx_v_g_a, __pyx_v_g_b);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_154llt_solve(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("llt_solve", 0);

  /* "miniga4py/ga.pyx":2269
 * 
 *     """
 *     return GA_Llt_solve(g_a, g_b)             # <<<<<<<<<<<<<<
 * 
 * def locate(int g_a, subscript):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Llt_solve(__pyx_v_g_a, __pyx_v_g_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2249
 *     return False
 * 
 * def llt_solve(int g_a, int g_b):             # <<<<<<<<<<<<<<
 *     """Solves a system of linear equations
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.llt_solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2271
 *     return GA_Llt_solve(g_a, g_b)
 * 
 * def locate(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Return the GA compute process id that 'owns' the data.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_157locate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_156locate[] = "locate(int g_a, subscript)\nReturn the GA compute process id that 'owns' the data.\n    \n    If any element of subscript[] is out of bounds \"-1\" is returned.\n\n    This operation is local.\n\n    :Parameters:\n        g_a : int\n            the array handle\n        subscript : 1D array-like of integers\n            len(subscript) should be ndim\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_157locate = {"locate", (PyCFunction)__pyx_pw_9miniga4py_2ga_157locate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_156locate};
static PyObject *__pyx_pw_9miniga4py_2ga_157locate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_subscript = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("locate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_subscript,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_subscript)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("locate", 1, 2, 2, 1); __PYX_ERR(0, 2271, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "locate") < 0)) __PYX_ERR(0, 2271, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2271, __pyx_L3_error)
    __pyx_v_subscript = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("locate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2271, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.locate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_156locate(__pyx_self, __pyx_v_g_a, __pyx_v_subscript);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_156locate(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_subscript) {
  PyArrayObject *__pyx_v_subscript_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_subscript_nd;
  __Pyx_Buffer __pyx_pybuffer_subscript_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("locate", 0);
  __pyx_pybuffer_subscript_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_subscript_nd.refcount = 0;
  __pyx_pybuffernd_subscript_nd.data = NULL;
  __pyx_pybuffernd_subscript_nd.rcbuffer = &__pyx_pybuffer_subscript_nd;

  /* "miniga4py/ga.pyx":2286
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] subscript_nd
 *     subscript_nd = _inta64(subscript)             # <<<<<<<<<<<<<<
 *     return NGA_Locate64(g_a, <int64_t*>subscript_nd.data)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_subscript)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_subscript_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      }
      __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
    }
    __pyx_pybuffernd_subscript_nd.diminfo[0].strides = __pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subscript_nd.diminfo[0].shape = __pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2286, __pyx_L1_error)
  }
  __pyx_v_subscript_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":2287
 *     cdef np.ndarray[np.int64_t, ndim=1] subscript_nd
 *     subscript_nd = _inta64(subscript)
 *     return NGA_Locate64(g_a, <int64_t*>subscript_nd.data)             # <<<<<<<<<<<<<<
 * 
 * def locate_nnodes(int g_a, lo, hi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(NGA_Locate64(__pyx_v_g_a, ((int64_t *)__pyx_v_subscript_nd->data))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2271
 *     return GA_Llt_solve(g_a, g_b)
 * 
 * def locate(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Return the GA compute process id that 'owns' the data.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.locate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_subscript_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2289
 *     return NGA_Locate64(g_a, <int64_t*>subscript_nd.data)
 * 
 * def locate_nnodes(int g_a, lo, hi):             # <<<<<<<<<<<<<<
 *     """Return the number of process which own the specified patch.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_159locate_nnodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_158locate_nnodes[] = "locate_nnodes(int g_a, lo, hi)\nReturn the number of process which own the specified patch.\n\n    This operation is local.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_159locate_nnodes = {"locate_nnodes", (PyCFunction)__pyx_pw_9miniga4py_2ga_159locate_nnodes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_158locate_nnodes};
static PyObject *__pyx_pw_9miniga4py_2ga_159locate_nnodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("locate_nnodes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_lo,&__pyx_n_s_hi,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("locate_nnodes", 1, 3, 3, 1); __PYX_ERR(0, 2289, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("locate_nnodes", 1, 3, 3, 2); __PYX_ERR(0, 2289, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "locate_nnodes") < 0)) __PYX_ERR(0, 2289, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2289, __pyx_L3_error)
    __pyx_v_lo = values[1];
    __pyx_v_hi = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("locate_nnodes", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2289, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.locate_nnodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_158locate_nnodes(__pyx_self, __pyx_v_g_a, __pyx_v_lo, __pyx_v_hi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_158locate_nnodes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
  PyArrayObject *__pyx_v_lo_nd = 0;
  PyArrayObject *__pyx_v_hi_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_nd;
  __Pyx_Buffer __pyx_pybuffer_hi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lo_nd;
  __Pyx_Buffer __pyx_pybuffer_lo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("locate_nnodes", 0);
  __pyx_pybuffer_lo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_lo_nd.refcount = 0;
  __pyx_pybuffernd_lo_nd.data = NULL;
  __pyx_pybuffernd_lo_nd.rcbuffer = &__pyx_pybuffer_lo_nd;
  __pyx_pybuffer_hi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_nd.refcount = 0;
  __pyx_pybuffernd_hi_nd.data = NULL;
  __pyx_pybuffernd_hi_nd.rcbuffer = &__pyx_pybuffer_hi_nd;

  /* "miniga4py/ga.pyx":2297
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd,hi_nd
 *     cdef int result
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)             # <<<<<<<<<<<<<<
 *     return NGA_Locate_nnodes64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 */
  __pyx_t_1 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_lo, __pyx_v_hi); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2297, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 2297, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2297, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2297, __pyx_L1_error)
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2297, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_lo_nd.diminfo[0].strides = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_nd.diminfo[0].shape = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2297, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_lo_nd = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
      __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
    }
    __pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2297, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "miniga4py/ga.pyx":2298
 *     cdef int result
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *     return NGA_Locate_nnodes64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)             # <<<<<<<<<<<<<<
 * 
 * def locate_region(int g_a, lo, hi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(NGA_Locate_nnodes64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2289
 *     return NGA_Locate64(g_a, <int64_t*>subscript_nd.data)
 * 
 * def locate_nnodes(int g_a, lo, hi):             # <<<<<<<<<<<<<<
 *     """Return the number of process which own the specified patch.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.locate_nnodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2300
 *     return NGA_Locate_nnodes64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 * def locate_region(int g_a, lo, hi):             # <<<<<<<<<<<<<<
 *     """Return the list of the GA processes id that 'own' the data.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_161locate_region(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_160locate_region[] = "locate_region(int g_a, lo, hi)\nReturn the list of the GA processes id that 'own' the data.\n    \n    Parts of the specified patch might be actually 'owned' by several\n    processes. If lo/hi are out of bounds \"0\" is returned, otherwise return\n    value is equal to the number of processes that hold the data .\n          \n    map[i][0] - lo[ndim]\n    map[i][1] - hi[ndim]\n    procs[i]  - processor id that owns data in patch lo[i]:hi[i]\n\n    This operation is local. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_161locate_region = {"locate_region", (PyCFunction)__pyx_pw_9miniga4py_2ga_161locate_region, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_160locate_region};
static PyObject *__pyx_pw_9miniga4py_2ga_161locate_region(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("locate_region (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_lo,&__pyx_n_s_hi,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("locate_region", 1, 3, 3, 1); __PYX_ERR(0, 2300, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("locate_region", 1, 3, 3, 2); __PYX_ERR(0, 2300, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "locate_region") < 0)) __PYX_ERR(0, 2300, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2300, __pyx_L3_error)
    __pyx_v_lo = values[1];
    __pyx_v_hi = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("locate_region", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2300, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.locate_region", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_160locate_region(__pyx_self, __pyx_v_g_a, __pyx_v_lo, __pyx_v_hi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_160locate_region(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
  PyArrayObject *__pyx_v_lo_nd = 0;
  PyArrayObject *__pyx_v_hi_nd = 0;
  PyArrayObject *__pyx_v_map = 0;
  PyArrayObject *__pyx_v_map_reshape = 0;
  PyArrayObject *__pyx_v_procs = 0;
  int __pyx_v_np_result;
  int __pyx_v_np_guess;
  int __pyx_v_ndim;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_nd;
  __Pyx_Buffer __pyx_pybuffer_hi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lo_nd;
  __Pyx_Buffer __pyx_pybuffer_lo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_map;
  __Pyx_Buffer __pyx_pybuffer_map;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_map_reshape;
  __Pyx_Buffer __pyx_pybuffer_map_reshape;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_procs;
  __Pyx_Buffer __pyx_pybuffer_procs;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyArrayObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyArrayObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  __Pyx_RefNannySetupContext("locate_region", 0);
  __pyx_pybuffer_lo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_lo_nd.refcount = 0;
  __pyx_pybuffernd_lo_nd.data = NULL;
  __pyx_pybuffernd_lo_nd.rcbuffer = &__pyx_pybuffer_lo_nd;
  __pyx_pybuffer_hi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_nd.refcount = 0;
  __pyx_pybuffernd_hi_nd.data = NULL;
  __pyx_pybuffernd_hi_nd.rcbuffer = &__pyx_pybuffer_hi_nd;
  __pyx_pybuffer_map.pybuffer.buf = NULL;
  __pyx_pybuffer_map.refcount = 0;
  __pyx_pybuffernd_map.data = NULL;
  __pyx_pybuffernd_map.rcbuffer = &__pyx_pybuffer_map;
  __pyx_pybuffer_map_reshape.pybuffer.buf = NULL;
  __pyx_pybuffer_map_reshape.refcount = 0;
  __pyx_pybuffernd_map_reshape.data = NULL;
  __pyx_pybuffernd_map_reshape.rcbuffer = &__pyx_pybuffer_map_reshape;
  __pyx_pybuffer_procs.pybuffer.buf = NULL;
  __pyx_pybuffer_procs.refcount = 0;
  __pyx_pybuffernd_procs.data = NULL;
  __pyx_pybuffernd_procs.rcbuffer = &__pyx_pybuffer_procs;

  /* "miniga4py/ga.pyx":2321
 *     cdef int np_result
 *     cdef int np_guess
 *     cdef int ndim = GA_Ndim(g_a)             # <<<<<<<<<<<<<<
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *     np_guess = NGA_Locate_nnodes64(
 */
  __pyx_v_ndim = GA_Ndim(__pyx_v_g_a);

  /* "miniga4py/ga.pyx":2322
 *     cdef int np_guess
 *     cdef int ndim = GA_Ndim(g_a)
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)             # <<<<<<<<<<<<<<
 *     np_guess = NGA_Locate_nnodes64(
 *             g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 */
  __pyx_t_1 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_lo, __pyx_v_hi); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2322, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 2322, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2322, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2322, __pyx_L1_error)
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2322, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_lo_nd.diminfo[0].strides = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_nd.diminfo[0].shape = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2322, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_lo_nd = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
      __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
    }
    __pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2322, __pyx_L1_error)
  }
  __pyx_t_11 = 0;
  __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "miniga4py/ga.pyx":2323
 *     cdef int ndim = GA_Ndim(g_a)
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *     np_guess = NGA_Locate_nnodes64(             # <<<<<<<<<<<<<<
 *             g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 *     map = np.ndarray(np_guess*ndim*2, dtype=np.int64)
 */
  __pyx_v_np_guess = NGA_Locate_nnodes64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data));

  /* "miniga4py/ga.pyx":2325
 *     np_guess = NGA_Locate_nnodes64(
 *             g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 *     map = np.ndarray(np_guess*ndim*2, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     procs = np.ndarray(np_guess, dtype=np.int32)
 *     np_result = NGA_Locate_region64(g_a,
 */
  __pyx_t_1 = __Pyx_PyInt_From_long(((__pyx_v_np_guess * __pyx_v_ndim) * 2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 2325, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_ndarray), __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_map.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_4), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_map.rcbuffer->pybuffer, (PyObject*)__pyx_v_map, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_map.diminfo[0].strides = __pyx_pybuffernd_map.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_map.diminfo[0].shape = __pyx_pybuffernd_map.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2325, __pyx_L1_error)
  }
  __pyx_v_map = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "miniga4py/ga.pyx":2326
 *             g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 *     map = np.ndarray(np_guess*ndim*2, dtype=np.int64)
 *     procs = np.ndarray(np_guess, dtype=np.int32)             # <<<<<<<<<<<<<<
 *     np_result = NGA_Locate_region64(g_a,
 *             <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_np_guess); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 2326, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_ndarray), __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_procs.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_procs.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_procs.rcbuffer->pybuffer, (PyObject*)__pyx_v_procs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
      __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
    }
    __pyx_pybuffernd_procs.diminfo[0].strides = __pyx_pybuffernd_procs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_procs.diminfo[0].shape = __pyx_pybuffernd_procs.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2326, __pyx_L1_error)
  }
  __pyx_v_procs = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "miniga4py/ga.pyx":2327
 *     map = np.ndarray(np_guess*ndim*2, dtype=np.int64)
 *     procs = np.ndarray(np_guess, dtype=np.int32)
 *     np_result = NGA_Locate_region64(g_a,             # <<<<<<<<<<<<<<
 *             <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *             <int64_t*>map.data, <int*>procs.data)
 */
  __pyx_v_np_result = NGA_Locate_region64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data), ((int64_t *)__pyx_v_map->data), ((int *)__pyx_v_procs->data));

  /* "miniga4py/ga.pyx":2330
 *             <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *             <int64_t*>map.data, <int*>procs.data)
 *     assert(np_guess == np_result)             # <<<<<<<<<<<<<<
 *     # TODO then slice it and reshape to something useful?
 *     map_reshape = map.reshape(np_result,2,ndim)
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_np_guess == __pyx_v_np_result) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 2330, __pyx_L1_error)
    }
  }
  #endif

  /* "miniga4py/ga.pyx":2332
 *     assert(np_guess == np_result)
 *     # TODO then slice it and reshape to something useful?
 *     map_reshape = map.reshape(np_result,2,ndim)             # <<<<<<<<<<<<<<
 *     # need to add 1 to every 'hi' value
 *     map_reshape[:,1,:] += 1
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_map), __pyx_n_s_reshape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_np_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_12 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_12)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_12, __pyx_t_1, __pyx_int_2, __pyx_t_3};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2332, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_12, __pyx_t_1, __pyx_int_2, __pyx_t_3};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2332, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_13 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2332, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    if (__pyx_t_12) {
      __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_7, __pyx_t_1);
    __Pyx_INCREF(__pyx_int_2);
    __Pyx_GIVEREF(__pyx_int_2);
    PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_7, __pyx_int_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_7, __pyx_t_3);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2332, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2332, __pyx_L1_error)
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map_reshape.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_map_reshape.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_map_reshape.rcbuffer->pybuffer, (PyObject*)__pyx_v_map_reshape, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_map_reshape.diminfo[0].strides = __pyx_pybuffernd_map_reshape.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_map_reshape.diminfo[0].shape = __pyx_pybuffernd_map_reshape.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_map_reshape.diminfo[1].strides = __pyx_pybuffernd_map_reshape.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_map_reshape.diminfo[1].shape = __pyx_pybuffernd_map_reshape.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_map_reshape.diminfo[2].strides = __pyx_pybuffernd_map_reshape.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_map_reshape.diminfo[2].shape = __pyx_pybuffernd_map_reshape.rcbuffer->pybuffer.shape[2];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2332, __pyx_L1_error)
  }
  __pyx_t_14 = 0;
  __pyx_v_map_reshape = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "miniga4py/ga.pyx":2334
 *     map_reshape = map.reshape(np_result,2,ndim)
 *     # need to add 1 to every 'hi' value
 *     map_reshape[:,1,:] += 1             # <<<<<<<<<<<<<<
 *     return map_reshape,procs
 * 
 */
  __Pyx_INCREF(__pyx_tuple__26);
  __pyx_t_15 = __pyx_tuple__26;
  __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_map_reshape), __pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_map_reshape), __pyx_t_15, __pyx_t_4) < 0)) __PYX_ERR(0, 2334, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "miniga4py/ga.pyx":2335
 *     # need to add 1 to every 'hi' value
 *     map_reshape[:,1,:] += 1
 *     return map_reshape,procs             # <<<<<<<<<<<<<<
 * 
 * def lock(int mutex):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_map_reshape));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_map_reshape));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_map_reshape));
  __Pyx_INCREF(((PyObject *)__pyx_v_procs));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_procs));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_procs));
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2300
 *     return NGA_Locate_nnodes64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 * def locate_region(int g_a, lo, hi):             # <<<<<<<<<<<<<<
 *     """Return the list of the GA processes id that 'own' the data.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_15);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map_reshape.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_procs.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.locate_region", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map_reshape.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_procs.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_map);
  __Pyx_XDECREF((PyObject *)__pyx_v_map_reshape);
  __Pyx_XDECREF((PyObject *)__pyx_v_procs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2337
 *     return map_reshape,procs
 * 
 * def lock(int mutex):             # <<<<<<<<<<<<<<
 *     """Locks a mutex object identified by the mutex number.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_163lock(PyObject *__pyx_self, PyObject *__pyx_arg_mutex); /*proto*/
static char __pyx_doc_9miniga4py_2ga_162lock[] = "lock(int mutex)\nLocks a mutex object identified by the mutex number.\n    \n    It is a fatal error for a process to attempt to lock a mutex which was\n    already locked by this process. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_163lock = {"lock", (PyCFunction)__pyx_pw_9miniga4py_2ga_163lock, METH_O, __pyx_doc_9miniga4py_2ga_162lock};
static PyObject *__pyx_pw_9miniga4py_2ga_163lock(PyObject *__pyx_self, PyObject *__pyx_arg_mutex) {
  int __pyx_v_mutex;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lock (wrapper)", 0);
  assert(__pyx_arg_mutex); {
    __pyx_v_mutex = __Pyx_PyInt_As_int(__pyx_arg_mutex); if (unlikely((__pyx_v_mutex == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2337, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.lock", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_162lock(__pyx_self, ((int)__pyx_v_mutex));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_162lock(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_mutex) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lock", 0);

  /* "miniga4py/ga.pyx":2344
 * 
 *     """
 *     GA_Lock(mutex)             # <<<<<<<<<<<<<<
 * 
 * def lu_solve(int g_a, int g_b, bint trans=False):
 */
  GA_Lock(__pyx_v_mutex);

  /* "miniga4py/ga.pyx":2337
 *     return map_reshape,procs
 * 
 * def lock(int mutex):             # <<<<<<<<<<<<<<
 *     """Locks a mutex object identified by the mutex number.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2346
 *     GA_Lock(mutex)
 * 
 * def lu_solve(int g_a, int g_b, bint trans=False):             # <<<<<<<<<<<<<<
 *     """Solve the system of linear equations op(A)X = B based on the LU
 *     factorization.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_165lu_solve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_164lu_solve[] = "lu_solve(int g_a, int g_b, bool trans=False)\nSolve the system of linear equations op(A)X = B based on the LU\n    factorization.\n\n    op(A) = A or A' depending on the parameter trans\n    trans = False means that the transpose operator should not be applied.\n    trans = True means that the transpose operator should be applied.\n\n    Matrix A is a general real matrix. Matrix B contains possibly multiple rhs\n    vectors. The array associated with the handle g_b is overwritten by the\n    solution matrix X.\n\n    This is a collective operation. \n\n    :Parameters:\n        g_a : int\n            the array handle for the coefficient matrix\n        g_b : int\n            the array handle for the solution matrix\n        trans : bool\n            transpose (True) or not transpose (False)\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_165lu_solve = {"lu_solve", (PyCFunction)__pyx_pw_9miniga4py_2ga_165lu_solve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_164lu_solve};
static PyObject *__pyx_pw_9miniga4py_2ga_165lu_solve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_b;
  int __pyx_v_trans;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lu_solve (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_b,&__pyx_n_s_trans,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lu_solve", 0, 2, 3, 1); __PYX_ERR(0, 2346, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_trans);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lu_solve") < 0)) __PYX_ERR(0, 2346, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2346, __pyx_L3_error)
    __pyx_v_g_b = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_b == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2346, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_trans = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_trans == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2346, __pyx_L3_error)
    } else {
      __pyx_v_trans = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lu_solve", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2346, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.lu_solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_164lu_solve(__pyx_self, __pyx_v_g_a, __pyx_v_g_b, __pyx_v_trans);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_164lu_solve(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b, int __pyx_v_trans) {
  char __pyx_v_ctrans;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("lu_solve", 0);

  /* "miniga4py/ga.pyx":2369
 * 
 *     """
 *     cdef char ctrans = 'N'             # <<<<<<<<<<<<<<
 *     if trans:
 *         ctrans = 'T'
 */
  __pyx_v_ctrans = 'N';

  /* "miniga4py/ga.pyx":2370
 *     """
 *     cdef char ctrans = 'N'
 *     if trans:             # <<<<<<<<<<<<<<
 *         ctrans = 'T'
 *     GA_Lu_solve(ctrans, g_a, g_b)
 */
  __pyx_t_1 = (__pyx_v_trans != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":2371
 *     cdef char ctrans = 'N'
 *     if trans:
 *         ctrans = 'T'             # <<<<<<<<<<<<<<
 *     GA_Lu_solve(ctrans, g_a, g_b)
 * 
 */
    __pyx_v_ctrans = 'T';

    /* "miniga4py/ga.pyx":2370
 *     """
 *     cdef char ctrans = 'N'
 *     if trans:             # <<<<<<<<<<<<<<
 *         ctrans = 'T'
 *     GA_Lu_solve(ctrans, g_a, g_b)
 */
  }

  /* "miniga4py/ga.pyx":2372
 *     if trans:
 *         ctrans = 'T'
 *     GA_Lu_solve(ctrans, g_a, g_b)             # <<<<<<<<<<<<<<
 * 
 * def mask_sync(bint first, bint last):
 */
  GA_Lu_solve(__pyx_v_ctrans, __pyx_v_g_a, __pyx_v_g_b);

  /* "miniga4py/ga.pyx":2346
 *     GA_Lock(mutex)
 * 
 * def lu_solve(int g_a, int g_b, bint trans=False):             # <<<<<<<<<<<<<<
 *     """Solve the system of linear equations op(A)X = B based on the LU
 *     factorization.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2374
 *     GA_Lu_solve(ctrans, g_a, g_b)
 * 
 * def mask_sync(bint first, bint last):             # <<<<<<<<<<<<<<
 *     """This subroutine can be used to remove synchronization calls from around
 *     collective operations.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_167mask_sync(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_166mask_sync[] = "mask_sync(bool first, bool last)\nThis subroutine can be used to remove synchronization calls from around\n    collective operations.\n    \n    Setting the parameter first=False removes the synchronization prior to the\n    collective operation, setting last=False removes the synchronization call\n    after the collective operation. This call is applicable to all collective\n    operations. It most be invoked before each collective operation.\n    \n    This is a collective operation. \n\n    :Parameters:\n        first : bool\n            mask for prior internal synchronization\n        last : bool\n            mask for post internal synchronization\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_167mask_sync = {"mask_sync", (PyCFunction)__pyx_pw_9miniga4py_2ga_167mask_sync, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_166mask_sync};
static PyObject *__pyx_pw_9miniga4py_2ga_167mask_sync(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_first;
  int __pyx_v_last;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mask_sync (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_first,&__pyx_n_s_last,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_first)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_last)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mask_sync", 1, 2, 2, 1); __PYX_ERR(0, 2374, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mask_sync") < 0)) __PYX_ERR(0, 2374, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_first = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_first == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2374, __pyx_L3_error)
    __pyx_v_last = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_last == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2374, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mask_sync", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2374, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.mask_sync", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_166mask_sync(__pyx_self, __pyx_v_first, __pyx_v_last);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_166mask_sync(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_first, int __pyx_v_last) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mask_sync", 0);

  /* "miniga4py/ga.pyx":2392
 * 
 *     """
 *     GA_Mask_sync(first,last)             # <<<<<<<<<<<<<<
 * 
 * def matmul_patch(bint transa, bint transb, alpha, beta,
 */
  GA_Mask_sync(__pyx_v_first, __pyx_v_last);

  /* "miniga4py/ga.pyx":2374
 *     GA_Lu_solve(ctrans, g_a, g_b)
 * 
 * def mask_sync(bint first, bint last):             # <<<<<<<<<<<<<<
 *     """This subroutine can be used to remove synchronization calls from around
 *     collective operations.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2394
 *     GA_Mask_sync(first,last)
 * 
 * def matmul_patch(bint transa, bint transb, alpha, beta,             # <<<<<<<<<<<<<<
 *         int g_a, alo, ahi,
 *         int g_b, blo, bhi,
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_169matmul_patch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_168matmul_patch[] = "matmul_patch(bool transa, bool transb, alpha, beta, int g_a, alo, ahi, int g_b, blo, bhi, int g_c, clo, chi)\nAn n-dimensional patch version of ga_dgemm.\n\n    C[clo[]:chi[]] := alpha * AA[alo[]:ahi[]] *\n                                   BB[blo[]:bhi[]] ) + beta*C[clo[]:chi[]],\n\n    where AA = op(A), BB = op(B), and op( X ) is one of\n\n    op( X ) = X   or   op( X ) = X',\n\n    It works for both double and DoubleComplex data tape.\n\n    This is a collective operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_169matmul_patch = {"matmul_patch", (PyCFunction)__pyx_pw_9miniga4py_2ga_169matmul_patch, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_168matmul_patch};
static PyObject *__pyx_pw_9miniga4py_2ga_169matmul_patch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_transa;
  int __pyx_v_transb;
  PyObject *__pyx_v_alpha = 0;
  PyObject *__pyx_v_beta = 0;
  int __pyx_v_g_a;
  PyObject *__pyx_v_alo = 0;
  PyObject *__pyx_v_ahi = 0;
  int __pyx_v_g_b;
  PyObject *__pyx_v_blo = 0;
  PyObject *__pyx_v_bhi = 0;
  int __pyx_v_g_c;
  PyObject *__pyx_v_clo = 0;
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matmul_patch (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transa,&__pyx_n_s_transb,&__pyx_n_s_alpha,&__pyx_n_s_beta,&__pyx_n_s_g_a,&__pyx_n_s_alo,&__pyx_n_s_ahi,&__pyx_n_s_g_b,&__pyx_n_s_blo,&__pyx_n_s_bhi,&__pyx_n_s_g_c,&__pyx_n_s_clo,&__pyx_n_s_chi,0};
    PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transa)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transb)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matmul_patch", 1, 13, 13, 1); __PYX_ERR(0, 2394, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matmul_patch", 1, 13, 13, 2); __PYX_ERR(0, 2394, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matmul_patch", 1, 13, 13, 3); __PYX_ERR(0, 2394, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matmul_patch", 1, 13, 13, 4); __PYX_ERR(0, 2394, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matmul_patch", 1, 13, 13, 5); __PYX_ERR(0, 2394, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ahi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matmul_patch", 1, 13, 13, 6); __PYX_ERR(0, 2394, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matmul_patch", 1, 13, 13, 7); __PYX_ERR(0, 2394, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_blo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matmul_patch", 1, 13, 13, 8); __PYX_ERR(0, 2394, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bhi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matmul_patch", 1, 13, 13, 9); __PYX_ERR(0, 2394, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_c)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matmul_patch", 1, 13, 13, 10); __PYX_ERR(0, 2394, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matmul_patch", 1, 13, 13, 11); __PYX_ERR(0, 2394, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matmul_patch", 1, 13, 13, 12); __PYX_ERR(0, 2394, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matmul_patch") < 0)) __PYX_ERR(0, 2394, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 13) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
      values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
      values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
    }
    __pyx_v_transa = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_transa == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2394, __pyx_L3_error)
    __pyx_v_transb = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_transb == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2394, __pyx_L3_error)
    __pyx_v_alpha = values[2];
    __pyx_v_beta = values[3];
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2395, __pyx_L3_error)
    __pyx_v_alo = values[5];
    __pyx_v_ahi = values[6];
    __pyx_v_g_b = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_g_b == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2396, __pyx_L3_error)
    __pyx_v_blo = values[8];
    __pyx_v_bhi = values[9];
    __pyx_v_g_c = __Pyx_PyInt_As_int(values[10]); if (unlikely((__pyx_v_g_c == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2397, __pyx_L3_error)
    __pyx_v_clo = values[11];
    __pyx_v_chi = values[12];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matmul_patch", 1, 13, 13, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2394, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.matmul_patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_168matmul_patch(__pyx_self, __pyx_v_transa, __pyx_v_transb, __pyx_v_alpha, __pyx_v_beta, __pyx_v_g_a, __pyx_v_alo, __pyx_v_ahi, __pyx_v_g_b, __pyx_v_blo, __pyx_v_bhi, __pyx_v_g_c, __pyx_v_clo, __pyx_v_chi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_168matmul_patch(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transa, int __pyx_v_transb, PyObject *__pyx_v_alpha, PyObject *__pyx_v_beta, int __pyx_v_g_a, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, int __pyx_v_g_b, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi, int __pyx_v_g_c, PyObject *__pyx_v_clo, PyObject *__pyx_v_chi) {
  PyArrayObject *__pyx_v_alo_nd = 0;
  PyArrayObject *__pyx_v_ahi_nd = 0;
  PyArrayObject *__pyx_v_blo_nd = 0;
  PyArrayObject *__pyx_v_bhi_nd = 0;
  PyArrayObject *__pyx_v_clo_nd = 0;
  PyArrayObject *__pyx_v_chi_nd = 0;
  int __pyx_v_gtype;
  int __pyx_v_ialpha;
  int __pyx_v_ibeta;
  long __pyx_v_lalpha;
  long __pyx_v_lbeta;
  PY_LONG_LONG __pyx_v_llalpha;
  PY_LONG_LONG __pyx_v_llbeta;
  float __pyx_v_falpha;
  float __pyx_v_fbeta;
  double __pyx_v_dalpha;
  double __pyx_v_dbeta;
  long double __pyx_v_ldalpha;
  long double __pyx_v_ldbeta;
  SingleComplex __pyx_v_fcalpha;
  SingleComplex __pyx_v_fcbeta;
  DoubleComplex __pyx_v_dcalpha;
  DoubleComplex __pyx_v_dcbeta;
  void *__pyx_v_valpha;
  void *__pyx_v_vbeta;
  char __pyx_v_char_transa;
  char __pyx_v_char_transb;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ahi_nd;
  __Pyx_Buffer __pyx_pybuffer_ahi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_alo_nd;
  __Pyx_Buffer __pyx_pybuffer_alo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bhi_nd;
  __Pyx_Buffer __pyx_pybuffer_bhi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_blo_nd;
  __Pyx_Buffer __pyx_pybuffer_blo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_chi_nd;
  __Pyx_Buffer __pyx_pybuffer_chi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_clo_nd;
  __Pyx_Buffer __pyx_pybuffer_clo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyArrayObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyArrayObject *__pyx_t_13 = NULL;
  PyArrayObject *__pyx_t_14 = NULL;
  __Pyx_RefNannySetupContext("matmul_patch", 0);
  __Pyx_INCREF(__pyx_v_alpha);
  __Pyx_INCREF(__pyx_v_beta);
  __pyx_pybuffer_alo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_alo_nd.refcount = 0;
  __pyx_pybuffernd_alo_nd.data = NULL;
  __pyx_pybuffernd_alo_nd.rcbuffer = &__pyx_pybuffer_alo_nd;
  __pyx_pybuffer_ahi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_ahi_nd.refcount = 0;
  __pyx_pybuffernd_ahi_nd.data = NULL;
  __pyx_pybuffernd_ahi_nd.rcbuffer = &__pyx_pybuffer_ahi_nd;
  __pyx_pybuffer_blo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_blo_nd.refcount = 0;
  __pyx_pybuffernd_blo_nd.data = NULL;
  __pyx_pybuffernd_blo_nd.rcbuffer = &__pyx_pybuffer_blo_nd;
  __pyx_pybuffer_bhi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_bhi_nd.refcount = 0;
  __pyx_pybuffernd_bhi_nd.data = NULL;
  __pyx_pybuffernd_bhi_nd.rcbuffer = &__pyx_pybuffer_bhi_nd;
  __pyx_pybuffer_clo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_clo_nd.refcount = 0;
  __pyx_pybuffernd_clo_nd.data = NULL;
  __pyx_pybuffernd_clo_nd.rcbuffer = &__pyx_pybuffer_clo_nd;
  __pyx_pybuffer_chi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_chi_nd.refcount = 0;
  __pyx_pybuffernd_chi_nd.data = NULL;
  __pyx_pybuffernd_chi_nd.rcbuffer = &__pyx_pybuffer_chi_nd;

  /* "miniga4py/ga.pyx":2415
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     cdef int gtype=inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     cdef int            ialpha,  ibeta
 *     cdef long           lalpha,  lbeta
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":2426
 *     cdef void          *valpha
 *     cdef void          *vbeta
 *     cdef char char_transa = 'N'             # <<<<<<<<<<<<<<
 *     cdef char char_transb = 'N'
 *     if alpha is None:
 */
  __pyx_v_char_transa = 'N';

  /* "miniga4py/ga.pyx":2427
 *     cdef void          *vbeta
 *     cdef char char_transa = 'N'
 *     cdef char char_transb = 'N'             # <<<<<<<<<<<<<<
 *     if alpha is None:
 *         alpha = 1
 */
  __pyx_v_char_transb = 'N';

  /* "miniga4py/ga.pyx":2428
 *     cdef char char_transa = 'N'
 *     cdef char char_transb = 'N'
 *     if alpha is None:             # <<<<<<<<<<<<<<
 *         alpha = 1
 *     valpha = _convert_multiplier(gtype, alpha,
 */
  __pyx_t_1 = (__pyx_v_alpha == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "miniga4py/ga.pyx":2429
 *     cdef char char_transb = 'N'
 *     if alpha is None:
 *         alpha = 1             # <<<<<<<<<<<<<<
 *     valpha = _convert_multiplier(gtype, alpha,
 *             &ialpha,  &lalpha,  &llalpha,
 */
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_DECREF_SET(__pyx_v_alpha, __pyx_int_1);

    /* "miniga4py/ga.pyx":2428
 *     cdef char char_transa = 'N'
 *     cdef char char_transb = 'N'
 *     if alpha is None:             # <<<<<<<<<<<<<<
 *         alpha = 1
 *     valpha = _convert_multiplier(gtype, alpha,
 */
  }

  /* "miniga4py/ga.pyx":2430
 *     if alpha is None:
 *         alpha = 1
 *     valpha = _convert_multiplier(gtype, alpha,             # <<<<<<<<<<<<<<
 *             &ialpha,  &lalpha,  &llalpha,
 *             &falpha,  &dalpha,  &ldalpha,
 */
  __pyx_v_valpha = __pyx_f_9miniga4py_2ga__convert_multiplier(__pyx_v_gtype, __pyx_v_alpha, (&__pyx_v_ialpha), (&__pyx_v_lalpha), (&__pyx_v_llalpha), (&__pyx_v_falpha), (&__pyx_v_dalpha), (&__pyx_v_ldalpha), (&__pyx_v_fcalpha), (&__pyx_v_dcalpha));

  /* "miniga4py/ga.pyx":2434
 *             &falpha,  &dalpha,  &ldalpha,
 *             &fcalpha, &dcalpha)
 *     if beta is None:             # <<<<<<<<<<<<<<
 *         beta = 1
 *     vbeta = _convert_multiplier(gtype, beta,
 */
  __pyx_t_2 = (__pyx_v_beta == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":2435
 *             &fcalpha, &dcalpha)
 *     if beta is None:
 *         beta = 1             # <<<<<<<<<<<<<<
 *     vbeta = _convert_multiplier(gtype, beta,
 *             &ibeta,  &lbeta,  &llbeta,
 */
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_DECREF_SET(__pyx_v_beta, __pyx_int_1);

    /* "miniga4py/ga.pyx":2434
 *             &falpha,  &dalpha,  &ldalpha,
 *             &fcalpha, &dcalpha)
 *     if beta is None:             # <<<<<<<<<<<<<<
 *         beta = 1
 *     vbeta = _convert_multiplier(gtype, beta,
 */
  }

  /* "miniga4py/ga.pyx":2436
 *     if beta is None:
 *         beta = 1
 *     vbeta = _convert_multiplier(gtype, beta,             # <<<<<<<<<<<<<<
 *             &ibeta,  &lbeta,  &llbeta,
 *             &fbeta,  &dbeta,  &ldbeta,
 */
  __pyx_v_vbeta = __pyx_f_9miniga4py_2ga__convert_multiplier(__pyx_v_gtype, __pyx_v_beta, (&__pyx_v_ibeta), (&__pyx_v_lbeta), (&__pyx_v_llbeta), (&__pyx_v_fbeta), (&__pyx_v_dbeta), (&__pyx_v_ldbeta), (&__pyx_v_fcbeta), (&__pyx_v_dcbeta));

  /* "miniga4py/ga.pyx":2440
 *             &fbeta,  &dbeta,  &ldbeta,
 *             &fcbeta, &dcbeta)
 *     alo_nd,ahi_nd = _lohi(g_a,alo,ahi)             # <<<<<<<<<<<<<<
 *     blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *     clo_nd,chi_nd = _lohi(g_c,clo,chi)
 */
  __pyx_t_3 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_alo, __pyx_v_ahi); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2440, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 2440, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2440, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2440, __pyx_L1_error)
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2440, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
    __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_9 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_alo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __pyx_t_10 = __pyx_t_11 = __pyx_t_12 = 0;
    }
    __pyx_pybuffernd_alo_nd.diminfo[0].strides = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alo_nd.diminfo[0].shape = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 2440, __pyx_L1_error)
  }
  __pyx_t_8 = 0;
  __pyx_v_alo_nd = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
    __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_9 < 0)) {
      PyErr_Fetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ahi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      }
      __pyx_t_12 = __pyx_t_11 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_ahi_nd.diminfo[0].strides = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ahi_nd.diminfo[0].shape = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 2440, __pyx_L1_error)
  }
  __pyx_t_8 = 0;
  __pyx_v_ahi_nd = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":2441
 *             &fcbeta, &dcbeta)
 *     alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *     blo_nd,bhi_nd = _lohi(g_b,blo,bhi)             # <<<<<<<<<<<<<<
 *     clo_nd,chi_nd = _lohi(g_c,clo,chi)
 *     if transa:
 */
  __pyx_t_3 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_b, __pyx_v_blo, __pyx_v_bhi); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2441, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 1; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 2441, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2441, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2441, __pyx_L1_error)
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2441, __pyx_L1_error)
  __pyx_t_13 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
    __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_9 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_blo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __pyx_t_10 = __pyx_t_11 = __pyx_t_12 = 0;
    }
    __pyx_pybuffernd_blo_nd.diminfo[0].strides = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_blo_nd.diminfo[0].shape = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 2441, __pyx_L1_error)
  }
  __pyx_t_13 = 0;
  __pyx_v_blo_nd = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_13 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
    __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_9 < 0)) {
      PyErr_Fetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_bhi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      }
      __pyx_t_12 = __pyx_t_11 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_bhi_nd.diminfo[0].strides = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bhi_nd.diminfo[0].shape = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 2441, __pyx_L1_error)
  }
  __pyx_t_13 = 0;
  __pyx_v_bhi_nd = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "miniga4py/ga.pyx":2442
 *     alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *     blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *     clo_nd,chi_nd = _lohi(g_c,clo,chi)             # <<<<<<<<<<<<<<
 *     if transa:
 *         char_transa = 'T'
 */
  __pyx_t_3 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_c, __pyx_v_clo, __pyx_v_chi); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2442, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2442, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2442, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2442, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L9_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L9_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 2442, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L10_unpacking_done;
    __pyx_L9_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2442, __pyx_L1_error)
    __pyx_L10_unpacking_done:;
  }
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2442, __pyx_L1_error)
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2442, __pyx_L1_error)
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
    __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_9 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_clo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __pyx_t_10 = __pyx_t_11 = __pyx_t_12 = 0;
    }
    __pyx_pybuffernd_clo_nd.diminfo[0].strides = __pyx_pybuffernd_clo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_clo_nd.diminfo[0].shape = __pyx_pybuffernd_clo_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 2442, __pyx_L1_error)
  }
  __pyx_t_14 = 0;
  __pyx_v_clo_nd = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
    __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_9 < 0)) {
      PyErr_Fetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_chi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      }
      __pyx_t_12 = __pyx_t_11 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_chi_nd.diminfo[0].strides = __pyx_pybuffernd_chi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_chi_nd.diminfo[0].shape = __pyx_pybuffernd_chi_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 2442, __pyx_L1_error)
  }
  __pyx_t_14 = 0;
  __pyx_v_chi_nd = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":2443
 *     blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *     clo_nd,chi_nd = _lohi(g_c,clo,chi)
 *     if transa:             # <<<<<<<<<<<<<<
 *         char_transa = 'T'
 *     if transb:
 */
  __pyx_t_1 = (__pyx_v_transa != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":2444
 *     clo_nd,chi_nd = _lohi(g_c,clo,chi)
 *     if transa:
 *         char_transa = 'T'             # <<<<<<<<<<<<<<
 *     if transb:
 *         char_transb = 'T'
 */
    __pyx_v_char_transa = 'T';

    /* "miniga4py/ga.pyx":2443
 *     blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *     clo_nd,chi_nd = _lohi(g_c,clo,chi)
 *     if transa:             # <<<<<<<<<<<<<<
 *         char_transa = 'T'
 *     if transb:
 */
  }

  /* "miniga4py/ga.pyx":2445
 *     if transa:
 *         char_transa = 'T'
 *     if transb:             # <<<<<<<<<<<<<<
 *         char_transb = 'T'
 *     NGA_Matmul_patch64(char_transa, char_transb, valpha, vbeta,
 */
  __pyx_t_1 = (__pyx_v_transb != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":2446
 *         char_transa = 'T'
 *     if transb:
 *         char_transb = 'T'             # <<<<<<<<<<<<<<
 *     NGA_Matmul_patch64(char_transa, char_transb, valpha, vbeta,
 *             g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    __pyx_v_char_transb = 'T';

    /* "miniga4py/ga.pyx":2445
 *     if transa:
 *         char_transa = 'T'
 *     if transb:             # <<<<<<<<<<<<<<
 *         char_transb = 'T'
 *     NGA_Matmul_patch64(char_transa, char_transb, valpha, vbeta,
 */
  }

  /* "miniga4py/ga.pyx":2447
 *     if transb:
 *         char_transb = 'T'
 *     NGA_Matmul_patch64(char_transa, char_transb, valpha, vbeta,             # <<<<<<<<<<<<<<
 *             g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *             g_b, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data,
 */
  NGA_Matmul_patch64(__pyx_v_char_transa, __pyx_v_char_transb, __pyx_v_valpha, __pyx_v_vbeta, __pyx_v_g_a, ((int64_t *)__pyx_v_alo_nd->data), ((int64_t *)__pyx_v_ahi_nd->data), __pyx_v_g_b, ((int64_t *)__pyx_v_blo_nd->data), ((int64_t *)__pyx_v_bhi_nd->data), __pyx_v_g_c, ((int64_t *)__pyx_v_clo_nd->data), ((int64_t *)__pyx_v_chi_nd->data));

  /* "miniga4py/ga.pyx":2394
 *     GA_Mask_sync(first,last)
 * 
 * def matmul_patch(bint transa, bint transb, alpha, beta,             # <<<<<<<<<<<<<<
 *         int g_a, alo, ahi,
 *         int g_b, blo, bhi,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.matmul_patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_alo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_ahi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_blo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_bhi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_clo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_chi_nd);
  __Pyx_XDECREF(__pyx_v_alpha);
  __Pyx_XDECREF(__pyx_v_beta);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2452
 *             g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def median(int g_a, int g_b, int g_c, int g_m,             # <<<<<<<<<<<<<<
 *         alo=None, ahi=None, blo=None, bhi=None,
 *         clo=None, chi=None, mlo=None, mhi=None):
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_171median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_170median[] = "median(int g_a, int g_b, int g_c, int g_m, alo=None, ahi=None, blo=None, bhi=None, clo=None, chi=None, mlo=None, mhi=None)\nComputes the componentwise Median of three arrays or patches g_a, g_b,\n    and g_c, and stores the result in this array or patch g_m.\n    \n    The result (m) may replace one of the input arrays (a/b/c).\n\n    This is a collective operation. \n\n    :Parameters:\n        g_a : int\n            the array handle\n        g_b : int\n            the array handle\n        g_c : int\n            the array handle\n        g_m : int\n            the array handle for the result\n        alo : 1D array-like of integers\n            lower bound patch coordinates of g_a, inclusive\n        ahi : 1D array-like of integers\n            higher bound patch coordinates of g_a, exclusive\n        blo : 1D array-like of integers\n            lower bound patch coordinates of g_b, inclusive\n        bhi : 1D array-like of integers\n            higher bound patch coordinates of g_b, exclusive\n        clo : 1D array-like of integers\n            lower bound patch coordinates of g_c, inclusive\n        chi : 1D array-like of integers\n            higher bound patch coordinates of g_c, exclusive\n        mlo : 1D array-like of integers\n            lower bound patch coordinates of g_m, inclusive\n        mhi : 1D array-like of integers\n            higher bound patch coordinates of g_m, exclusive\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_171median = {"median", (PyCFunction)__pyx_pw_9miniga4py_2ga_171median, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_170median};
static PyObject *__pyx_pw_9miniga4py_2ga_171median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_b;
  int __pyx_v_g_c;
  int __pyx_v_g_m;
  PyObject *__pyx_v_alo = 0;
  PyObject *__pyx_v_ahi = 0;
  PyObject *__pyx_v_blo = 0;
  PyObject *__pyx_v_bhi = 0;
  PyObject *__pyx_v_clo = 0;
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_v_mlo = 0;
  PyObject *__pyx_v_mhi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("median (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_b,&__pyx_n_s_g_c,&__pyx_n_s_g_m,&__pyx_n_s_alo,&__pyx_n_s_ahi,&__pyx_n_s_blo,&__pyx_n_s_bhi,&__pyx_n_s_clo,&__pyx_n_s_chi,&__pyx_n_s_mlo,&__pyx_n_s_mhi,0};
    PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};

    /* "miniga4py/ga.pyx":2453
 * 
 * def median(int g_a, int g_b, int g_c, int g_m,
 *         alo=None, ahi=None, blo=None, bhi=None,             # <<<<<<<<<<<<<<
 *         clo=None, chi=None, mlo=None, mhi=None):
 *     """Computes the componentwise Median of three arrays or patches g_a, g_b,
 */
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);

    /* "miniga4py/ga.pyx":2454
 * def median(int g_a, int g_b, int g_c, int g_m,
 *         alo=None, ahi=None, blo=None, bhi=None,
 *         clo=None, chi=None, mlo=None, mhi=None):             # <<<<<<<<<<<<<<
 *     """Computes the componentwise Median of three arrays or patches g_a, g_b,
 *     and g_c, and stores the result in this array or patch g_m.
 */
    values[8] = ((PyObject *)Py_None);
    values[9] = ((PyObject *)Py_None);
    values[10] = ((PyObject *)Py_None);
    values[11] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("median", 0, 4, 12, 1); __PYX_ERR(0, 2452, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_c)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("median", 0, 4, 12, 2); __PYX_ERR(0, 2452, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_m)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("median", 0, 4, 12, 3); __PYX_ERR(0, 2452, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alo);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ahi);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_blo);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bhi);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clo);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chi);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mlo);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mhi);
          if (value) { values[11] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "median") < 0)) __PYX_ERR(0, 2452, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2452, __pyx_L3_error)
    __pyx_v_g_b = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_b == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2452, __pyx_L3_error)
    __pyx_v_g_c = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_g_c == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2452, __pyx_L3_error)
    __pyx_v_g_m = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_g_m == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2452, __pyx_L3_error)
    __pyx_v_alo = values[4];
    __pyx_v_ahi = values[5];
    __pyx_v_blo = values[6];
    __pyx_v_bhi = values[7];
    __pyx_v_clo = values[8];
    __pyx_v_chi = values[9];
    __pyx_v_mlo = values[10];
    __pyx_v_mhi = values[11];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("median", 0, 4, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2452, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.median", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_170median(__pyx_self, __pyx_v_g_a, __pyx_v_g_b, __pyx_v_g_c, __pyx_v_g_m, __pyx_v_alo, __pyx_v_ahi, __pyx_v_blo, __pyx_v_bhi, __pyx_v_clo, __pyx_v_chi, __pyx_v_mlo, __pyx_v_mhi);

  /* "miniga4py/ga.pyx":2452
 *             g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def median(int g_a, int g_b, int g_c, int g_m,             # <<<<<<<<<<<<<<
 *         alo=None, ahi=None, blo=None, bhi=None,
 *         clo=None, chi=None, mlo=None, mhi=None):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_170median(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b, int __pyx_v_g_c, int __pyx_v_g_m, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi, PyObject *__pyx_v_clo, PyObject *__pyx_v_chi, PyObject *__pyx_v_mlo, PyObject *__pyx_v_mhi) {
  PyArrayObject *__pyx_v_alo_nd = 0;
  PyArrayObject *__pyx_v_ahi_nd = 0;
  PyArrayObject *__pyx_v_blo_nd = 0;
  PyArrayObject *__pyx_v_bhi_nd = 0;
  PyArrayObject *__pyx_v_clo_nd = 0;
  PyArrayObject *__pyx_v_chi_nd = 0;
  PyArrayObject *__pyx_v_mlo_nd = 0;
  PyArrayObject *__pyx_v_mhi_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ahi_nd;
  __Pyx_Buffer __pyx_pybuffer_ahi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_alo_nd;
  __Pyx_Buffer __pyx_pybuffer_alo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bhi_nd;
  __Pyx_Buffer __pyx_pybuffer_bhi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_blo_nd;
  __Pyx_Buffer __pyx_pybuffer_blo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_chi_nd;
  __Pyx_Buffer __pyx_pybuffer_chi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_clo_nd;
  __Pyx_Buffer __pyx_pybuffer_clo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mhi_nd;
  __Pyx_Buffer __pyx_pybuffer_mhi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mlo_nd;
  __Pyx_Buffer __pyx_pybuffer_mlo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyArrayObject *__pyx_t_14 = NULL;
  PyArrayObject *__pyx_t_15 = NULL;
  PyArrayObject *__pyx_t_16 = NULL;
  __Pyx_RefNannySetupContext("median", 0);
  __pyx_pybuffer_alo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_alo_nd.refcount = 0;
  __pyx_pybuffernd_alo_nd.data = NULL;
  __pyx_pybuffernd_alo_nd.rcbuffer = &__pyx_pybuffer_alo_nd;
  __pyx_pybuffer_ahi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_ahi_nd.refcount = 0;
  __pyx_pybuffernd_ahi_nd.data = NULL;
  __pyx_pybuffernd_ahi_nd.rcbuffer = &__pyx_pybuffer_ahi_nd;
  __pyx_pybuffer_blo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_blo_nd.refcount = 0;
  __pyx_pybuffernd_blo_nd.data = NULL;
  __pyx_pybuffernd_blo_nd.rcbuffer = &__pyx_pybuffer_blo_nd;
  __pyx_pybuffer_bhi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_bhi_nd.refcount = 0;
  __pyx_pybuffernd_bhi_nd.data = NULL;
  __pyx_pybuffernd_bhi_nd.rcbuffer = &__pyx_pybuffer_bhi_nd;
  __pyx_pybuffer_clo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_clo_nd.refcount = 0;
  __pyx_pybuffernd_clo_nd.data = NULL;
  __pyx_pybuffernd_clo_nd.rcbuffer = &__pyx_pybuffer_clo_nd;
  __pyx_pybuffer_chi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_chi_nd.refcount = 0;
  __pyx_pybuffernd_chi_nd.data = NULL;
  __pyx_pybuffernd_chi_nd.rcbuffer = &__pyx_pybuffer_chi_nd;
  __pyx_pybuffer_mlo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_mlo_nd.refcount = 0;
  __pyx_pybuffernd_mlo_nd.data = NULL;
  __pyx_pybuffernd_mlo_nd.rcbuffer = &__pyx_pybuffer_mlo_nd;
  __pyx_pybuffer_mhi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_mhi_nd.refcount = 0;
  __pyx_pybuffernd_mhi_nd.data = NULL;
  __pyx_pybuffernd_mhi_nd.rcbuffer = &__pyx_pybuffer_mhi_nd;

  /* "miniga4py/ga.pyx":2493
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] mlo_nd, mhi_nd
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None
 */
  __pyx_t_2 = (__pyx_v_alo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":2494
 *     cdef np.ndarray[np.int64_t, ndim=1] mlo_nd, mhi_nd
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None             # <<<<<<<<<<<<<<
 *             and clo is None and chi is None
 *             and mlo is None and mhi is None):
 */
  __pyx_t_3 = (__pyx_v_ahi == Py_None);

  /* "miniga4py/ga.pyx":2493
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] mlo_nd, mhi_nd
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None
 */
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":2494
 *     cdef np.ndarray[np.int64_t, ndim=1] mlo_nd, mhi_nd
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None             # <<<<<<<<<<<<<<
 *             and clo is None and chi is None
 *             and mlo is None and mhi is None):
 */
  __pyx_t_2 = (__pyx_v_blo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":2495
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None
 *             and clo is None and chi is None             # <<<<<<<<<<<<<<
 *             and mlo is None and mhi is None):
 *         GA_Median(g_a, g_b, g_c, g_m)
 */
  __pyx_t_3 = (__pyx_v_bhi == Py_None);

  /* "miniga4py/ga.pyx":2494
 *     cdef np.ndarray[np.int64_t, ndim=1] mlo_nd, mhi_nd
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None             # <<<<<<<<<<<<<<
 *             and clo is None and chi is None
 *             and mlo is None and mhi is None):
 */
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":2495
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None
 *             and clo is None and chi is None             # <<<<<<<<<<<<<<
 *             and mlo is None and mhi is None):
 *         GA_Median(g_a, g_b, g_c, g_m)
 */
  __pyx_t_2 = (__pyx_v_clo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":2496
 *             and blo is None and bhi is None
 *             and clo is None and chi is None
 *             and mlo is None and mhi is None):             # <<<<<<<<<<<<<<
 *         GA_Median(g_a, g_b, g_c, g_m)
 *     else:
 */
  __pyx_t_3 = (__pyx_v_chi == Py_None);

  /* "miniga4py/ga.pyx":2495
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None
 *             and clo is None and chi is None             # <<<<<<<<<<<<<<
 *             and mlo is None and mhi is None):
 *         GA_Median(g_a, g_b, g_c, g_m)
 */
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":2496
 *             and blo is None and bhi is None
 *             and clo is None and chi is None
 *             and mlo is None and mhi is None):             # <<<<<<<<<<<<<<
 *         GA_Median(g_a, g_b, g_c, g_m)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_mlo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_mhi == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "miniga4py/ga.pyx":2493
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] mlo_nd, mhi_nd
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None
 */
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":2497
 *             and clo is None and chi is None
 *             and mlo is None and mhi is None):
 *         GA_Median(g_a, g_b, g_c, g_m)             # <<<<<<<<<<<<<<
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 */
    GA_Median(__pyx_v_g_a, __pyx_v_g_b, __pyx_v_g_c, __pyx_v_g_m);

    /* "miniga4py/ga.pyx":2493
 *     cdef np.ndarray[np.int64_t, ndim=1] clo_nd, chi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] mlo_nd, mhi_nd
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None
 *             and clo is None and chi is None
 */
    goto __pyx_L3;
  }

  /* "miniga4py/ga.pyx":2499
 *         GA_Median(g_a, g_b, g_c, g_m)
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)             # <<<<<<<<<<<<<<
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_alo, __pyx_v_ahi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2499, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 2499, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2499, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2499, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2499, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 2499, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L13_unpacking_done;
      __pyx_L12_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 2499, __pyx_L1_error)
      __pyx_L13_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2499, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2499, __pyx_L1_error)
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_alo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_alo_nd.diminfo[0].strides = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alo_nd.diminfo[0].shape = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 2499, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_alo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ahi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_ahi_nd.diminfo[0].strides = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ahi_nd.diminfo[0].shape = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 2499, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_ahi_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":2500
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)             # <<<<<<<<<<<<<<
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)
 *         mlo_nd,mhi_nd = _lohi(g_m,mlo,mhi)
 */
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_b, __pyx_v_blo, __pyx_v_bhi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2500, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 2500, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2500, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2500, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2500, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L14_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L14_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 2500, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L15_unpacking_done;
      __pyx_L14_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 2500, __pyx_L1_error)
      __pyx_L15_unpacking_done:;
    }
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2500, __pyx_L1_error)
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2500, __pyx_L1_error)
    __pyx_t_14 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_blo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_blo_nd.diminfo[0].strides = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_blo_nd.diminfo[0].shape = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 2500, __pyx_L1_error)
    }
    __pyx_t_14 = 0;
    __pyx_v_blo_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_14 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_bhi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_bhi_nd.diminfo[0].strides = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bhi_nd.diminfo[0].shape = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 2500, __pyx_L1_error)
    }
    __pyx_t_14 = 0;
    __pyx_v_bhi_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "miniga4py/ga.pyx":2501
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)             # <<<<<<<<<<<<<<
 *         mlo_nd,mhi_nd = _lohi(g_m,mlo,mhi)
 *         GA_Median_patch64(
 */
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_c, __pyx_v_clo, __pyx_v_chi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2501, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 2501, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2501, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2501, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2501, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L16_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L16_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 2501, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L17_unpacking_done;
      __pyx_L16_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 2501, __pyx_L1_error)
      __pyx_L17_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2501, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2501, __pyx_L1_error)
    __pyx_t_15 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_clo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_clo_nd.diminfo[0].strides = __pyx_pybuffernd_clo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_clo_nd.diminfo[0].shape = __pyx_pybuffernd_clo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 2501, __pyx_L1_error)
    }
    __pyx_t_15 = 0;
    __pyx_v_clo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_15 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_chi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_chi_nd.diminfo[0].strides = __pyx_pybuffernd_chi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_chi_nd.diminfo[0].shape = __pyx_pybuffernd_chi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 2501, __pyx_L1_error)
    }
    __pyx_t_15 = 0;
    __pyx_v_chi_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":2502
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)
 *         mlo_nd,mhi_nd = _lohi(g_m,mlo,mhi)             # <<<<<<<<<<<<<<
 *         GA_Median_patch64(
 *                 g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_m, __pyx_v_mlo, __pyx_v_mhi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2502, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 2502, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2502, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2502, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2502, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L18_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L18_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 2502, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L19_unpacking_done;
      __pyx_L18_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 2502, __pyx_L1_error)
      __pyx_L19_unpacking_done:;
    }
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2502, __pyx_L1_error)
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2502, __pyx_L1_error)
    __pyx_t_16 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mlo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mlo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mlo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_mlo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_mlo_nd.diminfo[0].strides = __pyx_pybuffernd_mlo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mlo_nd.diminfo[0].shape = __pyx_pybuffernd_mlo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 2502, __pyx_L1_error)
    }
    __pyx_t_16 = 0;
    __pyx_v_mlo_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_16 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mhi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_mhi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_mhi_nd.diminfo[0].strides = __pyx_pybuffernd_mhi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mhi_nd.diminfo[0].shape = __pyx_pybuffernd_mhi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 2502, __pyx_L1_error)
    }
    __pyx_t_16 = 0;
    __pyx_v_mhi_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "miniga4py/ga.pyx":2503
 *         clo_nd,chi_nd = _lohi(g_c,clo,chi)
 *         mlo_nd,mhi_nd = _lohi(g_m,mlo,mhi)
 *         GA_Median_patch64(             # <<<<<<<<<<<<<<
 *                 g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                 g_b, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data,
 */
    GA_Median_patch64(__pyx_v_g_a, ((int64_t *)__pyx_v_alo_nd->data), ((int64_t *)__pyx_v_ahi_nd->data), __pyx_v_g_b, ((int64_t *)__pyx_v_blo_nd->data), ((int64_t *)__pyx_v_bhi_nd->data), __pyx_v_g_c, ((int64_t *)__pyx_v_clo_nd->data), ((int64_t *)__pyx_v_chi_nd->data), __pyx_v_g_m, ((int64_t *)__pyx_v_mlo_nd->data), ((int64_t *)__pyx_v_mhi_nd->data));
  }
  __pyx_L3:;

  /* "miniga4py/ga.pyx":2452
 *             g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def median(int g_a, int g_b, int g_c, int g_m,             # <<<<<<<<<<<<<<
 *         alo=None, ahi=None, blo=None, bhi=None,
 *         clo=None, chi=None, mlo=None, mhi=None):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mhi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mlo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.median", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_clo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mhi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mlo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_alo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_ahi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_blo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_bhi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_clo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_chi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_mlo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_mhi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2509
 *                 g_m, <int64_t*>mlo_nd.data, <int64_t*>mhi_nd.data)
 * 
 * def memory_avail():             # <<<<<<<<<<<<<<
 *     """Returns amount of memory (in bytes) left for allocation of new global
 *     arrays on the calling processor.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_173memory_avail(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_172memory_avail[] = "memory_avail()\nReturns amount of memory (in bytes) left for allocation of new global\n    arrays on the calling processor.\n\n    Note: If ga.uses_ma() returns True, then ga.memory_avail() returns the\n    lesser of the amount available under the GA limit and the amount available\n    from MA (according to ma.inquire_avail() operation). If no GA limit has\n    been set, it returns what MA says is available.\n\n    If ( ! ga.uses_ma() && ! ga.memory_limited() ) returns < 0, indicating\n    that the bound on currently available memory cannot be determined.\n\n    This operation is local. \n    \n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_173memory_avail = {"memory_avail", (PyCFunction)__pyx_pw_9miniga4py_2ga_173memory_avail, METH_NOARGS, __pyx_doc_9miniga4py_2ga_172memory_avail};
static PyObject *__pyx_pw_9miniga4py_2ga_173memory_avail(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("memory_avail (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_172memory_avail(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_172memory_avail(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("memory_avail", 0);

  /* "miniga4py/ga.pyx":2524
 * 
 *     """
 *     return GA_Memory_avail()             # <<<<<<<<<<<<<<
 * 
 * def memory_limited():
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(GA_Memory_avail()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2509
 *                 g_m, <int64_t*>mlo_nd.data, <int64_t*>mhi_nd.data)
 * 
 * def memory_avail():             # <<<<<<<<<<<<<<
 *     """Returns amount of memory (in bytes) left for allocation of new global
 *     arrays on the calling processor.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.memory_avail", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2526
 *     return GA_Memory_avail()
 * 
 * def memory_limited():             # <<<<<<<<<<<<<<
 *     """Indicates if limit is set on memory usage in Global Arrays on the
 *     calling processor.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_175memory_limited(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_174memory_limited[] = "memory_limited()\nIndicates if limit is set on memory usage in Global Arrays on the\n    calling processor.\n    \n    This operation is local. \n\n    :returns: True for \"yes\", False for \"no\"\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_175memory_limited = {"memory_limited", (PyCFunction)__pyx_pw_9miniga4py_2ga_175memory_limited, METH_NOARGS, __pyx_doc_9miniga4py_2ga_174memory_limited};
static PyObject *__pyx_pw_9miniga4py_2ga_175memory_limited(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("memory_limited (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_174memory_limited(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_174memory_limited(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("memory_limited", 0);

  /* "miniga4py/ga.pyx":2535
 * 
 *     """
 *     if 1 == GA_Memory_limited():             # <<<<<<<<<<<<<<
 *         return True
 *     return False
 */
  __pyx_t_1 = ((1 == GA_Memory_limited()) != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":2536
 *     """
 *     if 1 == GA_Memory_limited():
 *         return True             # <<<<<<<<<<<<<<
 *     return False
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":2535
 * 
 *     """
 *     if 1 == GA_Memory_limited():             # <<<<<<<<<<<<<<
 *         return True
 *     return False
 */
  }

  /* "miniga4py/ga.pyx":2537
 *     if 1 == GA_Memory_limited():
 *         return True
 *     return False             # <<<<<<<<<<<<<<
 * 
 * def merge_distr_patch(int g_a, alo, ahi, int g_b, blo, bhi):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2526
 *     return GA_Memory_avail()
 * 
 * def memory_limited():             # <<<<<<<<<<<<<<
 *     """Indicates if limit is set on memory usage in Global Arrays on the
 *     calling processor.
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2539
 *     return False
 * 
 * def merge_distr_patch(int g_a, alo, ahi, int g_b, blo, bhi):             # <<<<<<<<<<<<<<
 *     """This function merges all copies of a patch of a mirrored array (g_a)
 *     into a patch in a distributed array (g_b).
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_177merge_distr_patch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_176merge_distr_patch[] = "merge_distr_patch(int g_a, alo, ahi, int g_b, blo, bhi)\nThis function merges all copies of a patch of a mirrored array (g_a)\n    into a patch in a distributed array (g_b).\n\n    This is a  collective  operation. \n\n    :Parameters:\n        g_a : int\n            array handle\n        alo : 1D array-like of integers\n            g_a patch coordinate\n        ahi : 1D array-like of integers\n            g_a patch coordinate\n        g_b : int\n            array handle\n        blo : 1D array-like of integers\n            g_b patch coordinate\n        bhi : 1D array-like of integers\n            g_b patch coordinate\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_177merge_distr_patch = {"merge_distr_patch", (PyCFunction)__pyx_pw_9miniga4py_2ga_177merge_distr_patch, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_176merge_distr_patch};
static PyObject *__pyx_pw_9miniga4py_2ga_177merge_distr_patch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_alo = 0;
  PyObject *__pyx_v_ahi = 0;
  int __pyx_v_g_b;
  PyObject *__pyx_v_blo = 0;
  PyObject *__pyx_v_bhi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("merge_distr_patch (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_alo,&__pyx_n_s_ahi,&__pyx_n_s_g_b,&__pyx_n_s_blo,&__pyx_n_s_bhi,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("merge_distr_patch", 1, 6, 6, 1); __PYX_ERR(0, 2539, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ahi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("merge_distr_patch", 1, 6, 6, 2); __PYX_ERR(0, 2539, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("merge_distr_patch", 1, 6, 6, 3); __PYX_ERR(0, 2539, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_blo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("merge_distr_patch", 1, 6, 6, 4); __PYX_ERR(0, 2539, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bhi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("merge_distr_patch", 1, 6, 6, 5); __PYX_ERR(0, 2539, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "merge_distr_patch") < 0)) __PYX_ERR(0, 2539, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2539, __pyx_L3_error)
    __pyx_v_alo = values[1];
    __pyx_v_ahi = values[2];
    __pyx_v_g_b = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_g_b == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2539, __pyx_L3_error)
    __pyx_v_blo = values[4];
    __pyx_v_bhi = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("merge_distr_patch", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2539, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.merge_distr_patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_176merge_distr_patch(__pyx_self, __pyx_v_g_a, __pyx_v_alo, __pyx_v_ahi, __pyx_v_g_b, __pyx_v_blo, __pyx_v_bhi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_176merge_distr_patch(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, int __pyx_v_g_b, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi) {
  PyArrayObject *__pyx_v_alo_nd = 0;
  PyArrayObject *__pyx_v_ahi_nd = 0;
  PyArrayObject *__pyx_v_blo_nd = 0;
  PyArrayObject *__pyx_v_bhi_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ahi_nd;
  __Pyx_Buffer __pyx_pybuffer_ahi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_alo_nd;
  __Pyx_Buffer __pyx_pybuffer_alo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bhi_nd;
  __Pyx_Buffer __pyx_pybuffer_bhi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_blo_nd;
  __Pyx_Buffer __pyx_pybuffer_blo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyArrayObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("merge_distr_patch", 0);
  __pyx_pybuffer_alo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_alo_nd.refcount = 0;
  __pyx_pybuffernd_alo_nd.data = NULL;
  __pyx_pybuffernd_alo_nd.rcbuffer = &__pyx_pybuffer_alo_nd;
  __pyx_pybuffer_ahi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_ahi_nd.refcount = 0;
  __pyx_pybuffernd_ahi_nd.data = NULL;
  __pyx_pybuffernd_ahi_nd.rcbuffer = &__pyx_pybuffer_ahi_nd;
  __pyx_pybuffer_blo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_blo_nd.refcount = 0;
  __pyx_pybuffernd_blo_nd.data = NULL;
  __pyx_pybuffernd_blo_nd.rcbuffer = &__pyx_pybuffer_blo_nd;
  __pyx_pybuffer_bhi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_bhi_nd.refcount = 0;
  __pyx_pybuffernd_bhi_nd.data = NULL;
  __pyx_pybuffernd_bhi_nd.rcbuffer = &__pyx_pybuffer_bhi_nd;

  /* "miniga4py/ga.pyx":2562
 *     cdef np.ndarray[np.int64_t, ndim=1] alo_nd, ahi_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     alo_nd,ahi_nd = _lohi(g_a,alo,ahi)             # <<<<<<<<<<<<<<
 *     blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *     NGA_Merge_distr_patch64(
 */
  __pyx_t_1 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_alo, __pyx_v_ahi); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2562, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2562, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2562, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2562, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 2562, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2562, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2562, __pyx_L1_error)
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2562, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_alo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_alo_nd.diminfo[0].strides = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alo_nd.diminfo[0].shape = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2562, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_alo_nd = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ahi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
      __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
    }
    __pyx_pybuffernd_ahi_nd.diminfo[0].strides = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ahi_nd.diminfo[0].shape = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2562, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_ahi_nd = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "miniga4py/ga.pyx":2563
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *     blo_nd,bhi_nd = _lohi(g_b,blo,bhi)             # <<<<<<<<<<<<<<
 *     NGA_Merge_distr_patch64(
 *             g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
  __pyx_t_1 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_b, __pyx_v_blo, __pyx_v_bhi); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2563, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2563, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2563, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2563, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 2563, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2563, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2563, __pyx_L1_error)
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2563, __pyx_L1_error)
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_blo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_blo_nd.diminfo[0].strides = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_blo_nd.diminfo[0].shape = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2563, __pyx_L1_error)
  }
  __pyx_t_11 = 0;
  __pyx_v_blo_nd = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_bhi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
      __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
    }
    __pyx_pybuffernd_bhi_nd.diminfo[0].strides = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bhi_nd.diminfo[0].shape = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2563, __pyx_L1_error)
  }
  __pyx_t_11 = 0;
  __pyx_v_bhi_nd = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "miniga4py/ga.pyx":2564
 *     alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *     blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *     NGA_Merge_distr_patch64(             # <<<<<<<<<<<<<<
 *             g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *             g_b, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 */
  NGA_Merge_distr_patch64(__pyx_v_g_a, ((int64_t *)__pyx_v_alo_nd->data), ((int64_t *)__pyx_v_ahi_nd->data), __pyx_v_g_b, ((int64_t *)__pyx_v_blo_nd->data), ((int64_t *)__pyx_v_bhi_nd->data));

  /* "miniga4py/ga.pyx":2539
 *     return False
 * 
 * def merge_distr_patch(int g_a, alo, ahi, int g_b, blo, bhi):             # <<<<<<<<<<<<<<
 *     """This function merges all copies of a patch of a mirrored array (g_a)
 *     into a patch in a distributed array (g_b).
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.merge_distr_patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_alo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_ahi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_blo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_bhi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2568
 *             g_b, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 * 
 * def merge_mirrored(int g_a):             # <<<<<<<<<<<<<<
 *     """This subroutine merges mirrored arrays by adding the contents of each
 *     array across nodes.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_179merge_mirrored(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_178merge_mirrored[] = "merge_mirrored(int g_a)\nThis subroutine merges mirrored arrays by adding the contents of each\n    array across nodes.\n    \n    The result is that the each mirrored copy of the array represented by g_a\n    is the sum of the individual arrays before the merge operation. After the\n    merge, all mirrored arrays are equal.\n\n    This is a  collective  operation. \n\n    :Parameters:\n        g_a : int\n            array handle\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_179merge_mirrored = {"merge_mirrored", (PyCFunction)__pyx_pw_9miniga4py_2ga_179merge_mirrored, METH_O, __pyx_doc_9miniga4py_2ga_178merge_mirrored};
static PyObject *__pyx_pw_9miniga4py_2ga_179merge_mirrored(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("merge_mirrored (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2568, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.merge_mirrored", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_178merge_mirrored(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_178merge_mirrored(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("merge_mirrored", 0);

  /* "miniga4py/ga.pyx":2583
 * 
 *     """
 *     GA_Merge_mirrored(g_a)             # <<<<<<<<<<<<<<
 * 
 * def nbacc(int g_a, buffer, lo=None, hi=None, alpha=None):
 */
  GA_Merge_mirrored(__pyx_v_g_a);

  /* "miniga4py/ga.pyx":2568
 *             g_b, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 * 
 * def merge_mirrored(int g_a):             # <<<<<<<<<<<<<<
 *     """This subroutine merges mirrored arrays by adding the contents of each
 *     array across nodes.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2585
 *     GA_Merge_mirrored(g_a)
 * 
 * def nbacc(int g_a, buffer, lo=None, hi=None, alpha=None):             # <<<<<<<<<<<<<<
 *     """Non-blocking version of ga.acc.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_181nbacc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_180nbacc[] = "nbacc(int g_a, buffer, lo=None, hi=None, alpha=None)\nNon-blocking version of ga.acc.\n\n    The accumulate operation can be completed locally by making a call to the\n    ga.nbwait() routine.\n    \n    Combines data from buffer with data in the global array patch.\n    \n    The buffer array is assumed to be have the same number of\n    dimensions as the global array.  If the buffer is not contiguous, a\n    contiguous copy will be made.\n    \n    global array section (lo[],hi[]) += alpha * buffer\n\n    This is a non-blocking and one-sided and atomic operation.\n\n    :Parameters:\n        g_a : int\n            the array handle\n        buffer : array-like\n            must be contiguous and have same number of elements as patch\n        lo : 1D array-like of integers\n            lower bound patch coordinates, inclusive\n        hi : 1D array-like of integers\n            higher bound patch coordinates, exclusive\n        alpha : object\n            multiplier (converted to the appropriate type)\n\n    :returns: The non-blocking request handle.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_181nbacc = {"nbacc", (PyCFunction)__pyx_pw_9miniga4py_2ga_181nbacc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_180nbacc};
static PyObject *__pyx_pw_9miniga4py_2ga_181nbacc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_buffer = 0;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_v_alpha = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nbacc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_buffer,&__pyx_n_s_lo,&__pyx_n_s_hi,&__pyx_n_s_alpha,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nbacc", 0, 2, 5, 1); __PYX_ERR(0, 2585, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nbacc") < 0)) __PYX_ERR(0, 2585, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2585, __pyx_L3_error)
    __pyx_v_buffer = values[1];
    __pyx_v_lo = values[2];
    __pyx_v_hi = values[3];
    __pyx_v_alpha = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nbacc", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2585, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.nbacc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_180nbacc(__pyx_self, __pyx_v_g_a, __pyx_v_buffer, __pyx_v_lo, __pyx_v_hi, __pyx_v_alpha);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_180nbacc(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_buffer, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, PyObject *__pyx_v_alpha) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_9miniga4py_2ga__acc_common __pyx_t_2;
  __Pyx_RefNannySetupContext("nbacc", 0);

  /* "miniga4py/ga.pyx":2616
 * 
 *     """
 *     return _acc_common(g_a, buffer, lo, hi, alpha, True)             # <<<<<<<<<<<<<<
 * 
 * def nbget(int g_a, lo=None, hi=None, np.ndarray buffer=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 4;
  __pyx_t_2.lo = __pyx_v_lo;
  __pyx_t_2.hi = __pyx_v_hi;
  __pyx_t_2.alpha = __pyx_v_alpha;
  __pyx_t_2.nb = 1;
  __pyx_t_1 = __pyx_f_9miniga4py_2ga__acc_common(__pyx_v_g_a, __pyx_v_buffer, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2616, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2585
 *     GA_Merge_mirrored(g_a)
 * 
 * def nbacc(int g_a, buffer, lo=None, hi=None, alpha=None):             # <<<<<<<<<<<<<<
 *     """Non-blocking version of ga.acc.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.nbacc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2618
 *     return _acc_common(g_a, buffer, lo, hi, alpha, True)
 * 
 * def nbget(int g_a, lo=None, hi=None, np.ndarray buffer=None):             # <<<<<<<<<<<<<<
 *     """Non-blocking version of the blocking ga.get operation.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_183nbget(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_182nbget[] = "nbget(int g_a, lo=None, hi=None, ndarray buffer=None)\nNon-blocking version of the blocking ga.get operation.\n    \n    The get operation can be completed locally by making a call to the\n    ga.nbwait() routine.\n    \n    Copies data from global array section to the local array buffer.\n    \n    The local array is assumed to be have the same number of dimensions as the\n    global array. Any detected inconsitencies/errors in the input arguments\n    are fatal.\n\n    This is a non-blocking and one-sided operation.\n\n    :Parameters:\n        g_a : int\n            the array handle\n        lo : 1D array-like of integers\n            lower bound patch coordinates, inclusive\n        hi : 1D array-like of integers\n            higher bound patch coordinates, exclusive\n        buffer : ndarray\n            Fill this buffer instead of allocating a new one internally.\n            Must be contiguous and have same number of elements as patch.\n\n    :returns: The local array buffer.\n    \n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_183nbget = {"nbget", (PyCFunction)__pyx_pw_9miniga4py_2ga_183nbget, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_182nbget};
static PyObject *__pyx_pw_9miniga4py_2ga_183nbget(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyArrayObject *__pyx_v_buffer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nbget (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_lo,&__pyx_n_s_hi,&__pyx_n_s_buffer,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = (PyObject *)((PyArrayObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nbget") < 0)) __PYX_ERR(0, 2618, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2618, __pyx_L3_error)
    __pyx_v_lo = values[1];
    __pyx_v_hi = values[2];
    __pyx_v_buffer = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nbget", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2618, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.nbget", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buffer), __pyx_ptype_5numpy_ndarray, 1, "buffer", 0))) __PYX_ERR(0, 2618, __pyx_L1_error)
  __pyx_r = __pyx_pf_9miniga4py_2ga_182nbget(__pyx_self, __pyx_v_g_a, __pyx_v_lo, __pyx_v_hi, __pyx_v_buffer);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_182nbget(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, PyArrayObject *__pyx_v_buffer) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_9miniga4py_2ga__get_common __pyx_t_2;
  __Pyx_RefNannySetupContext("nbget", 0);

  /* "miniga4py/ga.pyx":2646
 * 
 *     """
 *     return _get_common(g_a, lo, hi, buffer, True)             # <<<<<<<<<<<<<<
 * 
 * def nblock(int g_a):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 4;
  __pyx_t_2.lo = __pyx_v_lo;
  __pyx_t_2.hi = __pyx_v_hi;
  __pyx_t_2.buffer = __pyx_v_buffer;
  __pyx_t_2.nb = 1;
  __pyx_t_1 = __pyx_f_9miniga4py_2ga__get_common(__pyx_v_g_a, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2618
 *     return _acc_common(g_a, buffer, lo, hi, alpha, True)
 * 
 * def nbget(int g_a, lo=None, hi=None, np.ndarray buffer=None):             # <<<<<<<<<<<<<<
 *     """Non-blocking version of the blocking ga.get operation.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.nbget", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2648
 *     return _get_common(g_a, lo, hi, buffer, True)
 * 
 * def nblock(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns the number of partitions of each array dimension for g_a.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_185nblock(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_184nblock[] = "nblock(int g_a)\nReturns the number of partitions of each array dimension for g_a.\n\n    This operation is local. \n\n    :Parameters:\n        g_a : int\n            array handle\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_185nblock = {"nblock", (PyCFunction)__pyx_pw_9miniga4py_2ga_185nblock, METH_O, __pyx_doc_9miniga4py_2ga_184nblock};
static PyObject *__pyx_pw_9miniga4py_2ga_185nblock(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nblock (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2648, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.nblock", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_184nblock(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_184nblock(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyArrayObject *__pyx_v_nblock_nd = 0;
  int __pyx_v_ndim;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nblock_nd;
  __Pyx_Buffer __pyx_pybuffer_nblock_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("nblock", 0);
  __pyx_pybuffer_nblock_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_nblock_nd.refcount = 0;
  __pyx_pybuffernd_nblock_nd.data = NULL;
  __pyx_pybuffernd_nblock_nd.rcbuffer = &__pyx_pybuffer_nblock_nd;

  /* "miniga4py/ga.pyx":2659
 *     """
 *     cdef np.ndarray[np.int32_t, ndim=1] nblock_nd
 *     cdef int ndim = GA_Ndim(g_a)             # <<<<<<<<<<<<<<
 *     nblock_nd = np.zeros(ndim, dtype=np.intc)
 *     GA_Nblock(g_a, <int*>nblock_nd.data)
 */
  __pyx_v_ndim = GA_Ndim(__pyx_v_g_a);

  /* "miniga4py/ga.pyx":2660
 *     cdef np.ndarray[np.int32_t, ndim=1] nblock_nd
 *     cdef int ndim = GA_Ndim(g_a)
 *     nblock_nd = np.zeros(ndim, dtype=np.intc)             # <<<<<<<<<<<<<<
 *     GA_Nblock(g_a, <int*>nblock_nd.data)
 *     return nblock_nd
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_intc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 2660, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2660, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nblock_nd.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nblock_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nblock_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_nblock_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_nblock_nd.diminfo[0].strides = __pyx_pybuffernd_nblock_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nblock_nd.diminfo[0].shape = __pyx_pybuffernd_nblock_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2660, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_nblock_nd = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":2661
 *     cdef int ndim = GA_Ndim(g_a)
 *     nblock_nd = np.zeros(ndim, dtype=np.intc)
 *     GA_Nblock(g_a, <int*>nblock_nd.data)             # <<<<<<<<<<<<<<
 *     return nblock_nd
 * 
 */
  GA_Nblock(__pyx_v_g_a, ((int *)__pyx_v_nblock_nd->data));

  /* "miniga4py/ga.pyx":2662
 *     nblock_nd = np.zeros(ndim, dtype=np.intc)
 *     GA_Nblock(g_a, <int*>nblock_nd.data)
 *     return nblock_nd             # <<<<<<<<<<<<<<
 * 
 * def nbput(int g_a, buffer, lo=None, hi=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_nblock_nd));
  __pyx_r = ((PyObject *)__pyx_v_nblock_nd);
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2648
 *     return _get_common(g_a, lo, hi, buffer, True)
 * 
 * def nblock(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns the number of partitions of each array dimension for g_a.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nblock_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.nblock", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nblock_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_nblock_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2664
 *     return nblock_nd
 * 
 * def nbput(int g_a, buffer, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Non-blocking version of the blocking put operation.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_187nbput(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_186nbput[] = "nbput(int g_a, buffer, lo=None, hi=None)\nNon-blocking version of the blocking put operation.\n    \n    The put operation can be completed locally by making a call to the\n    ga.nbwait() routine.\n    \n    Copies data from local array buffer to the global array section.\n    \n    The local array is assumed to be have the same number of dimensions as the\n    global array.  Any detected inconsitencies/errors in input arguments are\n    fatal.\n\n    This is a one-sided operation. \n\n    :Parameters:\n        g_a : int\n            the array handle\n        buffer : array-like\n            the data to put\n        lo : 1D array-like of integers\n            lower bound patch coordinates, inclusive\n        hi : 1D array-like of integers\n            higher bound patch coordinates, exclusive\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_187nbput = {"nbput", (PyCFunction)__pyx_pw_9miniga4py_2ga_187nbput, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_186nbput};
static PyObject *__pyx_pw_9miniga4py_2ga_187nbput(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_buffer = 0;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nbput (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_buffer,&__pyx_n_s_lo,&__pyx_n_s_hi,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nbput", 0, 2, 4, 1); __PYX_ERR(0, 2664, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nbput") < 0)) __PYX_ERR(0, 2664, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2664, __pyx_L3_error)
    __pyx_v_buffer = values[1];
    __pyx_v_lo = values[2];
    __pyx_v_hi = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nbput", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2664, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.nbput", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_186nbput(__pyx_self, __pyx_v_g_a, __pyx_v_buffer, __pyx_v_lo, __pyx_v_hi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_186nbput(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_buffer, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_9miniga4py_2ga__put_common __pyx_t_2;
  __Pyx_RefNannySetupContext("nbput", 0);

  /* "miniga4py/ga.pyx":2689
 * 
 *     """
 *     return _put_common(g_a, buffer, lo, hi, True, False)             # <<<<<<<<<<<<<<
 * 
 * def nbwait(ga_nbhdl_t nbhandle):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 4;
  __pyx_t_2.lo = __pyx_v_lo;
  __pyx_t_2.hi = __pyx_v_hi;
  __pyx_t_2.nb = 1;
  __pyx_t_2.periodic = 0;
  __pyx_t_1 = __pyx_f_9miniga4py_2ga__put_common(__pyx_v_g_a, __pyx_v_buffer, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2664
 *     return nblock_nd
 * 
 * def nbput(int g_a, buffer, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Non-blocking version of the blocking put operation.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.nbput", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2691
 *     return _put_common(g_a, buffer, lo, hi, True, False)
 * 
 * def nbwait(ga_nbhdl_t nbhandle):             # <<<<<<<<<<<<<<
 *     """This function completes a non-blocking one-sided operation locally.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_189nbwait(PyObject *__pyx_self, PyObject *__pyx_arg_nbhandle); /*proto*/
static char __pyx_doc_9miniga4py_2ga_188nbwait[] = "nbwait(ga_nbhdl_t nbhandle)\nThis function completes a non-blocking one-sided operation locally.\n\n    Waiting on a nonblocking put or an accumulate operation assures that data\n    was injected into the network and the user buffer can be now be reused.\n    Completing a get operation assures data has arrived into the user memory\n    and is ready for use. Wait operation ensures only local completion. Unlike\n    their blocking counterparts, the nonblocking operations are not ordered\n    with respect to the destination. Performance being one reason, the other\n    reason is that by ensuring ordering we incur additional and possibly\n    unnecessary overhead on applications that do not require their operations\n    to be ordered. For cases where ordering is necessary, it can be done by\n    calling a fence operation. The fence operation is provided to the user to\n    confirm remote completion if needed. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_189nbwait = {"nbwait", (PyCFunction)__pyx_pw_9miniga4py_2ga_189nbwait, METH_O, __pyx_doc_9miniga4py_2ga_188nbwait};
static PyObject *__pyx_pw_9miniga4py_2ga_189nbwait(PyObject *__pyx_self, PyObject *__pyx_arg_nbhandle) {
  ga_nbhdl_t __pyx_v_nbhandle;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nbwait (wrapper)", 0);
  assert(__pyx_arg_nbhandle); {
    __pyx_v_nbhandle = __Pyx_PyInt_As_Integer(__pyx_arg_nbhandle); if (unlikely((__pyx_v_nbhandle == ((ga_nbhdl_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2691, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.nbwait", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_188nbwait(__pyx_self, ((ga_nbhdl_t)__pyx_v_nbhandle));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_188nbwait(CYTHON_UNUSED PyObject *__pyx_self, ga_nbhdl_t __pyx_v_nbhandle) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nbwait", 0);

  /* "miniga4py/ga.pyx":2707
 * 
 *     """
 *     NGA_NbWait(&nbhandle)             # <<<<<<<<<<<<<<
 * 
 * def ndim(int g_a):
 */
  NGA_NbWait((&__pyx_v_nbhandle));

  /* "miniga4py/ga.pyx":2691
 *     return _put_common(g_a, buffer, lo, hi, True, False)
 * 
 * def nbwait(ga_nbhdl_t nbhandle):             # <<<<<<<<<<<<<<
 *     """This function completes a non-blocking one-sided operation locally.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2709
 *     NGA_NbWait(&nbhandle)
 * 
 * def ndim(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns the number of dimensions in array represented by the handle g_a.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_191ndim(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_190ndim[] = "ndim(int g_a)\nReturns the number of dimensions in array represented by the handle g_a.\n\n    This operation is local.\n    \n    :Parameters:\n        g_a : int\n            the array handle\n\n    :returns: the number of dimensions in the array g_a\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_191ndim = {"ndim", (PyCFunction)__pyx_pw_9miniga4py_2ga_191ndim, METH_O, __pyx_doc_9miniga4py_2ga_190ndim};
static PyObject *__pyx_pw_9miniga4py_2ga_191ndim(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ndim (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2709, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.ndim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_190ndim(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_190ndim(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("ndim", 0);

  /* "miniga4py/ga.pyx":2721
 * 
 *     """
 *     return GA_Ndim(g_a)             # <<<<<<<<<<<<<<
 * 
 * def nnodes():
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Ndim(__pyx_v_g_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2709
 *     NGA_NbWait(&nbhandle)
 * 
 * def ndim(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns the number of dimensions in array represented by the handle g_a.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.ndim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2723
 *     return GA_Ndim(g_a)
 * 
 * def nnodes():             # <<<<<<<<<<<<<<
 *     """Returns the number of the GA compute (user) processes.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_193nnodes(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_192nnodes[] = "nnodes()\nReturns the number of the GA compute (user) processes.\n\n    This operation is local.\n    \n    :returns: the number of GA compute (user) processes\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_193nnodes = {"nnodes", (PyCFunction)__pyx_pw_9miniga4py_2ga_193nnodes, METH_NOARGS, __pyx_doc_9miniga4py_2ga_192nnodes};
static PyObject *__pyx_pw_9miniga4py_2ga_193nnodes(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nnodes (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_192nnodes(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_192nnodes(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("nnodes", 0);

  /* "miniga4py/ga.pyx":2731
 * 
 *     """
 *     return GA_Nnodes()             # <<<<<<<<<<<<<<
 * 
 * def nodeid():
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Nnodes()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2723
 *     return GA_Ndim(g_a)
 * 
 * def nnodes():             # <<<<<<<<<<<<<<
 *     """Returns the number of the GA compute (user) processes.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.nnodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2733
 *     return GA_Nnodes()
 * 
 * def nodeid():             # <<<<<<<<<<<<<<
 *     """Returns the GA process id (0, ..., ga.nnodes()-1) of the requesting
 *     compute process.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_195nodeid(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_194nodeid[] = "nodeid()\nReturns the GA process id (0, ..., ga.nnodes()-1) of the requesting\n    compute process.\n\n    This operation is local.\n    \n    :returns: the GA process id\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_195nodeid = {"nodeid", (PyCFunction)__pyx_pw_9miniga4py_2ga_195nodeid, METH_NOARGS, __pyx_doc_9miniga4py_2ga_194nodeid};
static PyObject *__pyx_pw_9miniga4py_2ga_195nodeid(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nodeid (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_194nodeid(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_194nodeid(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("nodeid", 0);

  /* "miniga4py/ga.pyx":2742
 * 
 *     """
 *     return GA_Nodeid()             # <<<<<<<<<<<<<<
 * 
 * def norm1(int g_a):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Nodeid()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2742, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2733
 *     return GA_Nnodes()
 * 
 * def nodeid():             # <<<<<<<<<<<<<<
 *     """Returns the GA process id (0, ..., ga.nnodes()-1) of the requesting
 *     compute process.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.nodeid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2744
 *     return GA_Nodeid()
 * 
 * def norm1(int g_a):             # <<<<<<<<<<<<<<
 *     """Computes the 1-norm of the matrix or vector g_a.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_197norm1(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_196norm1[] = "norm1(int g_a)\nComputes the 1-norm of the matrix or vector g_a.\n\n    This is a collective operation. \n\n    :Parameters:\n        g_a : int\n            the array handle\n\n    :returns: the 1-norm of the matrix or vector g_a (as a float)\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_197norm1 = {"norm1", (PyCFunction)__pyx_pw_9miniga4py_2ga_197norm1, METH_O, __pyx_doc_9miniga4py_2ga_196norm1};
static PyObject *__pyx_pw_9miniga4py_2ga_197norm1(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("norm1 (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2744, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.norm1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_196norm1(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_196norm1(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  double __pyx_v_nm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("norm1", 0);

  /* "miniga4py/ga.pyx":2757
 *     """
 *     cdef double nm
 *     GA_Norm1(g_a, &nm)             # <<<<<<<<<<<<<<
 *     return nm
 * 
 */
  GA_Norm1(__pyx_v_g_a, (&__pyx_v_nm));

  /* "miniga4py/ga.pyx":2758
 *     cdef double nm
 *     GA_Norm1(g_a, &nm)
 *     return nm             # <<<<<<<<<<<<<<
 * 
 * def norm_infinity(int g_a):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_nm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2744
 *     return GA_Nodeid()
 * 
 * def norm1(int g_a):             # <<<<<<<<<<<<<<
 *     """Computes the 1-norm of the matrix or vector g_a.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.norm1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2760
 *     return nm
 * 
 * def norm_infinity(int g_a):             # <<<<<<<<<<<<<<
 *     """Computes the 1-norm of the matrix or vector g_a.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_199norm_infinity(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_198norm_infinity[] = "norm_infinity(int g_a)\nComputes the 1-norm of the matrix or vector g_a.\n\n    This is a collective operation. \n\n    :Parameters:\n        g_a : int\n            the array handle\n\n    :returns: the 1-norm of the matrix or vector g_a\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_199norm_infinity = {"norm_infinity", (PyCFunction)__pyx_pw_9miniga4py_2ga_199norm_infinity, METH_O, __pyx_doc_9miniga4py_2ga_198norm_infinity};
static PyObject *__pyx_pw_9miniga4py_2ga_199norm_infinity(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("norm_infinity (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2760, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.norm_infinity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_198norm_infinity(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_198norm_infinity(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  double __pyx_v_nm;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("norm_infinity", 0);

  /* "miniga4py/ga.pyx":2773
 *     """
 *     cdef double nm
 *     GA_Norm_infinity(g_a, &nm)             # <<<<<<<<<<<<<<
 *     return nm
 * 
 */
  GA_Norm_infinity(__pyx_v_g_a, (&__pyx_v_nm));

  /* "miniga4py/ga.pyx":2774
 *     cdef double nm
 *     GA_Norm_infinity(g_a, &nm)
 *     return nm             # <<<<<<<<<<<<<<
 * 
 * def enum(int g_a, lo=None, hi=None, start=None, inc=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_nm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2760
 *     return nm
 * 
 * def norm_infinity(int g_a):             # <<<<<<<<<<<<<<
 *     """Computes the 1-norm of the matrix or vector g_a.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.norm_infinity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2776
 *     return nm
 * 
 * def enum(int g_a, lo=None, hi=None, start=None, inc=None):             # <<<<<<<<<<<<<<
 *     """This subroutine enumerates the values of an array between elements lo
 *     and hi starting with the value istart and incrementing each subsequent
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_201enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_200enum[] = "enum(int g_a, lo=None, hi=None, start=None, inc=None)\nThis subroutine enumerates the values of an array between elements lo\n    and hi starting with the value istart and incrementing each subsequent\n    value by inc.\n    \n    This operation is only applicable to 1-dimensional arrays.\n\n    An example of its use is shown below:\n\n        ga.enum(g_a, 1, n, 7, 2)\n        # g_a: 7  9 11 13 15 17 19 21 23 ...\n\n    This is a collective operation.\n\n    :Parameters:\n        g_a : int\n            the array handle\n        lo : 1D array-like of integers\n            patch coordinate\n        hi : 1D array-like of integers\n            patch coordinate\n        start : object\n            starting value of enumeration (converted to appropriate type)\n        inc : object\n            increment value (converted to appropriate type)\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_201enum = {"enum", (PyCFunction)__pyx_pw_9miniga4py_2ga_201enum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_200enum};
static PyObject *__pyx_pw_9miniga4py_2ga_201enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_v_start = 0;
  PyObject *__pyx_v_inc = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("enum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_lo,&__pyx_n_s_hi,&__pyx_n_s_start,&__pyx_n_s_inc,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inc);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "enum") < 0)) __PYX_ERR(0, 2776, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2776, __pyx_L3_error)
    __pyx_v_lo = values[1];
    __pyx_v_hi = values[2];
    __pyx_v_start = values[3];
    __pyx_v_inc = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("enum", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2776, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_200enum(__pyx_self, __pyx_v_g_a, __pyx_v_lo, __pyx_v_hi, __pyx_v_start, __pyx_v_inc);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_200enum(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, PyObject *__pyx_v_start, PyObject *__pyx_v_inc) {
  PyArrayObject *__pyx_v_hi_nd = 0;
  int64_t __pyx_v_c_lo;
  int64_t __pyx_v_c_hi;
  int __pyx_v_gtype;
  int __pyx_v_istart;
  int __pyx_v_iinc;
  long __pyx_v_lstart;
  long __pyx_v_linc;
  PY_LONG_LONG __pyx_v_llstart;
  PY_LONG_LONG __pyx_v_llinc;
  float __pyx_v_fstart;
  float __pyx_v_finc;
  double __pyx_v_dstart;
  double __pyx_v_dinc;
  long double __pyx_v_ldstart;
  long double __pyx_v_ldinc;
  SingleComplex __pyx_v_fcstart;
  SingleComplex __pyx_v_fcinc;
  DoubleComplex __pyx_v_dcstart;
  DoubleComplex __pyx_v_dcinc;
  void *__pyx_v_vstart;
  void *__pyx_v_vinc;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_nd;
  __Pyx_Buffer __pyx_pybuffer_hi_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyArrayObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int64_t __pyx_t_8;
  __Pyx_RefNannySetupContext("enum", 0);
  __Pyx_INCREF(__pyx_v_start);
  __Pyx_INCREF(__pyx_v_inc);
  __pyx_pybuffer_hi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_nd.refcount = 0;
  __pyx_pybuffernd_hi_nd.data = NULL;
  __pyx_pybuffernd_hi_nd.rcbuffer = &__pyx_pybuffer_hi_nd;

  /* "miniga4py/ga.pyx":2803
 * 
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] hi_nd = inquire_dims(g_a)-1             # <<<<<<<<<<<<<<
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0]
 *     cdef int gtype=inquire_type(g_a)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga_inquire_dims(__pyx_v_g_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2803, __pyx_L1_error)
  __pyx_t_3 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_hi_nd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 2803, __pyx_L1_error)
    } else {__pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_3 = 0;
  __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "miniga4py/ga.pyx":2804
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] hi_nd = inquire_dims(g_a)-1
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0]             # <<<<<<<<<<<<<<
 *     cdef int gtype=inquire_type(g_a)
 *     cdef int            istart, iinc
 */
  __pyx_v_c_lo = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = -1;
  if (__pyx_t_4 < 0) {
    __pyx_t_4 += __pyx_pybuffernd_hi_nd.diminfo[0].shape;
    if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_hi_nd.diminfo[0].shape)) __pyx_t_5 = 0;
  if (unlikely(__pyx_t_5 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_5);
    __PYX_ERR(0, 2804, __pyx_L1_error)
  }
  __pyx_v_c_hi = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_hi_nd.diminfo[0].strides));

  /* "miniga4py/ga.pyx":2805
 *     cdef np.ndarray[np.int64_t, ndim=1] hi_nd = inquire_dims(g_a)-1
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0]
 *     cdef int gtype=inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     cdef int            istart, iinc
 *     cdef long           lstart, linc
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":2814
 *     cdef SingleComplex  fcstart, fcinc
 *     cdef DoubleComplex  dcstart, dcinc
 *     cdef void          *vstart=NULL             # <<<<<<<<<<<<<<
 *     cdef void          *vinc=NULL
 *     if lo is not None:
 */
  __pyx_v_vstart = NULL;

  /* "miniga4py/ga.pyx":2815
 *     cdef DoubleComplex  dcstart, dcinc
 *     cdef void          *vstart=NULL
 *     cdef void          *vinc=NULL             # <<<<<<<<<<<<<<
 *     if lo is not None:
 *         c_lo = lo
 */
  __pyx_v_vinc = NULL;

  /* "miniga4py/ga.pyx":2816
 *     cdef void          *vstart=NULL
 *     cdef void          *vinc=NULL
 *     if lo is not None:             # <<<<<<<<<<<<<<
 *         c_lo = lo
 *     if hi is not None:
 */
  __pyx_t_6 = (__pyx_v_lo != Py_None);
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "miniga4py/ga.pyx":2817
 *     cdef void          *vinc=NULL
 *     if lo is not None:
 *         c_lo = lo             # <<<<<<<<<<<<<<
 *     if hi is not None:
 *         c_hi = hi
 */
    __pyx_t_8 = __Pyx_PyInt_As_int64_t(__pyx_v_lo); if (unlikely((__pyx_t_8 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2817, __pyx_L1_error)
    __pyx_v_c_lo = __pyx_t_8;

    /* "miniga4py/ga.pyx":2816
 *     cdef void          *vstart=NULL
 *     cdef void          *vinc=NULL
 *     if lo is not None:             # <<<<<<<<<<<<<<
 *         c_lo = lo
 *     if hi is not None:
 */
  }

  /* "miniga4py/ga.pyx":2818
 *     if lo is not None:
 *         c_lo = lo
 *     if hi is not None:             # <<<<<<<<<<<<<<
 *         c_hi = hi
 *     if start is None:
 */
  __pyx_t_7 = (__pyx_v_hi != Py_None);
  __pyx_t_6 = (__pyx_t_7 != 0);
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":2819
 *         c_lo = lo
 *     if hi is not None:
 *         c_hi = hi             # <<<<<<<<<<<<<<
 *     if start is None:
 *         start = 1
 */
    __pyx_t_8 = __Pyx_PyInt_As_int64_t(__pyx_v_hi); if (unlikely((__pyx_t_8 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2819, __pyx_L1_error)
    __pyx_v_c_hi = __pyx_t_8;

    /* "miniga4py/ga.pyx":2818
 *     if lo is not None:
 *         c_lo = lo
 *     if hi is not None:             # <<<<<<<<<<<<<<
 *         c_hi = hi
 *     if start is None:
 */
  }

  /* "miniga4py/ga.pyx":2820
 *     if hi is not None:
 *         c_hi = hi
 *     if start is None:             # <<<<<<<<<<<<<<
 *         start = 1
 *     if inc is None:
 */
  __pyx_t_6 = (__pyx_v_start == Py_None);
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "miniga4py/ga.pyx":2821
 *         c_hi = hi
 *     if start is None:
 *         start = 1             # <<<<<<<<<<<<<<
 *     if inc is None:
 *         inc = 1
 */
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_DECREF_SET(__pyx_v_start, __pyx_int_1);

    /* "miniga4py/ga.pyx":2820
 *     if hi is not None:
 *         c_hi = hi
 *     if start is None:             # <<<<<<<<<<<<<<
 *         start = 1
 *     if inc is None:
 */
  }

  /* "miniga4py/ga.pyx":2822
 *     if start is None:
 *         start = 1
 *     if inc is None:             # <<<<<<<<<<<<<<
 *         inc = 1
 *     vstart = _convert_multiplier(gtype, start,
 */
  __pyx_t_7 = (__pyx_v_inc == Py_None);
  __pyx_t_6 = (__pyx_t_7 != 0);
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":2823
 *         start = 1
 *     if inc is None:
 *         inc = 1             # <<<<<<<<<<<<<<
 *     vstart = _convert_multiplier(gtype, start,
 *             &istart,  &lstart,  &llstart,
 */
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_DECREF_SET(__pyx_v_inc, __pyx_int_1);

    /* "miniga4py/ga.pyx":2822
 *     if start is None:
 *         start = 1
 *     if inc is None:             # <<<<<<<<<<<<<<
 *         inc = 1
 *     vstart = _convert_multiplier(gtype, start,
 */
  }

  /* "miniga4py/ga.pyx":2824
 *     if inc is None:
 *         inc = 1
 *     vstart = _convert_multiplier(gtype, start,             # <<<<<<<<<<<<<<
 *             &istart,  &lstart,  &llstart,
 *             &fstart,  &dstart,  &ldstart,
 */
  __pyx_v_vstart = __pyx_f_9miniga4py_2ga__convert_multiplier(__pyx_v_gtype, __pyx_v_start, (&__pyx_v_istart), (&__pyx_v_lstart), (&__pyx_v_llstart), (&__pyx_v_fstart), (&__pyx_v_dstart), (&__pyx_v_ldstart), (&__pyx_v_fcstart), (&__pyx_v_dcstart));

  /* "miniga4py/ga.pyx":2828
 *             &fstart,  &dstart,  &ldstart,
 *             &fcstart, &dcstart)
 *     vinc = _convert_multiplier(gtype, inc,             # <<<<<<<<<<<<<<
 *             &iinc,  &linc,  &llinc,
 *             &finc,  &dinc,  &ldinc,
 */
  __pyx_v_vinc = __pyx_f_9miniga4py_2ga__convert_multiplier(__pyx_v_gtype, __pyx_v_inc, (&__pyx_v_iinc), (&__pyx_v_linc), (&__pyx_v_llinc), (&__pyx_v_finc), (&__pyx_v_dinc), (&__pyx_v_ldinc), (&__pyx_v_fcinc), (&__pyx_v_dcinc));

  /* "miniga4py/ga.pyx":2832
 *             &finc,  &dinc,  &ldinc,
 *             &fcinc, &dcinc)
 *     GA_Patch_enum64(g_a, c_lo, c_hi, vstart, vinc)             # <<<<<<<<<<<<<<
 * 
 * def pack(int g_src, int g_dst, int g_msk, lo=None, hi=None):
 */
  GA_Patch_enum64(__pyx_v_g_a, __pyx_v_c_lo, __pyx_v_c_hi, __pyx_v_vstart, __pyx_v_vinc);

  /* "miniga4py/ga.pyx":2776
 *     return nm
 * 
 * def enum(int g_a, lo=None, hi=None, start=None, inc=None):             # <<<<<<<<<<<<<<
 *     """This subroutine enumerates the values of an array between elements lo
 *     and hi starting with the value istart and incrementing each subsequent
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_nd);
  __Pyx_XDECREF(__pyx_v_start);
  __Pyx_XDECREF(__pyx_v_inc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2834
 *     GA_Patch_enum64(g_a, c_lo, c_hi, vstart, vinc)
 * 
 * def pack(int g_src, int g_dst, int g_msk, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """The pack subroutine is designed to compress the values in the source
 *     vector g_src into a smaller destination array g_dst based on the values
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_203pack(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_202pack[] = "pack(int g_src, int g_dst, int g_msk, lo=None, hi=None)\nThe pack subroutine is designed to compress the values in the source\n    vector g_src into a smaller destination array g_dst based on the values\n    in an integer mask array g_msk. The values lo and hi denote the range of\n    elements that should be compressed and the number of values placed in the\n    compressed array is returned.  This operation is the complement of the\n    ga.unpack operation. An example is shown below::\n\n        icount = ga.pack(g_src, g_dst, g_msk, 1, n);\n        # g_msk:   1  0  0  0  0  0  1  0  1  0  0  1  0  0  1  1  0\n        # g_src:   1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17\n        # g_dst:   1  7  9 12 15 16\n        # icount:  6\n\n    This is a collective operation.\n\n    :Parameters:\n        g_src : int\n            handle for source arrray\n        g_dst : int\n            handle for destination array\n        g_msk : int\n            handle for integer array representing mask\n        lo : 1D array-like of integers\n            low value of range on which operation is performed\n        hi : 1D array-like of integers\n            hi value of range on which operation is performed\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_203pack = {"pack", (PyCFunction)__pyx_pw_9miniga4py_2ga_203pack, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_202pack};
static PyObject *__pyx_pw_9miniga4py_2ga_203pack(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_src;
  int __pyx_v_g_dst;
  int __pyx_v_g_msk;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pack (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_src,&__pyx_n_s_g_dst,&__pyx_n_s_g_msk,&__pyx_n_s_lo,&__pyx_n_s_hi,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_src)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_dst)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pack", 0, 3, 5, 1); __PYX_ERR(0, 2834, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_msk)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pack", 0, 3, 5, 2); __PYX_ERR(0, 2834, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pack") < 0)) __PYX_ERR(0, 2834, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_src = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_src == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2834, __pyx_L3_error)
    __pyx_v_g_dst = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_dst == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2834, __pyx_L3_error)
    __pyx_v_g_msk = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_g_msk == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2834, __pyx_L3_error)
    __pyx_v_lo = values[3];
    __pyx_v_hi = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pack", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2834, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.pack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_202pack(__pyx_self, __pyx_v_g_src, __pyx_v_g_dst, __pyx_v_g_msk, __pyx_v_lo, __pyx_v_hi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_202pack(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_src, int __pyx_v_g_dst, int __pyx_v_g_msk, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
  PyArrayObject *__pyx_v_hi_nd = 0;
  CYTHON_UNUSED int64_t __pyx_v_c_lo;
  CYTHON_UNUSED int64_t __pyx_v_c_hi;
  int64_t __pyx_v_icount;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_nd;
  __Pyx_Buffer __pyx_pybuffer_hi_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyArrayObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int64_t __pyx_t_8;
  int64_t __pyx_t_9;
  __Pyx_RefNannySetupContext("pack", 0);
  __pyx_pybuffer_hi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_nd.refcount = 0;
  __pyx_pybuffernd_hi_nd.data = NULL;
  __pyx_pybuffernd_hi_nd.rcbuffer = &__pyx_pybuffer_hi_nd;

  /* "miniga4py/ga.pyx":2863
 * 
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] hi_nd = inquire_dims(g_src)-1             # <<<<<<<<<<<<<<
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0], icount
 *     if lo is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga_inquire_dims(__pyx_v_g_src, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2863, __pyx_L1_error)
  __pyx_t_3 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_hi_nd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 2863, __pyx_L1_error)
    } else {__pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_3 = 0;
  __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "miniga4py/ga.pyx":2864
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] hi_nd = inquire_dims(g_src)-1
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0], icount             # <<<<<<<<<<<<<<
 *     if lo is not None:
 *         c_lo = lo
 */
  __pyx_v_c_lo = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = -1;
  if (__pyx_t_4 < 0) {
    __pyx_t_4 += __pyx_pybuffernd_hi_nd.diminfo[0].shape;
    if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_hi_nd.diminfo[0].shape)) __pyx_t_5 = 0;
  if (unlikely(__pyx_t_5 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_5);
    __PYX_ERR(0, 2864, __pyx_L1_error)
  }
  __pyx_v_c_hi = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_hi_nd.diminfo[0].strides));

  /* "miniga4py/ga.pyx":2865
 *     cdef np.ndarray[np.int64_t, ndim=1] hi_nd = inquire_dims(g_src)-1
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0], icount
 *     if lo is not None:             # <<<<<<<<<<<<<<
 *         c_lo = lo
 *     if hi is not None:
 */
  __pyx_t_6 = (__pyx_v_lo != Py_None);
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "miniga4py/ga.pyx":2866
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0], icount
 *     if lo is not None:
 *         c_lo = lo             # <<<<<<<<<<<<<<
 *     if hi is not None:
 *         c_hi = hi
 */
    __pyx_t_8 = __Pyx_PyInt_As_int64_t(__pyx_v_lo); if (unlikely((__pyx_t_8 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2866, __pyx_L1_error)
    __pyx_v_c_lo = __pyx_t_8;

    /* "miniga4py/ga.pyx":2865
 *     cdef np.ndarray[np.int64_t, ndim=1] hi_nd = inquire_dims(g_src)-1
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0], icount
 *     if lo is not None:             # <<<<<<<<<<<<<<
 *         c_lo = lo
 *     if hi is not None:
 */
  }

  /* "miniga4py/ga.pyx":2867
 *     if lo is not None:
 *         c_lo = lo
 *     if hi is not None:             # <<<<<<<<<<<<<<
 *         c_hi = hi
 *     GA_Pack64(g_src, g_dst, g_msk, lo, hi, &icount)
 */
  __pyx_t_7 = (__pyx_v_hi != Py_None);
  __pyx_t_6 = (__pyx_t_7 != 0);
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":2868
 *         c_lo = lo
 *     if hi is not None:
 *         c_hi = hi             # <<<<<<<<<<<<<<
 *     GA_Pack64(g_src, g_dst, g_msk, lo, hi, &icount)
 *     return icount
 */
    __pyx_t_8 = __Pyx_PyInt_As_int64_t(__pyx_v_hi); if (unlikely((__pyx_t_8 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2868, __pyx_L1_error)
    __pyx_v_c_hi = __pyx_t_8;

    /* "miniga4py/ga.pyx":2867
 *     if lo is not None:
 *         c_lo = lo
 *     if hi is not None:             # <<<<<<<<<<<<<<
 *         c_hi = hi
 *     GA_Pack64(g_src, g_dst, g_msk, lo, hi, &icount)
 */
  }

  /* "miniga4py/ga.pyx":2869
 *     if hi is not None:
 *         c_hi = hi
 *     GA_Pack64(g_src, g_dst, g_msk, lo, hi, &icount)             # <<<<<<<<<<<<<<
 *     return icount
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_As_int64_t(__pyx_v_lo); if (unlikely((__pyx_t_8 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2869, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyInt_As_int64_t(__pyx_v_hi); if (unlikely((__pyx_t_9 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2869, __pyx_L1_error)
  GA_Pack64(__pyx_v_g_src, __pyx_v_g_dst, __pyx_v_g_msk, __pyx_t_8, __pyx_t_9, (&__pyx_v_icount));

  /* "miniga4py/ga.pyx":2870
 *         c_hi = hi
 *     GA_Pack64(g_src, g_dst, g_msk, lo, hi, &icount)
 *     return icount             # <<<<<<<<<<<<<<
 * 
 * def periodic_acc(int g_a, buffer, lo=None, hi=None, alpha=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_v_icount); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2870, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2834
 *     GA_Patch_enum64(g_a, c_lo, c_hi, vstart, vinc)
 * 
 * def pack(int g_src, int g_dst, int g_msk, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """The pack subroutine is designed to compress the values in the source
 *     vector g_src into a smaller destination array g_dst based on the values
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.pack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2872
 *     return icount
 * 
 * def periodic_acc(int g_a, buffer, lo=None, hi=None, alpha=None):             # <<<<<<<<<<<<<<
 *     """Periodic version of ga.acc.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_205periodic_acc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_204periodic_acc[] = "periodic_acc(int g_a, buffer, lo=None, hi=None, alpha=None)\nPeriodic version of ga.acc.\n\n    The indices can extend beyond the array boundary/dimensions in which case\n    the libray wraps them around.\n    \n    Combines data from buffer with data in the global array patch.\n    \n    The buffer array is assumed to be have the same number of\n    dimensions as the global array.  If the buffer is not contiguous, a\n    contiguous copy will be made.\n    \n        global array section (lo[],hi[]) += alpha * buffer\n\n    This is a one-sided and atomic operation.\n\n    :Parameters:\n        g_a : int\n            the array handle\n        buffer : array-like\n            must be contiguous and have same number of elements as patch\n        lo : 1D array-like of integers\n            lower bound patch coordinates, inclusive\n        hi : array-like of integers\n            higher bound patch coordinates, exclusive\n        alpha : object\n            multiplier (converted to the appropriate type)\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_205periodic_acc = {"periodic_acc", (PyCFunction)__pyx_pw_9miniga4py_2ga_205periodic_acc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_204periodic_acc};
static PyObject *__pyx_pw_9miniga4py_2ga_205periodic_acc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_buffer = 0;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_v_alpha = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("periodic_acc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_buffer,&__pyx_n_s_lo,&__pyx_n_s_hi,&__pyx_n_s_alpha,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("periodic_acc", 0, 2, 5, 1); __PYX_ERR(0, 2872, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "periodic_acc") < 0)) __PYX_ERR(0, 2872, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2872, __pyx_L3_error)
    __pyx_v_buffer = values[1];
    __pyx_v_lo = values[2];
    __pyx_v_hi = values[3];
    __pyx_v_alpha = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("periodic_acc", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2872, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.periodic_acc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_204periodic_acc(__pyx_self, __pyx_v_g_a, __pyx_v_buffer, __pyx_v_lo, __pyx_v_hi, __pyx_v_alpha);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_204periodic_acc(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_buffer, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, PyObject *__pyx_v_alpha) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_9miniga4py_2ga__acc_common __pyx_t_2;
  __Pyx_RefNannySetupContext("periodic_acc", 0);

  /* "miniga4py/ga.pyx":2901
 * 
 *     """
 *     _acc_common(g_a, buffer, lo, hi, alpha, False, True)             # <<<<<<<<<<<<<<
 * 
 * def periodic_get(int g_a, lo=None, hi=None, np.ndarray buffer=None):
 */
  __pyx_t_2.__pyx_n = 5;
  __pyx_t_2.lo = __pyx_v_lo;
  __pyx_t_2.hi = __pyx_v_hi;
  __pyx_t_2.alpha = __pyx_v_alpha;
  __pyx_t_2.nb = 0;
  __pyx_t_2.periodic = 1;
  __pyx_t_1 = __pyx_f_9miniga4py_2ga__acc_common(__pyx_v_g_a, __pyx_v_buffer, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":2872
 *     return icount
 * 
 * def periodic_acc(int g_a, buffer, lo=None, hi=None, alpha=None):             # <<<<<<<<<<<<<<
 *     """Periodic version of ga.acc.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.periodic_acc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2903
 *     _acc_common(g_a, buffer, lo, hi, alpha, False, True)
 * 
 * def periodic_get(int g_a, lo=None, hi=None, np.ndarray buffer=None):             # <<<<<<<<<<<<<<
 *     """Periodic version of ga.get.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_207periodic_get(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_206periodic_get[] = "periodic_get(int g_a, lo=None, hi=None, ndarray buffer=None)\nPeriodic version of ga.get.\n    \n    The indices can extend beyond the array boundary/dimensions in which case\n    the libray wraps them around.\n    \n    Copies data from global array section to the local array buffer.\n    \n    The local array is assumed to be have the same number of dimensions as the\n    global array. Any detected inconsitencies/errors in the input arguments\n    are fatal.\n\n    This is a one-sided operation.\n\n    :Parameters:\n        g_a : int\n            the array handle\n        lo : 1D array-like of integers\n            lower bound patch coordinates, inclusive\n        hi : array-like of integers\n            higher bound patch coordinates, exclusive\n        buffer : array-like\n            must be contiguous and have same number of elements as patch\n\n    :returns: The local array buffer.\n    \n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_207periodic_get = {"periodic_get", (PyCFunction)__pyx_pw_9miniga4py_2ga_207periodic_get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_206periodic_get};
static PyObject *__pyx_pw_9miniga4py_2ga_207periodic_get(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyArrayObject *__pyx_v_buffer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("periodic_get (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_lo,&__pyx_n_s_hi,&__pyx_n_s_buffer,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = (PyObject *)((PyArrayObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "periodic_get") < 0)) __PYX_ERR(0, 2903, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2903, __pyx_L3_error)
    __pyx_v_lo = values[1];
    __pyx_v_hi = values[2];
    __pyx_v_buffer = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("periodic_get", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2903, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.periodic_get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buffer), __pyx_ptype_5numpy_ndarray, 1, "buffer", 0))) __PYX_ERR(0, 2903, __pyx_L1_error)
  __pyx_r = __pyx_pf_9miniga4py_2ga_206periodic_get(__pyx_self, __pyx_v_g_a, __pyx_v_lo, __pyx_v_hi, __pyx_v_buffer);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_206periodic_get(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, PyArrayObject *__pyx_v_buffer) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_9miniga4py_2ga__get_common __pyx_t_2;
  __Pyx_RefNannySetupContext("periodic_get", 0);

  /* "miniga4py/ga.pyx":2930
 * 
 *     """
 *     return _get_common(g_a, lo, hi, buffer, False, True)             # <<<<<<<<<<<<<<
 * 
 * def periodic_put(int g_a, buffer, lo=None, hi=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 5;
  __pyx_t_2.lo = __pyx_v_lo;
  __pyx_t_2.hi = __pyx_v_hi;
  __pyx_t_2.buffer = __pyx_v_buffer;
  __pyx_t_2.nb = 0;
  __pyx_t_2.periodic = 1;
  __pyx_t_1 = __pyx_f_9miniga4py_2ga__get_common(__pyx_v_g_a, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2903
 *     _acc_common(g_a, buffer, lo, hi, alpha, False, True)
 * 
 * def periodic_get(int g_a, lo=None, hi=None, np.ndarray buffer=None):             # <<<<<<<<<<<<<<
 *     """Periodic version of ga.get.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.periodic_get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2932
 *     return _get_common(g_a, lo, hi, buffer, False, True)
 * 
 * def periodic_put(int g_a, buffer, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Periodic version of ga.put.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_209periodic_put(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_208periodic_put[] = "periodic_put(int g_a, buffer, lo=None, hi=None)\nPeriodic version of ga.put.\n\n    The indices can extend beyond the array boundary/dimensions in which case\n    the libray wraps them around.\n    \n    Copies data from local array buffer to the global array section.\n    \n    The local array is assumed to be have the same number of dimensions as the\n    global array.  Any detected inconsitencies/errors in input arguments are\n    fatal.\n\n    This is a one-sided operation. \n\n    :Parameters:\n        g_a : int\n            the array handle\n        buffer : array-like\n            the data to put\n        lo : 1D array-like of integers\n            lower bound patch coordinates, inclusive\n        hi : array-like of integers\n            higher bound patch coordinates, exclusive\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_209periodic_put = {"periodic_put", (PyCFunction)__pyx_pw_9miniga4py_2ga_209periodic_put, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_208periodic_put};
static PyObject *__pyx_pw_9miniga4py_2ga_209periodic_put(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_buffer = 0;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("periodic_put (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_buffer,&__pyx_n_s_lo,&__pyx_n_s_hi,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("periodic_put", 0, 2, 4, 1); __PYX_ERR(0, 2932, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "periodic_put") < 0)) __PYX_ERR(0, 2932, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2932, __pyx_L3_error)
    __pyx_v_buffer = values[1];
    __pyx_v_lo = values[2];
    __pyx_v_hi = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("periodic_put", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2932, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.periodic_put", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_208periodic_put(__pyx_self, __pyx_v_g_a, __pyx_v_buffer, __pyx_v_lo, __pyx_v_hi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_208periodic_put(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_buffer, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_9miniga4py_2ga__put_common __pyx_t_2;
  __Pyx_RefNannySetupContext("periodic_put", 0);

  /* "miniga4py/ga.pyx":2957
 * 
 *     """
 *     _put_common(g_a, buffer, lo, hi, False, True)             # <<<<<<<<<<<<<<
 * 
 * def pgroup_absolute_id(int pgroup, int pid):
 */
  __pyx_t_2.__pyx_n = 4;
  __pyx_t_2.lo = __pyx_v_lo;
  __pyx_t_2.hi = __pyx_v_hi;
  __pyx_t_2.nb = 0;
  __pyx_t_2.periodic = 1;
  __pyx_t_1 = __pyx_f_9miniga4py_2ga__put_common(__pyx_v_g_a, __pyx_v_buffer, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":2932
 *     return _get_common(g_a, lo, hi, buffer, False, True)
 * 
 * def periodic_put(int g_a, buffer, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Periodic version of ga.put.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.periodic_put", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2959
 *     _put_common(g_a, buffer, lo, hi, False, True)
 * 
 * def pgroup_absolute_id(int pgroup, int pid):             # <<<<<<<<<<<<<<
 *     """TODO"""
 *     return GA_Pgroup_absolute_id(pgroup, pid)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_211pgroup_absolute_id(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_210pgroup_absolute_id[] = "pgroup_absolute_id(int pgroup, int pid)\nTODO";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_211pgroup_absolute_id = {"pgroup_absolute_id", (PyCFunction)__pyx_pw_9miniga4py_2ga_211pgroup_absolute_id, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_210pgroup_absolute_id};
static PyObject *__pyx_pw_9miniga4py_2ga_211pgroup_absolute_id(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_pgroup;
  int __pyx_v_pid;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pgroup_absolute_id (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pgroup,&__pyx_n_s_pid,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pgroup)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pid)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pgroup_absolute_id", 1, 2, 2, 1); __PYX_ERR(0, 2959, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pgroup_absolute_id") < 0)) __PYX_ERR(0, 2959, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pgroup = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2959, __pyx_L3_error)
    __pyx_v_pid = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_pid == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2959, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pgroup_absolute_id", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2959, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.pgroup_absolute_id", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_210pgroup_absolute_id(__pyx_self, __pyx_v_pgroup, __pyx_v_pid);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_210pgroup_absolute_id(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, int __pyx_v_pid) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("pgroup_absolute_id", 0);

  /* "miniga4py/ga.pyx":2961
 * def pgroup_absolute_id(int pgroup, int pid):
 *     """TODO"""
 *     return GA_Pgroup_absolute_id(pgroup, pid)             # <<<<<<<<<<<<<<
 * 
 * def pgroup_brdcst(int pgroup, buffer, int root=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Pgroup_absolute_id(__pyx_v_pgroup, __pyx_v_pid)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2961, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2959
 *     _put_common(g_a, buffer, lo, hi, False, True)
 * 
 * def pgroup_absolute_id(int pgroup, int pid):             # <<<<<<<<<<<<<<
 *     """TODO"""
 *     return GA_Pgroup_absolute_id(pgroup, pid)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.pgroup_absolute_id", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2963
 *     return GA_Pgroup_absolute_id(pgroup, pid)
 * 
 * def pgroup_brdcst(int pgroup, buffer, int root=0):             # <<<<<<<<<<<<<<
 *     """Broadcast from process root to all other processes in the same group.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_213pgroup_brdcst(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_212pgroup_brdcst[] = "pgroup_brdcst(int pgroup, buffer, int root=0)\nBroadcast from process root to all other processes in the same group.\n\n    If the buffer is not contiguous, an error is raised.  This operation is\n    provided only for convenience purposes: it is available regardless of the\n    message-passing library that GA is running with.\n\n    This is a collective operation. \n\n    :Parameters:\n        pgroup : int\n            processor group handle\n        buffer : array-like\n            the message\n        root : int\n            the process which is sending\n\n    :returns: The buffer in case a temporary was passed in.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_213pgroup_brdcst = {"pgroup_brdcst", (PyCFunction)__pyx_pw_9miniga4py_2ga_213pgroup_brdcst, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_212pgroup_brdcst};
static PyObject *__pyx_pw_9miniga4py_2ga_213pgroup_brdcst(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_pgroup;
  PyObject *__pyx_v_buffer = 0;
  int __pyx_v_root;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pgroup_brdcst (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pgroup,&__pyx_n_s_buffer,&__pyx_n_s_root,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pgroup)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pgroup_brdcst", 0, 2, 3, 1); __PYX_ERR(0, 2963, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_root);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pgroup_brdcst") < 0)) __PYX_ERR(0, 2963, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pgroup = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2963, __pyx_L3_error)
    __pyx_v_buffer = values[1];
    if (values[2]) {
      __pyx_v_root = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_root == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2963, __pyx_L3_error)
    } else {
      __pyx_v_root = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pgroup_brdcst", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2963, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.pgroup_brdcst", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_212pgroup_brdcst(__pyx_self, __pyx_v_pgroup, __pyx_v_buffer, __pyx_v_root);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_212pgroup_brdcst(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, PyObject *__pyx_v_buffer, int __pyx_v_root) {
  PyArrayObject *__pyx_v_buffer_nd = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("pgroup_brdcst", 0);

  /* "miniga4py/ga.pyx":2984
 *     """
 *     cdef np.ndarray buffer_nd
 *     buffer_nd = np.asarray(buffer)             # <<<<<<<<<<<<<<
 *     if not buffer_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("the buffer must be contiguous")
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_buffer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_buffer};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2984, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_buffer};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2984, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2984, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_v_buffer);
      __Pyx_GIVEREF(__pyx_v_buffer);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_buffer);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2984, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2984, __pyx_L1_error)
  __pyx_v_buffer_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":2985
 *     cdef np.ndarray buffer_nd
 *     buffer_nd = np.asarray(buffer)
 *     if not buffer_nd.flags['C_CONTIGUOUS']:             # <<<<<<<<<<<<<<
 *         raise ValueError("the buffer must be contiguous")
 *     #if buffer_nd.ndim != 1:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buffer_nd), __pyx_n_s_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_C_CONTIGUOUS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2985, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = ((!__pyx_t_5) != 0);
  if (unlikely(__pyx_t_6)) {

    /* "miniga4py/ga.pyx":2986
 *     buffer_nd = np.asarray(buffer)
 *     if not buffer_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("the buffer must be contiguous")             # <<<<<<<<<<<<<<
 *     #if buffer_nd.ndim != 1:
 *     #    raise ValueError("the buffer must be one-dimensional")
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 2986, __pyx_L1_error)

    /* "miniga4py/ga.pyx":2985
 *     cdef np.ndarray buffer_nd
 *     buffer_nd = np.asarray(buffer)
 *     if not buffer_nd.flags['C_CONTIGUOUS']:             # <<<<<<<<<<<<<<
 *         raise ValueError("the buffer must be contiguous")
 *     #if buffer_nd.ndim != 1:
 */
  }

  /* "miniga4py/ga.pyx":2990
 *     #    raise ValueError("the buffer must be one-dimensional")
 *     GA_Pgroup_brdcst(pgroup, buffer_nd.data,
 *             buffer_nd.size*buffer_nd.itemsize, root)             # <<<<<<<<<<<<<<
 *     return buffer_nd
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buffer_nd), __pyx_n_s_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buffer_nd), __pyx_n_s_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2990, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "miniga4py/ga.pyx":2989
 *     #if buffer_nd.ndim != 1:
 *     #    raise ValueError("the buffer must be one-dimensional")
 *     GA_Pgroup_brdcst(pgroup, buffer_nd.data,             # <<<<<<<<<<<<<<
 *             buffer_nd.size*buffer_nd.itemsize, root)
 *     return buffer_nd
 */
  GA_Pgroup_brdcst(__pyx_v_pgroup, __pyx_v_buffer_nd->data, __pyx_t_7, __pyx_v_root);

  /* "miniga4py/ga.pyx":2991
 *     GA_Pgroup_brdcst(pgroup, buffer_nd.data,
 *             buffer_nd.size*buffer_nd.itemsize, root)
 *     return buffer_nd             # <<<<<<<<<<<<<<
 * 
 * def pgroup_create(list):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_buffer_nd));
  __pyx_r = ((PyObject *)__pyx_v_buffer_nd);
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2963
 *     return GA_Pgroup_absolute_id(pgroup, pid)
 * 
 * def pgroup_brdcst(int pgroup, buffer, int root=0):             # <<<<<<<<<<<<<<
 *     """Broadcast from process root to all other processes in the same group.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("miniga4py.ga.pgroup_brdcst", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buffer_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":2993
 *     return buffer_nd
 * 
 * def pgroup_create(list):             # <<<<<<<<<<<<<<
 *     """Creates a processor group.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_215pgroup_create(PyObject *__pyx_self, PyObject *__pyx_v_list); /*proto*/
static char __pyx_doc_9miniga4py_2ga_214pgroup_create[] = "pgroup_create(list)\nCreates a processor group.\n    \n    At present, it must be invoked by all processors in the current default\n    processor group. The list of processors use the indexing scheme of the\n    default processor group.  If the default processor group is the world\n    group, then these indices are the usual processor indices. This function\n    returns a process group handle that can be used to reference this group by\n    other functions.\n\n    This is a collective operation on the default processor group. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_215pgroup_create = {"pgroup_create", (PyCFunction)__pyx_pw_9miniga4py_2ga_215pgroup_create, METH_O, __pyx_doc_9miniga4py_2ga_214pgroup_create};
static PyObject *__pyx_pw_9miniga4py_2ga_215pgroup_create(PyObject *__pyx_self, PyObject *__pyx_v_list) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pgroup_create (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_214pgroup_create(__pyx_self, ((PyObject *)__pyx_v_list));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_214pgroup_create(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_list) {
  PyArrayObject *__pyx_v_list_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_list_nd;
  __Pyx_Buffer __pyx_pybuffer_list_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  __Pyx_RefNannySetupContext("pgroup_create", 0);
  __pyx_pybuffer_list_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_list_nd.refcount = 0;
  __pyx_pybuffernd_list_nd.data = NULL;
  __pyx_pybuffernd_list_nd.rcbuffer = &__pyx_pybuffer_list_nd;

  /* "miniga4py/ga.pyx":3007
 *     """
 *     cdef np.ndarray[np.int32_t, ndim=1] list_nd
 *     list_nd = _inta32(list)             # <<<<<<<<<<<<<<
 *     return GA_Pgroup_create(<int*>list_nd.data, len(list_nd))
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta32(__pyx_v_list)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3007, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_list_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_list_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_list_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_list_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      }
      __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
    }
    __pyx_pybuffernd_list_nd.diminfo[0].strides = __pyx_pybuffernd_list_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_list_nd.diminfo[0].shape = __pyx_pybuffernd_list_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3007, __pyx_L1_error)
  }
  __pyx_v_list_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":3008
 *     cdef np.ndarray[np.int32_t, ndim=1] list_nd
 *     list_nd = _inta32(list)
 *     return GA_Pgroup_create(<int*>list_nd.data, len(list_nd))             # <<<<<<<<<<<<<<
 * 
 * def pgroup_destroy(int pgroup):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = PyObject_Length(((PyObject *)__pyx_v_list_nd)); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3008, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Pgroup_create(((int *)__pyx_v_list_nd->data), __pyx_t_6)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3008, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":2993
 *     return buffer_nd
 * 
 * def pgroup_create(list):             # <<<<<<<<<<<<<<
 *     """Creates a processor group.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_list_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.pgroup_create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_list_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_list_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3010
 *     return GA_Pgroup_create(<int*>list_nd.data, len(list_nd))
 * 
 * def pgroup_destroy(int pgroup):             # <<<<<<<<<<<<<<
 *     """Frees up a processor group handle.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_217pgroup_destroy(PyObject *__pyx_self, PyObject *__pyx_arg_pgroup); /*proto*/
static char __pyx_doc_9miniga4py_2ga_216pgroup_destroy[] = "pgroup_destroy(int pgroup)\nFrees up a processor group handle.\n    \n    This is a collective operation on the default processor group.\n\n    :returns: True if the handle was previously active.  False if the handle was not previously active.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_217pgroup_destroy = {"pgroup_destroy", (PyCFunction)__pyx_pw_9miniga4py_2ga_217pgroup_destroy, METH_O, __pyx_doc_9miniga4py_2ga_216pgroup_destroy};
static PyObject *__pyx_pw_9miniga4py_2ga_217pgroup_destroy(PyObject *__pyx_self, PyObject *__pyx_arg_pgroup) {
  int __pyx_v_pgroup;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pgroup_destroy (wrapper)", 0);
  assert(__pyx_arg_pgroup); {
    __pyx_v_pgroup = __Pyx_PyInt_As_int(__pyx_arg_pgroup); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3010, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.pgroup_destroy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_216pgroup_destroy(__pyx_self, ((int)__pyx_v_pgroup));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_216pgroup_destroy(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("pgroup_destroy", 0);

  /* "miniga4py/ga.pyx":3018
 * 
 *     """
 *     if 0 == GA_Pgroup_destroy(pgroup):             # <<<<<<<<<<<<<<
 *         return False
 *     return True
 */
  __pyx_t_1 = ((0 == GA_Pgroup_destroy(__pyx_v_pgroup)) != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":3019
 *     """
 *     if 0 == GA_Pgroup_destroy(pgroup):
 *         return False             # <<<<<<<<<<<<<<
 *     return True
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":3018
 * 
 *     """
 *     if 0 == GA_Pgroup_destroy(pgroup):             # <<<<<<<<<<<<<<
 *         return False
 *     return True
 */
  }

  /* "miniga4py/ga.pyx":3020
 *     if 0 == GA_Pgroup_destroy(pgroup):
 *         return False
 *     return True             # <<<<<<<<<<<<<<
 * 
 * def pgroup_get_default():
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3010
 *     return GA_Pgroup_create(<int*>list_nd.data, len(list_nd))
 * 
 * def pgroup_destroy(int pgroup):             # <<<<<<<<<<<<<<
 *     """Frees up a processor group handle.
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3022
 *     return True
 * 
 * def pgroup_get_default():             # <<<<<<<<<<<<<<
 *     """Returns a handle to the default processor group.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_219pgroup_get_default(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_218pgroup_get_default[] = "pgroup_get_default()\nReturns a handle to the default processor group.\n\n    The return value can then be used to create a global array using one of\n    the ga.create or ga.set_pgroup calls.\n\n    This is a local operation.  \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_219pgroup_get_default = {"pgroup_get_default", (PyCFunction)__pyx_pw_9miniga4py_2ga_219pgroup_get_default, METH_NOARGS, __pyx_doc_9miniga4py_2ga_218pgroup_get_default};
static PyObject *__pyx_pw_9miniga4py_2ga_219pgroup_get_default(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pgroup_get_default (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_218pgroup_get_default(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_218pgroup_get_default(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("pgroup_get_default", 0);

  /* "miniga4py/ga.pyx":3031
 * 
 *     """
 *     return GA_Pgroup_get_default()             # <<<<<<<<<<<<<<
 * 
 * def pgroup_get_mirror():
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Pgroup_get_default()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3022
 *     return True
 * 
 * def pgroup_get_default():             # <<<<<<<<<<<<<<
 *     """Returns a handle to the default processor group.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.pgroup_get_default", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3033
 *     return GA_Pgroup_get_default()
 * 
 * def pgroup_get_mirror():             # <<<<<<<<<<<<<<
 *     """Returns a handle to the mirrored processor group.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_221pgroup_get_mirror(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_220pgroup_get_mirror[] = "pgroup_get_mirror()\nReturns a handle to the mirrored processor group.\n\n    The return value can then be used to create a global array using one of\n    the ga.create or ga.set_pgroup calls.\n\n    This is a local operation.  \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_221pgroup_get_mirror = {"pgroup_get_mirror", (PyCFunction)__pyx_pw_9miniga4py_2ga_221pgroup_get_mirror, METH_NOARGS, __pyx_doc_9miniga4py_2ga_220pgroup_get_mirror};
static PyObject *__pyx_pw_9miniga4py_2ga_221pgroup_get_mirror(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pgroup_get_mirror (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_220pgroup_get_mirror(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_220pgroup_get_mirror(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("pgroup_get_mirror", 0);

  /* "miniga4py/ga.pyx":3042
 * 
 *     """
 *     return GA_Pgroup_get_mirror()             # <<<<<<<<<<<<<<
 * 
 * def pgroup_get_world():
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Pgroup_get_mirror()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3033
 *     return GA_Pgroup_get_default()
 * 
 * def pgroup_get_mirror():             # <<<<<<<<<<<<<<
 *     """Returns a handle to the mirrored processor group.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.pgroup_get_mirror", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3044
 *     return GA_Pgroup_get_mirror()
 * 
 * def pgroup_get_world():             # <<<<<<<<<<<<<<
 *     """Returns a handle to the world processor group.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_223pgroup_get_world(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_222pgroup_get_world[] = "pgroup_get_world()\nReturns a handle to the world processor group.\n    \n    The return value can then be used to create a global array using one of\n    the ga.create or ga.set_pgroup calls.\n\n    This is a local operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_223pgroup_get_world = {"pgroup_get_world", (PyCFunction)__pyx_pw_9miniga4py_2ga_223pgroup_get_world, METH_NOARGS, __pyx_doc_9miniga4py_2ga_222pgroup_get_world};
static PyObject *__pyx_pw_9miniga4py_2ga_223pgroup_get_world(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pgroup_get_world (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_222pgroup_get_world(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_222pgroup_get_world(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("pgroup_get_world", 0);

  /* "miniga4py/ga.pyx":3053
 * 
 *     """
 *     return GA_Pgroup_get_world()             # <<<<<<<<<<<<<<
 * 
 * def pgroup_gop(int pgroup, X, op):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Pgroup_get_world()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3053, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3044
 *     return GA_Pgroup_get_mirror()
 * 
 * def pgroup_get_world():             # <<<<<<<<<<<<<<
 *     """Returns a handle to the world processor group.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.pgroup_get_world", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3055
 *     return GA_Pgroup_get_world()
 * 
 * def pgroup_gop(int pgroup, X, op):             # <<<<<<<<<<<<<<
 *     """Global operation.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_225pgroup_gop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_224pgroup_gop[] = "pgroup_gop(int pgroup, X, op)\nGlobal operation.\n\n    X(1:N) is a vector present on each process in the group. gop 'sums'\n    elements of X accross all nodes using the commutative operator op. The\n    result is broadcast to all nodes. Supported operations include '+', '*',\n    'max', 'min', 'absmax', 'absmin'. The use of lowerecase for operators is\n    necessary.\n\n    X must be a contiguous array-like.  X is not guaranteed to be modified\n    in-place so use as:\n\n    >>> value = ga.gop((1,2,3), \"+\")\n\n    This operation is provided only for convenience purposes: it is available\n    regardless of the message-passing library that GA is running with.\n\n    This is a collective operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_225pgroup_gop = {"pgroup_gop", (PyCFunction)__pyx_pw_9miniga4py_2ga_225pgroup_gop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_224pgroup_gop};
static PyObject *__pyx_pw_9miniga4py_2ga_225pgroup_gop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_pgroup;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_op = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pgroup_gop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pgroup,&__pyx_n_s_X,&__pyx_n_s_op,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pgroup)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pgroup_gop", 1, 3, 3, 1); __PYX_ERR(0, 3055, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_op)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pgroup_gop", 1, 3, 3, 2); __PYX_ERR(0, 3055, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pgroup_gop") < 0)) __PYX_ERR(0, 3055, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_pgroup = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3055, __pyx_L3_error)
    __pyx_v_X = values[1];
    __pyx_v_op = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pgroup_gop", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3055, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.pgroup_gop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_224pgroup_gop(__pyx_self, __pyx_v_pgroup, __pyx_v_X, __pyx_v_op);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_224pgroup_gop(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, PyObject *__pyx_v_X, PyObject *__pyx_v_op) {
  PyArrayObject *__pyx_v_X_nd = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  char *__pyx_t_8;
  __Pyx_RefNannySetupContext("pgroup_gop", 0);

  /* "miniga4py/ga.pyx":3075
 * 
 *     """
 *     cdef np.ndarray X_nd = np.asarray(X)             # <<<<<<<<<<<<<<
 *     if not X_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("X must be contiguous")
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_X); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3075, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_X};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3075, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_X};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3075, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3075, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_v_X);
      __Pyx_GIVEREF(__pyx_v_X);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_X);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3075, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3075, __pyx_L1_error)
  __pyx_v_X_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":3076
 *     """
 *     cdef np.ndarray X_nd = np.asarray(X)
 *     if not X_nd.flags['C_CONTIGUOUS']:             # <<<<<<<<<<<<<<
 *         raise ValueError("X must be contiguous")
 *     if X_nd.dtype == np.intc:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X_nd), __pyx_n_s_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_C_CONTIGUOUS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 3076, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = ((!__pyx_t_5) != 0);
  if (unlikely(__pyx_t_6)) {

    /* "miniga4py/ga.pyx":3077
 *     cdef np.ndarray X_nd = np.asarray(X)
 *     if not X_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("X must be contiguous")             # <<<<<<<<<<<<<<
 *     if X_nd.dtype == np.intc:
 *         GA_Pgroup_igop(pgroup, <int*>X_nd.data, len(X_nd), b(op))
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3077, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 3077, __pyx_L1_error)

    /* "miniga4py/ga.pyx":3076
 *     """
 *     cdef np.ndarray X_nd = np.asarray(X)
 *     if not X_nd.flags['C_CONTIGUOUS']:             # <<<<<<<<<<<<<<
 *         raise ValueError("X must be contiguous")
 *     if X_nd.dtype == np.intc:
 */
  }

  /* "miniga4py/ga.pyx":3078
 *     if not X_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("X must be contiguous")
 *     if X_nd.dtype == np.intc:             # <<<<<<<<<<<<<<
 *         GA_Pgroup_igop(pgroup, <int*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.long:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X_nd), __pyx_n_s_dtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_intc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3078, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 3078, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":3079
 *         raise ValueError("X must be contiguous")
 *     if X_nd.dtype == np.intc:
 *         GA_Pgroup_igop(pgroup, <int*>X_nd.data, len(X_nd), b(op))             # <<<<<<<<<<<<<<
 *     elif X_nd.dtype == np.long:
 *         GA_Pgroup_lgop(pgroup, <long*>X_nd.data, len(X_nd), b(op))
 */
    __pyx_t_7 = PyObject_Length(((PyObject *)__pyx_v_X_nd)); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3079, __pyx_L1_error)
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3079, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_op); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3079, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_op};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3079, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_op};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3079, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3079, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_v_op);
        __Pyx_GIVEREF(__pyx_v_op);
        PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_op);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3079, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = __Pyx_PyObject_AsWritableString(__pyx_t_1); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 3079, __pyx_L1_error)
    GA_Pgroup_igop(__pyx_v_pgroup, ((int *)__pyx_v_X_nd->data), __pyx_t_7, __pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "miniga4py/ga.pyx":3078
 *     if not X_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("X must be contiguous")
 *     if X_nd.dtype == np.intc:             # <<<<<<<<<<<<<<
 *         GA_Pgroup_igop(pgroup, <int*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.long:
 */
    goto __pyx_L4;
  }

  /* "miniga4py/ga.pyx":3080
 *     if X_nd.dtype == np.intc:
 *         GA_Pgroup_igop(pgroup, <int*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.long:             # <<<<<<<<<<<<<<
 *         GA_Pgroup_lgop(pgroup, <long*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.longlong:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X_nd), __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_long); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3080, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 3080, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":3081
 *         GA_Pgroup_igop(pgroup, <int*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.long:
 *         GA_Pgroup_lgop(pgroup, <long*>X_nd.data, len(X_nd), b(op))             # <<<<<<<<<<<<<<
 *     elif X_nd.dtype == np.longlong:
 *         GA_Pgroup_llgop(pgroup, <long long*>X_nd.data, len(X_nd), b(op))
 */
    __pyx_t_7 = PyObject_Length(((PyObject *)__pyx_v_X_nd)); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3081, __pyx_L1_error)
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3081, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_1) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_op); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3081, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_op};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3081, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_op};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3081, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3081, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
        __Pyx_INCREF(__pyx_v_op);
        __Pyx_GIVEREF(__pyx_v_op);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_op);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3081, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __Pyx_PyObject_AsWritableString(__pyx_t_4); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 3081, __pyx_L1_error)
    GA_Pgroup_lgop(__pyx_v_pgroup, ((long *)__pyx_v_X_nd->data), __pyx_t_7, __pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "miniga4py/ga.pyx":3080
 *     if X_nd.dtype == np.intc:
 *         GA_Pgroup_igop(pgroup, <int*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.long:             # <<<<<<<<<<<<<<
 *         GA_Pgroup_lgop(pgroup, <long*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.longlong:
 */
    goto __pyx_L4;
  }

  /* "miniga4py/ga.pyx":3082
 *     elif X_nd.dtype == np.long:
 *         GA_Pgroup_lgop(pgroup, <long*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.longlong:             # <<<<<<<<<<<<<<
 *         GA_Pgroup_llgop(pgroup, <long long*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.single:
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X_nd), __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_longlong); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3082, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 3082, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":3083
 *         GA_Pgroup_lgop(pgroup, <long*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.longlong:
 *         GA_Pgroup_llgop(pgroup, <long long*>X_nd.data, len(X_nd), b(op))             # <<<<<<<<<<<<<<
 *     elif X_nd.dtype == np.single:
 *         GA_Pgroup_fgop(pgroup, <float*>X_nd.data, len(X_nd), b(op))
 */
    __pyx_t_7 = PyObject_Length(((PyObject *)__pyx_v_X_nd)); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3083, __pyx_L1_error)
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3083, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_op); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3083, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_op};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3083, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_op};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3083, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3083, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(__pyx_v_op);
        __Pyx_GIVEREF(__pyx_v_op);
        PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_op);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3083, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_8 = __Pyx_PyObject_AsWritableString(__pyx_t_2); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 3083, __pyx_L1_error)
    GA_Pgroup_llgop(__pyx_v_pgroup, ((PY_LONG_LONG *)__pyx_v_X_nd->data), __pyx_t_7, __pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "miniga4py/ga.pyx":3082
 *     elif X_nd.dtype == np.long:
 *         GA_Pgroup_lgop(pgroup, <long*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.longlong:             # <<<<<<<<<<<<<<
 *         GA_Pgroup_llgop(pgroup, <long long*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.single:
 */
    goto __pyx_L4;
  }

  /* "miniga4py/ga.pyx":3084
 *     elif X_nd.dtype == np.longlong:
 *         GA_Pgroup_llgop(pgroup, <long long*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.single:             # <<<<<<<<<<<<<<
 *         GA_Pgroup_fgop(pgroup, <float*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.double:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X_nd), __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_single); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3084, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 3084, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":3085
 *         GA_Pgroup_llgop(pgroup, <long long*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.single:
 *         GA_Pgroup_fgop(pgroup, <float*>X_nd.data, len(X_nd), b(op))             # <<<<<<<<<<<<<<
 *     elif X_nd.dtype == np.double:
 *         GA_Pgroup_dgop(pgroup, <double*>X_nd.data, len(X_nd), b(op))
 */
    __pyx_t_7 = PyObject_Length(((PyObject *)__pyx_v_X_nd)); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3085, __pyx_L1_error)
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3085, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_2) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_op); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3085, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_op};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3085, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_op};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3085, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3085, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
        __Pyx_INCREF(__pyx_v_op);
        __Pyx_GIVEREF(__pyx_v_op);
        PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_op);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3085, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = __Pyx_PyObject_AsWritableString(__pyx_t_3); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 3085, __pyx_L1_error)
    GA_Pgroup_fgop(__pyx_v_pgroup, ((float *)__pyx_v_X_nd->data), __pyx_t_7, __pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "miniga4py/ga.pyx":3084
 *     elif X_nd.dtype == np.longlong:
 *         GA_Pgroup_llgop(pgroup, <long long*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.single:             # <<<<<<<<<<<<<<
 *         GA_Pgroup_fgop(pgroup, <float*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.double:
 */
    goto __pyx_L4;
  }

  /* "miniga4py/ga.pyx":3086
 *     elif X_nd.dtype == np.single:
 *         GA_Pgroup_fgop(pgroup, <float*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.double:             # <<<<<<<<<<<<<<
 *         GA_Pgroup_dgop(pgroup, <double*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.complex64:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X_nd), __pyx_n_s_dtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_double); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3086, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 3086, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":3087
 *         GA_Pgroup_fgop(pgroup, <float*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.double:
 *         GA_Pgroup_dgop(pgroup, <double*>X_nd.data, len(X_nd), b(op))             # <<<<<<<<<<<<<<
 *     elif X_nd.dtype == np.complex64:
 *         GA_Pgroup_cgop(pgroup, <SingleComplex*>X_nd.data, len(X_nd), b(op))
 */
    __pyx_t_7 = PyObject_Length(((PyObject *)__pyx_v_X_nd)); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3087, __pyx_L1_error)
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3087, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_op); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3087, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_op};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3087, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_op};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3087, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3087, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_v_op);
        __Pyx_GIVEREF(__pyx_v_op);
        PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_op);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3087, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = __Pyx_PyObject_AsWritableString(__pyx_t_1); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 3087, __pyx_L1_error)
    GA_Pgroup_dgop(__pyx_v_pgroup, ((double *)__pyx_v_X_nd->data), __pyx_t_7, __pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "miniga4py/ga.pyx":3086
 *     elif X_nd.dtype == np.single:
 *         GA_Pgroup_fgop(pgroup, <float*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.double:             # <<<<<<<<<<<<<<
 *         GA_Pgroup_dgop(pgroup, <double*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.complex64:
 */
    goto __pyx_L4;
  }

  /* "miniga4py/ga.pyx":3088
 *     elif X_nd.dtype == np.double:
 *         GA_Pgroup_dgop(pgroup, <double*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.complex64:             # <<<<<<<<<<<<<<
 *         GA_Pgroup_cgop(pgroup, <SingleComplex*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.complex128:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X_nd), __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_complex64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3088, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 3088, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":3089
 *         GA_Pgroup_dgop(pgroup, <double*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.complex64:
 *         GA_Pgroup_cgop(pgroup, <SingleComplex*>X_nd.data, len(X_nd), b(op))             # <<<<<<<<<<<<<<
 *     elif X_nd.dtype == np.complex128:
 *         GA_Pgroup_zgop(pgroup, <DoubleComplex*>X_nd.data, len(X_nd), b(op))
 */
    __pyx_t_7 = PyObject_Length(((PyObject *)__pyx_v_X_nd)); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3089, __pyx_L1_error)
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3089, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_1) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_op); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3089, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_op};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3089, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_op};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3089, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3089, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
        __Pyx_INCREF(__pyx_v_op);
        __Pyx_GIVEREF(__pyx_v_op);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_op);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3089, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __Pyx_PyObject_AsWritableString(__pyx_t_4); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 3089, __pyx_L1_error)
    GA_Pgroup_cgop(__pyx_v_pgroup, ((SingleComplex *)__pyx_v_X_nd->data), __pyx_t_7, __pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "miniga4py/ga.pyx":3088
 *     elif X_nd.dtype == np.double:
 *         GA_Pgroup_dgop(pgroup, <double*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.complex64:             # <<<<<<<<<<<<<<
 *         GA_Pgroup_cgop(pgroup, <SingleComplex*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.complex128:
 */
    goto __pyx_L4;
  }

  /* "miniga4py/ga.pyx":3090
 *     elif X_nd.dtype == np.complex64:
 *         GA_Pgroup_cgop(pgroup, <SingleComplex*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.complex128:             # <<<<<<<<<<<<<<
 *         GA_Pgroup_zgop(pgroup, <DoubleComplex*>X_nd.data, len(X_nd), b(op))
 *     else:
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X_nd), __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_complex128); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3090, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 3090, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(__pyx_t_6)) {

    /* "miniga4py/ga.pyx":3091
 *         GA_Pgroup_cgop(pgroup, <SingleComplex*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.complex128:
 *         GA_Pgroup_zgop(pgroup, <DoubleComplex*>X_nd.data, len(X_nd), b(op))             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError("type not supported by ga.pgroup_gop %s" % X_nd.dtype)
 */
    __pyx_t_7 = PyObject_Length(((PyObject *)__pyx_v_X_nd)); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3091, __pyx_L1_error)
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3091, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_op); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3091, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_op};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3091, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_op};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3091, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3091, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(__pyx_v_op);
        __Pyx_GIVEREF(__pyx_v_op);
        PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_op);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3091, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_8 = __Pyx_PyObject_AsWritableString(__pyx_t_2); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 3091, __pyx_L1_error)
    GA_Pgroup_zgop(__pyx_v_pgroup, ((DoubleComplex *)__pyx_v_X_nd->data), __pyx_t_7, __pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "miniga4py/ga.pyx":3090
 *     elif X_nd.dtype == np.complex64:
 *         GA_Pgroup_cgop(pgroup, <SingleComplex*>X_nd.data, len(X_nd), b(op))
 *     elif X_nd.dtype == np.complex128:             # <<<<<<<<<<<<<<
 *         GA_Pgroup_zgop(pgroup, <DoubleComplex*>X_nd.data, len(X_nd), b(op))
 *     else:
 */
    goto __pyx_L4;
  }

  /* "miniga4py/ga.pyx":3093
 *         GA_Pgroup_zgop(pgroup, <DoubleComplex*>X_nd.data, len(X_nd), b(op))
 *     else:
 *         raise TypeError("type not supported by ga.pgroup_gop %s" % X_nd.dtype)             # <<<<<<<<<<<<<<
 *     return X_nd
 * 
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X_nd), __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3093, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_type_not_supported_by_ga_pgroup, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3093, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3093, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 3093, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "miniga4py/ga.pyx":3094
 *     else:
 *         raise TypeError("type not supported by ga.pgroup_gop %s" % X_nd.dtype)
 *     return X_nd             # <<<<<<<<<<<<<<
 * 
 * def pgroup_gop_add(int pgroup, X):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_X_nd));
  __pyx_r = ((PyObject *)__pyx_v_X_nd);
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3055
 *     return GA_Pgroup_get_world()
 * 
 * def pgroup_gop(int pgroup, X, op):             # <<<<<<<<<<<<<<
 *     """Global operation.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("miniga4py.ga.pgroup_gop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_X_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3096
 *     return X_nd
 * 
 * def pgroup_gop_add(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "+")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_227pgroup_gop_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_226pgroup_gop_add[] = "pgroup_gop_add(int pgroup, X)";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_227pgroup_gop_add = {"pgroup_gop_add", (PyCFunction)__pyx_pw_9miniga4py_2ga_227pgroup_gop_add, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_226pgroup_gop_add};
static PyObject *__pyx_pw_9miniga4py_2ga_227pgroup_gop_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_pgroup;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pgroup_gop_add (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pgroup,&__pyx_n_s_X,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pgroup)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pgroup_gop_add", 1, 2, 2, 1); __PYX_ERR(0, 3096, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pgroup_gop_add") < 0)) __PYX_ERR(0, 3096, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pgroup = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3096, __pyx_L3_error)
    __pyx_v_X = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pgroup_gop_add", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3096, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.pgroup_gop_add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_226pgroup_gop_add(__pyx_self, __pyx_v_pgroup, __pyx_v_X);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_226pgroup_gop_add(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, PyObject *__pyx_v_X) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("pgroup_gop_add", 0);

  /* "miniga4py/ga.pyx":3097
 * 
 * def pgroup_gop_add(int pgroup, X):
 *     return pgroup_gop(pgroup, X, "+")             # <<<<<<<<<<<<<<
 * 
 * def pgroup_gop_multiply(int pgroup, X):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pgroup_gop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_pgroup); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_3, __pyx_v_X, __pyx_kp_s__22};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3097, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_3, __pyx_v_X, __pyx_kp_s__22};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3097, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3097, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_X);
    __Pyx_GIVEREF(__pyx_v_X);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_X);
    __Pyx_INCREF(__pyx_kp_s__22);
    __Pyx_GIVEREF(__pyx_kp_s__22);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_kp_s__22);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3097, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3096
 *     return X_nd
 * 
 * def pgroup_gop_add(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "+")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("miniga4py.ga.pgroup_gop_add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3099
 *     return pgroup_gop(pgroup, X, "+")
 * 
 * def pgroup_gop_multiply(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "*")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_229pgroup_gop_multiply(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_228pgroup_gop_multiply[] = "pgroup_gop_multiply(int pgroup, X)";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_229pgroup_gop_multiply = {"pgroup_gop_multiply", (PyCFunction)__pyx_pw_9miniga4py_2ga_229pgroup_gop_multiply, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_228pgroup_gop_multiply};
static PyObject *__pyx_pw_9miniga4py_2ga_229pgroup_gop_multiply(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_pgroup;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pgroup_gop_multiply (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pgroup,&__pyx_n_s_X,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pgroup)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pgroup_gop_multiply", 1, 2, 2, 1); __PYX_ERR(0, 3099, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pgroup_gop_multiply") < 0)) __PYX_ERR(0, 3099, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pgroup = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3099, __pyx_L3_error)
    __pyx_v_X = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pgroup_gop_multiply", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3099, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.pgroup_gop_multiply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_228pgroup_gop_multiply(__pyx_self, __pyx_v_pgroup, __pyx_v_X);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_228pgroup_gop_multiply(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, PyObject *__pyx_v_X) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("pgroup_gop_multiply", 0);

  /* "miniga4py/ga.pyx":3100
 * 
 * def pgroup_gop_multiply(int pgroup, X):
 *     return pgroup_gop(pgroup, X, "*")             # <<<<<<<<<<<<<<
 * 
 * def pgroup_gop_max(int pgroup, X):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pgroup_gop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_pgroup); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_3, __pyx_v_X, __pyx_kp_s__23};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3100, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_3, __pyx_v_X, __pyx_kp_s__23};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3100, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_X);
    __Pyx_GIVEREF(__pyx_v_X);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_X);
    __Pyx_INCREF(__pyx_kp_s__23);
    __Pyx_GIVEREF(__pyx_kp_s__23);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_kp_s__23);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3099
 *     return pgroup_gop(pgroup, X, "+")
 * 
 * def pgroup_gop_multiply(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "*")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("miniga4py.ga.pgroup_gop_multiply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3102
 *     return pgroup_gop(pgroup, X, "*")
 * 
 * def pgroup_gop_max(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "max")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_231pgroup_gop_max(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_230pgroup_gop_max[] = "pgroup_gop_max(int pgroup, X)";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_231pgroup_gop_max = {"pgroup_gop_max", (PyCFunction)__pyx_pw_9miniga4py_2ga_231pgroup_gop_max, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_230pgroup_gop_max};
static PyObject *__pyx_pw_9miniga4py_2ga_231pgroup_gop_max(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_pgroup;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pgroup_gop_max (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pgroup,&__pyx_n_s_X,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pgroup)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pgroup_gop_max", 1, 2, 2, 1); __PYX_ERR(0, 3102, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pgroup_gop_max") < 0)) __PYX_ERR(0, 3102, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pgroup = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3102, __pyx_L3_error)
    __pyx_v_X = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pgroup_gop_max", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3102, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.pgroup_gop_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_230pgroup_gop_max(__pyx_self, __pyx_v_pgroup, __pyx_v_X);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_230pgroup_gop_max(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, PyObject *__pyx_v_X) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("pgroup_gop_max", 0);

  /* "miniga4py/ga.pyx":3103
 * 
 * def pgroup_gop_max(int pgroup, X):
 *     return pgroup_gop(pgroup, X, "max")             # <<<<<<<<<<<<<<
 * 
 * def pgroup_gop_min(int pgroup, X):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pgroup_gop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_pgroup); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_3, __pyx_v_X, __pyx_n_s_max};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3103, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_3, __pyx_v_X, __pyx_n_s_max};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3103, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3103, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_X);
    __Pyx_GIVEREF(__pyx_v_X);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_X);
    __Pyx_INCREF(__pyx_n_s_max);
    __Pyx_GIVEREF(__pyx_n_s_max);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_n_s_max);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3103, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3102
 *     return pgroup_gop(pgroup, X, "*")
 * 
 * def pgroup_gop_max(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "max")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("miniga4py.ga.pgroup_gop_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3105
 *     return pgroup_gop(pgroup, X, "max")
 * 
 * def pgroup_gop_min(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "min")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_233pgroup_gop_min(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_232pgroup_gop_min[] = "pgroup_gop_min(int pgroup, X)";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_233pgroup_gop_min = {"pgroup_gop_min", (PyCFunction)__pyx_pw_9miniga4py_2ga_233pgroup_gop_min, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_232pgroup_gop_min};
static PyObject *__pyx_pw_9miniga4py_2ga_233pgroup_gop_min(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_pgroup;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pgroup_gop_min (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pgroup,&__pyx_n_s_X,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pgroup)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pgroup_gop_min", 1, 2, 2, 1); __PYX_ERR(0, 3105, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pgroup_gop_min") < 0)) __PYX_ERR(0, 3105, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pgroup = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3105, __pyx_L3_error)
    __pyx_v_X = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pgroup_gop_min", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3105, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.pgroup_gop_min", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_232pgroup_gop_min(__pyx_self, __pyx_v_pgroup, __pyx_v_X);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_232pgroup_gop_min(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, PyObject *__pyx_v_X) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("pgroup_gop_min", 0);

  /* "miniga4py/ga.pyx":3106
 * 
 * def pgroup_gop_min(int pgroup, X):
 *     return pgroup_gop(pgroup, X, "min")             # <<<<<<<<<<<<<<
 * 
 * def pgroup_gop_absmax(int pgroup, X):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pgroup_gop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_pgroup); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_3, __pyx_v_X, __pyx_n_s_min};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3106, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_3, __pyx_v_X, __pyx_n_s_min};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3106, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_X);
    __Pyx_GIVEREF(__pyx_v_X);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_X);
    __Pyx_INCREF(__pyx_n_s_min);
    __Pyx_GIVEREF(__pyx_n_s_min);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_n_s_min);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3105
 *     return pgroup_gop(pgroup, X, "max")
 * 
 * def pgroup_gop_min(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "min")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("miniga4py.ga.pgroup_gop_min", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3108
 *     return pgroup_gop(pgroup, X, "min")
 * 
 * def pgroup_gop_absmax(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "absmax")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_235pgroup_gop_absmax(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_234pgroup_gop_absmax[] = "pgroup_gop_absmax(int pgroup, X)";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_235pgroup_gop_absmax = {"pgroup_gop_absmax", (PyCFunction)__pyx_pw_9miniga4py_2ga_235pgroup_gop_absmax, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_234pgroup_gop_absmax};
static PyObject *__pyx_pw_9miniga4py_2ga_235pgroup_gop_absmax(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_pgroup;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pgroup_gop_absmax (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pgroup,&__pyx_n_s_X,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pgroup)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pgroup_gop_absmax", 1, 2, 2, 1); __PYX_ERR(0, 3108, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pgroup_gop_absmax") < 0)) __PYX_ERR(0, 3108, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pgroup = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3108, __pyx_L3_error)
    __pyx_v_X = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pgroup_gop_absmax", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3108, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.pgroup_gop_absmax", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_234pgroup_gop_absmax(__pyx_self, __pyx_v_pgroup, __pyx_v_X);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_234pgroup_gop_absmax(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, PyObject *__pyx_v_X) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("pgroup_gop_absmax", 0);

  /* "miniga4py/ga.pyx":3109
 * 
 * def pgroup_gop_absmax(int pgroup, X):
 *     return pgroup_gop(pgroup, X, "absmax")             # <<<<<<<<<<<<<<
 * 
 * def pgroup_gop_absmin(int pgroup, X):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pgroup_gop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_pgroup); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_3, __pyx_v_X, __pyx_n_s_absmax};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3109, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_3, __pyx_v_X, __pyx_n_s_absmax};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3109, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_X);
    __Pyx_GIVEREF(__pyx_v_X);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_X);
    __Pyx_INCREF(__pyx_n_s_absmax);
    __Pyx_GIVEREF(__pyx_n_s_absmax);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_n_s_absmax);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3108
 *     return pgroup_gop(pgroup, X, "min")
 * 
 * def pgroup_gop_absmax(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "absmax")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("miniga4py.ga.pgroup_gop_absmax", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3111
 *     return pgroup_gop(pgroup, X, "absmax")
 * 
 * def pgroup_gop_absmin(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "absmin")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_237pgroup_gop_absmin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_236pgroup_gop_absmin[] = "pgroup_gop_absmin(int pgroup, X)";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_237pgroup_gop_absmin = {"pgroup_gop_absmin", (PyCFunction)__pyx_pw_9miniga4py_2ga_237pgroup_gop_absmin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_236pgroup_gop_absmin};
static PyObject *__pyx_pw_9miniga4py_2ga_237pgroup_gop_absmin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_pgroup;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pgroup_gop_absmin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pgroup,&__pyx_n_s_X,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pgroup)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pgroup_gop_absmin", 1, 2, 2, 1); __PYX_ERR(0, 3111, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pgroup_gop_absmin") < 0)) __PYX_ERR(0, 3111, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pgroup = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3111, __pyx_L3_error)
    __pyx_v_X = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pgroup_gop_absmin", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3111, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.pgroup_gop_absmin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_236pgroup_gop_absmin(__pyx_self, __pyx_v_pgroup, __pyx_v_X);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_236pgroup_gop_absmin(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, PyObject *__pyx_v_X) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("pgroup_gop_absmin", 0);

  /* "miniga4py/ga.pyx":3112
 * 
 * def pgroup_gop_absmin(int pgroup, X):
 *     return pgroup_gop(pgroup, X, "absmin")             # <<<<<<<<<<<<<<
 * 
 * def pgroup_nnodes(int pgroup=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pgroup_gop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_pgroup); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_3, __pyx_v_X, __pyx_n_s_absmin};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3112, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_3, __pyx_v_X, __pyx_n_s_absmin};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3112, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_X);
    __Pyx_GIVEREF(__pyx_v_X);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_X);
    __Pyx_INCREF(__pyx_n_s_absmin);
    __Pyx_GIVEREF(__pyx_n_s_absmin);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_n_s_absmin);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3111
 *     return pgroup_gop(pgroup, X, "absmax")
 * 
 * def pgroup_gop_absmin(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "absmin")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("miniga4py.ga.pgroup_gop_absmin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3114
 *     return pgroup_gop(pgroup, X, "absmin")
 * 
 * def pgroup_nnodes(int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Returns the number of processors contained in the group specified by
 *     pgroup.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_239pgroup_nnodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_238pgroup_nnodes[] = "pgroup_nnodes(int pgroup=-1)\nReturns the number of processors contained in the group specified by\n    pgroup.\n\n    This is a local local operation. \n\n    :Parameters:\n        pgroup : int\n            the group handle\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_239pgroup_nnodes = {"pgroup_nnodes", (PyCFunction)__pyx_pw_9miniga4py_2ga_239pgroup_nnodes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_238pgroup_nnodes};
static PyObject *__pyx_pw_9miniga4py_2ga_239pgroup_nnodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_pgroup;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pgroup_nnodes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pgroup,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pgroup);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pgroup_nnodes") < 0)) __PYX_ERR(0, 3114, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_pgroup = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3114, __pyx_L3_error)
    } else {
      __pyx_v_pgroup = ((int)-1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pgroup_nnodes", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3114, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.pgroup_nnodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_238pgroup_nnodes(__pyx_self, __pyx_v_pgroup);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_238pgroup_nnodes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("pgroup_nnodes", 0);

  /* "miniga4py/ga.pyx":3125
 * 
 *     """
 *     if pgroup < 0:             # <<<<<<<<<<<<<<
 *         pgroup = pgroup_get_default()
 *     return GA_Pgroup_nnodes(pgroup)
 */
  __pyx_t_1 = ((__pyx_v_pgroup < 0) != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":3126
 *     """
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()             # <<<<<<<<<<<<<<
 *     return GA_Pgroup_nnodes(pgroup)
 * 
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_pgroup_get_default); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_4) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3126, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3126, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3126, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_pgroup = __pyx_t_5;

    /* "miniga4py/ga.pyx":3125
 * 
 *     """
 *     if pgroup < 0:             # <<<<<<<<<<<<<<
 *         pgroup = pgroup_get_default()
 *     return GA_Pgroup_nnodes(pgroup)
 */
  }

  /* "miniga4py/ga.pyx":3127
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()
 *     return GA_Pgroup_nnodes(pgroup)             # <<<<<<<<<<<<<<
 * 
 * def pgroup_nodeid(int pgroup=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_int(GA_Pgroup_nnodes(__pyx_v_pgroup)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3114
 *     return pgroup_gop(pgroup, X, "absmin")
 * 
 * def pgroup_nnodes(int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Returns the number of processors contained in the group specified by
 *     pgroup.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("miniga4py.ga.pgroup_nnodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3129
 *     return GA_Pgroup_nnodes(pgroup)
 * 
 * def pgroup_nodeid(int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Returns the relative index of the processor in the processor group
 *     specified by pgroup.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_241pgroup_nodeid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_240pgroup_nodeid[] = "pgroup_nodeid(int pgroup=-1)\nReturns the relative index of the processor in the processor group\n    specified by pgroup.\n    \n    This index will generally differ from the absolute processor index\n    returned by ga.nodeid if the processor group is not the world group.\n\n    This is a local operation. \n\n    :Parameters:\n        pgroup : int\n            the group handle\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_241pgroup_nodeid = {"pgroup_nodeid", (PyCFunction)__pyx_pw_9miniga4py_2ga_241pgroup_nodeid, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_240pgroup_nodeid};
static PyObject *__pyx_pw_9miniga4py_2ga_241pgroup_nodeid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_pgroup;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pgroup_nodeid (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pgroup,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pgroup);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pgroup_nodeid") < 0)) __PYX_ERR(0, 3129, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_pgroup = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3129, __pyx_L3_error)
    } else {
      __pyx_v_pgroup = ((int)-1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pgroup_nodeid", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3129, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.pgroup_nodeid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_240pgroup_nodeid(__pyx_self, __pyx_v_pgroup);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_240pgroup_nodeid(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("pgroup_nodeid", 0);

  /* "miniga4py/ga.pyx":3143
 * 
 *     """
 *     if pgroup < 0:             # <<<<<<<<<<<<<<
 *         pgroup = pgroup_get_default()
 *     return GA_Pgroup_nodeid(pgroup)
 */
  __pyx_t_1 = ((__pyx_v_pgroup < 0) != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":3144
 *     """
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()             # <<<<<<<<<<<<<<
 *     return GA_Pgroup_nodeid(pgroup)
 * 
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_pgroup_get_default); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_4) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3144, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3144, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3144, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_pgroup = __pyx_t_5;

    /* "miniga4py/ga.pyx":3143
 * 
 *     """
 *     if pgroup < 0:             # <<<<<<<<<<<<<<
 *         pgroup = pgroup_get_default()
 *     return GA_Pgroup_nodeid(pgroup)
 */
  }

  /* "miniga4py/ga.pyx":3145
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()
 *     return GA_Pgroup_nodeid(pgroup)             # <<<<<<<<<<<<<<
 * 
 * def pgroup_set_default(int pgroup=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_int(GA_Pgroup_nodeid(__pyx_v_pgroup)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3129
 *     return GA_Pgroup_nnodes(pgroup)
 * 
 * def pgroup_nodeid(int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Returns the relative index of the processor in the processor group
 *     specified by pgroup.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("miniga4py.ga.pgroup_nodeid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3147
 *     return GA_Pgroup_nodeid(pgroup)
 * 
 * def pgroup_set_default(int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Resets the default processor group on a collection of processors.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_243pgroup_set_default(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_242pgroup_set_default[] = "pgroup_set_default(int pgroup=-1)\nResets the default processor group on a collection of processors.\n    \n    All processors in the group referenced by p_handle must make a call to\n    this function. Any standard global array call that is made after resetting\n    the default processor group will be restricted to processors in that\n    group. Global arrays that are created after resetting the default\n    processor group will only be defined on that group and global operations\n    such as ga.sync or ga.gop will be restricted to processors in that group.\n    The ga.pgroup_set_default call can be used to rapidly convert large\n    applications, written with GA, into routines that run on processor groups.\n\n    The default processor group can be overridden by using GA calls that\n    require an explicit group handle as one of the arguments.\n\n    This is a collective operation on the group represented by the handle\n    pgroup. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_243pgroup_set_default = {"pgroup_set_default", (PyCFunction)__pyx_pw_9miniga4py_2ga_243pgroup_set_default, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_242pgroup_set_default};
static PyObject *__pyx_pw_9miniga4py_2ga_243pgroup_set_default(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_pgroup;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pgroup_set_default (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pgroup,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pgroup);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pgroup_set_default") < 0)) __PYX_ERR(0, 3147, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_pgroup = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3147, __pyx_L3_error)
    } else {
      __pyx_v_pgroup = ((int)-1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pgroup_set_default", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3147, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.pgroup_set_default", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_242pgroup_set_default(__pyx_self, __pyx_v_pgroup);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_242pgroup_set_default(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("pgroup_set_default", 0);

  /* "miniga4py/ga.pyx":3166
 * 
 *     """
 *     if pgroup < 0:             # <<<<<<<<<<<<<<
 *         pgroup = pgroup_get_world()
 *     GA_Pgroup_set_default(pgroup)
 */
  __pyx_t_1 = ((__pyx_v_pgroup < 0) != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":3167
 *     """
 *     if pgroup < 0:
 *         pgroup = pgroup_get_world()             # <<<<<<<<<<<<<<
 *     GA_Pgroup_set_default(pgroup)
 * 
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_pgroup_get_world); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_4) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3167, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3167, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3167, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_pgroup = __pyx_t_5;

    /* "miniga4py/ga.pyx":3166
 * 
 *     """
 *     if pgroup < 0:             # <<<<<<<<<<<<<<
 *         pgroup = pgroup_get_world()
 *     GA_Pgroup_set_default(pgroup)
 */
  }

  /* "miniga4py/ga.pyx":3168
 *     if pgroup < 0:
 *         pgroup = pgroup_get_world()
 *     GA_Pgroup_set_default(pgroup)             # <<<<<<<<<<<<<<
 * 
 * def pgroup_split(int pgroup, int num_group):
 */
  GA_Pgroup_set_default(__pyx_v_pgroup);

  /* "miniga4py/ga.pyx":3147
 *     return GA_Pgroup_nodeid(pgroup)
 * 
 * def pgroup_set_default(int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Resets the default processor group on a collection of processors.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("miniga4py.ga.pgroup_set_default", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3170
 *     GA_Pgroup_set_default(pgroup)
 * 
 * def pgroup_split(int pgroup, int num_group):             # <<<<<<<<<<<<<<
 *     """TODO"""
 *     return GA_Pgroup_split(pgroup, num_group)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_245pgroup_split(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_244pgroup_split[] = "pgroup_split(int pgroup, int num_group)\nTODO";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_245pgroup_split = {"pgroup_split", (PyCFunction)__pyx_pw_9miniga4py_2ga_245pgroup_split, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_244pgroup_split};
static PyObject *__pyx_pw_9miniga4py_2ga_245pgroup_split(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_pgroup;
  int __pyx_v_num_group;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pgroup_split (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pgroup,&__pyx_n_s_num_group,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pgroup)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_group)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pgroup_split", 1, 2, 2, 1); __PYX_ERR(0, 3170, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pgroup_split") < 0)) __PYX_ERR(0, 3170, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pgroup = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3170, __pyx_L3_error)
    __pyx_v_num_group = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_num_group == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3170, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pgroup_split", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3170, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.pgroup_split", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_244pgroup_split(__pyx_self, __pyx_v_pgroup, __pyx_v_num_group);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_244pgroup_split(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, int __pyx_v_num_group) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("pgroup_split", 0);

  /* "miniga4py/ga.pyx":3172
 * def pgroup_split(int pgroup, int num_group):
 *     """TODO"""
 *     return GA_Pgroup_split(pgroup, num_group)             # <<<<<<<<<<<<<<
 * 
 * def pgroup_split_irreg(int pgroup, int color):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Pgroup_split(__pyx_v_pgroup, __pyx_v_num_group)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3170
 *     GA_Pgroup_set_default(pgroup)
 * 
 * def pgroup_split(int pgroup, int num_group):             # <<<<<<<<<<<<<<
 *     """TODO"""
 *     return GA_Pgroup_split(pgroup, num_group)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.pgroup_split", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3174
 *     return GA_Pgroup_split(pgroup, num_group)
 * 
 * def pgroup_split_irreg(int pgroup, int color):             # <<<<<<<<<<<<<<
 *     """TODO"""
 *     return GA_Pgroup_split_irreg(pgroup, color)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_247pgroup_split_irreg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_246pgroup_split_irreg[] = "pgroup_split_irreg(int pgroup, int color)\nTODO";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_247pgroup_split_irreg = {"pgroup_split_irreg", (PyCFunction)__pyx_pw_9miniga4py_2ga_247pgroup_split_irreg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_246pgroup_split_irreg};
static PyObject *__pyx_pw_9miniga4py_2ga_247pgroup_split_irreg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_pgroup;
  int __pyx_v_color;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pgroup_split_irreg (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pgroup,&__pyx_n_s_color,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pgroup)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pgroup_split_irreg", 1, 2, 2, 1); __PYX_ERR(0, 3174, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pgroup_split_irreg") < 0)) __PYX_ERR(0, 3174, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pgroup = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3174, __pyx_L3_error)
    __pyx_v_color = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_color == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3174, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pgroup_split_irreg", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3174, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.pgroup_split_irreg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_246pgroup_split_irreg(__pyx_self, __pyx_v_pgroup, __pyx_v_color);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_246pgroup_split_irreg(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup, int __pyx_v_color) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("pgroup_split_irreg", 0);

  /* "miniga4py/ga.pyx":3176
 * def pgroup_split_irreg(int pgroup, int color):
 *     """TODO"""
 *     return GA_Pgroup_split_irreg(pgroup, color)             # <<<<<<<<<<<<<<
 * 
 * def pgroup_sync(int pgroup=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Pgroup_split_irreg(__pyx_v_pgroup, __pyx_v_color)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3174
 *     return GA_Pgroup_split(pgroup, num_group)
 * 
 * def pgroup_split_irreg(int pgroup, int color):             # <<<<<<<<<<<<<<
 *     """TODO"""
 *     return GA_Pgroup_split_irreg(pgroup, color)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.pgroup_split_irreg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3178
 *     return GA_Pgroup_split_irreg(pgroup, color)
 * 
 * def pgroup_sync(int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Executes a synchronization group across the processors in the processor
 *     group specified by pgroup.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_249pgroup_sync(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_248pgroup_sync[] = "pgroup_sync(int pgroup=-1)\nExecutes a synchronization group across the processors in the processor\n    group specified by pgroup.\n    \n    Nodes outside this group are unaffected.\n\n    This is a collective operation on the processor group specified by\n    pgroup.  \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_249pgroup_sync = {"pgroup_sync", (PyCFunction)__pyx_pw_9miniga4py_2ga_249pgroup_sync, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_248pgroup_sync};
static PyObject *__pyx_pw_9miniga4py_2ga_249pgroup_sync(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_pgroup;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pgroup_sync (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pgroup,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pgroup);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pgroup_sync") < 0)) __PYX_ERR(0, 3178, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_pgroup = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3178, __pyx_L3_error)
    } else {
      __pyx_v_pgroup = ((int)-1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pgroup_sync", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3178, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.pgroup_sync", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_248pgroup_sync(__pyx_self, __pyx_v_pgroup);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_248pgroup_sync(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_pgroup) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("pgroup_sync", 0);

  /* "miniga4py/ga.pyx":3188
 * 
 *     """
 *     if pgroup < 0:             # <<<<<<<<<<<<<<
 *         pgroup = pgroup_get_default()
 *     GA_Pgroup_sync(pgroup)
 */
  __pyx_t_1 = ((__pyx_v_pgroup < 0) != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":3189
 *     """
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()             # <<<<<<<<<<<<<<
 *     GA_Pgroup_sync(pgroup)
 * 
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_pgroup_get_default); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_4) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3189, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3189, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3189, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_pgroup = __pyx_t_5;

    /* "miniga4py/ga.pyx":3188
 * 
 *     """
 *     if pgroup < 0:             # <<<<<<<<<<<<<<
 *         pgroup = pgroup_get_default()
 *     GA_Pgroup_sync(pgroup)
 */
  }

  /* "miniga4py/ga.pyx":3190
 *     if pgroup < 0:
 *         pgroup = pgroup_get_default()
 *     GA_Pgroup_sync(pgroup)             # <<<<<<<<<<<<<<
 * 
 * def print_distribution(int g_a):
 */
  GA_Pgroup_sync(__pyx_v_pgroup);

  /* "miniga4py/ga.pyx":3178
 *     return GA_Pgroup_split_irreg(pgroup, color)
 * 
 * def pgroup_sync(int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Executes a synchronization group across the processors in the processor
 *     group specified by pgroup.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("miniga4py.ga.pgroup_sync", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3192
 *     GA_Pgroup_sync(pgroup)
 * 
 * def print_distribution(int g_a):             # <<<<<<<<<<<<<<
 *     """Prints the array distribution.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_251print_distribution(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_250print_distribution[] = "print_distribution(int g_a)\nPrints the array distribution.\n\n    This is a collective operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_251print_distribution = {"print_distribution", (PyCFunction)__pyx_pw_9miniga4py_2ga_251print_distribution, METH_O, __pyx_doc_9miniga4py_2ga_250print_distribution};
static PyObject *__pyx_pw_9miniga4py_2ga_251print_distribution(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_distribution (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3192, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.print_distribution", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_250print_distribution(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_250print_distribution(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_distribution", 0);

  /* "miniga4py/ga.pyx":3198
 * 
 *     """
 *     GA_Print_distribution(g_a)             # <<<<<<<<<<<<<<
 * 
 * def print_file(int g_a, file):
 */
  GA_Print_distribution(__pyx_v_g_a);

  /* "miniga4py/ga.pyx":3192
 *     GA_Pgroup_sync(pgroup)
 * 
 * def print_distribution(int g_a):             # <<<<<<<<<<<<<<
 *     """Prints the array distribution.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3200
 *     GA_Print_distribution(g_a)
 * 
 * def print_file(int g_a, file):             # <<<<<<<<<<<<<<
 *     """Prints an entire array to a file.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_253print_file(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_252print_file[] = "print_file(int g_a, file)\nPrints an entire array to a file.\n\n    This is a collective operation. \n\n    :Parameters:\n        file : file-like\n            file-like object which must implement fileno(), or a string\n        g_a : int\n            the array handle\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_253print_file = {"print_file", (PyCFunction)__pyx_pw_9miniga4py_2ga_253print_file, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_252print_file};
static PyObject *__pyx_pw_9miniga4py_2ga_253print_file(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED int __pyx_v_g_a;
  CYTHON_UNUSED PyObject *__pyx_v_file = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_file (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_file,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_file)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("print_file", 1, 2, 2, 1); __PYX_ERR(0, 3200, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "print_file") < 0)) __PYX_ERR(0, 3200, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3200, __pyx_L3_error)
    __pyx_v_file = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("print_file", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3200, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.print_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_252print_file(__pyx_self, __pyx_v_g_a, __pyx_v_file);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_252print_file(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED int __pyx_v_g_a, CYTHON_UNUSED PyObject *__pyx_v_file) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_file", 0);

  /* "miniga4py/ga.pyx":3213
 *     """
 *     #GA_Print_file(file.fileno(), g_a)
 *     raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 * def print_patch(int g_a, lo=None, hi=None, bint pretty=True):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 3213, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3200
 *     GA_Print_distribution(g_a)
 * 
 * def print_file(int g_a, file):             # <<<<<<<<<<<<<<
 *     """Prints an entire array to a file.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("miniga4py.ga.print_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3215
 *     raise NotImplementedError
 * 
 * def print_patch(int g_a, lo=None, hi=None, bint pretty=True):             # <<<<<<<<<<<<<<
 *     """Prints a patch of g_a array to the standard output.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_255print_patch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_254print_patch[] = "print_patch(int g_a, lo=None, hi=None, bool pretty=True)\nPrints a patch of g_a array to the standard output.\n    \n    If pretty is False then output is printed in a dense fashion. If\n    pretty is True then output is formatted and rows/columns labeled.\n\n    This is a collective operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_255print_patch = {"print_patch", (PyCFunction)__pyx_pw_9miniga4py_2ga_255print_patch, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_254print_patch};
static PyObject *__pyx_pw_9miniga4py_2ga_255print_patch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  int __pyx_v_pretty;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_patch (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_lo,&__pyx_n_s_hi,&__pyx_n_s_pretty,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pretty);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "print_patch") < 0)) __PYX_ERR(0, 3215, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3215, __pyx_L3_error)
    __pyx_v_lo = values[1];
    __pyx_v_hi = values[2];
    if (values[3]) {
      __pyx_v_pretty = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_pretty == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3215, __pyx_L3_error)
    } else {
      __pyx_v_pretty = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("print_patch", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3215, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.print_patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_254print_patch(__pyx_self, __pyx_v_g_a, __pyx_v_lo, __pyx_v_hi, __pyx_v_pretty);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_254print_patch(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, int __pyx_v_pretty) {
  PyArrayObject *__pyx_v_lo_nd = 0;
  PyArrayObject *__pyx_v_hi_nd = 0;
  int __pyx_v_apretty;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_nd;
  __Pyx_Buffer __pyx_pybuffer_hi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lo_nd;
  __Pyx_Buffer __pyx_pybuffer_lo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("print_patch", 0);
  __pyx_pybuffer_lo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_lo_nd.refcount = 0;
  __pyx_pybuffernd_lo_nd.data = NULL;
  __pyx_pybuffernd_lo_nd.rcbuffer = &__pyx_pybuffer_lo_nd;
  __pyx_pybuffer_hi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_nd.refcount = 0;
  __pyx_pybuffernd_hi_nd.data = NULL;
  __pyx_pybuffernd_hi_nd.rcbuffer = &__pyx_pybuffer_hi_nd;

  /* "miniga4py/ga.pyx":3225
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 *     cdef int apretty=0             # <<<<<<<<<<<<<<
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *     if pretty:
 */
  __pyx_v_apretty = 0;

  /* "miniga4py/ga.pyx":3226
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 *     cdef int apretty=0
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)             # <<<<<<<<<<<<<<
 *     if pretty:
 *         apretty = 1
 */
  __pyx_t_1 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_lo, __pyx_v_hi); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3226, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3226, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3226, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3226, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 3226, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 3226, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3226, __pyx_L1_error)
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3226, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_lo_nd.diminfo[0].strides = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_nd.diminfo[0].shape = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3226, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_lo_nd = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
      __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
    }
    __pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3226, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "miniga4py/ga.pyx":3227
 *     cdef int apretty=0
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *     if pretty:             # <<<<<<<<<<<<<<
 *         apretty = 1
 *     NGA_Print_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, apretty)
 */
  __pyx_t_11 = (__pyx_v_pretty != 0);
  if (__pyx_t_11) {

    /* "miniga4py/ga.pyx":3228
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *     if pretty:
 *         apretty = 1             # <<<<<<<<<<<<<<
 *     NGA_Print_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, apretty)
 * 
 */
    __pyx_v_apretty = 1;

    /* "miniga4py/ga.pyx":3227
 *     cdef int apretty=0
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *     if pretty:             # <<<<<<<<<<<<<<
 *         apretty = 1
 *     NGA_Print_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, apretty)
 */
  }

  /* "miniga4py/ga.pyx":3229
 *     if pretty:
 *         apretty = 1
 *     NGA_Print_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, apretty)             # <<<<<<<<<<<<<<
 * 
 * def print_stats():
 */
  NGA_Print_patch64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data), __pyx_v_apretty);

  /* "miniga4py/ga.pyx":3215
 *     raise NotImplementedError
 * 
 * def print_patch(int g_a, lo=None, hi=None, bint pretty=True):             # <<<<<<<<<<<<<<
 *     """Prints a patch of g_a array to the standard output.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.print_patch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3231
 *     NGA_Print_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, apretty)
 * 
 * def print_stats():             # <<<<<<<<<<<<<<
 *     """This non-collective (MIMD) operation prints information about:
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_257print_stats(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_256print_stats[] = "print_stats()\nThis non-collective (MIMD) operation prints information about:\n\n    * number of calls to the GA create/duplicate, destroy, get, put,\n    * scatter, gather, and read_and_inc operations\n    * total amount of data moved in the GA primitive operations\n    * amount of data moved in GA primitive operations to logicaly\n    * remote locations\n    * maximum memory consumption in global arrays, and\n    * number of requests serviced in the interrupt-driven\n    * implementations by the calling process.\n\n    This operation is local. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_257print_stats = {"print_stats", (PyCFunction)__pyx_pw_9miniga4py_2ga_257print_stats, METH_NOARGS, __pyx_doc_9miniga4py_2ga_256print_stats};
static PyObject *__pyx_pw_9miniga4py_2ga_257print_stats(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_stats (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_256print_stats(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_256print_stats(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_stats", 0);

  /* "miniga4py/ga.pyx":3246
 * 
 *     """
 *     GA_Print_stats()             # <<<<<<<<<<<<<<
 * 
 * def print_stdout(int g_a):
 */
  GA_Print_stats();

  /* "miniga4py/ga.pyx":3231
 *     NGA_Print_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, apretty)
 * 
 * def print_stats():             # <<<<<<<<<<<<<<
 *     """This non-collective (MIMD) operation prints information about:
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3248
 *     GA_Print_stats()
 * 
 * def print_stdout(int g_a):             # <<<<<<<<<<<<<<
 *     """Prints an entire array to the standard output."""
 *     GA_Print(g_a)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_259print_stdout(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_258print_stdout[] = "print_stdout(int g_a)\nPrints an entire array to the standard output.";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_259print_stdout = {"print_stdout", (PyCFunction)__pyx_pw_9miniga4py_2ga_259print_stdout, METH_O, __pyx_doc_9miniga4py_2ga_258print_stdout};
static PyObject *__pyx_pw_9miniga4py_2ga_259print_stdout(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_stdout (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3248, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.print_stdout", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_258print_stdout(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_258print_stdout(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_stdout", 0);

  /* "miniga4py/ga.pyx":3250
 * def print_stdout(int g_a):
 *     """Prints an entire array to the standard output."""
 *     GA_Print(g_a)             # <<<<<<<<<<<<<<
 * 
 * def proc_topology(int g_a, int proc):
 */
  GA_Print(__pyx_v_g_a);

  /* "miniga4py/ga.pyx":3248
 *     GA_Print_stats()
 * 
 * def print_stdout(int g_a):             # <<<<<<<<<<<<<<
 *     """Prints an entire array to the standard output."""
 *     GA_Print(g_a)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3252
 *     GA_Print(g_a)
 * 
 * def proc_topology(int g_a, int proc):             # <<<<<<<<<<<<<<
 *     """Based on the distribution of an array associated with handle g_a,
 *     determines coordinates of the specified processor in the virtual processor
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_261proc_topology(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_260proc_topology[] = "proc_topology(int g_a, int proc)\nBased on the distribution of an array associated with handle g_a,\n    determines coordinates of the specified processor in the virtual processor\n    grid corresponding to the distribution of array g_a.\n    \n    The numbering starts from 0. The values of -1 means that the processor\n    doesn't 'own' any section of array represented by g_a.\n\n    This operation is local. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_261proc_topology = {"proc_topology", (PyCFunction)__pyx_pw_9miniga4py_2ga_261proc_topology, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_260proc_topology};
static PyObject *__pyx_pw_9miniga4py_2ga_261proc_topology(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_proc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("proc_topology (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_proc,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_proc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("proc_topology", 1, 2, 2, 1); __PYX_ERR(0, 3252, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "proc_topology") < 0)) __PYX_ERR(0, 3252, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3252, __pyx_L3_error)
    __pyx_v_proc = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_proc == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3252, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("proc_topology", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3252, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.proc_topology", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_260proc_topology(__pyx_self, __pyx_v_g_a, __pyx_v_proc);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_260proc_topology(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_proc) {
  int __pyx_v_ndim;
  PyArrayObject *__pyx_v_coord = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_coord;
  __Pyx_Buffer __pyx_pybuffer_coord;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("proc_topology", 0);
  __pyx_pybuffer_coord.pybuffer.buf = NULL;
  __pyx_pybuffer_coord.refcount = 0;
  __pyx_pybuffernd_coord.data = NULL;
  __pyx_pybuffernd_coord.rcbuffer = &__pyx_pybuffer_coord;

  /* "miniga4py/ga.pyx":3263
 * 
 *     """
 *     cdef int ndim = GA_Ndim(g_a)             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[np.int32_t, ndim=1] coord
 *     coord = np.zeros(ndim, dtype=np.intc)
 */
  __pyx_v_ndim = GA_Ndim(__pyx_v_g_a);

  /* "miniga4py/ga.pyx":3265
 *     cdef int ndim = GA_Ndim(g_a)
 *     cdef np.ndarray[np.int32_t, ndim=1] coord
 *     coord = np.zeros(ndim, dtype=np.intc)             # <<<<<<<<<<<<<<
 *     NGA_Proc_topology(g_a, proc, <int*>coord.data)
 *     return coord
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_intc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 3265, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3265, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coord.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coord.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coord.rcbuffer->pybuffer, (PyObject*)__pyx_v_coord, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_coord.diminfo[0].strides = __pyx_pybuffernd_coord.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coord.diminfo[0].shape = __pyx_pybuffernd_coord.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3265, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_coord = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":3266
 *     cdef np.ndarray[np.int32_t, ndim=1] coord
 *     coord = np.zeros(ndim, dtype=np.intc)
 *     NGA_Proc_topology(g_a, proc, <int*>coord.data)             # <<<<<<<<<<<<<<
 *     return coord
 * 
 */
  NGA_Proc_topology(__pyx_v_g_a, __pyx_v_proc, ((int *)__pyx_v_coord->data));

  /* "miniga4py/ga.pyx":3267
 *     coord = np.zeros(ndim, dtype=np.intc)
 *     NGA_Proc_topology(g_a, proc, <int*>coord.data)
 *     return coord             # <<<<<<<<<<<<<<
 * 
 * def put(int g_a, buffer, lo=None, hi=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_coord));
  __pyx_r = ((PyObject *)__pyx_v_coord);
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3252
 *     GA_Print(g_a)
 * 
 * def proc_topology(int g_a, int proc):             # <<<<<<<<<<<<<<
 *     """Based on the distribution of an array associated with handle g_a,
 *     determines coordinates of the specified processor in the virtual processor
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coord.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.proc_topology", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coord.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_coord);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3269
 *     return coord
 * 
 * def put(int g_a, buffer, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Copies data from local array buffer to the global array section.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_263put(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_262put[] = "put(int g_a, buffer, lo=None, hi=None)\nCopies data from local array buffer to the global array section.\n    \n    The local array is assumed to be have the same number of dimensions as the\n    global array.  Any detected inconsitencies/errors in input arguments are\n    fatal.\n\n    This is a one-sided operation. \n\n    :Parameters:\n        g_a : int\n            the array handle\n        buffer : array-like\n            the data to put\n        lo : 1D array-like of integers\n            lower bound patch coordinates, inclusive\n        hi : array-like of integers\n            higher bound patch coordinates, exclusive\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_263put = {"put", (PyCFunction)__pyx_pw_9miniga4py_2ga_263put, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_262put};
static PyObject *__pyx_pw_9miniga4py_2ga_263put(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_buffer = 0;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("put (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_buffer,&__pyx_n_s_lo,&__pyx_n_s_hi,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("put", 0, 2, 4, 1); __PYX_ERR(0, 3269, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "put") < 0)) __PYX_ERR(0, 3269, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3269, __pyx_L3_error)
    __pyx_v_buffer = values[1];
    __pyx_v_lo = values[2];
    __pyx_v_hi = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("put", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3269, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_262put(__pyx_self, __pyx_v_g_a, __pyx_v_buffer, __pyx_v_lo, __pyx_v_hi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_262put(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_buffer, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_9miniga4py_2ga__put_common __pyx_t_2;
  __Pyx_RefNannySetupContext("put", 0);

  /* "miniga4py/ga.pyx":3289
 * 
 *     """
 *     _put_common(g_a, buffer, lo, hi)             # <<<<<<<<<<<<<<
 * 
 * cdef _put_common(int g_a, buffer, lo=None, hi=None,
 */
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.lo = __pyx_v_lo;
  __pyx_t_2.hi = __pyx_v_hi;
  __pyx_t_1 = __pyx_f_9miniga4py_2ga__put_common(__pyx_v_g_a, __pyx_v_buffer, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":3269
 *     return coord
 * 
 * def put(int g_a, buffer, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Copies data from local array buffer to the global array section.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3291
 *     _put_common(g_a, buffer, lo, hi)
 * 
 * cdef _put_common(int g_a, buffer, lo=None, hi=None,             # <<<<<<<<<<<<<<
 *         bint nb=False, bint periodic=False, skip=None):
 *     """Copies data from local array buffer to the global array section.
 */

static PyObject *__pyx_f_9miniga4py_2ga__put_common(int __pyx_v_g_a, PyObject *__pyx_v_buffer, struct __pyx_opt_args_9miniga4py_2ga__put_common *__pyx_optional_args) {
  PyObject *__pyx_v_lo = ((PyObject *)Py_None);
  PyObject *__pyx_v_hi = ((PyObject *)Py_None);

  /* "miniga4py/ga.pyx":3292
 * 
 * cdef _put_common(int g_a, buffer, lo=None, hi=None,
 *         bint nb=False, bint periodic=False, skip=None):             # <<<<<<<<<<<<<<
 *     """Copies data from local array buffer to the global array section.
 * 
 */
  int __pyx_v_nb = ((int)0);
  int __pyx_v_periodic = ((int)0);
  PyObject *__pyx_v_skip = ((PyObject *)Py_None);
  PyArrayObject *__pyx_v_buffer_nd = 0;
  PyArrayObject *__pyx_v_lo_nd = 0;
  PyArrayObject *__pyx_v_hi_nd = 0;
  PyArrayObject *__pyx_v_ld_nd = 0;
  PyArrayObject *__pyx_v_shape = 0;
  PyArrayObject *__pyx_v_skip_nd = 0;
  int __pyx_v_gtype;
  ga_nbhdl_t __pyx_v_nbhandle;
  PyObject *__pyx_v_dtype = NULL;
  PyObject *__pyx_v_strides = NULL;
  PyObject *__pyx_v_buffer_shape = NULL;
  PyObject *__pyx_v_i = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_nd;
  __Pyx_Buffer __pyx_pybuffer_hi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ld_nd;
  __Pyx_Buffer __pyx_pybuffer_ld_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lo_nd;
  __Pyx_Buffer __pyx_pybuffer_lo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_shape;
  __Pyx_Buffer __pyx_pybuffer_shape;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_skip_nd;
  __Pyx_Buffer __pyx_pybuffer_skip_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  PyObject *(*__pyx_t_14)(PyObject *);
  Py_ssize_t __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  __Pyx_RefNannySetupContext("_put_common", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_lo = __pyx_optional_args->lo;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_hi = __pyx_optional_args->hi;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_nb = __pyx_optional_args->nb;
          if (__pyx_optional_args->__pyx_n > 3) {
            __pyx_v_periodic = __pyx_optional_args->periodic;
            if (__pyx_optional_args->__pyx_n > 4) {
              __pyx_v_skip = __pyx_optional_args->skip;
            }
          }
        }
      }
    }
  }
  __pyx_pybuffer_lo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_lo_nd.refcount = 0;
  __pyx_pybuffernd_lo_nd.data = NULL;
  __pyx_pybuffernd_lo_nd.rcbuffer = &__pyx_pybuffer_lo_nd;
  __pyx_pybuffer_hi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_nd.refcount = 0;
  __pyx_pybuffernd_hi_nd.data = NULL;
  __pyx_pybuffernd_hi_nd.rcbuffer = &__pyx_pybuffer_hi_nd;
  __pyx_pybuffer_ld_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_ld_nd.refcount = 0;
  __pyx_pybuffernd_ld_nd.data = NULL;
  __pyx_pybuffernd_ld_nd.rcbuffer = &__pyx_pybuffer_ld_nd;
  __pyx_pybuffer_shape.pybuffer.buf = NULL;
  __pyx_pybuffer_shape.refcount = 0;
  __pyx_pybuffernd_shape.data = NULL;
  __pyx_pybuffernd_shape.rcbuffer = &__pyx_pybuffer_shape;
  __pyx_pybuffer_skip_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_skip_nd.refcount = 0;
  __pyx_pybuffernd_skip_nd.data = NULL;
  __pyx_pybuffernd_skip_nd.rcbuffer = &__pyx_pybuffer_skip_nd;

  /* "miniga4py/ga.pyx":3326
 *     cdef np.ndarray buffer_nd
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd, ld_nd, shape, skip_nd
 *     cdef int gtype=inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     cdef ga_nbhdl_t nbhandle
 *     dtype = _to_dtype[gtype]
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":3328
 *     cdef int gtype=inquire_type(g_a)
 *     cdef ga_nbhdl_t nbhandle
 *     dtype = _to_dtype[gtype]             # <<<<<<<<<<<<<<
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *     shape = hi_nd-lo_nd+1
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_to_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_gtype, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dtype = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "miniga4py/ga.pyx":3329
 *     cdef ga_nbhdl_t nbhandle
 *     dtype = _to_dtype[gtype]
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)             # <<<<<<<<<<<<<<
 *     shape = hi_nd-lo_nd+1
 *     if skip is None:
 */
  __pyx_t_2 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_lo, __pyx_v_hi); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3329, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 3329, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 3329, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3329, __pyx_L1_error)
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3329, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_lo_nd.diminfo[0].strides = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_nd.diminfo[0].shape = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3329, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_lo_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
      __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
    }
    __pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3329, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "miniga4py/ga.pyx":3330
 *     dtype = _to_dtype[gtype]
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *     shape = hi_nd-lo_nd+1             # <<<<<<<<<<<<<<
 *     if skip is None:
 *         skip_nd = None
 */
  __pyx_t_2 = PyNumber_Subtract(((PyObject *)__pyx_v_hi_nd), ((PyObject *)__pyx_v_lo_nd)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3330, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_shape.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_shape.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_shape.rcbuffer->pybuffer, (PyObject*)__pyx_v_shape, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_shape.diminfo[0].strides = __pyx_pybuffernd_shape.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_shape.diminfo[0].shape = __pyx_pybuffernd_shape.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3330, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_shape = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "miniga4py/ga.pyx":3331
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *     shape = hi_nd-lo_nd+1
 *     if skip is None:             # <<<<<<<<<<<<<<
 *         skip_nd = None
 *     else:
 */
  __pyx_t_11 = (__pyx_v_skip == Py_None);
  __pyx_t_12 = (__pyx_t_11 != 0);
  if (__pyx_t_12) {

    /* "miniga4py/ga.pyx":3332
 *     shape = hi_nd-lo_nd+1
 *     if skip is None:
 *         skip_nd = None             # <<<<<<<<<<<<<<
 *     else:
 *         skip_nd = _inta64(skip)
 */
    __pyx_t_6 = ((PyArrayObject *)Py_None);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_skip_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
        }
        __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
      }
      __pyx_pybuffernd_skip_nd.diminfo[0].strides = __pyx_pybuffernd_skip_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_skip_nd.diminfo[0].shape = __pyx_pybuffernd_skip_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3332, __pyx_L1_error)
    }
    __pyx_t_6 = 0;
    __Pyx_INCREF(Py_None);
    __pyx_v_skip_nd = ((PyArrayObject *)Py_None);

    /* "miniga4py/ga.pyx":3331
 *     lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *     shape = hi_nd-lo_nd+1
 *     if skip is None:             # <<<<<<<<<<<<<<
 *         skip_nd = None
 *     else:
 */
    goto __pyx_L5;
  }

  /* "miniga4py/ga.pyx":3334
 *         skip_nd = None
 *     else:
 *         skip_nd = _inta64(skip)             # <<<<<<<<<<<<<<
 *         shape = (hi_nd-lo_nd)/skip_nd+1
 *     buffer_nd = np.asarray(buffer, dtype=dtype)
 */
  /*else*/ {
    __pyx_t_3 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_skip)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_3), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_skip_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        }
        __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
      }
      __pyx_pybuffernd_skip_nd.diminfo[0].strides = __pyx_pybuffernd_skip_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_skip_nd.diminfo[0].shape = __pyx_pybuffernd_skip_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3334, __pyx_L1_error)
    }
    __pyx_v_skip_nd = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "miniga4py/ga.pyx":3335
 *     else:
 *         skip_nd = _inta64(skip)
 *         shape = (hi_nd-lo_nd)/skip_nd+1             # <<<<<<<<<<<<<<
 *     buffer_nd = np.asarray(buffer, dtype=dtype)
 *     if buffer_nd.dtype != dtype:
 */
    __pyx_t_3 = PyNumber_Subtract(((PyObject *)__pyx_v_hi_nd), ((PyObject *)__pyx_v_lo_nd)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_3, ((PyObject *)__pyx_v_skip_nd)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3335, __pyx_L1_error)
    __pyx_t_6 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_shape.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_shape.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_shape.rcbuffer->pybuffer, (PyObject*)__pyx_v_shape, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
        }
        __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
      }
      __pyx_pybuffernd_shape.diminfo[0].strides = __pyx_pybuffernd_shape.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_shape.diminfo[0].shape = __pyx_pybuffernd_shape.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3335, __pyx_L1_error)
    }
    __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_shape, ((PyArrayObject *)__pyx_t_3));
    __pyx_t_3 = 0;
  }
  __pyx_L5:;

  /* "miniga4py/ga.pyx":3336
 *         skip_nd = _inta64(skip)
 *         shape = (hi_nd-lo_nd)/skip_nd+1
 *     buffer_nd = np.asarray(buffer, dtype=dtype)             # <<<<<<<<<<<<<<
 *     if buffer_nd.dtype != dtype:
 *         raise ValueError("buffer is wrong type :: buffer=%s != %s" % (
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_buffer);
  __Pyx_GIVEREF(__pyx_v_buffer);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_buffer);
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_dtype) < 0) __PYX_ERR(0, 3336, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3336, __pyx_L1_error)
  __pyx_v_buffer_nd = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "miniga4py/ga.pyx":3337
 *         shape = (hi_nd-lo_nd)/skip_nd+1
 *     buffer_nd = np.asarray(buffer, dtype=dtype)
 *     if buffer_nd.dtype != dtype:             # <<<<<<<<<<<<<<
 *         raise ValueError("buffer is wrong type :: buffer=%s != %s" % (
 *                 buffer.dtype, dtype))
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buffer_nd), __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_v_dtype, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3337, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 3337, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_12)) {

    /* "miniga4py/ga.pyx":3339
 *     if buffer_nd.dtype != dtype:
 *         raise ValueError("buffer is wrong type :: buffer=%s != %s" % (
 *                 buffer.dtype, dtype))             # <<<<<<<<<<<<<<
 *     # Due to GA restrictions, buffer must not have negative strides
 *     # and buffer's last stride must be same as itemsize
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_buffer, __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3339, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3339, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_dtype);
    __Pyx_GIVEREF(__pyx_v_dtype);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_dtype);
    __pyx_t_1 = 0;

    /* "miniga4py/ga.pyx":3338
 *     buffer_nd = np.asarray(buffer, dtype=dtype)
 *     if buffer_nd.dtype != dtype:
 *         raise ValueError("buffer is wrong type :: buffer=%s != %s" % (             # <<<<<<<<<<<<<<
 *                 buffer.dtype, dtype))
 *     # Due to GA restrictions, buffer must not have negative strides
 */
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_buffer_is_wrong_type_buffer_s_s, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 3338, __pyx_L1_error)

    /* "miniga4py/ga.pyx":3337
 *         shape = (hi_nd-lo_nd)/skip_nd+1
 *     buffer_nd = np.asarray(buffer, dtype=dtype)
 *     if buffer_nd.dtype != dtype:             # <<<<<<<<<<<<<<
 *         raise ValueError("buffer is wrong type :: buffer=%s != %s" % (
 *                 buffer.dtype, dtype))
 */
  }

  /* "miniga4py/ga.pyx":3342
 *     # Due to GA restrictions, buffer must not have negative strides
 *     # and buffer's last stride must be same as itemsize
 *     strides = [buffer_nd.strides[i]/buffer_nd.itemsize             # <<<<<<<<<<<<<<
 *             for i in range(buffer_nd.ndim)]
 *     if (strides and (strides[-1] != 1 or np.any(np.asarray(strides) < 0))):
 */
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "miniga4py/ga.pyx":3343
 *     # and buffer's last stride must be same as itemsize
 *     strides = [buffer_nd.strides[i]/buffer_nd.itemsize
 *             for i in range(buffer_nd.ndim)]             # <<<<<<<<<<<<<<
 *     if (strides and (strides[-1] != 1 or np.any(np.asarray(strides) < 0))):
 *         buffer_nd = np.ascontiguousarray(buffer_nd)
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_buffer_nd->nd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0;
    __pyx_t_14 = NULL;
  } else {
    __pyx_t_13 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_14 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3343, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_14)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 3343, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3343, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 3343, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3343, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_14(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 3343, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "miniga4py/ga.pyx":3342
 *     # Due to GA restrictions, buffer must not have negative strides
 *     # and buffer's last stride must be same as itemsize
 *     strides = [buffer_nd.strides[i]/buffer_nd.itemsize             # <<<<<<<<<<<<<<
 *             for i in range(buffer_nd.ndim)]
 *     if (strides and (strides[-1] != 1 or np.any(np.asarray(strides) < 0))):
 */
    __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3342, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_buffer_nd->strides[__pyx_t_15])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buffer_nd), __pyx_n_s_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_16 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_16))) __PYX_ERR(0, 3342, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

    /* "miniga4py/ga.pyx":3343
 *     # and buffer's last stride must be same as itemsize
 *     strides = [buffer_nd.strides[i]/buffer_nd.itemsize
 *             for i in range(buffer_nd.ndim)]             # <<<<<<<<<<<<<<
 *     if (strides and (strides[-1] != 1 or np.any(np.asarray(strides) < 0))):
 *         buffer_nd = np.ascontiguousarray(buffer_nd)
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_strides = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "miniga4py/ga.pyx":3344
 *     strides = [buffer_nd.strides[i]/buffer_nd.itemsize
 *             for i in range(buffer_nd.ndim)]
 *     if (strides and (strides[-1] != 1 or np.any(np.asarray(strides) < 0))):             # <<<<<<<<<<<<<<
 *         buffer_nd = np.ascontiguousarray(buffer_nd)
 *     # we allow 1-d "flat" buffers in addition to buffers matching the shape of
 */
  __pyx_t_11 = (PyList_GET_SIZE(__pyx_v_strides) != 0);
  if (__pyx_t_11) {
  } else {
    __pyx_t_12 = __pyx_t_11;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_strides, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_int_1, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_11) {
  } else {
    __pyx_t_12 = __pyx_t_11;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_any); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_strides); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3344, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_strides};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3344, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_strides};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3344, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_17 = PyTuple_New(1+1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3344, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_v_strides);
      __Pyx_GIVEREF(__pyx_v_strides);
      PyTuple_SET_ITEM(__pyx_t_17, 0+1, __pyx_v_strides);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_17, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3344, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_16);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_16, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3344, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3344, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3344, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_17 = PyTuple_New(1+1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3344, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_17, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3344, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 3344, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_12 = __pyx_t_11;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_12) {

    /* "miniga4py/ga.pyx":3345
 *             for i in range(buffer_nd.ndim)]
 *     if (strides and (strides[-1] != 1 or np.any(np.asarray(strides) < 0))):
 *         buffer_nd = np.ascontiguousarray(buffer_nd)             # <<<<<<<<<<<<<<
 *     # we allow 1-d "flat" buffers in addition to buffers matching the shape of
 *     # the requested region
 */
    __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3345, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_17);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_17, function);
      }
    }
    if (!__pyx_t_16) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_17, ((PyObject *)__pyx_v_buffer_nd)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3345, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_17)) {
        PyObject *__pyx_temp[2] = {__pyx_t_16, ((PyObject *)__pyx_v_buffer_nd)};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3345, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) {
        PyObject *__pyx_temp[2] = {__pyx_t_16, ((PyObject *)__pyx_v_buffer_nd)};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3345, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3345, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_16); __pyx_t_16 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_v_buffer_nd));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_buffer_nd));
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, ((PyObject *)__pyx_v_buffer_nd));
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3345, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3345, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_buffer_nd, ((PyArrayObject *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "miniga4py/ga.pyx":3344
 *     strides = [buffer_nd.strides[i]/buffer_nd.itemsize
 *             for i in range(buffer_nd.ndim)]
 *     if (strides and (strides[-1] != 1 or np.any(np.asarray(strides) < 0))):             # <<<<<<<<<<<<<<
 *         buffer_nd = np.ascontiguousarray(buffer_nd)
 *     # we allow 1-d "flat" buffers in addition to buffers matching the shape of
 */
  }

  /* "miniga4py/ga.pyx":3348
 *     # we allow 1-d "flat" buffers in addition to buffers matching the shape of
 *     # the requested region
 *     if buffer_nd.ndim == 1:             # <<<<<<<<<<<<<<
 *         if buffer_nd.size != np.prod(shape):
 *             raise ValueError('buffer size does not match shape :: '
 */
  __pyx_t_12 = ((__pyx_v_buffer_nd->nd == 1) != 0);
  if (__pyx_t_12) {

    /* "miniga4py/ga.pyx":3349
 *     # the requested region
 *     if buffer_nd.ndim == 1:
 *         if buffer_nd.size != np.prod(shape):             # <<<<<<<<<<<<<<
 *             raise ValueError('buffer size does not match shape :: '
 *                     'buffer.size=%s != np.prod(shape)=%s' % (
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buffer_nd), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_prod); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_16);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_16, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_17 = __Pyx_PyObject_CallOneArg(__pyx_t_16, ((PyObject *)__pyx_v_shape)); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3349, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_16)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, ((PyObject *)__pyx_v_shape)};
        __pyx_t_17 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3349, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_17);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, ((PyObject *)__pyx_v_shape)};
        __pyx_t_17 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3349, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_17);
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3349, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_v_shape));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_shape));
        PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_shape));
        __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_4, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3349, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = PyObject_RichCompare(__pyx_t_1, __pyx_t_17, Py_NE); __Pyx_XGOTREF(__pyx_t_16); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3349, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_16); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 3349, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    if (unlikely(__pyx_t_12)) {

      /* "miniga4py/ga.pyx":3352
 *             raise ValueError('buffer size does not match shape :: '
 *                     'buffer.size=%s != np.prod(shape)=%s' % (
 *                     buffer_nd.size, np.prod(shape)))             # <<<<<<<<<<<<<<
 *         ld_nd = shape[1:]
 *     else:
 */
      __pyx_t_16 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_buffer_nd), __pyx_n_s_size); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3352, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3352, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_prod); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3352, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_1) {
        __pyx_t_17 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_v_shape)); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3352, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_1, ((PyObject *)__pyx_v_shape)};
          __pyx_t_17 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3352, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_17);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_1, ((PyObject *)__pyx_v_shape)};
          __pyx_t_17 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3352, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_17);
        } else
        #endif
        {
          __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3352, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
          __Pyx_INCREF(((PyObject *)__pyx_v_shape));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_shape));
          PyTuple_SET_ITEM(__pyx_t_3, 0+1, ((PyObject *)__pyx_v_shape));
          __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3352, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_17);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3352, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_16);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_16);
      __Pyx_GIVEREF(__pyx_t_17);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_17);
      __pyx_t_16 = 0;
      __pyx_t_17 = 0;

      /* "miniga4py/ga.pyx":3351
 *         if buffer_nd.size != np.prod(shape):
 *             raise ValueError('buffer size does not match shape :: '
 *                     'buffer.size=%s != np.prod(shape)=%s' % (             # <<<<<<<<<<<<<<
 *                     buffer_nd.size, np.prod(shape)))
 *         ld_nd = shape[1:]
 */
      __pyx_t_17 = __Pyx_PyString_Format(__pyx_kp_s_buffer_size_does_not_match_shape, __pyx_t_4); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3351, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "miniga4py/ga.pyx":3350
 *     if buffer_nd.ndim == 1:
 *         if buffer_nd.size != np.prod(shape):
 *             raise ValueError('buffer size does not match shape :: '             # <<<<<<<<<<<<<<
 *                     'buffer.size=%s != np.prod(shape)=%s' % (
 *                     buffer_nd.size, np.prod(shape)))
 */
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_17); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 3350, __pyx_L1_error)

      /* "miniga4py/ga.pyx":3349
 *     # the requested region
 *     if buffer_nd.ndim == 1:
 *         if buffer_nd.size != np.prod(shape):             # <<<<<<<<<<<<<<
 *             raise ValueError('buffer size does not match shape :: '
 *                     'buffer.size=%s != np.prod(shape)=%s' % (
 */
    }

    /* "miniga4py/ga.pyx":3353
 *                     'buffer.size=%s != np.prod(shape)=%s' % (
 *                     buffer_nd.size, np.prod(shape)))
 *         ld_nd = shape[1:]             # <<<<<<<<<<<<<<
 *     else:
 *         buffer_shape = [buffer_nd.shape[i] for i in range(buffer_nd.ndim)]
 */
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_shape), __pyx_slice__29); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3353, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3353, __pyx_L1_error)
    __pyx_t_6 = ((PyArrayObject *)__pyx_t_4);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ld_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        }
        __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
      }
      __pyx_pybuffernd_ld_nd.diminfo[0].strides = __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ld_nd.diminfo[0].shape = __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3353, __pyx_L1_error)
    }
    __pyx_t_6 = 0;
    __pyx_v_ld_nd = ((PyArrayObject *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "miniga4py/ga.pyx":3348
 *     # we allow 1-d "flat" buffers in addition to buffers matching the shape of
 *     # the requested region
 *     if buffer_nd.ndim == 1:             # <<<<<<<<<<<<<<
 *         if buffer_nd.size != np.prod(shape):
 *             raise ValueError('buffer size does not match shape :: '
 */
    goto __pyx_L13;
  }

  /* "miniga4py/ga.pyx":3355
 *         ld_nd = shape[1:]
 *     else:
 *         buffer_shape = [buffer_nd.shape[i] for i in range(buffer_nd.ndim)]             # <<<<<<<<<<<<<<
 *         if not np.all(buffer_shape == shape):
 *             raise ValueError('buffer shape does not match request shape :: '
 */
  /*else*/ {
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_buffer_nd->nd); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    if (likely(PyList_CheckExact(__pyx_t_16)) || PyTuple_CheckExact(__pyx_t_16)) {
      __pyx_t_17 = __pyx_t_16; __Pyx_INCREF(__pyx_t_17); __pyx_t_13 = 0;
      __pyx_t_14 = NULL;
    } else {
      __pyx_t_13 = -1; __pyx_t_17 = PyObject_GetIter(__pyx_t_16); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3355, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_14 = Py_TYPE(__pyx_t_17)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3355, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    for (;;) {
      if (likely(!__pyx_t_14)) {
        if (likely(PyList_CheckExact(__pyx_t_17))) {
          if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_17)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_16 = PyList_GET_ITEM(__pyx_t_17, __pyx_t_13); __Pyx_INCREF(__pyx_t_16); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 3355, __pyx_L1_error)
          #else
          __pyx_t_16 = PySequence_ITEM(__pyx_t_17, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3355, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_16);
          #endif
        } else {
          if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_17)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_16 = PyTuple_GET_ITEM(__pyx_t_17, __pyx_t_13); __Pyx_INCREF(__pyx_t_16); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 3355, __pyx_L1_error)
          #else
          __pyx_t_16 = PySequence_ITEM(__pyx_t_17, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3355, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_16);
          #endif
        }
      } else {
        __pyx_t_16 = __pyx_t_14(__pyx_t_17);
        if (unlikely(!__pyx_t_16)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 3355, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_16);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_16);
      __pyx_t_16 = 0;
      __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3355, __pyx_L1_error)
      __pyx_t_16 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_buffer_nd->dimensions[__pyx_t_15])); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3355, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_16))) __PYX_ERR(0, 3355, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    }
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __pyx_v_buffer_shape = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "miniga4py/ga.pyx":3356
 *     else:
 *         buffer_shape = [buffer_nd.shape[i] for i in range(buffer_nd.ndim)]
 *         if not np.all(buffer_shape == shape):             # <<<<<<<<<<<<<<
 *             raise ValueError('buffer shape does not match request shape :: '
 *                     'buffer_shape=%s != shape=%s' % (
 */
    __pyx_t_17 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3356, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_all); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3356, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __pyx_t_17 = PyObject_RichCompare(__pyx_v_buffer_shape, ((PyObject *)__pyx_v_shape), Py_EQ); __Pyx_XGOTREF(__pyx_t_17); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3356, __pyx_L1_error)
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_16);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_16, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_17); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3356, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_16)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_17};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3356, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_17};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3356, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      } else
      #endif
      {
        __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3356, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_GIVEREF(__pyx_t_17);
        PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_17);
        __pyx_t_17 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3356, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 3356, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_11 = ((!__pyx_t_12) != 0);
    if (unlikely(__pyx_t_11)) {

      /* "miniga4py/ga.pyx":3359
 *             raise ValueError('buffer shape does not match request shape :: '
 *                     'buffer_shape=%s != shape=%s' % (
 *                     buffer_shape, shape))             # <<<<<<<<<<<<<<
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)
 */
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3359, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_buffer_shape);
      __Pyx_GIVEREF(__pyx_v_buffer_shape);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_buffer_shape);
      __Pyx_INCREF(((PyObject *)__pyx_v_shape));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_shape));
      PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_shape));

      /* "miniga4py/ga.pyx":3358
 *         if not np.all(buffer_shape == shape):
 *             raise ValueError('buffer shape does not match request shape :: '
 *                     'buffer_shape=%s != shape=%s' % (             # <<<<<<<<<<<<<<
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 */
      __pyx_t_16 = __Pyx_PyString_Format(__pyx_kp_s_buffer_shape_does_not_match_requ, __pyx_t_4); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3358, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "miniga4py/ga.pyx":3357
 *         buffer_shape = [buffer_nd.shape[i] for i in range(buffer_nd.ndim)]
 *         if not np.all(buffer_shape == shape):
 *             raise ValueError('buffer shape does not match request shape :: '             # <<<<<<<<<<<<<<
 *                     'buffer_shape=%s != shape=%s' % (
 *                     buffer_shape, shape))
 */
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3357, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 3357, __pyx_L1_error)

      /* "miniga4py/ga.pyx":3356
 *     else:
 *         buffer_shape = [buffer_nd.shape[i] for i in range(buffer_nd.ndim)]
 *         if not np.all(buffer_shape == shape):             # <<<<<<<<<<<<<<
 *             raise ValueError('buffer shape does not match request shape :: '
 *                     'buffer_shape=%s != shape=%s' % (
 */
    }

    /* "miniga4py/ga.pyx":3360
 *                     'buffer_shape=%s != shape=%s' % (
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]             # <<<<<<<<<<<<<<
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)
 *     if nb:
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3360, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3360, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3360, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "miniga4py/ga.pyx":3361
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)             # <<<<<<<<<<<<<<
 *     if nb:
 *         NGA_NbPut64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 */
    __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_buffer_nd->nd - 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_17 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (likely(PyList_CheckExact(__pyx_t_17)) || PyTuple_CheckExact(__pyx_t_17)) {
      __pyx_t_1 = __pyx_t_17; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0;
      __pyx_t_14 = NULL;
    } else {
      __pyx_t_13 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_17); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3361, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_14 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3361, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    for (;;) {
      if (likely(!__pyx_t_14)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_17 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_17); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 3361, __pyx_L1_error)
          #else
          __pyx_t_17 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3361, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_17);
          #endif
        } else {
          if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_17 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_17); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 3361, __pyx_L1_error)
          #else
          __pyx_t_17 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3361, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_17);
          #endif
        }
      } else {
        __pyx_t_17 = __pyx_t_14(__pyx_t_1);
        if (unlikely(!__pyx_t_17)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 3361, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_17);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_17);
      __pyx_t_17 = 0;

      /* "miniga4py/ga.pyx":3360
 *                     'buffer_shape=%s != shape=%s' % (
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]             # <<<<<<<<<<<<<<
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)
 *     if nb:
 */
      __pyx_t_17 = __Pyx_PyObject_GetItem(__pyx_v_strides, __pyx_v_i); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3360, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3360, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_strides, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3360, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_17, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3360, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 3360, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "miniga4py/ga.pyx":3361
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)             # <<<<<<<<<<<<<<
 *     if nb:
 *         NGA_NbPut64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "miniga4py/ga.pyx":3360
 *                     'buffer_shape=%s != shape=%s' % (
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]             # <<<<<<<<<<<<<<
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)
 *     if nb:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3360, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "miniga4py/ga.pyx":3361
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)             # <<<<<<<<<<<<<<
 *     if nb:
 *         NGA_NbPut64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 */
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 3361, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "miniga4py/ga.pyx":3360
 *                     'buffer_shape=%s != shape=%s' % (
 *                     buffer_shape, shape))
 *         ld_nd = np.asarray([strides[i]/strides[i+1]             # <<<<<<<<<<<<<<
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)
 *     if nb:
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3360, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3360, __pyx_L1_error)
    __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ld_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
        }
        __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
      }
      __pyx_pybuffernd_ld_nd.diminfo[0].strides = __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ld_nd.diminfo[0].shape = __pyx_pybuffernd_ld_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3360, __pyx_L1_error)
    }
    __pyx_t_6 = 0;
    __pyx_v_ld_nd = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L13:;

  /* "miniga4py/ga.pyx":3362
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)
 *     if nb:             # <<<<<<<<<<<<<<
 *         NGA_NbPut64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, &nbhandle)
 */
  __pyx_t_11 = (__pyx_v_nb != 0);
  if (__pyx_t_11) {

    /* "miniga4py/ga.pyx":3363
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)
 *     if nb:
 *         NGA_NbPut64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,             # <<<<<<<<<<<<<<
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, &nbhandle)
 *         return nbhandle
 */
    NGA_NbPut64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data), ((void *)__pyx_v_buffer_nd->data), ((int64_t *)__pyx_v_ld_nd->data), (&__pyx_v_nbhandle));

    /* "miniga4py/ga.pyx":3365
 *         NGA_NbPut64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, &nbhandle)
 *         return nbhandle             # <<<<<<<<<<<<<<
 *     elif periodic:
 *         NGA_Periodic_put64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_Integer(__pyx_v_nbhandle); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":3362
 *         ld_nd = np.asarray([strides[i]/strides[i+1]
 *                 for i in range(buffer_nd.ndim-1)], dtype=np.int64)
 *     if nb:             # <<<<<<<<<<<<<<
 *         NGA_NbPut64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, &nbhandle)
 */
  }

  /* "miniga4py/ga.pyx":3366
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, &nbhandle)
 *         return nbhandle
 *     elif periodic:             # <<<<<<<<<<<<<<
 *         NGA_Periodic_put64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data)
 */
  __pyx_t_11 = (__pyx_v_periodic != 0);
  if (__pyx_t_11) {

    /* "miniga4py/ga.pyx":3367
 *         return nbhandle
 *     elif periodic:
 *         NGA_Periodic_put64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,             # <<<<<<<<<<<<<<
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data)
 *     elif skip is not None:
 */
    NGA_Periodic_put64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data), ((void *)__pyx_v_buffer_nd->data), ((int64_t *)__pyx_v_ld_nd->data));

    /* "miniga4py/ga.pyx":3366
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, &nbhandle)
 *         return nbhandle
 *     elif periodic:             # <<<<<<<<<<<<<<
 *         NGA_Periodic_put64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data)
 */
    goto __pyx_L20;
  }

  /* "miniga4py/ga.pyx":3369
 *         NGA_Periodic_put64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data)
 *     elif skip is not None:             # <<<<<<<<<<<<<<
 *         NGA_Strided_put64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <int64_t*>skip_nd.data,
 */
  __pyx_t_11 = (__pyx_v_skip != Py_None);
  __pyx_t_12 = (__pyx_t_11 != 0);
  if (__pyx_t_12) {

    /* "miniga4py/ga.pyx":3370
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data)
 *     elif skip is not None:
 *         NGA_Strided_put64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,             # <<<<<<<<<<<<<<
 *                 <int64_t*>skip_nd.data,
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data)
 */
    NGA_Strided_put64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data), ((int64_t *)__pyx_v_skip_nd->data), ((void *)__pyx_v_buffer_nd->data), ((int64_t *)__pyx_v_ld_nd->data));

    /* "miniga4py/ga.pyx":3369
 *         NGA_Periodic_put64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data)
 *     elif skip is not None:             # <<<<<<<<<<<<<<
 *         NGA_Strided_put64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <int64_t*>skip_nd.data,
 */
    goto __pyx_L20;
  }

  /* "miniga4py/ga.pyx":3374
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data)
 *     else:
 *         NGA_Put64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,             # <<<<<<<<<<<<<<
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data)
 * 
 */
  /*else*/ {

    /* "miniga4py/ga.pyx":3375
 *     else:
 *         NGA_Put64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data,
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data)             # <<<<<<<<<<<<<<
 * 
 * def randomize(int g_a, val=None):
 */
    NGA_Put64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data), ((void *)__pyx_v_buffer_nd->data), ((int64_t *)__pyx_v_ld_nd->data));
  }
  __pyx_L20:;

  /* "miniga4py/ga.pyx":3291
 *     _put_common(g_a, buffer, lo, hi)
 * 
 * cdef _put_common(int g_a, buffer, lo=None, hi=None,             # <<<<<<<<<<<<<<
 *         bint nb=False, bint periodic=False, skip=None):
 *     """Copies data from local array buffer to the global array section.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_shape.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga._put_common", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ld_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_shape.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_skip_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_buffer_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_lo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_ld_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_shape);
  __Pyx_XDECREF((PyObject *)__pyx_v_skip_nd);
  __Pyx_XDECREF(__pyx_v_dtype);
  __Pyx_XDECREF(__pyx_v_strides);
  __Pyx_XDECREF(__pyx_v_buffer_shape);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3377
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data)
 * 
 * def randomize(int g_a, val=None):             # <<<<<<<<<<<<<<
 *     """Fill array with random values in [0,val)."""
 *     cdef int gtype=inquire_type(g_a)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_265randomize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_264randomize[] = "randomize(int g_a, val=None)\nFill array with random values in [0,val).";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_265randomize = {"randomize", (PyCFunction)__pyx_pw_9miniga4py_2ga_265randomize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_264randomize};
static PyObject *__pyx_pw_9miniga4py_2ga_265randomize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_val = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("randomize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_val,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "randomize") < 0)) __PYX_ERR(0, 3377, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3377, __pyx_L3_error)
    __pyx_v_val = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("randomize", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3377, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.randomize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_264randomize(__pyx_self, __pyx_v_g_a, __pyx_v_val);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_264randomize(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_val) {
  int __pyx_v_gtype;
  int __pyx_v_ival;
  long __pyx_v_lval;
  PY_LONG_LONG __pyx_v_llval;
  float __pyx_v_fval;
  double __pyx_v_dval;
  long double __pyx_v_ldval;
  SingleComplex __pyx_v_fcval;
  DoubleComplex __pyx_v_dcval;
  void *__pyx_v_vval;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("randomize", 0);
  __Pyx_INCREF(__pyx_v_val);

  /* "miniga4py/ga.pyx":3379
 * def randomize(int g_a, val=None):
 *     """Fill array with random values in [0,val)."""
 *     cdef int gtype=inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     cdef int            ival
 *     cdef long           lval
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":3388
 *     cdef SingleComplex  fcval
 *     cdef DoubleComplex  dcval
 *     cdef void          *vval=NULL             # <<<<<<<<<<<<<<
 *     if val is None:
 *         val = 1
 */
  __pyx_v_vval = NULL;

  /* "miniga4py/ga.pyx":3389
 *     cdef DoubleComplex  dcval
 *     cdef void          *vval=NULL
 *     if val is None:             # <<<<<<<<<<<<<<
 *         val = 1
 *     vval = _convert_multiplier(gtype, val,
 */
  __pyx_t_1 = (__pyx_v_val == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "miniga4py/ga.pyx":3390
 *     cdef void          *vval=NULL
 *     if val is None:
 *         val = 1             # <<<<<<<<<<<<<<
 *     vval = _convert_multiplier(gtype, val,
 *             &ival,  &lval,  &llval,
 */
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_DECREF_SET(__pyx_v_val, __pyx_int_1);

    /* "miniga4py/ga.pyx":3389
 *     cdef DoubleComplex  dcval
 *     cdef void          *vval=NULL
 *     if val is None:             # <<<<<<<<<<<<<<
 *         val = 1
 *     vval = _convert_multiplier(gtype, val,
 */
  }

  /* "miniga4py/ga.pyx":3391
 *     if val is None:
 *         val = 1
 *     vval = _convert_multiplier(gtype, val,             # <<<<<<<<<<<<<<
 *             &ival,  &lval,  &llval,
 *             &fval,  &dval,  &ldval,
 */
  __pyx_v_vval = __pyx_f_9miniga4py_2ga__convert_multiplier(__pyx_v_gtype, __pyx_v_val, (&__pyx_v_ival), (&__pyx_v_lval), (&__pyx_v_llval), (&__pyx_v_fval), (&__pyx_v_dval), (&__pyx_v_ldval), (&__pyx_v_fcval), (&__pyx_v_dcval));

  /* "miniga4py/ga.pyx":3395
 *             &fval,  &dval,  &ldval,
 *             &fcval, &dcval)
 *     GA_Randomize(g_a, vval)             # <<<<<<<<<<<<<<
 * 
 * def read_inc(int g_a, subscript, long inc=1):
 */
  GA_Randomize(__pyx_v_g_a, __pyx_v_vval);

  /* "miniga4py/ga.pyx":3377
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data)
 * 
 * def randomize(int g_a, val=None):             # <<<<<<<<<<<<<<
 *     """Fill array with random values in [0,val)."""
 *     cdef int gtype=inquire_type(g_a)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3397
 *     GA_Randomize(g_a, vval)
 * 
 * def read_inc(int g_a, subscript, long inc=1):             # <<<<<<<<<<<<<<
 *     """Atomically read and increment an element in an integer array.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_267read_inc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_266read_inc[] = "read_inc(int g_a, subscript, long inc=1)\nAtomically read and increment an element in an integer array. \n\n    This is a one-sided and atomic operation.\n\n    :Parameters:\n        g_a : int\n            the array handle\n        subscript : 1D array-like of integers\n            index for the referenced element\n        inc : long\n            the increment\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_267read_inc = {"read_inc", (PyCFunction)__pyx_pw_9miniga4py_2ga_267read_inc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_266read_inc};
static PyObject *__pyx_pw_9miniga4py_2ga_267read_inc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_subscript = 0;
  long __pyx_v_inc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read_inc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_subscript,&__pyx_n_s_inc,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_subscript)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("read_inc", 0, 2, 3, 1); __PYX_ERR(0, 3397, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inc);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_inc") < 0)) __PYX_ERR(0, 3397, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3397, __pyx_L3_error)
    __pyx_v_subscript = values[1];
    if (values[2]) {
      __pyx_v_inc = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_inc == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 3397, __pyx_L3_error)
    } else {
      __pyx_v_inc = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("read_inc", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3397, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.read_inc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_266read_inc(__pyx_self, __pyx_v_g_a, __pyx_v_subscript, __pyx_v_inc);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_266read_inc(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_subscript, long __pyx_v_inc) {
  PyArrayObject *__pyx_v_subscript_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_subscript_nd;
  __Pyx_Buffer __pyx_pybuffer_subscript_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("read_inc", 0);
  __pyx_pybuffer_subscript_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_subscript_nd.refcount = 0;
  __pyx_pybuffernd_subscript_nd.data = NULL;
  __pyx_pybuffernd_subscript_nd.rcbuffer = &__pyx_pybuffer_subscript_nd;

  /* "miniga4py/ga.pyx":3412
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] subscript_nd
 *     subscript_nd = _inta64(subscript)             # <<<<<<<<<<<<<<
 *     return NGA_Read_inc64(g_a, <int64_t*>subscript_nd.data, inc)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_subscript)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_subscript_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      }
      __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
    }
    __pyx_pybuffernd_subscript_nd.diminfo[0].strides = __pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subscript_nd.diminfo[0].shape = __pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3412, __pyx_L1_error)
  }
  __pyx_v_subscript_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":3413
 *     cdef np.ndarray[np.int64_t, ndim=1] subscript_nd
 *     subscript_nd = _inta64(subscript)
 *     return NGA_Read_inc64(g_a, <int64_t*>subscript_nd.data, inc)             # <<<<<<<<<<<<<<
 * 
 * def register_dtype(dtype):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(NGA_Read_inc64(__pyx_v_g_a, ((int64_t *)__pyx_v_subscript_nd->data), __pyx_v_inc)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3397
 *     GA_Randomize(g_a, vval)
 * 
 * def read_inc(int g_a, subscript, long inc=1):             # <<<<<<<<<<<<<<
 *     """Atomically read and increment an element in an integer array.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.read_inc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_subscript_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3415
 *     return NGA_Read_inc64(g_a, <int64_t*>subscript_nd.data, inc)
 * 
 * def register_dtype(dtype):             # <<<<<<<<<<<<<<
 *     """Creates a new data type based on the given dtype.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_269register_dtype(PyObject *__pyx_self, PyObject *__pyx_v_dtype); /*proto*/
static char __pyx_doc_9miniga4py_2ga_268register_dtype[] = "register_dtype(dtype)\nCreates a new data type based on the given dtype.\n\n    :Parameters:\n        dtype : dtype\n            the numpy dtype to register\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_269register_dtype = {"register_dtype", (PyCFunction)__pyx_pw_9miniga4py_2ga_269register_dtype, METH_O, __pyx_doc_9miniga4py_2ga_268register_dtype};
static PyObject *__pyx_pw_9miniga4py_2ga_269register_dtype(PyObject *__pyx_self, PyObject *__pyx_v_dtype) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("register_dtype (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_268register_dtype(__pyx_self, ((PyObject *)__pyx_v_dtype));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_268register_dtype(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dtype) {
  int __pyx_v_gatype;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  __Pyx_RefNannySetupContext("register_dtype", 0);
  __Pyx_INCREF(__pyx_v_dtype);

  /* "miniga4py/ga.pyx":3424
 *     """
 *     cdef int gatype
 *     dtype = np.dtype(dtype) # just in case it's not really a dtype instance             # <<<<<<<<<<<<<<
 *     gatype = NGA_Register_type(dtype.itemsize)
 *     _to_dtype[gatype] = dtype
 */
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_v_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_dtype, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":3425
 *     cdef int gatype
 *     dtype = np.dtype(dtype) # just in case it's not really a dtype instance
 *     gatype = NGA_Register_type(dtype.itemsize)             # <<<<<<<<<<<<<<
 *     _to_dtype[gatype] = dtype
 *     return gatype
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3425, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_gatype = NGA_Register_type(__pyx_t_2);

  /* "miniga4py/ga.pyx":3426
 *     dtype = np.dtype(dtype) # just in case it's not really a dtype instance
 *     gatype = NGA_Register_type(dtype.itemsize)
 *     _to_dtype[gatype] = dtype             # <<<<<<<<<<<<<<
 *     return gatype
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_to_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_1, __pyx_v_gatype, __pyx_v_dtype, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) __PYX_ERR(0, 3426, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":3427
 *     gatype = NGA_Register_type(dtype.itemsize)
 *     _to_dtype[gatype] = dtype
 *     return gatype             # <<<<<<<<<<<<<<
 * 
 * def register_type(size_t bytes):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_gatype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3415
 *     return NGA_Read_inc64(g_a, <int64_t*>subscript_nd.data, inc)
 * 
 * def register_dtype(dtype):             # <<<<<<<<<<<<<<
 *     """Creates a new data type based on the given dtype.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.register_dtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_dtype);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3429
 *     return gatype
 * 
 * def register_type(size_t bytes):             # <<<<<<<<<<<<<<
 *     """Creates a new data type of size bytes.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_271register_type(PyObject *__pyx_self, PyObject *__pyx_arg_bytes); /*proto*/
static char __pyx_doc_9miniga4py_2ga_270register_type[] = "register_type(size_t bytes)\nCreates a new data type of size bytes.\n\n    :Parameters:\n        bytes : size_t\n            the size of the new data type\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_271register_type = {"register_type", (PyCFunction)__pyx_pw_9miniga4py_2ga_271register_type, METH_O, __pyx_doc_9miniga4py_2ga_270register_type};
static PyObject *__pyx_pw_9miniga4py_2ga_271register_type(PyObject *__pyx_self, PyObject *__pyx_arg_bytes) {
  size_t __pyx_v_bytes;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("register_type (wrapper)", 0);
  assert(__pyx_arg_bytes); {
    __pyx_v_bytes = __Pyx_PyInt_As_size_t(__pyx_arg_bytes); if (unlikely((__pyx_v_bytes == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3429, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.register_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_270register_type(__pyx_self, ((size_t)__pyx_v_bytes));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_270register_type(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_bytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("register_type", 0);

  /* "miniga4py/ga.pyx":3437
 * 
 *     """
 *     return NGA_Register_type(bytes)             # <<<<<<<<<<<<<<
 * 
 * def recip(int g_a, lo=None, hi=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(NGA_Register_type(__pyx_v_bytes)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3429
 *     return gatype
 * 
 * def register_type(size_t bytes):             # <<<<<<<<<<<<<<
 *     """Creates a new data type of size bytes.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.register_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3439
 *     return NGA_Register_type(bytes)
 * 
 * def recip(int g_a, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Take element-wise reciprocal of the array or patch.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_273recip(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_272recip[] = "recip(int g_a, lo=None, hi=None)\nTake element-wise reciprocal of the array or patch.\n\n    This is a collective operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_273recip = {"recip", (PyCFunction)__pyx_pw_9miniga4py_2ga_273recip, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_272recip};
static PyObject *__pyx_pw_9miniga4py_2ga_273recip(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("recip (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_lo,&__pyx_n_s_hi,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "recip") < 0)) __PYX_ERR(0, 3439, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3439, __pyx_L3_error)
    __pyx_v_lo = values[1];
    __pyx_v_hi = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("recip", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3439, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.recip", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_272recip(__pyx_self, __pyx_v_g_a, __pyx_v_lo, __pyx_v_hi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_272recip(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
  PyArrayObject *__pyx_v_lo_nd = 0;
  PyArrayObject *__pyx_v_hi_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_nd;
  __Pyx_Buffer __pyx_pybuffer_hi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lo_nd;
  __Pyx_Buffer __pyx_pybuffer_lo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  __Pyx_RefNannySetupContext("recip", 0);
  __pyx_pybuffer_lo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_lo_nd.refcount = 0;
  __pyx_pybuffernd_lo_nd.data = NULL;
  __pyx_pybuffernd_lo_nd.rcbuffer = &__pyx_pybuffer_lo_nd;
  __pyx_pybuffer_hi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_nd.refcount = 0;
  __pyx_pybuffernd_hi_nd.data = NULL;
  __pyx_pybuffernd_hi_nd.rcbuffer = &__pyx_pybuffer_hi_nd;

  /* "miniga4py/ga.pyx":3446
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 *     if lo is None and hi is None:             # <<<<<<<<<<<<<<
 *         GA_Recip(g_a)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_lo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_hi == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":3447
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 *     if lo is None and hi is None:
 *         GA_Recip(g_a)             # <<<<<<<<<<<<<<
 *     else:
 *         lo_nd,hi_nd = _lohi(g_a,lo,hi)
 */
    GA_Recip(__pyx_v_g_a);

    /* "miniga4py/ga.pyx":3446
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 *     if lo is None and hi is None:             # <<<<<<<<<<<<<<
 *         GA_Recip(g_a)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "miniga4py/ga.pyx":3449
 *         GA_Recip(g_a)
 *     else:
 *         lo_nd,hi_nd = _lohi(g_a,lo,hi)             # <<<<<<<<<<<<<<
 *         GA_Recip_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_lo, __pyx_v_hi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3449, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 3449, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3449, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3449, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3449, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 3449, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 3449, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3449, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3449, __pyx_L1_error)
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_lo_nd.diminfo[0].strides = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_nd.diminfo[0].shape = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 3449, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_lo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 3449, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":3450
 *     else:
 *         lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *         GA_Recip_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)             # <<<<<<<<<<<<<<
 * 
 * def release(int g_a, lo=None, hi=None):
 */
    GA_Recip_patch64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data));
  }
  __pyx_L3:;

  /* "miniga4py/ga.pyx":3439
 *     return NGA_Register_type(bytes)
 * 
 * def recip(int g_a, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Take element-wise reciprocal of the array or patch.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.recip", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3452
 *         GA_Recip_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 * def release(int g_a, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Releases access to a global array when the data was read only.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_275release(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_274release[] = "release(int g_a, lo=None, hi=None)\nReleases access to a global array when the data was read only.\n\n    Your code should look like:\n\n        array = ga.access(g_a)\n        # <operate on the data referenced by ptr> \n        ga.release(g_a)\n\n    NOTE: see restrictions specified for ga.access\n\n    This operation is local. \n    \n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_275release = {"release", (PyCFunction)__pyx_pw_9miniga4py_2ga_275release, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_274release};
static PyObject *__pyx_pw_9miniga4py_2ga_275release(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("release (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_lo,&__pyx_n_s_hi,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "release") < 0)) __PYX_ERR(0, 3452, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3452, __pyx_L3_error)
    __pyx_v_lo = values[1];
    __pyx_v_hi = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("release", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3452, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.release", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_274release(__pyx_self, __pyx_v_g_a, __pyx_v_lo, __pyx_v_hi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_274release(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("release", 0);

  /* "miniga4py/ga.pyx":3466
 * 
 *     """
 *     _release_common(g_a, lo, hi, False)             # <<<<<<<<<<<<<<
 * 
 * def release_block(int g_a, int index):
 */
  __pyx_t_1 = __pyx_f_9miniga4py_2ga__release_common(__pyx_v_g_a, __pyx_v_lo, __pyx_v_hi, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":3452
 *         GA_Recip_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 * def release(int g_a, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Releases access to a global array when the data was read only.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.release", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3468
 *     _release_common(g_a, lo, hi, False)
 * 
 * def release_block(int g_a, int index):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of data specified by the integer index
 *     when data was accessed as read only.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_277release_block(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_276release_block[] = "release_block(int g_a, int index)\nReleases access to the block of data specified by the integer index\n    when data was accessed as read only.\n    \n    This is only applicable to block-cyclic data distributions created using\n    the simple block-cyclic distribution. This is a local operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_277release_block = {"release_block", (PyCFunction)__pyx_pw_9miniga4py_2ga_277release_block, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_276release_block};
static PyObject *__pyx_pw_9miniga4py_2ga_277release_block(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_index;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("release_block (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_index,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_index)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("release_block", 1, 2, 2, 1); __PYX_ERR(0, 3468, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "release_block") < 0)) __PYX_ERR(0, 3468, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3468, __pyx_L3_error)
    __pyx_v_index = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3468, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("release_block", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3468, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.release_block", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_276release_block(__pyx_self, __pyx_v_g_a, __pyx_v_index);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_276release_block(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("release_block", 0);

  /* "miniga4py/ga.pyx":3476
 * 
 *     """
 *     NGA_Release_block(g_a, index)             # <<<<<<<<<<<<<<
 * 
 * def release_block_grid(int g_a, subscript):
 */
  NGA_Release_block(__pyx_v_g_a, __pyx_v_index);

  /* "miniga4py/ga.pyx":3468
 *     _release_common(g_a, lo, hi, False)
 * 
 * def release_block(int g_a, int index):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of data specified by the integer index
 *     when data was accessed as read only.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3478
 *     NGA_Release_block(g_a, index)
 * 
 * def release_block_grid(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of data specified by the subscript array
 *     when data was accessed as read only.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_279release_block_grid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_278release_block_grid[] = "release_block_grid(int g_a, subscript)\nReleases access to the block of data specified by the subscript array\n    when data was accessed as read only.\n    \n    This is only applicable to block-cyclic data distributions created using\n    the SCALAPACK data distribution.\n    \n    This is a local operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_279release_block_grid = {"release_block_grid", (PyCFunction)__pyx_pw_9miniga4py_2ga_279release_block_grid, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_278release_block_grid};
static PyObject *__pyx_pw_9miniga4py_2ga_279release_block_grid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_subscript = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("release_block_grid (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_subscript,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_subscript)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("release_block_grid", 1, 2, 2, 1); __PYX_ERR(0, 3478, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "release_block_grid") < 0)) __PYX_ERR(0, 3478, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3478, __pyx_L3_error)
    __pyx_v_subscript = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("release_block_grid", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3478, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.release_block_grid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_278release_block_grid(__pyx_self, __pyx_v_g_a, __pyx_v_subscript);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_278release_block_grid(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_subscript) {
  PyArrayObject *__pyx_v_subscript_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_subscript_nd;
  __Pyx_Buffer __pyx_pybuffer_subscript_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("release_block_grid", 0);
  __pyx_pybuffer_subscript_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_subscript_nd.refcount = 0;
  __pyx_pybuffernd_subscript_nd.data = NULL;
  __pyx_pybuffernd_subscript_nd.rcbuffer = &__pyx_pybuffer_subscript_nd;

  /* "miniga4py/ga.pyx":3489
 *     """
 *     cdef np.ndarray[np.int32_t, ndim=1] subscript_nd
 *     subscript_nd = _inta32(subscript)             # <<<<<<<<<<<<<<
 *     NGA_Release_block_grid(g_a, <int*>subscript_nd.data)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta32(__pyx_v_subscript)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_subscript_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      }
      __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
    }
    __pyx_pybuffernd_subscript_nd.diminfo[0].strides = __pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subscript_nd.diminfo[0].shape = __pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3489, __pyx_L1_error)
  }
  __pyx_v_subscript_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":3490
 *     cdef np.ndarray[np.int32_t, ndim=1] subscript_nd
 *     subscript_nd = _inta32(subscript)
 *     NGA_Release_block_grid(g_a, <int*>subscript_nd.data)             # <<<<<<<<<<<<<<
 * 
 * def release_block_segment(int g_a, int proc):
 */
  NGA_Release_block_grid(__pyx_v_g_a, ((int *)__pyx_v_subscript_nd->data));

  /* "miniga4py/ga.pyx":3478
 *     NGA_Release_block(g_a, index)
 * 
 * def release_block_grid(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of data specified by the subscript array
 *     when data was accessed as read only.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.release_block_grid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_subscript_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3492
 *     NGA_Release_block_grid(g_a, <int*>subscript_nd.data)
 * 
 * def release_block_segment(int g_a, int proc):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of locally held data for a block-cyclic
 *     array, when data was accessed as read-only.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_281release_block_segment(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_280release_block_segment[] = "release_block_segment(int g_a, int proc)\nReleases access to the block of locally held data for a block-cyclic\n    array, when data was accessed as read-only.\n    \n    This is a local operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_281release_block_segment = {"release_block_segment", (PyCFunction)__pyx_pw_9miniga4py_2ga_281release_block_segment, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_280release_block_segment};
static PyObject *__pyx_pw_9miniga4py_2ga_281release_block_segment(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_proc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("release_block_segment (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_proc,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_proc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("release_block_segment", 1, 2, 2, 1); __PYX_ERR(0, 3492, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "release_block_segment") < 0)) __PYX_ERR(0, 3492, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3492, __pyx_L3_error)
    __pyx_v_proc = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_proc == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3492, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("release_block_segment", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3492, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.release_block_segment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_280release_block_segment(__pyx_self, __pyx_v_g_a, __pyx_v_proc);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_280release_block_segment(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_proc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("release_block_segment", 0);

  /* "miniga4py/ga.pyx":3499
 * 
 *     """
 *     NGA_Release_block_segment(g_a, proc)             # <<<<<<<<<<<<<<
 * 
 * cdef _release_common(int g_a, lo, hi, bint update):
 */
  NGA_Release_block_segment(__pyx_v_g_a, __pyx_v_proc);

  /* "miniga4py/ga.pyx":3492
 *     NGA_Release_block_grid(g_a, <int*>subscript_nd.data)
 * 
 * def release_block_segment(int g_a, int proc):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of locally held data for a block-cyclic
 *     array, when data was accessed as read-only.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3501
 *     NGA_Release_block_segment(g_a, proc)
 * 
 * cdef _release_common(int g_a, lo, hi, bint update):             # <<<<<<<<<<<<<<
 *     """TODO"""
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd, lo_dst, hi_dst
 */

static PyObject *__pyx_f_9miniga4py_2ga__release_common(int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, int __pyx_v_update) {
  PyArrayObject *__pyx_v_lo_nd = 0;
  PyArrayObject *__pyx_v_hi_nd = 0;
  PyArrayObject *__pyx_v_lo_dst = 0;
  PyArrayObject *__pyx_v_hi_dst = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_dst;
  __Pyx_Buffer __pyx_pybuffer_hi_dst;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_nd;
  __Pyx_Buffer __pyx_pybuffer_hi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lo_dst;
  __Pyx_Buffer __pyx_pybuffer_lo_dst;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lo_nd;
  __Pyx_Buffer __pyx_pybuffer_lo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  __Pyx_RefNannySetupContext("_release_common", 0);
  __pyx_pybuffer_lo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_lo_nd.refcount = 0;
  __pyx_pybuffernd_lo_nd.data = NULL;
  __pyx_pybuffernd_lo_nd.rcbuffer = &__pyx_pybuffer_lo_nd;
  __pyx_pybuffer_hi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_nd.refcount = 0;
  __pyx_pybuffernd_hi_nd.data = NULL;
  __pyx_pybuffernd_hi_nd.rcbuffer = &__pyx_pybuffer_hi_nd;
  __pyx_pybuffer_lo_dst.pybuffer.buf = NULL;
  __pyx_pybuffer_lo_dst.refcount = 0;
  __pyx_pybuffernd_lo_dst.data = NULL;
  __pyx_pybuffernd_lo_dst.rcbuffer = &__pyx_pybuffer_lo_dst;
  __pyx_pybuffer_hi_dst.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_dst.refcount = 0;
  __pyx_pybuffernd_hi_dst.data = NULL;
  __pyx_pybuffernd_hi_dst.rcbuffer = &__pyx_pybuffer_hi_dst;

  /* "miniga4py/ga.pyx":3505
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd, lo_dst, hi_dst
 *     # first things first, if no data is owned, return silently
 *     lo_dst,hi_dst = distribution(g_a)             # <<<<<<<<<<<<<<
 *     # convet hi_dst back to GA inclusive indexing convention
 *     hi_dst -= 1
 */
  __pyx_t_1 = __pyx_f_9miniga4py_2ga_distribution(__pyx_v_g_a, 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3505, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 3505, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 3505, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3505, __pyx_L1_error)
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3505, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_dst.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_dst.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_dst.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_dst, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_lo_dst.diminfo[0].strides = __pyx_pybuffernd_lo_dst.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_dst.diminfo[0].shape = __pyx_pybuffernd_lo_dst.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3505, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_lo_dst = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_dst, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
      __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
    }
    __pyx_pybuffernd_hi_dst.diminfo[0].strides = __pyx_pybuffernd_hi_dst.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_dst.diminfo[0].shape = __pyx_pybuffernd_hi_dst.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3505, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_hi_dst = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "miniga4py/ga.pyx":3507
 *     lo_dst,hi_dst = distribution(g_a)
 *     # convet hi_dst back to GA inclusive indexing convention
 *     hi_dst -= 1             # <<<<<<<<<<<<<<
 *     if lo_dst[0] < 0 or hi_dst[0] < 0:
 *         return
 */
  __pyx_t_1 = PyNumber_InPlaceSubtract(((PyObject *)__pyx_v_hi_dst), __pyx_int_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3507, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_dst, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_hi_dst.diminfo[0].strides = __pyx_pybuffernd_hi_dst.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_dst.diminfo[0].shape = __pyx_pybuffernd_hi_dst.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3507, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __Pyx_DECREF_SET(__pyx_v_hi_dst, ((PyArrayObject *)__pyx_t_1));
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":3508
 *     # convet hi_dst back to GA inclusive indexing convention
 *     hi_dst -= 1
 *     if lo_dst[0] < 0 or hi_dst[0] < 0:             # <<<<<<<<<<<<<<
 *         return
 *     if lo is not None:
 */
  __pyx_t_12 = 0;
  __pyx_t_7 = -1;
  if (__pyx_t_12 < 0) {
    __pyx_t_12 += __pyx_pybuffernd_lo_dst.diminfo[0].shape;
    if (unlikely(__pyx_t_12 < 0)) __pyx_t_7 = 0;
  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_lo_dst.diminfo[0].shape)) __pyx_t_7 = 0;
  if (unlikely(__pyx_t_7 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_7);
    __PYX_ERR(0, 3508, __pyx_L1_error)
  }
  __pyx_t_13 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lo_dst.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_lo_dst.diminfo[0].strides)) < 0) != 0);
  if (!__pyx_t_13) {
  } else {
    __pyx_t_11 = __pyx_t_13;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_14 = 0;
  __pyx_t_7 = -1;
  if (__pyx_t_14 < 0) {
    __pyx_t_14 += __pyx_pybuffernd_hi_dst.diminfo[0].shape;
    if (unlikely(__pyx_t_14 < 0)) __pyx_t_7 = 0;
  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_hi_dst.diminfo[0].shape)) __pyx_t_7 = 0;
  if (unlikely(__pyx_t_7 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_7);
    __PYX_ERR(0, 3508, __pyx_L1_error)
  }
  __pyx_t_13 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_hi_dst.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_hi_dst.diminfo[0].strides)) < 0) != 0);
  __pyx_t_11 = __pyx_t_13;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_11) {

    /* "miniga4py/ga.pyx":3509
 *     hi_dst -= 1
 *     if lo_dst[0] < 0 or hi_dst[0] < 0:
 *         return             # <<<<<<<<<<<<<<
 *     if lo is not None:
 *         lo_nd = _inta64(lo)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":3508
 *     # convet hi_dst back to GA inclusive indexing convention
 *     hi_dst -= 1
 *     if lo_dst[0] < 0 or hi_dst[0] < 0:             # <<<<<<<<<<<<<<
 *         return
 *     if lo is not None:
 */
  }

  /* "miniga4py/ga.pyx":3510
 *     if lo_dst[0] < 0 or hi_dst[0] < 0:
 *         return
 *     if lo is not None:             # <<<<<<<<<<<<<<
 *         lo_nd = _inta64(lo)
 *     else:
 */
  __pyx_t_11 = (__pyx_v_lo != Py_None);
  __pyx_t_13 = (__pyx_t_11 != 0);
  if (__pyx_t_13) {

    /* "miniga4py/ga.pyx":3511
 *         return
 *     if lo is not None:
 *         lo_nd = _inta64(lo)             # <<<<<<<<<<<<<<
 *     else:
 *         lo_nd = lo_dst
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_lo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3511, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
        }
        __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
      }
      __pyx_pybuffernd_lo_nd.diminfo[0].strides = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_nd.diminfo[0].shape = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3511, __pyx_L1_error)
    }
    __pyx_v_lo_nd = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "miniga4py/ga.pyx":3510
 *     if lo_dst[0] < 0 or hi_dst[0] < 0:
 *         return
 *     if lo is not None:             # <<<<<<<<<<<<<<
 *         lo_nd = _inta64(lo)
 *     else:
 */
    goto __pyx_L8;
  }

  /* "miniga4py/ga.pyx":3513
 *         lo_nd = _inta64(lo)
 *     else:
 *         lo_nd = lo_dst             # <<<<<<<<<<<<<<
 *     if hi is not None:
 *         hi_nd = _inta64(hi)
 */
  /*else*/ {
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_dst, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        }
        __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
      }
      __pyx_pybuffernd_lo_nd.diminfo[0].strides = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_nd.diminfo[0].shape = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3513, __pyx_L1_error)
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_lo_dst));
    __pyx_v_lo_nd = __pyx_v_lo_dst;
  }
  __pyx_L8:;

  /* "miniga4py/ga.pyx":3514
 *     else:
 *         lo_nd = lo_dst
 *     if hi is not None:             # <<<<<<<<<<<<<<
 *         hi_nd = _inta64(hi)
 *     else:
 */
  __pyx_t_13 = (__pyx_v_hi != Py_None);
  __pyx_t_11 = (__pyx_t_13 != 0);
  if (__pyx_t_11) {

    /* "miniga4py/ga.pyx":3515
 *         lo_nd = lo_dst
 *     if hi is not None:
 *         hi_nd = _inta64(hi)             # <<<<<<<<<<<<<<
 *     else:
 *         hi_nd = hi_dst
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_hi)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
        }
        __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
      }
      __pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3515, __pyx_L1_error)
    }
    __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "miniga4py/ga.pyx":3514
 *     else:
 *         lo_nd = lo_dst
 *     if hi is not None:             # <<<<<<<<<<<<<<
 *         hi_nd = _inta64(hi)
 *     else:
 */
    goto __pyx_L9;
  }

  /* "miniga4py/ga.pyx":3517
 *         hi_nd = _inta64(hi)
 *     else:
 *         hi_nd = hi_dst             # <<<<<<<<<<<<<<
 *     # sanity checks
 *     if np.sometrue(lo_nd>hi_nd):
 */
  /*else*/ {
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_dst, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        }
        __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
      }
      __pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3517, __pyx_L1_error)
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_hi_dst));
    __pyx_v_hi_nd = __pyx_v_hi_dst;
  }
  __pyx_L9:;

  /* "miniga4py/ga.pyx":3519
 *         hi_nd = hi_dst
 *     # sanity checks
 *     if np.sometrue(lo_nd>hi_nd):             # <<<<<<<<<<<<<<
 *         raise ValueError("lo>hi lo=%s hi=%s"%(lo_nd,hi_nd))
 *     if np.sometrue(lo_nd<lo_dst):
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sometrue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_lo_nd), ((PyObject *)__pyx_v_hi_nd), Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3519, __pyx_L1_error)
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3519, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3519, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3519, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 3519, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3519, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 3519, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_11)) {

    /* "miniga4py/ga.pyx":3520
 *     # sanity checks
 *     if np.sometrue(lo_nd>hi_nd):
 *         raise ValueError("lo>hi lo=%s hi=%s"%(lo_nd,hi_nd))             # <<<<<<<<<<<<<<
 *     if np.sometrue(lo_nd<lo_dst):
 *         raise ValueError("lo out of bounds lo_dst=%s lo=%s"%(lo_dst,lo_nd))
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_v_lo_nd));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_lo_nd));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_lo_nd));
    __Pyx_INCREF(((PyObject *)__pyx_v_hi_nd));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_hi_nd));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_hi_nd));
    __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_lo_hi_lo_s_hi_s, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 3520, __pyx_L1_error)

    /* "miniga4py/ga.pyx":3519
 *         hi_nd = hi_dst
 *     # sanity checks
 *     if np.sometrue(lo_nd>hi_nd):             # <<<<<<<<<<<<<<
 *         raise ValueError("lo>hi lo=%s hi=%s"%(lo_nd,hi_nd))
 *     if np.sometrue(lo_nd<lo_dst):
 */
  }

  /* "miniga4py/ga.pyx":3521
 *     if np.sometrue(lo_nd>hi_nd):
 *         raise ValueError("lo>hi lo=%s hi=%s"%(lo_nd,hi_nd))
 *     if np.sometrue(lo_nd<lo_dst):             # <<<<<<<<<<<<<<
 *         raise ValueError("lo out of bounds lo_dst=%s lo=%s"%(lo_dst,lo_nd))
 *     if np.sometrue(hi_nd>hi_dst):
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sometrue); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 3521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_lo_nd), ((PyObject *)__pyx_v_lo_dst), Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3521, __pyx_L1_error)
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_15);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_15, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3521, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_15)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3521, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3521, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3521, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3521, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 3521, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_11)) {

    /* "miniga4py/ga.pyx":3522
 *         raise ValueError("lo>hi lo=%s hi=%s"%(lo_nd,hi_nd))
 *     if np.sometrue(lo_nd<lo_dst):
 *         raise ValueError("lo out of bounds lo_dst=%s lo=%s"%(lo_dst,lo_nd))             # <<<<<<<<<<<<<<
 *     if np.sometrue(hi_nd>hi_dst):
 *         raise ValueError("hi out of bounds hi_dst=%s hi=%s"%(hi_dst,hi_nd))
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_v_lo_dst));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_lo_dst));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_lo_dst));
    __Pyx_INCREF(((PyObject *)__pyx_v_lo_nd));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_lo_nd));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_lo_nd));
    __pyx_t_15 = __Pyx_PyString_Format(__pyx_kp_s_lo_out_of_bounds_lo_dst_s_lo_s, __pyx_t_1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 3522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 3522, __pyx_L1_error)

    /* "miniga4py/ga.pyx":3521
 *     if np.sometrue(lo_nd>hi_nd):
 *         raise ValueError("lo>hi lo=%s hi=%s"%(lo_nd,hi_nd))
 *     if np.sometrue(lo_nd<lo_dst):             # <<<<<<<<<<<<<<
 *         raise ValueError("lo out of bounds lo_dst=%s lo=%s"%(lo_dst,lo_nd))
 *     if np.sometrue(hi_nd>hi_dst):
 */
  }

  /* "miniga4py/ga.pyx":3523
 *     if np.sometrue(lo_nd<lo_dst):
 *         raise ValueError("lo out of bounds lo_dst=%s lo=%s"%(lo_dst,lo_nd))
 *     if np.sometrue(hi_nd>hi_dst):             # <<<<<<<<<<<<<<
 *         raise ValueError("hi out of bounds hi_dst=%s hi=%s"%(hi_dst,hi_nd))
 *     if update:
 */
  __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 3523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_sometrue); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_t_15 = PyObject_RichCompare(((PyObject *)__pyx_v_hi_nd), ((PyObject *)__pyx_v_hi_dst), Py_GT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 3523, __pyx_L1_error)
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3523, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_15};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3523, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_15};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3523, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3523, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_15);
      __pyx_t_15 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3523, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 3523, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_11)) {

    /* "miniga4py/ga.pyx":3524
 *         raise ValueError("lo out of bounds lo_dst=%s lo=%s"%(lo_dst,lo_nd))
 *     if np.sometrue(hi_nd>hi_dst):
 *         raise ValueError("hi out of bounds hi_dst=%s hi=%s"%(hi_dst,hi_nd))             # <<<<<<<<<<<<<<
 *     if update:
 *         NGA_Release_update64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_v_hi_dst));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_hi_dst));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_hi_dst));
    __Pyx_INCREF(((PyObject *)__pyx_v_hi_nd));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_hi_nd));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_hi_nd));
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_hi_out_of_bounds_hi_dst_s_hi_s, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 3524, __pyx_L1_error)

    /* "miniga4py/ga.pyx":3523
 *     if np.sometrue(lo_nd<lo_dst):
 *         raise ValueError("lo out of bounds lo_dst=%s lo=%s"%(lo_dst,lo_nd))
 *     if np.sometrue(hi_nd>hi_dst):             # <<<<<<<<<<<<<<
 *         raise ValueError("hi out of bounds hi_dst=%s hi=%s"%(hi_dst,hi_nd))
 *     if update:
 */
  }

  /* "miniga4py/ga.pyx":3525
 *     if np.sometrue(hi_nd>hi_dst):
 *         raise ValueError("hi out of bounds hi_dst=%s hi=%s"%(hi_dst,hi_nd))
 *     if update:             # <<<<<<<<<<<<<<
 *         NGA_Release_update64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 *     else:
 */
  __pyx_t_11 = (__pyx_v_update != 0);
  if (__pyx_t_11) {

    /* "miniga4py/ga.pyx":3526
 *         raise ValueError("hi out of bounds hi_dst=%s hi=%s"%(hi_dst,hi_nd))
 *     if update:
 *         NGA_Release_update64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)             # <<<<<<<<<<<<<<
 *     else:
 *         NGA_Release64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 */
    NGA_Release_update64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data));

    /* "miniga4py/ga.pyx":3525
 *     if np.sometrue(hi_nd>hi_dst):
 *         raise ValueError("hi out of bounds hi_dst=%s hi=%s"%(hi_dst,hi_nd))
 *     if update:             # <<<<<<<<<<<<<<
 *         NGA_Release_update64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 *     else:
 */
    goto __pyx_L13;
  }

  /* "miniga4py/ga.pyx":3528
 *         NGA_Release_update64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 *     else:
 *         NGA_Release64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)             # <<<<<<<<<<<<<<
 * 
 * def release_ghost_element(int g_a, subscript):
 */
  /*else*/ {
    NGA_Release64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data));
  }
  __pyx_L13:;

  /* "miniga4py/ga.pyx":3501
 *     NGA_Release_block_segment(g_a, proc)
 * 
 * cdef _release_common(int g_a, lo, hi, bint update):             # <<<<<<<<<<<<<<
 *     """TODO"""
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd, lo_dst, hi_dst
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_15);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_dst.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga._release_common", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_dst.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_dst.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_lo_dst);
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_dst);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3530
 *         NGA_Release64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 * def release_ghost_element(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Releases access to the locally held data for an array with ghost
 *     elements, when data was accessed as read-only.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_283release_ghost_element(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_282release_ghost_element[] = "release_ghost_element(int g_a, subscript)\nReleases access to the locally held data for an array with ghost\n    elements, when data was accessed as read-only.\n    \n    This is a local operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_283release_ghost_element = {"release_ghost_element", (PyCFunction)__pyx_pw_9miniga4py_2ga_283release_ghost_element, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_282release_ghost_element};
static PyObject *__pyx_pw_9miniga4py_2ga_283release_ghost_element(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_subscript = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("release_ghost_element (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_subscript,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_subscript)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("release_ghost_element", 1, 2, 2, 1); __PYX_ERR(0, 3530, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "release_ghost_element") < 0)) __PYX_ERR(0, 3530, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3530, __pyx_L3_error)
    __pyx_v_subscript = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("release_ghost_element", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3530, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.release_ghost_element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_282release_ghost_element(__pyx_self, __pyx_v_g_a, __pyx_v_subscript);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_282release_ghost_element(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_subscript) {
  PyArrayObject *__pyx_v_subscript_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_subscript_nd;
  __Pyx_Buffer __pyx_pybuffer_subscript_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("release_ghost_element", 0);
  __pyx_pybuffer_subscript_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_subscript_nd.refcount = 0;
  __pyx_pybuffernd_subscript_nd.data = NULL;
  __pyx_pybuffernd_subscript_nd.rcbuffer = &__pyx_pybuffer_subscript_nd;

  /* "miniga4py/ga.pyx":3538
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] subscript_nd
 *     subscript_nd = _inta64(subscript)             # <<<<<<<<<<<<<<
 *     NGA_Release_ghost_element64(g_a, <int64_t*>subscript_nd.data)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_subscript)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_subscript_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      }
      __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
    }
    __pyx_pybuffernd_subscript_nd.diminfo[0].strides = __pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subscript_nd.diminfo[0].shape = __pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3538, __pyx_L1_error)
  }
  __pyx_v_subscript_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":3539
 *     cdef np.ndarray[np.int64_t, ndim=1] subscript_nd
 *     subscript_nd = _inta64(subscript)
 *     NGA_Release_ghost_element64(g_a, <int64_t*>subscript_nd.data)             # <<<<<<<<<<<<<<
 * 
 * def release_ghosts(int g_a):
 */
  NGA_Release_ghost_element64(__pyx_v_g_a, ((int64_t *)__pyx_v_subscript_nd->data));

  /* "miniga4py/ga.pyx":3530
 *         NGA_Release64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 * def release_ghost_element(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Releases access to the locally held data for an array with ghost
 *     elements, when data was accessed as read-only.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.release_ghost_element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_subscript_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3541
 *     NGA_Release_ghost_element64(g_a, <int64_t*>subscript_nd.data)
 * 
 * def release_ghosts(int g_a):             # <<<<<<<<<<<<<<
 *     """Releases access to the locally held block of data containing ghost
 *     elements, when data was accessed as read-only.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_285release_ghosts(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_284release_ghosts[] = "release_ghosts(int g_a)\nReleases access to the locally held block of data containing ghost\n    elements, when data was accessed as read-only.\n    \n    This is a local operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_285release_ghosts = {"release_ghosts", (PyCFunction)__pyx_pw_9miniga4py_2ga_285release_ghosts, METH_O, __pyx_doc_9miniga4py_2ga_284release_ghosts};
static PyObject *__pyx_pw_9miniga4py_2ga_285release_ghosts(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("release_ghosts (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3541, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.release_ghosts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_284release_ghosts(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_284release_ghosts(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("release_ghosts", 0);

  /* "miniga4py/ga.pyx":3548
 * 
 *     """
 *     NGA_Release_ghosts(g_a)             # <<<<<<<<<<<<<<
 * 
 * def release_update(int g_a, lo=None, hi=None):
 */
  NGA_Release_ghosts(__pyx_v_g_a);

  /* "miniga4py/ga.pyx":3541
 *     NGA_Release_ghost_element64(g_a, <int64_t*>subscript_nd.data)
 * 
 * def release_ghosts(int g_a):             # <<<<<<<<<<<<<<
 *     """Releases access to the locally held block of data containing ghost
 *     elements, when data was accessed as read-only.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3550
 *     NGA_Release_ghosts(g_a)
 * 
 * def release_update(int g_a, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Releases access to the data.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_287release_update(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_286release_update[] = "release_update(int g_a, lo=None, hi=None)\nReleases access to the data.\n    \n    It must be used if the data was accessed for writing.\n    NOTE: see restrictions specified for ga.access.\n    \n    This operation is local. \n    \n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_287release_update = {"release_update", (PyCFunction)__pyx_pw_9miniga4py_2ga_287release_update, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_286release_update};
static PyObject *__pyx_pw_9miniga4py_2ga_287release_update(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("release_update (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_lo,&__pyx_n_s_hi,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "release_update") < 0)) __PYX_ERR(0, 3550, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3550, __pyx_L3_error)
    __pyx_v_lo = values[1];
    __pyx_v_hi = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("release_update", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3550, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.release_update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_286release_update(__pyx_self, __pyx_v_g_a, __pyx_v_lo, __pyx_v_hi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_286release_update(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("release_update", 0);

  /* "miniga4py/ga.pyx":3559
 * 
 *     """
 *     _release_common(g_a, lo, hi, True)             # <<<<<<<<<<<<<<
 * 
 * def release_update_block(int g_a, int index):
 */
  __pyx_t_1 = __pyx_f_9miniga4py_2ga__release_common(__pyx_v_g_a, __pyx_v_lo, __pyx_v_hi, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":3550
 *     NGA_Release_ghosts(g_a)
 * 
 * def release_update(int g_a, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Releases access to the data.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.release_update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3561
 *     _release_common(g_a, lo, hi, True)
 * 
 * def release_update_block(int g_a, int index):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of data specified by the integer index
 *     when data was accessed in read-write mode.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_289release_update_block(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_288release_update_block[] = "release_update_block(int g_a, int index)\nReleases access to the block of data specified by the integer index\n    when data was accessed in read-write mode.\n    \n    This is only applicable to block-cyclic data distributions created using\n    the simple block-cyclic distribution.\n    \n    This is a local operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_289release_update_block = {"release_update_block", (PyCFunction)__pyx_pw_9miniga4py_2ga_289release_update_block, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_288release_update_block};
static PyObject *__pyx_pw_9miniga4py_2ga_289release_update_block(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_index;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("release_update_block (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_index,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_index)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("release_update_block", 1, 2, 2, 1); __PYX_ERR(0, 3561, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "release_update_block") < 0)) __PYX_ERR(0, 3561, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3561, __pyx_L3_error)
    __pyx_v_index = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3561, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("release_update_block", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3561, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.release_update_block", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_288release_update_block(__pyx_self, __pyx_v_g_a, __pyx_v_index);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_288release_update_block(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("release_update_block", 0);

  /* "miniga4py/ga.pyx":3571
 * 
 *     """
 *     NGA_Release_update_block(g_a, index)             # <<<<<<<<<<<<<<
 * 
 * def release_update_block_grid(int g_a, subscript):
 */
  NGA_Release_update_block(__pyx_v_g_a, __pyx_v_index);

  /* "miniga4py/ga.pyx":3561
 *     _release_common(g_a, lo, hi, True)
 * 
 * def release_update_block(int g_a, int index):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of data specified by the integer index
 *     when data was accessed in read-write mode.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3573
 *     NGA_Release_update_block(g_a, index)
 * 
 * def release_update_block_grid(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of data specified by the subscript array
 *     when data was accessed in read-write mode.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_291release_update_block_grid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_290release_update_block_grid[] = "release_update_block_grid(int g_a, subscript)\nReleases access to the block of data specified by the subscript array\n    when data was accessed in read-write mode.\n    \n    This is only applicable to block-cyclic data distributions created using\n    the SCALAPACK data distribution.\n    \n    This is a local operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_291release_update_block_grid = {"release_update_block_grid", (PyCFunction)__pyx_pw_9miniga4py_2ga_291release_update_block_grid, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_290release_update_block_grid};
static PyObject *__pyx_pw_9miniga4py_2ga_291release_update_block_grid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_subscript = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("release_update_block_grid (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_subscript,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_subscript)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("release_update_block_grid", 1, 2, 2, 1); __PYX_ERR(0, 3573, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "release_update_block_grid") < 0)) __PYX_ERR(0, 3573, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3573, __pyx_L3_error)
    __pyx_v_subscript = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("release_update_block_grid", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3573, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.release_update_block_grid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_290release_update_block_grid(__pyx_self, __pyx_v_g_a, __pyx_v_subscript);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_290release_update_block_grid(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_subscript) {
  PyArrayObject *__pyx_v_subscript_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_subscript_nd;
  __Pyx_Buffer __pyx_pybuffer_subscript_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("release_update_block_grid", 0);
  __pyx_pybuffer_subscript_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_subscript_nd.refcount = 0;
  __pyx_pybuffernd_subscript_nd.data = NULL;
  __pyx_pybuffernd_subscript_nd.rcbuffer = &__pyx_pybuffer_subscript_nd;

  /* "miniga4py/ga.pyx":3584
 *     """
 *     cdef np.ndarray[np.int32_t, ndim=1] subscript_nd
 *     subscript_nd = _inta32(subscript)             # <<<<<<<<<<<<<<
 *     NGA_Release_update_block_grid(g_a, <int*>subscript_nd.data)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta32(__pyx_v_subscript)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_subscript_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      }
      __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
    }
    __pyx_pybuffernd_subscript_nd.diminfo[0].strides = __pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subscript_nd.diminfo[0].shape = __pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3584, __pyx_L1_error)
  }
  __pyx_v_subscript_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":3585
 *     cdef np.ndarray[np.int32_t, ndim=1] subscript_nd
 *     subscript_nd = _inta32(subscript)
 *     NGA_Release_update_block_grid(g_a, <int*>subscript_nd.data)             # <<<<<<<<<<<<<<
 * 
 * def release_update_block_segment(int g_a, int proc):
 */
  NGA_Release_update_block_grid(__pyx_v_g_a, ((int *)__pyx_v_subscript_nd->data));

  /* "miniga4py/ga.pyx":3573
 *     NGA_Release_update_block(g_a, index)
 * 
 * def release_update_block_grid(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of data specified by the subscript array
 *     when data was accessed in read-write mode.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.release_update_block_grid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_subscript_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3587
 *     NGA_Release_update_block_grid(g_a, <int*>subscript_nd.data)
 * 
 * def release_update_block_segment(int g_a, int proc):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of locally held data for a block-cyclic
 *     array, when data was accessed as read-only.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_293release_update_block_segment(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_292release_update_block_segment[] = "release_update_block_segment(int g_a, int proc)\nReleases access to the block of locally held data for a block-cyclic\n    array, when data was accessed as read-only.\n    \n    This is a local operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_293release_update_block_segment = {"release_update_block_segment", (PyCFunction)__pyx_pw_9miniga4py_2ga_293release_update_block_segment, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_292release_update_block_segment};
static PyObject *__pyx_pw_9miniga4py_2ga_293release_update_block_segment(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_proc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("release_update_block_segment (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_proc,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_proc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("release_update_block_segment", 1, 2, 2, 1); __PYX_ERR(0, 3587, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "release_update_block_segment") < 0)) __PYX_ERR(0, 3587, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3587, __pyx_L3_error)
    __pyx_v_proc = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_proc == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3587, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("release_update_block_segment", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3587, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.release_update_block_segment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_292release_update_block_segment(__pyx_self, __pyx_v_g_a, __pyx_v_proc);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_292release_update_block_segment(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_proc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("release_update_block_segment", 0);

  /* "miniga4py/ga.pyx":3594
 * 
 *     """
 *     NGA_Release_update_block_segment(g_a, proc)             # <<<<<<<<<<<<<<
 * 
 * def release_update_ghost_element(int g_a, subscript):
 */
  NGA_Release_update_block_segment(__pyx_v_g_a, __pyx_v_proc);

  /* "miniga4py/ga.pyx":3587
 *     NGA_Release_update_block_grid(g_a, <int*>subscript_nd.data)
 * 
 * def release_update_block_segment(int g_a, int proc):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of locally held data for a block-cyclic
 *     array, when data was accessed as read-only.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3596
 *     NGA_Release_update_block_segment(g_a, proc)
 * 
 * def release_update_ghost_element(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Releases access to the locally held data for an array with ghost
 *     elements, when data was accessed in read-write mode.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_295release_update_ghost_element(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_294release_update_ghost_element[] = "release_update_ghost_element(int g_a, subscript)\nReleases access to the locally held data for an array with ghost\n    elements, when data was accessed in read-write mode.\n    \n    This is a local operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_295release_update_ghost_element = {"release_update_ghost_element", (PyCFunction)__pyx_pw_9miniga4py_2ga_295release_update_ghost_element, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_294release_update_ghost_element};
static PyObject *__pyx_pw_9miniga4py_2ga_295release_update_ghost_element(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_subscript = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("release_update_ghost_element (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_subscript,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_subscript)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("release_update_ghost_element", 1, 2, 2, 1); __PYX_ERR(0, 3596, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "release_update_ghost_element") < 0)) __PYX_ERR(0, 3596, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3596, __pyx_L3_error)
    __pyx_v_subscript = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("release_update_ghost_element", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3596, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.release_update_ghost_element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_294release_update_ghost_element(__pyx_self, __pyx_v_g_a, __pyx_v_subscript);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_294release_update_ghost_element(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_subscript) {
  PyArrayObject *__pyx_v_subscript_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_subscript_nd;
  __Pyx_Buffer __pyx_pybuffer_subscript_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("release_update_ghost_element", 0);
  __pyx_pybuffer_subscript_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_subscript_nd.refcount = 0;
  __pyx_pybuffernd_subscript_nd.data = NULL;
  __pyx_pybuffernd_subscript_nd.rcbuffer = &__pyx_pybuffer_subscript_nd;

  /* "miniga4py/ga.pyx":3604
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] subscript_nd
 *     subscript_nd = _inta64(subscript)             # <<<<<<<<<<<<<<
 *     NGA_Release_update_ghost_element64(g_a, <int64_t*>subscript_nd.data)
 *     pass
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_subscript)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_subscript_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      }
      __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
    }
    __pyx_pybuffernd_subscript_nd.diminfo[0].strides = __pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subscript_nd.diminfo[0].shape = __pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3604, __pyx_L1_error)
  }
  __pyx_v_subscript_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":3605
 *     cdef np.ndarray[np.int64_t, ndim=1] subscript_nd
 *     subscript_nd = _inta64(subscript)
 *     NGA_Release_update_ghost_element64(g_a, <int64_t*>subscript_nd.data)             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
  NGA_Release_update_ghost_element64(__pyx_v_g_a, ((int64_t *)__pyx_v_subscript_nd->data));

  /* "miniga4py/ga.pyx":3596
 *     NGA_Release_update_block_segment(g_a, proc)
 * 
 * def release_update_ghost_element(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Releases access to the locally held data for an array with ghost
 *     elements, when data was accessed in read-write mode.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.release_update_ghost_element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subscript_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_subscript_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3608
 *     pass
 * 
 * def release_update_ghosts(int g_a):             # <<<<<<<<<<<<<<
 *     """Releases access to the locally held block of data containing ghost
 *     elements, when data was accessed in read-write mode.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_297release_update_ghosts(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_296release_update_ghosts[] = "release_update_ghosts(int g_a)\nReleases access to the locally held block of data containing ghost\n    elements, when data was accessed in read-write mode.\n    \n    This is a local operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_297release_update_ghosts = {"release_update_ghosts", (PyCFunction)__pyx_pw_9miniga4py_2ga_297release_update_ghosts, METH_O, __pyx_doc_9miniga4py_2ga_296release_update_ghosts};
static PyObject *__pyx_pw_9miniga4py_2ga_297release_update_ghosts(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("release_update_ghosts (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3608, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.release_update_ghosts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_296release_update_ghosts(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_296release_update_ghosts(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("release_update_ghosts", 0);

  /* "miniga4py/ga.pyx":3615
 * 
 *     """
 *     NGA_Release_update_ghosts(g_a)             # <<<<<<<<<<<<<<
 * 
 * def scale(int g_a, value, lo=None, hi=None):
 */
  NGA_Release_update_ghosts(__pyx_v_g_a);

  /* "miniga4py/ga.pyx":3608
 *     pass
 * 
 * def release_update_ghosts(int g_a):             # <<<<<<<<<<<<<<
 *     """Releases access to the locally held block of data containing ghost
 *     elements, when data was accessed in read-write mode.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3617
 *     NGA_Release_update_ghosts(g_a)
 * 
 * def scale(int g_a, value, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Scales an array by the constant s.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_299scale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_298scale[] = "scale(int g_a, value, lo=None, hi=None)\nScales an array by the constant s.\n    \n    Note that the library is unable to detect errors when the pointed value is\n    of different type than the array.\n\n    This is a collective operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_299scale = {"scale", (PyCFunction)__pyx_pw_9miniga4py_2ga_299scale, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_298scale};
static PyObject *__pyx_pw_9miniga4py_2ga_299scale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("scale (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_value,&__pyx_n_s_lo,&__pyx_n_s_hi,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("scale", 0, 2, 4, 1); __PYX_ERR(0, 3617, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale") < 0)) __PYX_ERR(0, 3617, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3617, __pyx_L3_error)
    __pyx_v_value = values[1];
    __pyx_v_lo = values[2];
    __pyx_v_hi = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("scale", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3617, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.scale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_298scale(__pyx_self, __pyx_v_g_a, __pyx_v_value, __pyx_v_lo, __pyx_v_hi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_298scale(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_value, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
  PyArrayObject *__pyx_v_lo_nd = 0;
  PyArrayObject *__pyx_v_hi_nd = 0;
  int __pyx_v_gtype;
  int __pyx_v_ivalue;
  long __pyx_v_lvalue;
  PY_LONG_LONG __pyx_v_llvalue;
  float __pyx_v_fvalue;
  double __pyx_v_dvalue;
  long double __pyx_v_ldvalue;
  SingleComplex __pyx_v_fcvalue;
  DoubleComplex __pyx_v_dcvalue;
  void *__pyx_v_vvalue;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_nd;
  __Pyx_Buffer __pyx_pybuffer_hi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lo_nd;
  __Pyx_Buffer __pyx_pybuffer_lo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  __Pyx_RefNannySetupContext("scale", 0);
  __pyx_pybuffer_lo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_lo_nd.refcount = 0;
  __pyx_pybuffernd_lo_nd.data = NULL;
  __pyx_pybuffernd_lo_nd.rcbuffer = &__pyx_pybuffer_lo_nd;
  __pyx_pybuffer_hi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_nd.refcount = 0;
  __pyx_pybuffernd_hi_nd.data = NULL;
  __pyx_pybuffernd_hi_nd.rcbuffer = &__pyx_pybuffer_hi_nd;

  /* "miniga4py/ga.pyx":3627
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 *     cdef int gtype=inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     cdef int            ivalue
 *     cdef long           lvalue
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":3637
 *     cdef DoubleComplex  dcvalue
 *     cdef void          *vvalue
 *     vvalue = _convert_multiplier(gtype, value,             # <<<<<<<<<<<<<<
 *             &ivalue,  &lvalue,  &llvalue,
 *             &fvalue,  &dvalue,  &ldvalue,
 */
  __pyx_v_vvalue = __pyx_f_9miniga4py_2ga__convert_multiplier(__pyx_v_gtype, __pyx_v_value, (&__pyx_v_ivalue), (&__pyx_v_lvalue), (&__pyx_v_llvalue), (&__pyx_v_fvalue), (&__pyx_v_dvalue), (&__pyx_v_ldvalue), (&__pyx_v_fcvalue), (&__pyx_v_dcvalue));

  /* "miniga4py/ga.pyx":3641
 *             &fvalue,  &dvalue,  &ldvalue,
 *             &fcvalue, &dcvalue)
 *     if lo is None and hi is None:             # <<<<<<<<<<<<<<
 *         GA_Scale(g_a, vvalue)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_lo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_hi == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":3642
 *             &fcvalue, &dcvalue)
 *     if lo is None and hi is None:
 *         GA_Scale(g_a, vvalue)             # <<<<<<<<<<<<<<
 *     else:
 *         lo_nd,hi_nd = _lohi(g_a,lo,hi)
 */
    GA_Scale(__pyx_v_g_a, __pyx_v_vvalue);

    /* "miniga4py/ga.pyx":3641
 *             &fvalue,  &dvalue,  &ldvalue,
 *             &fcvalue, &dcvalue)
 *     if lo is None and hi is None:             # <<<<<<<<<<<<<<
 *         GA_Scale(g_a, vvalue)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "miniga4py/ga.pyx":3644
 *         GA_Scale(g_a, vvalue)
 *     else:
 *         lo_nd,hi_nd = _lohi(g_a,lo,hi)             # <<<<<<<<<<<<<<
 *         NGA_Scale_patch64(
 *                 g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, vvalue)
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_lo, __pyx_v_hi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3644, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 3644, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3644, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3644, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3644, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 3644, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 3644, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3644, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3644, __pyx_L1_error)
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_lo_nd.diminfo[0].strides = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_nd.diminfo[0].shape = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 3644, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_lo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 3644, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":3645
 *     else:
 *         lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *         NGA_Scale_patch64(             # <<<<<<<<<<<<<<
 *                 g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, vvalue)
 * 
 */
    NGA_Scale_patch64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data), __pyx_v_vvalue);
  }
  __pyx_L3:;

  /* "miniga4py/ga.pyx":3617
 *     NGA_Release_update_ghosts(g_a)
 * 
 * def scale(int g_a, value, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Scales an array by the constant s.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.scale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3648
 *                 g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, vvalue)
 * 
 * def scale_rows(int g_a, int g_v):             # <<<<<<<<<<<<<<
 *     """Scales the rows of this matrix g_a using the vector g_v.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_301scale_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_300scale_rows[] = "scale_rows(int g_a, int g_v)\nScales the rows of this matrix g_a using the vector g_v.\n\n    This is a collective operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_301scale_rows = {"scale_rows", (PyCFunction)__pyx_pw_9miniga4py_2ga_301scale_rows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_300scale_rows};
static PyObject *__pyx_pw_9miniga4py_2ga_301scale_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_v;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("scale_rows (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_v,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("scale_rows", 1, 2, 2, 1); __PYX_ERR(0, 3648, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale_rows") < 0)) __PYX_ERR(0, 3648, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3648, __pyx_L3_error)
    __pyx_v_g_v = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3648, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("scale_rows", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3648, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.scale_rows", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_300scale_rows(__pyx_self, __pyx_v_g_a, __pyx_v_g_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_300scale_rows(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_v) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("scale_rows", 0);

  /* "miniga4py/ga.pyx":3654
 * 
 *     """
 *     GA_Scale_rows(g_a, g_v)             # <<<<<<<<<<<<<<
 * 
 * def scale_cols(int g_a, int g_v):
 */
  GA_Scale_rows(__pyx_v_g_a, __pyx_v_g_v);

  /* "miniga4py/ga.pyx":3648
 *                 g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, vvalue)
 * 
 * def scale_rows(int g_a, int g_v):             # <<<<<<<<<<<<<<
 *     """Scales the rows of this matrix g_a using the vector g_v.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3656
 *     GA_Scale_rows(g_a, g_v)
 * 
 * def scale_cols(int g_a, int g_v):             # <<<<<<<<<<<<<<
 *     """Scales the columns of this matrix g_a using the vector g_v.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_303scale_cols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_302scale_cols[] = "scale_cols(int g_a, int g_v)\nScales the columns of this matrix g_a using the vector g_v.\n\n    This is a collective operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_303scale_cols = {"scale_cols", (PyCFunction)__pyx_pw_9miniga4py_2ga_303scale_cols, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_302scale_cols};
static PyObject *__pyx_pw_9miniga4py_2ga_303scale_cols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_v;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("scale_cols (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_v,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("scale_cols", 1, 2, 2, 1); __PYX_ERR(0, 3656, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale_cols") < 0)) __PYX_ERR(0, 3656, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3656, __pyx_L3_error)
    __pyx_v_g_v = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3656, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("scale_cols", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3656, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.scale_cols", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_302scale_cols(__pyx_self, __pyx_v_g_a, __pyx_v_g_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_302scale_cols(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_v) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("scale_cols", 0);

  /* "miniga4py/ga.pyx":3662
 * 
 *     """
 *     GA_Scale_cols(g_a, g_v)             # <<<<<<<<<<<<<<
 * 
 * def scan_add(int g_src, int g_dst, int g_msk, lo=None, hi=None,
 */
  GA_Scale_cols(__pyx_v_g_a, __pyx_v_g_v);

  /* "miniga4py/ga.pyx":3656
 *     GA_Scale_rows(g_a, g_v)
 * 
 * def scale_cols(int g_a, int g_v):             # <<<<<<<<<<<<<<
 *     """Scales the columns of this matrix g_a using the vector g_v.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3664
 *     GA_Scale_cols(g_a, g_v)
 * 
 * def scan_add(int g_src, int g_dst, int g_msk, lo=None, hi=None,             # <<<<<<<<<<<<<<
 *         bint excl=False):
 *     """Adds successive elements in a source vector g_src and put the results
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_305scan_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_304scan_add[] = "scan_add(int g_src, int g_dst, int g_msk, lo=None, hi=None, bool excl=False)\nAdds successive elements in a source vector g_src and put the results\n    in a destination vector g_dst.\n    \n    The addition will restart based on the values of the integer mask vector\n    g_msk. The scan is performed within the range specified by the integer\n    values lo and hi. Note that this operation can only be applied to\n    1-dimensional arrays. The excl flag determines whether the sum starts with\n    the value in the source vector corresponding to the location of a 1 in the\n    mask vector (excl=False) or whether the first value is set equal to 0\n    (excl=True). Some examples of this operation are given below.\n\n    ga.scan_add(g_src, g_dst, g_msk, 0, n, False);\n    g_msk:   1  0  0  0  0  0  1  0  1  0  0  1  0  0  1  1  0\n    g_src:   1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17\n    g_dst:   1  3  6 10 16 21  7 15  9 19 30 12 25 39 15 16 33\n\n    ga.scan_add(g_src, g_dst, g_msk, 0, n, True);\n    g_msk:   1  0  0  0  0  0  1  0  1  0  0  1  0  0  1  1  0\n    g_src:   1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17\n    g_dst:   0  1  3  6 10 15  0  7  0  9 19  0 12 25  0  0 16\n\n    This is a collective operation.\n\n    :Parameters:\n        g_src : int\n            handle for source arrray\n        g_dst : int\n            handle for destination array\n        g_msk : int\n            handle for integer array representing mask\n        lo : 1D array-like of integers\n            low value of range on which operation is performed\n        hi : 1D array-like of integers\n            hi value of range on which operation is performed\n        excl : bool\n            whether the first value is set to 0 (see above)\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_305scan_add = {"scan_add", (PyCFunction)__pyx_pw_9miniga4py_2ga_305scan_add, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_304scan_add};
static PyObject *__pyx_pw_9miniga4py_2ga_305scan_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_src;
  int __pyx_v_g_dst;
  int __pyx_v_g_msk;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  int __pyx_v_excl;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("scan_add (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_src,&__pyx_n_s_g_dst,&__pyx_n_s_g_msk,&__pyx_n_s_lo,&__pyx_n_s_hi,&__pyx_n_s_excl,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_src)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_dst)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("scan_add", 0, 3, 6, 1); __PYX_ERR(0, 3664, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_msk)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("scan_add", 0, 3, 6, 2); __PYX_ERR(0, 3664, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_excl);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scan_add") < 0)) __PYX_ERR(0, 3664, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_src = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_src == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3664, __pyx_L3_error)
    __pyx_v_g_dst = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_dst == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3664, __pyx_L3_error)
    __pyx_v_g_msk = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_g_msk == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3664, __pyx_L3_error)
    __pyx_v_lo = values[3];
    __pyx_v_hi = values[4];
    if (values[5]) {
      __pyx_v_excl = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_excl == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3665, __pyx_L3_error)
    } else {

      /* "miniga4py/ga.pyx":3665
 * 
 * def scan_add(int g_src, int g_dst, int g_msk, lo=None, hi=None,
 *         bint excl=False):             # <<<<<<<<<<<<<<
 *     """Adds successive elements in a source vector g_src and put the results
 *     in a destination vector g_dst.
 */
      __pyx_v_excl = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("scan_add", 0, 3, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3664, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.scan_add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_304scan_add(__pyx_self, __pyx_v_g_src, __pyx_v_g_dst, __pyx_v_g_msk, __pyx_v_lo, __pyx_v_hi, __pyx_v_excl);

  /* "miniga4py/ga.pyx":3664
 *     GA_Scale_cols(g_a, g_v)
 * 
 * def scan_add(int g_src, int g_dst, int g_msk, lo=None, hi=None,             # <<<<<<<<<<<<<<
 *         bint excl=False):
 *     """Adds successive elements in a source vector g_src and put the results
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_304scan_add(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_src, int __pyx_v_g_dst, int __pyx_v_g_msk, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, int __pyx_v_excl) {
  PyArrayObject *__pyx_v_hi_nd = 0;
  int64_t __pyx_v_c_lo;
  int64_t __pyx_v_c_hi;
  int __pyx_v_c_excl;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_nd;
  __Pyx_Buffer __pyx_pybuffer_hi_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyArrayObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int64_t __pyx_t_8;
  __Pyx_RefNannySetupContext("scan_add", 0);
  __pyx_pybuffer_hi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_nd.refcount = 0;
  __pyx_pybuffernd_hi_nd.data = NULL;
  __pyx_pybuffernd_hi_nd.rcbuffer = &__pyx_pybuffer_hi_nd;

  /* "miniga4py/ga.pyx":3704
 * 
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] hi_nd = inquire_dims(g_src)-1             # <<<<<<<<<<<<<<
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0]
 *     cdef int c_excl=0
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga_inquire_dims(__pyx_v_g_src, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3704, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3704, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3704, __pyx_L1_error)
  __pyx_t_3 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_hi_nd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 3704, __pyx_L1_error)
    } else {__pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_3 = 0;
  __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "miniga4py/ga.pyx":3705
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] hi_nd = inquire_dims(g_src)-1
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0]             # <<<<<<<<<<<<<<
 *     cdef int c_excl=0
 *     if lo is not None:
 */
  __pyx_v_c_lo = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = -1;
  if (__pyx_t_4 < 0) {
    __pyx_t_4 += __pyx_pybuffernd_hi_nd.diminfo[0].shape;
    if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_hi_nd.diminfo[0].shape)) __pyx_t_5 = 0;
  if (unlikely(__pyx_t_5 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_5);
    __PYX_ERR(0, 3705, __pyx_L1_error)
  }
  __pyx_v_c_hi = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_hi_nd.diminfo[0].strides));

  /* "miniga4py/ga.pyx":3706
 *     cdef np.ndarray[np.int64_t, ndim=1] hi_nd = inquire_dims(g_src)-1
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0]
 *     cdef int c_excl=0             # <<<<<<<<<<<<<<
 *     if lo is not None:
 *         c_lo = lo
 */
  __pyx_v_c_excl = 0;

  /* "miniga4py/ga.pyx":3707
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0]
 *     cdef int c_excl=0
 *     if lo is not None:             # <<<<<<<<<<<<<<
 *         c_lo = lo
 *     if hi is not None:
 */
  __pyx_t_6 = (__pyx_v_lo != Py_None);
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "miniga4py/ga.pyx":3708
 *     cdef int c_excl=0
 *     if lo is not None:
 *         c_lo = lo             # <<<<<<<<<<<<<<
 *     if hi is not None:
 *         c_hi = hi
 */
    __pyx_t_8 = __Pyx_PyInt_As_int64_t(__pyx_v_lo); if (unlikely((__pyx_t_8 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3708, __pyx_L1_error)
    __pyx_v_c_lo = __pyx_t_8;

    /* "miniga4py/ga.pyx":3707
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0]
 *     cdef int c_excl=0
 *     if lo is not None:             # <<<<<<<<<<<<<<
 *         c_lo = lo
 *     if hi is not None:
 */
  }

  /* "miniga4py/ga.pyx":3709
 *     if lo is not None:
 *         c_lo = lo
 *     if hi is not None:             # <<<<<<<<<<<<<<
 *         c_hi = hi
 *     if excl:
 */
  __pyx_t_7 = (__pyx_v_hi != Py_None);
  __pyx_t_6 = (__pyx_t_7 != 0);
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":3710
 *         c_lo = lo
 *     if hi is not None:
 *         c_hi = hi             # <<<<<<<<<<<<<<
 *     if excl:
 *         c_excl = 1
 */
    __pyx_t_8 = __Pyx_PyInt_As_int64_t(__pyx_v_hi); if (unlikely((__pyx_t_8 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3710, __pyx_L1_error)
    __pyx_v_c_hi = __pyx_t_8;

    /* "miniga4py/ga.pyx":3709
 *     if lo is not None:
 *         c_lo = lo
 *     if hi is not None:             # <<<<<<<<<<<<<<
 *         c_hi = hi
 *     if excl:
 */
  }

  /* "miniga4py/ga.pyx":3711
 *     if hi is not None:
 *         c_hi = hi
 *     if excl:             # <<<<<<<<<<<<<<
 *         c_excl = 1
 *     GA_Scan_add64(g_src, g_dst, g_msk, c_lo, c_hi, c_excl)
 */
  __pyx_t_6 = (__pyx_v_excl != 0);
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":3712
 *         c_hi = hi
 *     if excl:
 *         c_excl = 1             # <<<<<<<<<<<<<<
 *     GA_Scan_add64(g_src, g_dst, g_msk, c_lo, c_hi, c_excl)
 * 
 */
    __pyx_v_c_excl = 1;

    /* "miniga4py/ga.pyx":3711
 *     if hi is not None:
 *         c_hi = hi
 *     if excl:             # <<<<<<<<<<<<<<
 *         c_excl = 1
 *     GA_Scan_add64(g_src, g_dst, g_msk, c_lo, c_hi, c_excl)
 */
  }

  /* "miniga4py/ga.pyx":3713
 *     if excl:
 *         c_excl = 1
 *     GA_Scan_add64(g_src, g_dst, g_msk, c_lo, c_hi, c_excl)             # <<<<<<<<<<<<<<
 * 
 * def scan_copy(int g_src, int g_dst, int g_msk, lo=None, hi=None):
 */
  GA_Scan_add64(__pyx_v_g_src, __pyx_v_g_dst, __pyx_v_g_msk, __pyx_v_c_lo, __pyx_v_c_hi, __pyx_v_c_excl);

  /* "miniga4py/ga.pyx":3664
 *     GA_Scale_cols(g_a, g_v)
 * 
 * def scan_add(int g_src, int g_dst, int g_msk, lo=None, hi=None,             # <<<<<<<<<<<<<<
 *         bint excl=False):
 *     """Adds successive elements in a source vector g_src and put the results
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.scan_add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3715
 *     GA_Scan_add64(g_src, g_dst, g_msk, c_lo, c_hi, c_excl)
 * 
 * def scan_copy(int g_src, int g_dst, int g_msk, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """This subroutine does a segmented scan-copy of values in the source
 *     array g_src into a destination array g_dst with segments defined by
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_307scan_copy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_306scan_copy[] = "scan_copy(int g_src, int g_dst, int g_msk, lo=None, hi=None)\nThis subroutine does a segmented scan-copy of values in the source\n    array g_src into a destination array g_dst with segments defined by\n    values in the integer mask array g_msk. The scan-copy operation is only\n    applied to the range between the lo and hi indices. This operation is\n    restriced to 1-dimensional arrays. The resulting destination array will\n    consist of segments of consecutive elements with the same value. An\n    example is shown below\n\n    GA_Scan_copy(g_src, g_dst, g_msk, 0, n);\n    g_msk:   1  0  0  0  0  0  1  0  1  0  0  1  0  0  1  1  0\n    g_src:   1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17\n    g_dst:   1  1  1  1  1  1  7  7  9  9  9 12 12 12 15 16 16\n\n    This is a collective operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_307scan_copy = {"scan_copy", (PyCFunction)__pyx_pw_9miniga4py_2ga_307scan_copy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_306scan_copy};
static PyObject *__pyx_pw_9miniga4py_2ga_307scan_copy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_src;
  int __pyx_v_g_dst;
  int __pyx_v_g_msk;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("scan_copy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_src,&__pyx_n_s_g_dst,&__pyx_n_s_g_msk,&__pyx_n_s_lo,&__pyx_n_s_hi,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_src)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_dst)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("scan_copy", 0, 3, 5, 1); __PYX_ERR(0, 3715, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_msk)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("scan_copy", 0, 3, 5, 2); __PYX_ERR(0, 3715, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scan_copy") < 0)) __PYX_ERR(0, 3715, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_src = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_src == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3715, __pyx_L3_error)
    __pyx_v_g_dst = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_dst == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3715, __pyx_L3_error)
    __pyx_v_g_msk = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_g_msk == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3715, __pyx_L3_error)
    __pyx_v_lo = values[3];
    __pyx_v_hi = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("scan_copy", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3715, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.scan_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_306scan_copy(__pyx_self, __pyx_v_g_src, __pyx_v_g_dst, __pyx_v_g_msk, __pyx_v_lo, __pyx_v_hi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_306scan_copy(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_src, int __pyx_v_g_dst, int __pyx_v_g_msk, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
  PyArrayObject *__pyx_v_hi_nd = 0;
  int64_t __pyx_v_c_lo;
  int64_t __pyx_v_c_hi;
  CYTHON_UNUSED int __pyx_v_c_excl;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_nd;
  __Pyx_Buffer __pyx_pybuffer_hi_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyArrayObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int64_t __pyx_t_8;
  __Pyx_RefNannySetupContext("scan_copy", 0);
  __pyx_pybuffer_hi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_nd.refcount = 0;
  __pyx_pybuffernd_hi_nd.data = NULL;
  __pyx_pybuffernd_hi_nd.rcbuffer = &__pyx_pybuffer_hi_nd;

  /* "miniga4py/ga.pyx":3732
 * 
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] hi_nd = inquire_dims(g_src)-1             # <<<<<<<<<<<<<<
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0]
 *     cdef int c_excl=0
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga_inquire_dims(__pyx_v_g_src, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3732, __pyx_L1_error)
  __pyx_t_3 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_hi_nd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 3732, __pyx_L1_error)
    } else {__pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_3 = 0;
  __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "miniga4py/ga.pyx":3733
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] hi_nd = inquire_dims(g_src)-1
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0]             # <<<<<<<<<<<<<<
 *     cdef int c_excl=0
 *     if lo is not None:
 */
  __pyx_v_c_lo = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = -1;
  if (__pyx_t_4 < 0) {
    __pyx_t_4 += __pyx_pybuffernd_hi_nd.diminfo[0].shape;
    if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_hi_nd.diminfo[0].shape)) __pyx_t_5 = 0;
  if (unlikely(__pyx_t_5 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_5);
    __PYX_ERR(0, 3733, __pyx_L1_error)
  }
  __pyx_v_c_hi = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_hi_nd.diminfo[0].strides));

  /* "miniga4py/ga.pyx":3734
 *     cdef np.ndarray[np.int64_t, ndim=1] hi_nd = inquire_dims(g_src)-1
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0]
 *     cdef int c_excl=0             # <<<<<<<<<<<<<<
 *     if lo is not None:
 *         c_lo = lo
 */
  __pyx_v_c_excl = 0;

  /* "miniga4py/ga.pyx":3735
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0]
 *     cdef int c_excl=0
 *     if lo is not None:             # <<<<<<<<<<<<<<
 *         c_lo = lo
 *     if hi is not None:
 */
  __pyx_t_6 = (__pyx_v_lo != Py_None);
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "miniga4py/ga.pyx":3736
 *     cdef int c_excl=0
 *     if lo is not None:
 *         c_lo = lo             # <<<<<<<<<<<<<<
 *     if hi is not None:
 *         c_hi = hi
 */
    __pyx_t_8 = __Pyx_PyInt_As_int64_t(__pyx_v_lo); if (unlikely((__pyx_t_8 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3736, __pyx_L1_error)
    __pyx_v_c_lo = __pyx_t_8;

    /* "miniga4py/ga.pyx":3735
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0]
 *     cdef int c_excl=0
 *     if lo is not None:             # <<<<<<<<<<<<<<
 *         c_lo = lo
 *     if hi is not None:
 */
  }

  /* "miniga4py/ga.pyx":3737
 *     if lo is not None:
 *         c_lo = lo
 *     if hi is not None:             # <<<<<<<<<<<<<<
 *         c_hi = hi
 *     GA_Scan_copy64(g_src, g_dst, g_msk, c_lo, c_hi)
 */
  __pyx_t_7 = (__pyx_v_hi != Py_None);
  __pyx_t_6 = (__pyx_t_7 != 0);
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":3738
 *         c_lo = lo
 *     if hi is not None:
 *         c_hi = hi             # <<<<<<<<<<<<<<
 *     GA_Scan_copy64(g_src, g_dst, g_msk, c_lo, c_hi)
 * 
 */
    __pyx_t_8 = __Pyx_PyInt_As_int64_t(__pyx_v_hi); if (unlikely((__pyx_t_8 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3738, __pyx_L1_error)
    __pyx_v_c_hi = __pyx_t_8;

    /* "miniga4py/ga.pyx":3737
 *     if lo is not None:
 *         c_lo = lo
 *     if hi is not None:             # <<<<<<<<<<<<<<
 *         c_hi = hi
 *     GA_Scan_copy64(g_src, g_dst, g_msk, c_lo, c_hi)
 */
  }

  /* "miniga4py/ga.pyx":3739
 *     if hi is not None:
 *         c_hi = hi
 *     GA_Scan_copy64(g_src, g_dst, g_msk, c_lo, c_hi)             # <<<<<<<<<<<<<<
 * 
 * def scatter(int g_a, values, subsarray):
 */
  GA_Scan_copy64(__pyx_v_g_src, __pyx_v_g_dst, __pyx_v_g_msk, __pyx_v_c_lo, __pyx_v_c_hi);

  /* "miniga4py/ga.pyx":3715
 *     GA_Scan_add64(g_src, g_dst, g_msk, c_lo, c_hi, c_excl)
 * 
 * def scan_copy(int g_src, int g_dst, int g_msk, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """This subroutine does a segmented scan-copy of values in the source
 *     array g_src into a destination array g_dst with segments defined by
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.scan_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3741
 *     GA_Scan_copy64(g_src, g_dst, g_msk, c_lo, c_hi)
 * 
 * def scatter(int g_a, values, subsarray):             # <<<<<<<<<<<<<<
 *     """Scatters array elements from a global array into a local array.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_309scatter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_308scatter[] = "scatter(int g_a, values, subsarray)\nScatters array elements from a global array into a local array.\n\n    subsarray will be converted to an ndarray if it is not one already.  A\n    two-dimensional array is allowed so long as its shape is (n,ndim) where n\n    is the number of elements to gather and ndim is the number of dimensions\n    of the target array.  Also, subsarray must be contiguous.\n\n    For example, if the subsarray were two-dimensional::\n\n        for k in range(n):\n            v[k] = g_a[subsarray[k,0],subsarray[k,1],subsarray[k,2]...]\n\n    For example, if the subsarray were one-dimensional::\n\n        for k in range(n):\n            base = n*ndim\n            v[k] = g_a[subsarray[base+0],subsarray[base+1],subsarray[base+2]...]\n\n    This is a one-sided operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_309scatter = {"scatter", (PyCFunction)__pyx_pw_9miniga4py_2ga_309scatter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_308scatter};
static PyObject *__pyx_pw_9miniga4py_2ga_309scatter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_values = 0;
  PyObject *__pyx_v_subsarray = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("scatter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_values,&__pyx_n_s_subsarray,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("scatter", 1, 3, 3, 1); __PYX_ERR(0, 3741, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_subsarray)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("scatter", 1, 3, 3, 2); __PYX_ERR(0, 3741, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scatter") < 0)) __PYX_ERR(0, 3741, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3741, __pyx_L3_error)
    __pyx_v_values = values[1];
    __pyx_v_subsarray = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("scatter", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3741, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.scatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_308scatter(__pyx_self, __pyx_v_g_a, __pyx_v_values, __pyx_v_subsarray);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_308scatter(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_values, PyObject *__pyx_v_subsarray) {
  PyArrayObject *__pyx_v_subsarray1_nd = 0;
  PyArrayObject *__pyx_v_subsarray2_nd = 0;
  PyArrayObject *__pyx_v_values_nd = 0;
  int __pyx_v_gtype;
  int __pyx_v_ndim;
  int64_t __pyx_v_n;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_subsarray1_nd;
  __Pyx_Buffer __pyx_pybuffer_subsarray1_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_subsarray2_nd;
  __Pyx_Buffer __pyx_pybuffer_subsarray2_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyArrayObject *__pyx_t_1 = NULL;
  PyArrayObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  Py_ssize_t __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  int __pyx_t_22;
  int __pyx_t_23;
  __Pyx_RefNannySetupContext("scatter", 0);
  __pyx_pybuffer_subsarray1_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_subsarray1_nd.refcount = 0;
  __pyx_pybuffernd_subsarray1_nd.data = NULL;
  __pyx_pybuffernd_subsarray1_nd.rcbuffer = &__pyx_pybuffer_subsarray1_nd;
  __pyx_pybuffer_subsarray2_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_subsarray2_nd.refcount = 0;
  __pyx_pybuffernd_subsarray2_nd.data = NULL;
  __pyx_pybuffernd_subsarray2_nd.rcbuffer = &__pyx_pybuffer_subsarray2_nd;

  /* "miniga4py/ga.pyx":3763
 * 
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] subsarray1_nd = None             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[np.int64_t, ndim=2] subsarray2_nd = None
 *     cdef np.ndarray values_nd = None
 */
  __pyx_t_1 = ((PyArrayObject *)Py_None);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_subsarray1_nd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 3763, __pyx_L1_error)
    } else {__pyx_pybuffernd_subsarray1_nd.diminfo[0].strides = __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subsarray1_nd.diminfo[0].shape = __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_1 = 0;
  __Pyx_INCREF(Py_None);
  __pyx_v_subsarray1_nd = ((PyArrayObject *)Py_None);

  /* "miniga4py/ga.pyx":3764
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] subsarray1_nd = None
 *     cdef np.ndarray[np.int64_t, ndim=2] subsarray2_nd = None             # <<<<<<<<<<<<<<
 *     cdef np.ndarray values_nd = None
 *     cdef int gtype = inquire_type(g_a)
 */
  __pyx_t_2 = ((PyArrayObject *)Py_None);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_subsarray2_nd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 3764, __pyx_L1_error)
    } else {__pyx_pybuffernd_subsarray2_nd.diminfo[0].strides = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subsarray2_nd.diminfo[0].shape = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_subsarray2_nd.diminfo[1].strides = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_subsarray2_nd.diminfo[1].shape = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_2 = 0;
  __Pyx_INCREF(Py_None);
  __pyx_v_subsarray2_nd = ((PyArrayObject *)Py_None);

  /* "miniga4py/ga.pyx":3765
 *     cdef np.ndarray[np.int64_t, ndim=1] subsarray1_nd = None
 *     cdef np.ndarray[np.int64_t, ndim=2] subsarray2_nd = None
 *     cdef np.ndarray values_nd = None             # <<<<<<<<<<<<<<
 *     cdef int gtype = inquire_type(g_a)
 *     cdef int ndim = GA_Ndim(g_a)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_values_nd = ((PyArrayObject *)Py_None);

  /* "miniga4py/ga.pyx":3766
 *     cdef np.ndarray[np.int64_t, ndim=2] subsarray2_nd = None
 *     cdef np.ndarray values_nd = None
 *     cdef int gtype = inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     cdef int ndim = GA_Ndim(g_a)
 *     cdef int64_t n
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":3767
 *     cdef np.ndarray values_nd = None
 *     cdef int gtype = inquire_type(g_a)
 *     cdef int ndim = GA_Ndim(g_a)             # <<<<<<<<<<<<<<
 *     cdef int64_t n
 *     # prepare subsarray
 */
  __pyx_v_ndim = GA_Ndim(__pyx_v_g_a);

  /* "miniga4py/ga.pyx":3770
 *     cdef int64_t n
 *     # prepare subsarray
 *     try:             # <<<<<<<<<<<<<<
 *         subsarray1_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *         n = len(subsarray1_nd) / ndim
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "miniga4py/ga.pyx":3771
 *     # prepare subsarray
 *     try:
 *         subsarray1_nd = np.ascontiguousarray(subsarray, dtype=np.int64)             # <<<<<<<<<<<<<<
 *         n = len(subsarray1_nd) / ndim
 *     except ValueError:
 */
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3771, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3771, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3771, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_subsarray);
      __Pyx_GIVEREF(__pyx_v_subsarray);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_subsarray);
      __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3771, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3771, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_int64); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3771, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 3771, __pyx_L3_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3771, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3771, __pyx_L3_error)
      __pyx_t_1 = ((PyArrayObject *)__pyx_t_10);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer);
        __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_11 < 0)) {
          PyErr_Fetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_subsarray1_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
          }
          __pyx_t_12 = __pyx_t_13 = __pyx_t_14 = 0;
        }
        __pyx_pybuffernd_subsarray1_nd.diminfo[0].strides = __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subsarray1_nd.diminfo[0].shape = __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 3771, __pyx_L3_error)
      }
      __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_subsarray1_nd, ((PyArrayObject *)__pyx_t_10));
      __pyx_t_10 = 0;

      /* "miniga4py/ga.pyx":3772
 *     try:
 *         subsarray1_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *         n = len(subsarray1_nd) / ndim             # <<<<<<<<<<<<<<
 *     except ValueError:
 *         subsarray1_nd = None
 */
      __pyx_t_15 = PyObject_Length(((PyObject *)__pyx_v_subsarray1_nd)); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3772, __pyx_L3_error)
      if (unlikely(__pyx_v_ndim == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
        __PYX_ERR(0, 3772, __pyx_L3_error)
      }
      else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_ndim == (int)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_15))) {
        PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
        __PYX_ERR(0, 3772, __pyx_L3_error)
      }
      __pyx_v_n = __Pyx_div_Py_ssize_t(__pyx_t_15, __pyx_v_ndim);

      /* "miniga4py/ga.pyx":3770
 *     cdef int64_t n
 *     # prepare subsarray
 *     try:             # <<<<<<<<<<<<<<
 *         subsarray1_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *         n = len(subsarray1_nd) / ndim
 */
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "miniga4py/ga.pyx":3773
 *         subsarray1_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *         n = len(subsarray1_nd) / ndim
 *     except ValueError:             # <<<<<<<<<<<<<<
 *         subsarray1_nd = None
 *         try:
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_11) {
      __Pyx_AddTraceback("miniga4py.ga.scatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(0, 3773, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_6);

      /* "miniga4py/ga.pyx":3774
 *         n = len(subsarray1_nd) / ndim
 *     except ValueError:
 *         subsarray1_nd = None             # <<<<<<<<<<<<<<
 *         try:
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 */
      __pyx_t_1 = ((PyArrayObject *)Py_None);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer);
        __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_11 < 0)) {
          PyErr_Fetch(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_subsarray1_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_14, __pyx_t_13, __pyx_t_12);
          }
          __pyx_t_14 = __pyx_t_13 = __pyx_t_12 = 0;
        }
        __pyx_pybuffernd_subsarray1_nd.diminfo[0].strides = __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subsarray1_nd.diminfo[0].shape = __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 3774, __pyx_L5_except_error)
      }
      __pyx_t_1 = 0;
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF_SET(__pyx_v_subsarray1_nd, ((PyArrayObject *)Py_None));

      /* "miniga4py/ga.pyx":3775
 *     except ValueError:
 *         subsarray1_nd = None
 *         try:             # <<<<<<<<<<<<<<
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
        __Pyx_XGOTREF(__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_13);
        __Pyx_XGOTREF(__pyx_t_14);
        /*try:*/ {

          /* "miniga4py/ga.pyx":3776
 *         subsarray1_nd = None
 *         try:
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)             # <<<<<<<<<<<<<<
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 *         except ValueError:
 */
          __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3776, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3776, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3776, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_INCREF(__pyx_v_subsarray);
          __Pyx_GIVEREF(__pyx_v_subsarray);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_subsarray);
          __pyx_t_16 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3776, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_16);
          __pyx_t_17 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3776, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_17);
          __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_int64); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 3776, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_18);
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_dtype, __pyx_t_18) < 0) __PYX_ERR(0, 3776, __pyx_L11_error)
          __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
          __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, __pyx_t_16); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 3776, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_18);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          if (!(likely(((__pyx_t_18) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_18, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3776, __pyx_L11_error)
          __pyx_t_2 = ((PyArrayObject *)__pyx_t_18);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer);
            __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_11 < 0)) {
              PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_subsarray2_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
              }
              __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
            }
            __pyx_pybuffernd_subsarray2_nd.diminfo[0].strides = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subsarray2_nd.diminfo[0].shape = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_subsarray2_nd.diminfo[1].strides = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_subsarray2_nd.diminfo[1].shape = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 3776, __pyx_L11_error)
          }
          __pyx_t_2 = 0;
          __Pyx_DECREF_SET(__pyx_v_subsarray2_nd, ((PyArrayObject *)__pyx_t_18));
          __pyx_t_18 = 0;

          /* "miniga4py/ga.pyx":3777
 *         try:
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd             # <<<<<<<<<<<<<<
 *         except ValueError:
 *             raise ValueError("subsarray must be either 1- or 2-dimensional")
 */
          __pyx_t_15 = PyObject_Length(((PyObject *)__pyx_v_subsarray2_nd)); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3777, __pyx_L11_error)
          __pyx_v_n = __pyx_t_15;

          /* "miniga4py/ga.pyx":3775
 *     except ValueError:
 *         subsarray1_nd = None
 *         try:             # <<<<<<<<<<<<<<
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 */
        }
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        goto __pyx_L18_try_end;
        __pyx_L11_error:;
        __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;

        /* "miniga4py/ga.pyx":3778
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 *         except ValueError:             # <<<<<<<<<<<<<<
 *             raise ValueError("subsarray must be either 1- or 2-dimensional")
 *     # prepare values array
 */
        __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
        if (__pyx_t_11) {
          __Pyx_AddTraceback("miniga4py.ga.scatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_18, &__pyx_t_16, &__pyx_t_7) < 0) __PYX_ERR(0, 3778, __pyx_L13_except_error)
          __Pyx_GOTREF(__pyx_t_18);
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_GOTREF(__pyx_t_7);

          /* "miniga4py/ga.pyx":3779
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 *         except ValueError:
 *             raise ValueError("subsarray must be either 1- or 2-dimensional")             # <<<<<<<<<<<<<<
 *     # prepare values array
 *     values_nd = np.asarray(values, dtype=_to_dtype[gtype])
 */
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3779, __pyx_L13_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_Raise(__pyx_t_9, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __PYX_ERR(0, 3779, __pyx_L13_except_error)
        }
        goto __pyx_L13_except_error;
        __pyx_L13_except_error:;

        /* "miniga4py/ga.pyx":3775
 *     except ValueError:
 *         subsarray1_nd = None
 *         try:             # <<<<<<<<<<<<<<
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 */
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
        goto __pyx_L5_except_error;
        __pyx_L18_try_end:;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "miniga4py/ga.pyx":3770
 *     cdef int64_t n
 *     # prepare subsarray
 *     try:             # <<<<<<<<<<<<<<
 *         subsarray1_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *         n = len(subsarray1_nd) / ndim
 */
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    __pyx_L8_try_end:;
  }

  /* "miniga4py/ga.pyx":3781
 *             raise ValueError("subsarray must be either 1- or 2-dimensional")
 *     # prepare values array
 *     values_nd = np.asarray(values, dtype=_to_dtype[gtype])             # <<<<<<<<<<<<<<
 *     if values_nd.ndim != 1:
 *         raise ValueError("values must be one-dimensional")
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_asarray); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_values);
  __Pyx_GIVEREF(__pyx_v_values);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_values);
  __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_to_dtype); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_7, __pyx_v_gtype, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_16) < 0) __PYX_ERR(0, 3781, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, __pyx_t_10); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3781, __pyx_L1_error)
  __Pyx_DECREF_SET(__pyx_v_values_nd, ((PyArrayObject *)__pyx_t_16));
  __pyx_t_16 = 0;

  /* "miniga4py/ga.pyx":3782
 *     # prepare values array
 *     values_nd = np.asarray(values, dtype=_to_dtype[gtype])
 *     if values_nd.ndim != 1:             # <<<<<<<<<<<<<<
 *         raise ValueError("values must be one-dimensional")
 *     if not values_nd.flags['C_CONTIGUOUS']:
 */
  __pyx_t_22 = ((__pyx_v_values_nd->nd != 1) != 0);
  if (unlikely(__pyx_t_22)) {

    /* "miniga4py/ga.pyx":3783
 *     values_nd = np.asarray(values, dtype=_to_dtype[gtype])
 *     if values_nd.ndim != 1:
 *         raise ValueError("values must be one-dimensional")             # <<<<<<<<<<<<<<
 *     if not values_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("values must be contiguous")
 */
    __pyx_t_16 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3783, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_Raise(__pyx_t_16, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __PYX_ERR(0, 3783, __pyx_L1_error)

    /* "miniga4py/ga.pyx":3782
 *     # prepare values array
 *     values_nd = np.asarray(values, dtype=_to_dtype[gtype])
 *     if values_nd.ndim != 1:             # <<<<<<<<<<<<<<
 *         raise ValueError("values must be one-dimensional")
 *     if not values_nd.flags['C_CONTIGUOUS']:
 */
  }

  /* "miniga4py/ga.pyx":3784
 *     if values_nd.ndim != 1:
 *         raise ValueError("values must be one-dimensional")
 *     if not values_nd.flags['C_CONTIGUOUS']:             # <<<<<<<<<<<<<<
 *         raise ValueError("values must be contiguous")
 *     if len(values_nd) < n:
 */
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_values_nd), __pyx_n_s_flags); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3784, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_t_16, __pyx_n_s_C_CONTIGUOUS); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3784, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_22 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 3784, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_23 = ((!__pyx_t_22) != 0);
  if (unlikely(__pyx_t_23)) {

    /* "miniga4py/ga.pyx":3785
 *         raise ValueError("values must be one-dimensional")
 *     if not values_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("values must be contiguous")             # <<<<<<<<<<<<<<
 *     if len(values_nd) < n:
 *         raise ValueError("values was not large enough")
 */
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3785, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_Raise(__pyx_t_10, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __PYX_ERR(0, 3785, __pyx_L1_error)

    /* "miniga4py/ga.pyx":3784
 *     if values_nd.ndim != 1:
 *         raise ValueError("values must be one-dimensional")
 *     if not values_nd.flags['C_CONTIGUOUS']:             # <<<<<<<<<<<<<<
 *         raise ValueError("values must be contiguous")
 *     if len(values_nd) < n:
 */
  }

  /* "miniga4py/ga.pyx":3786
 *     if not values_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("values must be contiguous")
 *     if len(values_nd) < n:             # <<<<<<<<<<<<<<
 *         raise ValueError("values was not large enough")
 *     # call the wrapped function
 */
  __pyx_t_15 = PyObject_Length(((PyObject *)__pyx_v_values_nd)); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3786, __pyx_L1_error)
  __pyx_t_23 = ((__pyx_t_15 < __pyx_v_n) != 0);
  if (unlikely(__pyx_t_23)) {

    /* "miniga4py/ga.pyx":3787
 *         raise ValueError("values must be contiguous")
 *     if len(values_nd) < n:
 *         raise ValueError("values was not large enough")             # <<<<<<<<<<<<<<
 *     # call the wrapped function
 *     if subsarray1_nd is not None:
 */
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_Raise(__pyx_t_10, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __PYX_ERR(0, 3787, __pyx_L1_error)

    /* "miniga4py/ga.pyx":3786
 *     if not values_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("values must be contiguous")
 *     if len(values_nd) < n:             # <<<<<<<<<<<<<<
 *         raise ValueError("values was not large enough")
 *     # call the wrapped function
 */
  }

  /* "miniga4py/ga.pyx":3789
 *         raise ValueError("values was not large enough")
 *     # call the wrapped function
 *     if subsarray1_nd is not None:             # <<<<<<<<<<<<<<
 *         NGA_Scatter_flat64(g_a, <void*>values_nd.data,
 *                 <int64_t*>subsarray1_nd.data, n)
 */
  __pyx_t_23 = (((PyObject *)__pyx_v_subsarray1_nd) != Py_None);
  __pyx_t_22 = (__pyx_t_23 != 0);
  if (__pyx_t_22) {

    /* "miniga4py/ga.pyx":3790
 *     # call the wrapped function
 *     if subsarray1_nd is not None:
 *         NGA_Scatter_flat64(g_a, <void*>values_nd.data,             # <<<<<<<<<<<<<<
 *                 <int64_t*>subsarray1_nd.data, n)
 *     elif subsarray2_nd is not None:
 */
    NGA_Scatter_flat64(__pyx_v_g_a, ((void *)__pyx_v_values_nd->data), ((int64_t *)__pyx_v_subsarray1_nd->data), __pyx_v_n);

    /* "miniga4py/ga.pyx":3789
 *         raise ValueError("values was not large enough")
 *     # call the wrapped function
 *     if subsarray1_nd is not None:             # <<<<<<<<<<<<<<
 *         NGA_Scatter_flat64(g_a, <void*>values_nd.data,
 *                 <int64_t*>subsarray1_nd.data, n)
 */
    goto __pyx_L24;
  }

  /* "miniga4py/ga.pyx":3792
 *         NGA_Scatter_flat64(g_a, <void*>values_nd.data,
 *                 <int64_t*>subsarray1_nd.data, n)
 *     elif subsarray2_nd is not None:             # <<<<<<<<<<<<<<
 *         NGA_Scatter_flat64(g_a, <void*>values_nd.data,
 *                 <int64_t*>subsarray2_nd.data, n)
 */
  __pyx_t_22 = (((PyObject *)__pyx_v_subsarray2_nd) != Py_None);
  __pyx_t_23 = (__pyx_t_22 != 0);
  if (likely(__pyx_t_23)) {

    /* "miniga4py/ga.pyx":3793
 *                 <int64_t*>subsarray1_nd.data, n)
 *     elif subsarray2_nd is not None:
 *         NGA_Scatter_flat64(g_a, <void*>values_nd.data,             # <<<<<<<<<<<<<<
 *                 <int64_t*>subsarray2_nd.data, n)
 *     else:
 */
    NGA_Scatter_flat64(__pyx_v_g_a, ((void *)__pyx_v_values_nd->data), ((int64_t *)__pyx_v_subsarray2_nd->data), __pyx_v_n);

    /* "miniga4py/ga.pyx":3792
 *         NGA_Scatter_flat64(g_a, <void*>values_nd.data,
 *                 <int64_t*>subsarray1_nd.data, n)
 *     elif subsarray2_nd is not None:             # <<<<<<<<<<<<<<
 *         NGA_Scatter_flat64(g_a, <void*>values_nd.data,
 *                 <int64_t*>subsarray2_nd.data, n)
 */
    goto __pyx_L24;
  }

  /* "miniga4py/ga.pyx":3796
 *                 <int64_t*>subsarray2_nd.data, n)
 *     else:
 *         raise ValueError("how did this happen?")             # <<<<<<<<<<<<<<
 * 
 * def scatter_acc(int g_a, values, subsarray, alpha=None):
 */
  /*else*/ {
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3796, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_Raise(__pyx_t_10, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __PYX_ERR(0, 3796, __pyx_L1_error)
  }
  __pyx_L24:;

  /* "miniga4py/ga.pyx":3741
 *     GA_Scan_copy64(g_src, g_dst, g_msk, c_lo, c_hi)
 * 
 * def scatter(int g_a, values, subsarray):             # <<<<<<<<<<<<<<
 *     """Scatters array elements from a global array into a local array.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.scatter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_subsarray1_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_subsarray2_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_values_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3798
 *         raise ValueError("how did this happen?")
 * 
 * def scatter_acc(int g_a, values, subsarray, alpha=None):             # <<<<<<<<<<<<<<
 *     """Scatters array elements from a global array into a local array.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_311scatter_acc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_310scatter_acc[] = "scatter_acc(int g_a, values, subsarray, alpha=None)\nScatters array elements from a global array into a local array.\n\n    Like scatter, but adds values to existing values in the global array after\n    multiplying by alpha.\n\n    subsarray will be converted to an ndarray if it is not one already.  A\n    two-dimensional array is allowed so long as its shape is (n,ndim) where n\n    is the number of elements to gather and ndim is the number of dimensions\n    of the target array.  Also, subsarray must be contiguous.\n\n    For example, if the subsarray were two-dimensional::\n\n        for k in range(n):\n            v[k] = g_a[subsarray[k,0],subsarray[k,1],subsarray[k,2]...]\n\n    For example, if the subsarray were one-dimensional::\n\n        for k in range(n):\n            base = n*ndim\n            v[k] = g_a[subsarray[base+0],subsarray[base+1],subsarray[base+2]...]\n\n    This is a one-sided operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_311scatter_acc = {"scatter_acc", (PyCFunction)__pyx_pw_9miniga4py_2ga_311scatter_acc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_310scatter_acc};
static PyObject *__pyx_pw_9miniga4py_2ga_311scatter_acc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_values = 0;
  PyObject *__pyx_v_subsarray = 0;
  PyObject *__pyx_v_alpha = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("scatter_acc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_values,&__pyx_n_s_subsarray,&__pyx_n_s_alpha,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("scatter_acc", 0, 3, 4, 1); __PYX_ERR(0, 3798, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_subsarray)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("scatter_acc", 0, 3, 4, 2); __PYX_ERR(0, 3798, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scatter_acc") < 0)) __PYX_ERR(0, 3798, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3798, __pyx_L3_error)
    __pyx_v_values = values[1];
    __pyx_v_subsarray = values[2];
    __pyx_v_alpha = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("scatter_acc", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3798, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.scatter_acc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_310scatter_acc(__pyx_self, __pyx_v_g_a, __pyx_v_values, __pyx_v_subsarray, __pyx_v_alpha);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_310scatter_acc(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_values, PyObject *__pyx_v_subsarray, PyObject *__pyx_v_alpha) {
  PyArrayObject *__pyx_v_subsarray1_nd = 0;
  PyArrayObject *__pyx_v_subsarray2_nd = 0;
  PyArrayObject *__pyx_v_values_nd = 0;
  int __pyx_v_gtype;
  int __pyx_v_ndim;
  int64_t __pyx_v_n;
  int __pyx_v_ialpha;
  long __pyx_v_lalpha;
  PY_LONG_LONG __pyx_v_llalpha;
  float __pyx_v_falpha;
  double __pyx_v_dalpha;
  long double __pyx_v_ldalpha;
  SingleComplex __pyx_v_fcalpha;
  DoubleComplex __pyx_v_dcalpha;
  void *__pyx_v_valpha;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_subsarray1_nd;
  __Pyx_Buffer __pyx_pybuffer_subsarray1_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_subsarray2_nd;
  __Pyx_Buffer __pyx_pybuffer_subsarray2_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyArrayObject *__pyx_t_1 = NULL;
  PyArrayObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  Py_ssize_t __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  int __pyx_t_22;
  int __pyx_t_23;
  __Pyx_RefNannySetupContext("scatter_acc", 0);
  __Pyx_INCREF(__pyx_v_alpha);
  __pyx_pybuffer_subsarray1_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_subsarray1_nd.refcount = 0;
  __pyx_pybuffernd_subsarray1_nd.data = NULL;
  __pyx_pybuffernd_subsarray1_nd.rcbuffer = &__pyx_pybuffer_subsarray1_nd;
  __pyx_pybuffer_subsarray2_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_subsarray2_nd.refcount = 0;
  __pyx_pybuffernd_subsarray2_nd.data = NULL;
  __pyx_pybuffernd_subsarray2_nd.rcbuffer = &__pyx_pybuffer_subsarray2_nd;

  /* "miniga4py/ga.pyx":3823
 * 
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] subsarray1_nd = None             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[np.int64_t, ndim=2] subsarray2_nd = None
 *     cdef np.ndarray values_nd = None
 */
  __pyx_t_1 = ((PyArrayObject *)Py_None);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_subsarray1_nd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 3823, __pyx_L1_error)
    } else {__pyx_pybuffernd_subsarray1_nd.diminfo[0].strides = __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subsarray1_nd.diminfo[0].shape = __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_1 = 0;
  __Pyx_INCREF(Py_None);
  __pyx_v_subsarray1_nd = ((PyArrayObject *)Py_None);

  /* "miniga4py/ga.pyx":3824
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] subsarray1_nd = None
 *     cdef np.ndarray[np.int64_t, ndim=2] subsarray2_nd = None             # <<<<<<<<<<<<<<
 *     cdef np.ndarray values_nd = None
 *     cdef int gtype = inquire_type(g_a)
 */
  __pyx_t_2 = ((PyArrayObject *)Py_None);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_subsarray2_nd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 3824, __pyx_L1_error)
    } else {__pyx_pybuffernd_subsarray2_nd.diminfo[0].strides = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subsarray2_nd.diminfo[0].shape = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_subsarray2_nd.diminfo[1].strides = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_subsarray2_nd.diminfo[1].shape = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_2 = 0;
  __Pyx_INCREF(Py_None);
  __pyx_v_subsarray2_nd = ((PyArrayObject *)Py_None);

  /* "miniga4py/ga.pyx":3825
 *     cdef np.ndarray[np.int64_t, ndim=1] subsarray1_nd = None
 *     cdef np.ndarray[np.int64_t, ndim=2] subsarray2_nd = None
 *     cdef np.ndarray values_nd = None             # <<<<<<<<<<<<<<
 *     cdef int gtype = inquire_type(g_a)
 *     cdef int ndim = GA_Ndim(g_a)
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_values_nd = ((PyArrayObject *)Py_None);

  /* "miniga4py/ga.pyx":3826
 *     cdef np.ndarray[np.int64_t, ndim=2] subsarray2_nd = None
 *     cdef np.ndarray values_nd = None
 *     cdef int gtype = inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     cdef int ndim = GA_Ndim(g_a)
 *     cdef int64_t n
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":3827
 *     cdef np.ndarray values_nd = None
 *     cdef int gtype = inquire_type(g_a)
 *     cdef int ndim = GA_Ndim(g_a)             # <<<<<<<<<<<<<<
 *     cdef int64_t n
 *     cdef int            ialpha
 */
  __pyx_v_ndim = GA_Ndim(__pyx_v_g_a);

  /* "miniga4py/ga.pyx":3837
 *     cdef SingleComplex  fcalpha
 *     cdef DoubleComplex  dcalpha
 *     cdef void          *valpha=NULL             # <<<<<<<<<<<<<<
 *     # prepare subsarray
 *     try:
 */
  __pyx_v_valpha = NULL;

  /* "miniga4py/ga.pyx":3839
 *     cdef void          *valpha=NULL
 *     # prepare subsarray
 *     try:             # <<<<<<<<<<<<<<
 *         subsarray1_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *         n = len(subsarray1_nd) / ndim
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "miniga4py/ga.pyx":3840
 *     # prepare subsarray
 *     try:
 *         subsarray1_nd = np.ascontiguousarray(subsarray, dtype=np.int64)             # <<<<<<<<<<<<<<
 *         n = len(subsarray1_nd) / ndim
 *     except ValueError:
 */
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3840, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3840, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3840, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_subsarray);
      __Pyx_GIVEREF(__pyx_v_subsarray);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_subsarray);
      __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3840, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3840, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_int64); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3840, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 3840, __pyx_L3_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3840, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3840, __pyx_L3_error)
      __pyx_t_1 = ((PyArrayObject *)__pyx_t_10);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer);
        __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_11 < 0)) {
          PyErr_Fetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_subsarray1_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
          }
          __pyx_t_12 = __pyx_t_13 = __pyx_t_14 = 0;
        }
        __pyx_pybuffernd_subsarray1_nd.diminfo[0].strides = __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subsarray1_nd.diminfo[0].shape = __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 3840, __pyx_L3_error)
      }
      __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_subsarray1_nd, ((PyArrayObject *)__pyx_t_10));
      __pyx_t_10 = 0;

      /* "miniga4py/ga.pyx":3841
 *     try:
 *         subsarray1_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *         n = len(subsarray1_nd) / ndim             # <<<<<<<<<<<<<<
 *     except ValueError:
 *         subsarray1_nd = None
 */
      __pyx_t_15 = PyObject_Length(((PyObject *)__pyx_v_subsarray1_nd)); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3841, __pyx_L3_error)
      if (unlikely(__pyx_v_ndim == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
        __PYX_ERR(0, 3841, __pyx_L3_error)
      }
      else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_ndim == (int)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_15))) {
        PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
        __PYX_ERR(0, 3841, __pyx_L3_error)
      }
      __pyx_v_n = __Pyx_div_Py_ssize_t(__pyx_t_15, __pyx_v_ndim);

      /* "miniga4py/ga.pyx":3839
 *     cdef void          *valpha=NULL
 *     # prepare subsarray
 *     try:             # <<<<<<<<<<<<<<
 *         subsarray1_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *         n = len(subsarray1_nd) / ndim
 */
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "miniga4py/ga.pyx":3842
 *         subsarray1_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *         n = len(subsarray1_nd) / ndim
 *     except ValueError:             # <<<<<<<<<<<<<<
 *         subsarray1_nd = None
 *         try:
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_11) {
      __Pyx_AddTraceback("miniga4py.ga.scatter_acc", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(0, 3842, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_6);

      /* "miniga4py/ga.pyx":3843
 *         n = len(subsarray1_nd) / ndim
 *     except ValueError:
 *         subsarray1_nd = None             # <<<<<<<<<<<<<<
 *         try:
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 */
      __pyx_t_1 = ((PyArrayObject *)Py_None);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer);
        __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_11 < 0)) {
          PyErr_Fetch(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_subsarray1_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_14, __pyx_t_13, __pyx_t_12);
          }
          __pyx_t_14 = __pyx_t_13 = __pyx_t_12 = 0;
        }
        __pyx_pybuffernd_subsarray1_nd.diminfo[0].strides = __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subsarray1_nd.diminfo[0].shape = __pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 3843, __pyx_L5_except_error)
      }
      __pyx_t_1 = 0;
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF_SET(__pyx_v_subsarray1_nd, ((PyArrayObject *)Py_None));

      /* "miniga4py/ga.pyx":3844
 *     except ValueError:
 *         subsarray1_nd = None
 *         try:             # <<<<<<<<<<<<<<
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
        __Pyx_XGOTREF(__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_13);
        __Pyx_XGOTREF(__pyx_t_14);
        /*try:*/ {

          /* "miniga4py/ga.pyx":3845
 *         subsarray1_nd = None
 *         try:
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)             # <<<<<<<<<<<<<<
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 *         except ValueError:
 */
          __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3845, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3845, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3845, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_INCREF(__pyx_v_subsarray);
          __Pyx_GIVEREF(__pyx_v_subsarray);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_subsarray);
          __pyx_t_16 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3845, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_16);
          __pyx_t_17 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 3845, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_17);
          __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_int64); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 3845, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_18);
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_dtype, __pyx_t_18) < 0) __PYX_ERR(0, 3845, __pyx_L11_error)
          __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
          __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, __pyx_t_16); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 3845, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_18);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          if (!(likely(((__pyx_t_18) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_18, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3845, __pyx_L11_error)
          __pyx_t_2 = ((PyArrayObject *)__pyx_t_18);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer);
            __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_11 < 0)) {
              PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_subsarray2_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
              }
              __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
            }
            __pyx_pybuffernd_subsarray2_nd.diminfo[0].strides = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_subsarray2_nd.diminfo[0].shape = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_subsarray2_nd.diminfo[1].strides = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_subsarray2_nd.diminfo[1].shape = __pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 3845, __pyx_L11_error)
          }
          __pyx_t_2 = 0;
          __Pyx_DECREF_SET(__pyx_v_subsarray2_nd, ((PyArrayObject *)__pyx_t_18));
          __pyx_t_18 = 0;

          /* "miniga4py/ga.pyx":3846
 *         try:
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd             # <<<<<<<<<<<<<<
 *         except ValueError:
 *             raise ValueError("subsarray must be either 1- or 2-dimensional")
 */
          __pyx_t_15 = PyObject_Length(((PyObject *)__pyx_v_subsarray2_nd)); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3846, __pyx_L11_error)
          __pyx_v_n = __pyx_t_15;

          /* "miniga4py/ga.pyx":3844
 *     except ValueError:
 *         subsarray1_nd = None
 *         try:             # <<<<<<<<<<<<<<
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 */
        }
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        goto __pyx_L18_try_end;
        __pyx_L11_error:;
        __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;

        /* "miniga4py/ga.pyx":3847
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 *         except ValueError:             # <<<<<<<<<<<<<<
 *             raise ValueError("subsarray must be either 1- or 2-dimensional")
 *     # prepare values array
 */
        __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
        if (__pyx_t_11) {
          __Pyx_AddTraceback("miniga4py.ga.scatter_acc", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_18, &__pyx_t_16, &__pyx_t_7) < 0) __PYX_ERR(0, 3847, __pyx_L13_except_error)
          __Pyx_GOTREF(__pyx_t_18);
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_GOTREF(__pyx_t_7);

          /* "miniga4py/ga.pyx":3848
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 *         except ValueError:
 *             raise ValueError("subsarray must be either 1- or 2-dimensional")             # <<<<<<<<<<<<<<
 *     # prepare values array
 *     values_nd = np.asarray(values, dtype=_to_dtype[gtype])
 */
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3848, __pyx_L13_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_Raise(__pyx_t_9, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __PYX_ERR(0, 3848, __pyx_L13_except_error)
        }
        goto __pyx_L13_except_error;
        __pyx_L13_except_error:;

        /* "miniga4py/ga.pyx":3844
 *     except ValueError:
 *         subsarray1_nd = None
 *         try:             # <<<<<<<<<<<<<<
 *             subsarray2_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 */
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
        goto __pyx_L5_except_error;
        __pyx_L18_try_end:;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "miniga4py/ga.pyx":3839
 *     cdef void          *valpha=NULL
 *     # prepare subsarray
 *     try:             # <<<<<<<<<<<<<<
 *         subsarray1_nd = np.ascontiguousarray(subsarray, dtype=np.int64)
 *         n = len(subsarray1_nd) / ndim
 */
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    __pyx_L8_try_end:;
  }

  /* "miniga4py/ga.pyx":3850
 *             raise ValueError("subsarray must be either 1- or 2-dimensional")
 *     # prepare values array
 *     values_nd = np.asarray(values, dtype=_to_dtype[gtype])             # <<<<<<<<<<<<<<
 *     if values_nd.ndim != 1:
 *         raise ValueError("values must be one-dimensional")
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_asarray); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_values);
  __Pyx_GIVEREF(__pyx_v_values);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_values);
  __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_to_dtype); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_7, __pyx_v_gtype, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_16) < 0) __PYX_ERR(0, 3850, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, __pyx_t_10); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3850, __pyx_L1_error)
  __Pyx_DECREF_SET(__pyx_v_values_nd, ((PyArrayObject *)__pyx_t_16));
  __pyx_t_16 = 0;

  /* "miniga4py/ga.pyx":3851
 *     # prepare values array
 *     values_nd = np.asarray(values, dtype=_to_dtype[gtype])
 *     if values_nd.ndim != 1:             # <<<<<<<<<<<<<<
 *         raise ValueError("values must be one-dimensional")
 *     if not values_nd.flags['C_CONTIGUOUS']:
 */
  __pyx_t_22 = ((__pyx_v_values_nd->nd != 1) != 0);
  if (unlikely(__pyx_t_22)) {

    /* "miniga4py/ga.pyx":3852
 *     values_nd = np.asarray(values, dtype=_to_dtype[gtype])
 *     if values_nd.ndim != 1:
 *         raise ValueError("values must be one-dimensional")             # <<<<<<<<<<<<<<
 *     if not values_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("values must be contiguous")
 */
    __pyx_t_16 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3852, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_Raise(__pyx_t_16, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __PYX_ERR(0, 3852, __pyx_L1_error)

    /* "miniga4py/ga.pyx":3851
 *     # prepare values array
 *     values_nd = np.asarray(values, dtype=_to_dtype[gtype])
 *     if values_nd.ndim != 1:             # <<<<<<<<<<<<<<
 *         raise ValueError("values must be one-dimensional")
 *     if not values_nd.flags['C_CONTIGUOUS']:
 */
  }

  /* "miniga4py/ga.pyx":3853
 *     if values_nd.ndim != 1:
 *         raise ValueError("values must be one-dimensional")
 *     if not values_nd.flags['C_CONTIGUOUS']:             # <<<<<<<<<<<<<<
 *         raise ValueError("values must be contiguous")
 *     if len(values_nd) < n:
 */
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_values_nd), __pyx_n_s_flags); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 3853, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_t_16, __pyx_n_s_C_CONTIGUOUS); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3853, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_22 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 3853, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_23 = ((!__pyx_t_22) != 0);
  if (unlikely(__pyx_t_23)) {

    /* "miniga4py/ga.pyx":3854
 *         raise ValueError("values must be one-dimensional")
 *     if not values_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("values must be contiguous")             # <<<<<<<<<<<<<<
 *     if len(values_nd) < n:
 *         raise ValueError("values was not large enough")
 */
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3854, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_Raise(__pyx_t_10, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __PYX_ERR(0, 3854, __pyx_L1_error)

    /* "miniga4py/ga.pyx":3853
 *     if values_nd.ndim != 1:
 *         raise ValueError("values must be one-dimensional")
 *     if not values_nd.flags['C_CONTIGUOUS']:             # <<<<<<<<<<<<<<
 *         raise ValueError("values must be contiguous")
 *     if len(values_nd) < n:
 */
  }

  /* "miniga4py/ga.pyx":3855
 *     if not values_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("values must be contiguous")
 *     if len(values_nd) < n:             # <<<<<<<<<<<<<<
 *         raise ValueError("values was not large enough")
 *     # prepare alpha
 */
  __pyx_t_15 = PyObject_Length(((PyObject *)__pyx_v_values_nd)); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3855, __pyx_L1_error)
  __pyx_t_23 = ((__pyx_t_15 < __pyx_v_n) != 0);
  if (unlikely(__pyx_t_23)) {

    /* "miniga4py/ga.pyx":3856
 *         raise ValueError("values must be contiguous")
 *     if len(values_nd) < n:
 *         raise ValueError("values was not large enough")             # <<<<<<<<<<<<<<
 *     # prepare alpha
 *     if alpha is None:
 */
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3856, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_Raise(__pyx_t_10, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __PYX_ERR(0, 3856, __pyx_L1_error)

    /* "miniga4py/ga.pyx":3855
 *     if not values_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("values must be contiguous")
 *     if len(values_nd) < n:             # <<<<<<<<<<<<<<
 *         raise ValueError("values was not large enough")
 *     # prepare alpha
 */
  }

  /* "miniga4py/ga.pyx":3858
 *         raise ValueError("values was not large enough")
 *     # prepare alpha
 *     if alpha is None:             # <<<<<<<<<<<<<<
 *         alpha = 1
 *     valpha = _convert_multiplier(gtype, alpha,
 */
  __pyx_t_23 = (__pyx_v_alpha == Py_None);
  __pyx_t_22 = (__pyx_t_23 != 0);
  if (__pyx_t_22) {

    /* "miniga4py/ga.pyx":3859
 *     # prepare alpha
 *     if alpha is None:
 *         alpha = 1             # <<<<<<<<<<<<<<
 *     valpha = _convert_multiplier(gtype, alpha,
 *             &ialpha,  &lalpha,  &llalpha,
 */
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_DECREF_SET(__pyx_v_alpha, __pyx_int_1);

    /* "miniga4py/ga.pyx":3858
 *         raise ValueError("values was not large enough")
 *     # prepare alpha
 *     if alpha is None:             # <<<<<<<<<<<<<<
 *         alpha = 1
 *     valpha = _convert_multiplier(gtype, alpha,
 */
  }

  /* "miniga4py/ga.pyx":3860
 *     if alpha is None:
 *         alpha = 1
 *     valpha = _convert_multiplier(gtype, alpha,             # <<<<<<<<<<<<<<
 *             &ialpha,  &lalpha,  &llalpha,
 *             &falpha,  &dalpha,  &ldalpha,
 */
  __pyx_v_valpha = __pyx_f_9miniga4py_2ga__convert_multiplier(__pyx_v_gtype, __pyx_v_alpha, (&__pyx_v_ialpha), (&__pyx_v_lalpha), (&__pyx_v_llalpha), (&__pyx_v_falpha), (&__pyx_v_dalpha), (&__pyx_v_ldalpha), (&__pyx_v_fcalpha), (&__pyx_v_dcalpha));

  /* "miniga4py/ga.pyx":3865
 *             &fcalpha, &dcalpha)
 *     # call the wrapped function
 *     if subsarray1_nd is not None:             # <<<<<<<<<<<<<<
 *         NGA_Scatter_acc_flat64(g_a, <void*>values_nd.data,
 *                 <int64_t*>subsarray1_nd.data, n, valpha)
 */
  __pyx_t_22 = (((PyObject *)__pyx_v_subsarray1_nd) != Py_None);
  __pyx_t_23 = (__pyx_t_22 != 0);
  if (__pyx_t_23) {

    /* "miniga4py/ga.pyx":3866
 *     # call the wrapped function
 *     if subsarray1_nd is not None:
 *         NGA_Scatter_acc_flat64(g_a, <void*>values_nd.data,             # <<<<<<<<<<<<<<
 *                 <int64_t*>subsarray1_nd.data, n, valpha)
 *     elif subsarray2_nd is not None:
 */
    NGA_Scatter_acc_flat64(__pyx_v_g_a, ((void *)__pyx_v_values_nd->data), ((int64_t *)__pyx_v_subsarray1_nd->data), __pyx_v_n, __pyx_v_valpha);

    /* "miniga4py/ga.pyx":3865
 *             &fcalpha, &dcalpha)
 *     # call the wrapped function
 *     if subsarray1_nd is not None:             # <<<<<<<<<<<<<<
 *         NGA_Scatter_acc_flat64(g_a, <void*>values_nd.data,
 *                 <int64_t*>subsarray1_nd.data, n, valpha)
 */
    goto __pyx_L25;
  }

  /* "miniga4py/ga.pyx":3868
 *         NGA_Scatter_acc_flat64(g_a, <void*>values_nd.data,
 *                 <int64_t*>subsarray1_nd.data, n, valpha)
 *     elif subsarray2_nd is not None:             # <<<<<<<<<<<<<<
 *         NGA_Scatter_acc_flat64(g_a, <void*>values_nd.data,
 *                 <int64_t*>subsarray2_nd.data, n, valpha)
 */
  __pyx_t_23 = (((PyObject *)__pyx_v_subsarray2_nd) != Py_None);
  __pyx_t_22 = (__pyx_t_23 != 0);
  if (likely(__pyx_t_22)) {

    /* "miniga4py/ga.pyx":3869
 *                 <int64_t*>subsarray1_nd.data, n, valpha)
 *     elif subsarray2_nd is not None:
 *         NGA_Scatter_acc_flat64(g_a, <void*>values_nd.data,             # <<<<<<<<<<<<<<
 *                 <int64_t*>subsarray2_nd.data, n, valpha)
 *     else:
 */
    NGA_Scatter_acc_flat64(__pyx_v_g_a, ((void *)__pyx_v_values_nd->data), ((int64_t *)__pyx_v_subsarray2_nd->data), __pyx_v_n, __pyx_v_valpha);

    /* "miniga4py/ga.pyx":3868
 *         NGA_Scatter_acc_flat64(g_a, <void*>values_nd.data,
 *                 <int64_t*>subsarray1_nd.data, n, valpha)
 *     elif subsarray2_nd is not None:             # <<<<<<<<<<<<<<
 *         NGA_Scatter_acc_flat64(g_a, <void*>values_nd.data,
 *                 <int64_t*>subsarray2_nd.data, n, valpha)
 */
    goto __pyx_L25;
  }

  /* "miniga4py/ga.pyx":3872
 *                 <int64_t*>subsarray2_nd.data, n, valpha)
 *     else:
 *         raise ValueError("how did this happen?")             # <<<<<<<<<<<<<<
 * 
 * def select_elem(int g_a, op):
 */
  /*else*/ {
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3872, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_Raise(__pyx_t_10, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __PYX_ERR(0, 3872, __pyx_L1_error)
  }
  __pyx_L25:;

  /* "miniga4py/ga.pyx":3798
 *         raise ValueError("how did this happen?")
 * 
 * def scatter_acc(int g_a, values, subsarray, alpha=None):             # <<<<<<<<<<<<<<
 *     """Scatters array elements from a global array into a local array.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.scatter_acc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray1_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_subsarray2_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_subsarray1_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_subsarray2_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_values_nd);
  __Pyx_XDECREF(__pyx_v_alpha);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3874
 *         raise ValueError("how did this happen?")
 * 
 * def select_elem(int g_a, op):             # <<<<<<<<<<<<<<
 *     """Returns the value and index for an element that is selected by the
 *     specified operator in a global array corresponding to g_a handle.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_313select_elem(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_312select_elem[] = "select_elem(int g_a, op)\nReturns the value and index for an element that is selected by the\n    specified operator in a global array corresponding to g_a handle.\n\n    This is a collective operation. \n\n    :returns: the selected element and the array index for the selected element\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_313select_elem = {"select_elem", (PyCFunction)__pyx_pw_9miniga4py_2ga_313select_elem, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_312select_elem};
static PyObject *__pyx_pw_9miniga4py_2ga_313select_elem(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_op = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("select_elem (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_op,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_op)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("select_elem", 1, 2, 2, 1); __PYX_ERR(0, 3874, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "select_elem") < 0)) __PYX_ERR(0, 3874, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3874, __pyx_L3_error)
    __pyx_v_op = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("select_elem", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3874, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.select_elem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_312select_elem(__pyx_self, __pyx_v_g_a, __pyx_v_op);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_312select_elem(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_op) {
  PyArrayObject *__pyx_v_index = 0;
  int __pyx_v_gtype;
  int __pyx_v_ialpha;
  long __pyx_v_lalpha;
  PY_LONG_LONG __pyx_v_llalpha;
  float __pyx_v_falpha;
  double __pyx_v_dalpha;
  long double __pyx_v_ldalpha;
  SingleComplex __pyx_v_fcalpha;
  DoubleComplex __pyx_v_dcalpha;
  void *__pyx_v_valpha;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  char *__pyx_t_9;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("select_elem", 0);
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;

  /* "miniga4py/ga.pyx":3884
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] index
 *     cdef int gtype=inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     cdef int            ialpha
 *     cdef long           lalpha
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":3893
 *     cdef SingleComplex  fcalpha
 *     cdef DoubleComplex  dcalpha
 *     cdef void          *valpha=NULL             # <<<<<<<<<<<<<<
 *     valpha = _convert_multiplier(gtype, 0,
 *             &ialpha,  &lalpha,  &llalpha,
 */
  __pyx_v_valpha = NULL;

  /* "miniga4py/ga.pyx":3894
 *     cdef DoubleComplex  dcalpha
 *     cdef void          *valpha=NULL
 *     valpha = _convert_multiplier(gtype, 0,             # <<<<<<<<<<<<<<
 *             &ialpha,  &lalpha,  &llalpha,
 *             &falpha,  &dalpha,  &ldalpha,
 */
  __pyx_v_valpha = __pyx_f_9miniga4py_2ga__convert_multiplier(__pyx_v_gtype, __pyx_int_0, (&__pyx_v_ialpha), (&__pyx_v_lalpha), (&__pyx_v_llalpha), (&__pyx_v_falpha), (&__pyx_v_dalpha), (&__pyx_v_ldalpha), (&__pyx_v_fcalpha), (&__pyx_v_dcalpha));

  /* "miniga4py/ga.pyx":3898
 *             &falpha,  &dalpha,  &ldalpha,
 *             &fcalpha, &dcalpha)
 *     index = np.ndarray(GA_Ndim(g_a), dtype=np.int64)             # <<<<<<<<<<<<<<
 *     NGA_Select_elem64(g_a, b(op), valpha, <int64_t*>index.data)
 *     if gtype == C_INT:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Ndim(__pyx_v_g_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 3898, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_ndarray), __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_4), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
      __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
    }
    __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 3898, __pyx_L1_error)
  }
  __pyx_v_index = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "miniga4py/ga.pyx":3899
 *             &fcalpha, &dcalpha)
 *     index = np.ndarray(GA_Ndim(g_a), dtype=np.int64)
 *     NGA_Select_elem64(g_a, b(op), valpha, <int64_t*>index.data)             # <<<<<<<<<<<<<<
 *     if gtype == C_INT:
 *         return ialpha,index
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_op); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3899, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_op};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3899, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_op};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3899, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3899, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_v_op);
      __Pyx_GIVEREF(__pyx_v_op);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_op);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3899, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = __Pyx_PyObject_AsWritableString(__pyx_t_4); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 3899, __pyx_L1_error)
  NGA_Select_elem64(__pyx_v_g_a, __pyx_t_9, __pyx_v_valpha, ((int64_t *)__pyx_v_index->data));
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "miniga4py/ga.pyx":3900
 *     index = np.ndarray(GA_Ndim(g_a), dtype=np.int64)
 *     NGA_Select_elem64(g_a, b(op), valpha, <int64_t*>index.data)
 *     if gtype == C_INT:             # <<<<<<<<<<<<<<
 *         return ialpha,index
 *     elif gtype == C_LONG:
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3900, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_INT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3900, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3900, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 3900, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_10) {

    /* "miniga4py/ga.pyx":3901
 *     NGA_Select_elem64(g_a, b(op), valpha, <int64_t*>index.data)
 *     if gtype == C_INT:
 *         return ialpha,index             # <<<<<<<<<<<<<<
 *     elif gtype == C_LONG:
 *         return lalpha,index
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_ialpha); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3901, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3901, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_index));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_index));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_index));
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":3900
 *     index = np.ndarray(GA_Ndim(g_a), dtype=np.int64)
 *     NGA_Select_elem64(g_a, b(op), valpha, <int64_t*>index.data)
 *     if gtype == C_INT:             # <<<<<<<<<<<<<<
 *         return ialpha,index
 *     elif gtype == C_LONG:
 */
  }

  /* "miniga4py/ga.pyx":3902
 *     if gtype == C_INT:
 *         return ialpha,index
 *     elif gtype == C_LONG:             # <<<<<<<<<<<<<<
 *         return lalpha,index
 *     elif gtype == C_LONGLONG:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_LONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3902, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 3902, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_10) {

    /* "miniga4py/ga.pyx":3903
 *         return ialpha,index
 *     elif gtype == C_LONG:
 *         return lalpha,index             # <<<<<<<<<<<<<<
 *     elif gtype == C_LONGLONG:
 *         return llalpha,index
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_lalpha); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3903, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3903, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_v_index));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_index));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_index));
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":3902
 *     if gtype == C_INT:
 *         return ialpha,index
 *     elif gtype == C_LONG:             # <<<<<<<<<<<<<<
 *         return lalpha,index
 *     elif gtype == C_LONGLONG:
 */
  }

  /* "miniga4py/ga.pyx":3904
 *     elif gtype == C_LONG:
 *         return lalpha,index
 *     elif gtype == C_LONGLONG:             # <<<<<<<<<<<<<<
 *         return llalpha,index
 *     elif gtype == C_FLOAT:
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3904, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3904, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3904, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 3904, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_10) {

    /* "miniga4py/ga.pyx":3905
 *         return lalpha,index
 *     elif gtype == C_LONGLONG:
 *         return llalpha,index             # <<<<<<<<<<<<<<
 *     elif gtype == C_FLOAT:
 *         return falpha,index
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_llalpha); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3905, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3905, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_v_index));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_index));
    PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_index));
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":3904
 *     elif gtype == C_LONG:
 *         return lalpha,index
 *     elif gtype == C_LONGLONG:             # <<<<<<<<<<<<<<
 *         return llalpha,index
 *     elif gtype == C_FLOAT:
 */
  }

  /* "miniga4py/ga.pyx":3906
 *     elif gtype == C_LONGLONG:
 *         return llalpha,index
 *     elif gtype == C_FLOAT:             # <<<<<<<<<<<<<<
 *         return falpha,index
 *     elif gtype == C_DBL:
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_FLOAT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3906, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 3906, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_10) {

    /* "miniga4py/ga.pyx":3907
 *         return llalpha,index
 *     elif gtype == C_FLOAT:
 *         return falpha,index             # <<<<<<<<<<<<<<
 *     elif gtype == C_DBL:
 *         return dalpha,index
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_falpha); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3907, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3907, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_index));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_index));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_index));
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":3906
 *     elif gtype == C_LONGLONG:
 *         return llalpha,index
 *     elif gtype == C_FLOAT:             # <<<<<<<<<<<<<<
 *         return falpha,index
 *     elif gtype == C_DBL:
 */
  }

  /* "miniga4py/ga.pyx":3908
 *     elif gtype == C_FLOAT:
 *         return falpha,index
 *     elif gtype == C_DBL:             # <<<<<<<<<<<<<<
 *         return dalpha,index
 *     elif gtype == C_LDBL:
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_DBL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3908, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 3908, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_10) {

    /* "miniga4py/ga.pyx":3909
 *         return falpha,index
 *     elif gtype == C_DBL:
 *         return dalpha,index             # <<<<<<<<<<<<<<
 *     elif gtype == C_LDBL:
 *         return ldalpha,index
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_dalpha); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_v_index));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_index));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_index));
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":3908
 *     elif gtype == C_FLOAT:
 *         return falpha,index
 *     elif gtype == C_DBL:             # <<<<<<<<<<<<<<
 *         return dalpha,index
 *     elif gtype == C_LDBL:
 */
  }

  /* "miniga4py/ga.pyx":3910
 *     elif gtype == C_DBL:
 *         return dalpha,index
 *     elif gtype == C_LDBL:             # <<<<<<<<<<<<<<
 *         return ldalpha,index
 *     elif gtype == C_SCPL:
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_LDBL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3910, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 3910, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_10) {

    /* "miniga4py/ga.pyx":3911
 *         return dalpha,index
 *     elif gtype == C_LDBL:
 *         return ldalpha,index             # <<<<<<<<<<<<<<
 *     elif gtype == C_SCPL:
 *         # TODO explicitly convert GA complex to Python complex type
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_ldalpha); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3911, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3911, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_v_index));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_index));
    PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_index));
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":3910
 *     elif gtype == C_DBL:
 *         return dalpha,index
 *     elif gtype == C_LDBL:             # <<<<<<<<<<<<<<
 *         return ldalpha,index
 *     elif gtype == C_SCPL:
 */
  }

  /* "miniga4py/ga.pyx":3912
 *     elif gtype == C_LDBL:
 *         return ldalpha,index
 *     elif gtype == C_SCPL:             # <<<<<<<<<<<<<<
 *         # TODO explicitly convert GA complex to Python complex type
 *         return fcalpha,index
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3912, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_SCPL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3912, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3912, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 3912, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_10) {

    /* "miniga4py/ga.pyx":3914
 *     elif gtype == C_SCPL:
 *         # TODO explicitly convert GA complex to Python complex type
 *         return fcalpha,index             # <<<<<<<<<<<<<<
 *     elif gtype == C_DCPL:
 *         # TODO explicitly convert GA complex to Python complex type
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_convert__to_py_SingleComplex(__pyx_v_fcalpha); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3914, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3914, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_index));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_index));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_index));
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":3912
 *     elif gtype == C_LDBL:
 *         return ldalpha,index
 *     elif gtype == C_SCPL:             # <<<<<<<<<<<<<<
 *         # TODO explicitly convert GA complex to Python complex type
 *         return fcalpha,index
 */
  }

  /* "miniga4py/ga.pyx":3915
 *         # TODO explicitly convert GA complex to Python complex type
 *         return fcalpha,index
 *     elif gtype == C_DCPL:             # <<<<<<<<<<<<<<
 *         # TODO explicitly convert GA complex to Python complex type
 *         return dcalpha,index
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_gtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_DCPL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3915, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 3915, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (likely(__pyx_t_10)) {

    /* "miniga4py/ga.pyx":3917
 *     elif gtype == C_DCPL:
 *         # TODO explicitly convert GA complex to Python complex type
 *         return dcalpha,index             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError("type of g_a not recognized")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __pyx_convert__to_py_DoubleComplex(__pyx_v_dcalpha); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3917, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3917, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_v_index));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_index));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_index));
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":3915
 *         # TODO explicitly convert GA complex to Python complex type
 *         return fcalpha,index
 *     elif gtype == C_DCPL:             # <<<<<<<<<<<<<<
 *         # TODO explicitly convert GA complex to Python complex type
 *         return dcalpha,index
 */
  }

  /* "miniga4py/ga.pyx":3919
 *         return dcalpha,index
 *     else:
 *         raise TypeError("type of g_a not recognized")             # <<<<<<<<<<<<<<
 * 
 * def select_elem_min(int g_a):
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3919, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 3919, __pyx_L1_error)
  }

  /* "miniga4py/ga.pyx":3874
 *         raise ValueError("how did this happen?")
 * 
 * def select_elem(int g_a, op):             # <<<<<<<<<<<<<<
 *     """Returns the value and index for an element that is selected by the
 *     specified operator in a global array corresponding to g_a handle.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.select_elem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_index);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3921
 *         raise TypeError("type of g_a not recognized")
 * 
 * def select_elem_min(int g_a):             # <<<<<<<<<<<<<<
 *     """Equivalent to ga.select_elem(g_a, "min")."""
 *     return select_elem(g_a, "min")
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_315select_elem_min(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_314select_elem_min[] = "select_elem_min(int g_a)\nEquivalent to ga.select_elem(g_a, \"min\").";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_315select_elem_min = {"select_elem_min", (PyCFunction)__pyx_pw_9miniga4py_2ga_315select_elem_min, METH_O, __pyx_doc_9miniga4py_2ga_314select_elem_min};
static PyObject *__pyx_pw_9miniga4py_2ga_315select_elem_min(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("select_elem_min (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3921, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.select_elem_min", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_314select_elem_min(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_314select_elem_min(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("select_elem_min", 0);

  /* "miniga4py/ga.pyx":3923
 * def select_elem_min(int g_a):
 *     """Equivalent to ga.select_elem(g_a, "min")."""
 *     return select_elem(g_a, "min")             # <<<<<<<<<<<<<<
 * 
 * def select_elem_max(int g_a):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_select_elem); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_g_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_n_s_min};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3923, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_n_s_min};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3923, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3923, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3);
    __Pyx_INCREF(__pyx_n_s_min);
    __Pyx_GIVEREF(__pyx_n_s_min);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_n_s_min);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3923, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3921
 *         raise TypeError("type of g_a not recognized")
 * 
 * def select_elem_min(int g_a):             # <<<<<<<<<<<<<<
 *     """Equivalent to ga.select_elem(g_a, "min")."""
 *     return select_elem(g_a, "min")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("miniga4py.ga.select_elem_min", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3925
 *     return select_elem(g_a, "min")
 * 
 * def select_elem_max(int g_a):             # <<<<<<<<<<<<<<
 *     """Equivalent to ga.select_elem(g_a, "max")."""
 *     return select_elem(g_a, "max")
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_317select_elem_max(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_316select_elem_max[] = "select_elem_max(int g_a)\nEquivalent to ga.select_elem(g_a, \"max\").";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_317select_elem_max = {"select_elem_max", (PyCFunction)__pyx_pw_9miniga4py_2ga_317select_elem_max, METH_O, __pyx_doc_9miniga4py_2ga_316select_elem_max};
static PyObject *__pyx_pw_9miniga4py_2ga_317select_elem_max(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("select_elem_max (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3925, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.select_elem_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_316select_elem_max(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_316select_elem_max(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("select_elem_max", 0);

  /* "miniga4py/ga.pyx":3927
 * def select_elem_max(int g_a):
 *     """Equivalent to ga.select_elem(g_a, "max")."""
 *     return select_elem(g_a, "max")             # <<<<<<<<<<<<<<
 * 
 * def set_array_name(int g_a, name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_select_elem); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3927, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_g_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3927, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_n_s_max};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3927, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_n_s_max};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3927, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3927, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3);
    __Pyx_INCREF(__pyx_n_s_max);
    __Pyx_GIVEREF(__pyx_n_s_max);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_n_s_max);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3927, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":3925
 *     return select_elem(g_a, "min")
 * 
 * def select_elem_max(int g_a):             # <<<<<<<<<<<<<<
 *     """Equivalent to ga.select_elem(g_a, "max")."""
 *     return select_elem(g_a, "max")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("miniga4py.ga.select_elem_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3929
 *     return select_elem(g_a, "max")
 * 
 * def set_array_name(int g_a, name):             # <<<<<<<<<<<<<<
 *     """Assigns a unique character string name to a global array handle that
 *     was obtained using the GA_Create_handle function.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_319set_array_name(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_318set_array_name[] = "set_array_name(int g_a, name)\nAssigns a unique character string name to a global array handle that\n    was obtained using the GA_Create_handle function.\n\n    This is a collective operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_319set_array_name = {"set_array_name", (PyCFunction)__pyx_pw_9miniga4py_2ga_319set_array_name, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_318set_array_name};
static PyObject *__pyx_pw_9miniga4py_2ga_319set_array_name(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_array_name (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_name,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_array_name", 1, 2, 2, 1); __PYX_ERR(0, 3929, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_array_name") < 0)) __PYX_ERR(0, 3929, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3929, __pyx_L3_error)
    __pyx_v_name = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_array_name", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3929, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.set_array_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_318set_array_name(__pyx_self, __pyx_v_g_a, __pyx_v_name);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_318set_array_name(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  char *__pyx_t_5;
  __Pyx_RefNannySetupContext("set_array_name", 0);

  /* "miniga4py/ga.pyx":3936
 * 
 *     """
 *     GA_Set_array_name(g_a, b(name))             # <<<<<<<<<<<<<<
 * 
 * def set_block_cyclic(int g_a, dims):
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3936, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_name};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3936, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_name};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3936, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3936, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_name);
      __Pyx_GIVEREF(__pyx_v_name);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_name);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3936, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_AsWritableString(__pyx_t_1); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 3936, __pyx_L1_error)
  GA_Set_array_name(__pyx_v_g_a, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":3929
 *     return select_elem(g_a, "max")
 * 
 * def set_array_name(int g_a, name):             # <<<<<<<<<<<<<<
 *     """Assigns a unique character string name to a global array handle that
 *     was obtained using the GA_Create_handle function.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("miniga4py.ga.set_array_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3938
 *     GA_Set_array_name(g_a, b(name))
 * 
 * def set_block_cyclic(int g_a, dims):             # <<<<<<<<<<<<<<
 *     """Creates a global array with a simple block-cyclic data distribution.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_321set_block_cyclic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_320set_block_cyclic[] = "set_block_cyclic(int g_a, dims)\nCreates a global array with a simple block-cyclic data distribution.\n\n    The array is broken up into blocks of size dims and each block is numbered\n    sequentially using a column major indexing scheme. The blocks are then\n    assigned in a simple round-robin fashion to processors. This is\n    illustrated in the figure below for an array containing 25 blocks\n    distributed on 4 processors. Blocks at the edge of the array may be\n    smaller than the block size specified in dims. In the example below,\n    blocks 4,9,14,19,20,21,22,23, and 24 might be smaller thatn the remaining\n    blocks. Most global array operations are insensitive to whether or not a\n    block-cyclic data distribution is used, although performance may be slower\n    in some cases if the global array is using a block-cyclic data\n    distribution. Individual data blocks can be accessesed using the\n    block-cyclic access functions.\n\n    This is a collective operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_321set_block_cyclic = {"set_block_cyclic", (PyCFunction)__pyx_pw_9miniga4py_2ga_321set_block_cyclic, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_320set_block_cyclic};
static PyObject *__pyx_pw_9miniga4py_2ga_321set_block_cyclic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_dims = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_block_cyclic (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_dims,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dims)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_block_cyclic", 1, 2, 2, 1); __PYX_ERR(0, 3938, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_block_cyclic") < 0)) __PYX_ERR(0, 3938, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3938, __pyx_L3_error)
    __pyx_v_dims = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_block_cyclic", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3938, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.set_block_cyclic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_320set_block_cyclic(__pyx_self, __pyx_v_g_a, __pyx_v_dims);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_320set_block_cyclic(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_dims) {
  PyArrayObject *__pyx_v_dims_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dims_nd;
  __Pyx_Buffer __pyx_pybuffer_dims_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("set_block_cyclic", 0);
  __pyx_pybuffer_dims_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_dims_nd.refcount = 0;
  __pyx_pybuffernd_dims_nd.data = NULL;
  __pyx_pybuffernd_dims_nd.rcbuffer = &__pyx_pybuffer_dims_nd;

  /* "miniga4py/ga.pyx":3958
 *     """
 *     cdef np.ndarray[np.int32_t, ndim=1] dims_nd
 *     dims_nd = _inta32(dims)             # <<<<<<<<<<<<<<
 *     GA_Set_block_cyclic(g_a, <int*>dims_nd.data)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta32(__pyx_v_dims)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_dims_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      }
      __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
    }
    __pyx_pybuffernd_dims_nd.diminfo[0].strides = __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dims_nd.diminfo[0].shape = __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3958, __pyx_L1_error)
  }
  __pyx_v_dims_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":3959
 *     cdef np.ndarray[np.int32_t, ndim=1] dims_nd
 *     dims_nd = _inta32(dims)
 *     GA_Set_block_cyclic(g_a, <int*>dims_nd.data)             # <<<<<<<<<<<<<<
 * 
 * def set_block_cyclic_proc_grid(int g_a, block, proc_grid):
 */
  GA_Set_block_cyclic(__pyx_v_g_a, ((int *)__pyx_v_dims_nd->data));

  /* "miniga4py/ga.pyx":3938
 *     GA_Set_array_name(g_a, b(name))
 * 
 * def set_block_cyclic(int g_a, dims):             # <<<<<<<<<<<<<<
 *     """Creates a global array with a simple block-cyclic data distribution.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.set_block_cyclic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dims_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3961
 *     GA_Set_block_cyclic(g_a, <int*>dims_nd.data)
 * 
 * def set_block_cyclic_proc_grid(int g_a, block, proc_grid):             # <<<<<<<<<<<<<<
 *     """Creates a global array with a SCALAPACK-type block cyclic data
 *     distribution.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_323set_block_cyclic_proc_grid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_322set_block_cyclic_proc_grid[] = "set_block_cyclic_proc_grid(int g_a, block, proc_grid)\nCreates a global array with a SCALAPACK-type block cyclic data\n    distribution.\n    \n    The user specifies the dimensions of the processor grid in the array\n    proc_grid. The product of the processor grid dimensions must equal the\n    number of total number of processors  and the number of dimensions in the\n    processor grid must be the same as the number of dimensions in the global\n    array. The data blocks are mapped onto the processor grid in a cyclic\n    manner along each of the processor grid axes.  This is illustrated below\n    for an array consisting of 25 data blocks disributed on 6 processors. The\n    6 processors are configured in a 3 by 2 processor grid. Blocks at the edge\n    of the array may be smaller than the block size specified in dims. Most\n    global array operations are insensitive to whether or not a block-cyclic\n    data distribution is used, although performance may be slower in some\n    cases if the global array is using a block-cyclic data distribution.\n    Individual data blocks can be accessesed using the block-cyclic access\n    functions.\n\n    This is a collective operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_323set_block_cyclic_proc_grid = {"set_block_cyclic_proc_grid", (PyCFunction)__pyx_pw_9miniga4py_2ga_323set_block_cyclic_proc_grid, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_322set_block_cyclic_proc_grid};
static PyObject *__pyx_pw_9miniga4py_2ga_323set_block_cyclic_proc_grid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_block = 0;
  PyObject *__pyx_v_proc_grid = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_block_cyclic_proc_grid (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_block,&__pyx_n_s_proc_grid,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_block)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_block_cyclic_proc_grid", 1, 3, 3, 1); __PYX_ERR(0, 3961, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_proc_grid)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_block_cyclic_proc_grid", 1, 3, 3, 2); __PYX_ERR(0, 3961, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_block_cyclic_proc_grid") < 0)) __PYX_ERR(0, 3961, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3961, __pyx_L3_error)
    __pyx_v_block = values[1];
    __pyx_v_proc_grid = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_block_cyclic_proc_grid", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3961, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.set_block_cyclic_proc_grid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_322set_block_cyclic_proc_grid(__pyx_self, __pyx_v_g_a, __pyx_v_block, __pyx_v_proc_grid);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_322set_block_cyclic_proc_grid(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_block, PyObject *__pyx_v_proc_grid) {
  PyArrayObject *__pyx_v_block_nd = 0;
  PyArrayObject *__pyx_v_proc_grid_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_block_nd;
  __Pyx_Buffer __pyx_pybuffer_block_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_proc_grid_nd;
  __Pyx_Buffer __pyx_pybuffer_proc_grid_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("set_block_cyclic_proc_grid", 0);
  __pyx_pybuffer_block_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_block_nd.refcount = 0;
  __pyx_pybuffernd_block_nd.data = NULL;
  __pyx_pybuffernd_block_nd.rcbuffer = &__pyx_pybuffer_block_nd;
  __pyx_pybuffer_proc_grid_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_proc_grid_nd.refcount = 0;
  __pyx_pybuffernd_proc_grid_nd.data = NULL;
  __pyx_pybuffernd_proc_grid_nd.rcbuffer = &__pyx_pybuffer_proc_grid_nd;

  /* "miniga4py/ga.pyx":3984
 *     """
 *     cdef np.ndarray[np.int32_t, ndim=1] block_nd, proc_grid_nd
 *     block_nd = _inta32(block)             # <<<<<<<<<<<<<<
 *     proc_grid_nd = _inta32(proc_grid)
 *     GA_Set_block_cyclic_proc_grid(g_a,
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta32(__pyx_v_block)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_block_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_block_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_block_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_block_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      }
      __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
    }
    __pyx_pybuffernd_block_nd.diminfo[0].strides = __pyx_pybuffernd_block_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_block_nd.diminfo[0].shape = __pyx_pybuffernd_block_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3984, __pyx_L1_error)
  }
  __pyx_v_block_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":3985
 *     cdef np.ndarray[np.int32_t, ndim=1] block_nd, proc_grid_nd
 *     block_nd = _inta32(block)
 *     proc_grid_nd = _inta32(proc_grid)             # <<<<<<<<<<<<<<
 *     GA_Set_block_cyclic_proc_grid(g_a,
 *             <int*>block_nd.data,
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta32(__pyx_v_proc_grid)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_proc_grid_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_proc_grid_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_proc_grid_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_proc_grid_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_5, __pyx_t_4, __pyx_t_3);
      }
      __pyx_t_5 = __pyx_t_4 = __pyx_t_3 = 0;
    }
    __pyx_pybuffernd_proc_grid_nd.diminfo[0].strides = __pyx_pybuffernd_proc_grid_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_proc_grid_nd.diminfo[0].shape = __pyx_pybuffernd_proc_grid_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3985, __pyx_L1_error)
  }
  __pyx_v_proc_grid_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":3986
 *     block_nd = _inta32(block)
 *     proc_grid_nd = _inta32(proc_grid)
 *     GA_Set_block_cyclic_proc_grid(g_a,             # <<<<<<<<<<<<<<
 *             <int*>block_nd.data,
 *             <int*>proc_grid_nd.data)
 */
  GA_Set_block_cyclic_proc_grid(__pyx_v_g_a, ((int *)__pyx_v_block_nd->data), ((int *)__pyx_v_proc_grid_nd->data));

  /* "miniga4py/ga.pyx":3961
 *     GA_Set_block_cyclic(g_a, <int*>dims_nd.data)
 * 
 * def set_block_cyclic_proc_grid(int g_a, block, proc_grid):             # <<<<<<<<<<<<<<
 *     """Creates a global array with a SCALAPACK-type block cyclic data
 *     distribution.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_block_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_proc_grid_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.set_block_cyclic_proc_grid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_block_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_proc_grid_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_block_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_proc_grid_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":3990
 *             <int*>proc_grid_nd.data)
 * 
 * def set_chunk(int g_a, chunk):             # <<<<<<<<<<<<<<
 *     """This function is used to set the chunk array for a global array handle
 *     that was obtained using the GA_Create_handle function. The chunk array is
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_325set_chunk(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_324set_chunk[] = "set_chunk(int g_a, chunk)\nThis function is used to set the chunk array for a global array handle\n    that was obtained using the GA_Create_handle function. The chunk array is\n    used to determine the minimum number of array elements assigned to each\n    processor along each coordinate direction.\n\n    This is a collective operation.\n    \n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_325set_chunk = {"set_chunk", (PyCFunction)__pyx_pw_9miniga4py_2ga_325set_chunk, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_324set_chunk};
static PyObject *__pyx_pw_9miniga4py_2ga_325set_chunk(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_chunk = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_chunk (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_chunk,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chunk)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_chunk", 1, 2, 2, 1); __PYX_ERR(0, 3990, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_chunk") < 0)) __PYX_ERR(0, 3990, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3990, __pyx_L3_error)
    __pyx_v_chunk = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_chunk", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3990, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.set_chunk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_324set_chunk(__pyx_self, __pyx_v_g_a, __pyx_v_chunk);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_324set_chunk(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_chunk) {
  PyArrayObject *__pyx_v_chunk_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_chunk_nd;
  __Pyx_Buffer __pyx_pybuffer_chunk_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("set_chunk", 0);
  __pyx_pybuffer_chunk_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_chunk_nd.refcount = 0;
  __pyx_pybuffernd_chunk_nd.data = NULL;
  __pyx_pybuffernd_chunk_nd.rcbuffer = &__pyx_pybuffer_chunk_nd;

  /* "miniga4py/ga.pyx":4000
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] chunk_nd
 *     chunk_nd = _inta64(chunk)             # <<<<<<<<<<<<<<
 *     GA_Set_chunk64(g_a, <int64_t*>chunk_nd.data)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_chunk)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_chunk_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      }
      __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
    }
    __pyx_pybuffernd_chunk_nd.diminfo[0].strides = __pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_chunk_nd.diminfo[0].shape = __pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 4000, __pyx_L1_error)
  }
  __pyx_v_chunk_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":4001
 *     cdef np.ndarray[np.int64_t, ndim=1] chunk_nd
 *     chunk_nd = _inta64(chunk)
 *     GA_Set_chunk64(g_a, <int64_t*>chunk_nd.data)             # <<<<<<<<<<<<<<
 * 
 * def set_data(int g_a, dims, int type):
 */
  GA_Set_chunk64(__pyx_v_g_a, ((int64_t *)__pyx_v_chunk_nd->data));

  /* "miniga4py/ga.pyx":3990
 *             <int*>proc_grid_nd.data)
 * 
 * def set_chunk(int g_a, chunk):             # <<<<<<<<<<<<<<
 *     """This function is used to set the chunk array for a global array handle
 *     that was obtained using the GA_Create_handle function. The chunk array is
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.set_chunk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chunk_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_chunk_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4003
 *     GA_Set_chunk64(g_a, <int64_t*>chunk_nd.data)
 * 
 * def set_data(int g_a, dims, int type):             # <<<<<<<<<<<<<<
 *     """Sets the array dimension, the coordinate dimensions, and the data type
 *     assigned to a global array handle obtained using the ga.create_handle
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_327set_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_326set_data[] = "set_data(int g_a, dims, int type)\nSets the array dimension, the coordinate dimensions, and the data type\n    assigned to a global array handle obtained using the ga.create_handle\n    function.\n\n    This is a collective operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_327set_data = {"set_data", (PyCFunction)__pyx_pw_9miniga4py_2ga_327set_data, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_326set_data};
static PyObject *__pyx_pw_9miniga4py_2ga_327set_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_dims = 0;
  int __pyx_v_type;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_data (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_dims,&__pyx_n_s_type,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dims)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_data", 1, 3, 3, 1); __PYX_ERR(0, 4003, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_type)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_data", 1, 3, 3, 2); __PYX_ERR(0, 4003, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_data") < 0)) __PYX_ERR(0, 4003, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4003, __pyx_L3_error)
    __pyx_v_dims = values[1];
    __pyx_v_type = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_type == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4003, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_data", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4003, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.set_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_326set_data(__pyx_self, __pyx_v_g_a, __pyx_v_dims, __pyx_v_type);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_326set_data(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_dims, int __pyx_v_type) {
  PyArrayObject *__pyx_v_dims_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dims_nd;
  __Pyx_Buffer __pyx_pybuffer_dims_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  __Pyx_RefNannySetupContext("set_data", 0);
  __pyx_pybuffer_dims_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_dims_nd.refcount = 0;
  __pyx_pybuffernd_dims_nd.data = NULL;
  __pyx_pybuffernd_dims_nd.rcbuffer = &__pyx_pybuffer_dims_nd;

  /* "miniga4py/ga.pyx":4012
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] dims_nd
 *     dims_nd = _inta64(dims)             # <<<<<<<<<<<<<<
 *     GA_Set_data64(g_a, len(dims_nd), <int64_t*>dims_nd.data, type)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_dims)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4012, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_dims_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      }
      __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
    }
    __pyx_pybuffernd_dims_nd.diminfo[0].strides = __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dims_nd.diminfo[0].shape = __pyx_pybuffernd_dims_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 4012, __pyx_L1_error)
  }
  __pyx_v_dims_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":4013
 *     cdef np.ndarray[np.int64_t, ndim=1] dims_nd
 *     dims_nd = _inta64(dims)
 *     GA_Set_data64(g_a, len(dims_nd), <int64_t*>dims_nd.data, type)             # <<<<<<<<<<<<<<
 * 
 * def set_debug(bint debug):
 */
  __pyx_t_6 = PyObject_Length(((PyObject *)__pyx_v_dims_nd)); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 4013, __pyx_L1_error)
  GA_Set_data64(__pyx_v_g_a, __pyx_t_6, ((int64_t *)__pyx_v_dims_nd->data), __pyx_v_type);

  /* "miniga4py/ga.pyx":4003
 *     GA_Set_chunk64(g_a, <int64_t*>chunk_nd.data)
 * 
 * def set_data(int g_a, dims, int type):             # <<<<<<<<<<<<<<
 *     """Sets the array dimension, the coordinate dimensions, and the data type
 *     assigned to a global array handle obtained using the ga.create_handle
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.set_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dims_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dims_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4015
 *     GA_Set_data64(g_a, len(dims_nd), <int64_t*>dims_nd.data, type)
 * 
 * def set_debug(bint debug):             # <<<<<<<<<<<<<<
 *     """Sets an internal flag in the GA library to either True or False.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_329set_debug(PyObject *__pyx_self, PyObject *__pyx_arg_debug); /*proto*/
static char __pyx_doc_9miniga4py_2ga_328set_debug[] = "set_debug(bool debug)\nSets an internal flag in the GA library to either True or False.\n    \n    The value of this flag can be recovered at any time using the ga.get_debug\n    function. The flag is set to false when the the GA library is initialized.\n    This can be useful in a number of debugging situations, especially when\n    examining the behavior of routines that are called in multiple locations\n    in a code.\n\n    This is a local operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_329set_debug = {"set_debug", (PyCFunction)__pyx_pw_9miniga4py_2ga_329set_debug, METH_O, __pyx_doc_9miniga4py_2ga_328set_debug};
static PyObject *__pyx_pw_9miniga4py_2ga_329set_debug(PyObject *__pyx_self, PyObject *__pyx_arg_debug) {
  int __pyx_v_debug;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_debug (wrapper)", 0);
  assert(__pyx_arg_debug); {
    __pyx_v_debug = __Pyx_PyObject_IsTrue(__pyx_arg_debug); if (unlikely((__pyx_v_debug == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4015, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.set_debug", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_328set_debug(__pyx_self, ((int)__pyx_v_debug));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_328set_debug(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_debug) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_debug", 0);

  /* "miniga4py/ga.pyx":4027
 * 
 *     """
 *     GA_Set_debug(debug)             # <<<<<<<<<<<<<<
 * 
 * def set_diagonal(int g_a, int g_v):
 */
  GA_Set_debug(__pyx_v_debug);

  /* "miniga4py/ga.pyx":4015
 *     GA_Set_data64(g_a, len(dims_nd), <int64_t*>dims_nd.data, type)
 * 
 * def set_debug(bint debug):             # <<<<<<<<<<<<<<
 *     """Sets an internal flag in the GA library to either True or False.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4029
 *     GA_Set_debug(debug)
 * 
 * def set_diagonal(int g_a, int g_v):             # <<<<<<<<<<<<<<
 *     """Sets the diagonal elements of this matrix g_a with the elements of the
 *     vector g_v.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_331set_diagonal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_330set_diagonal[] = "set_diagonal(int g_a, int g_v)\nSets the diagonal elements of this matrix g_a with the elements of the\n    vector g_v.\n\n    This is a collective operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_331set_diagonal = {"set_diagonal", (PyCFunction)__pyx_pw_9miniga4py_2ga_331set_diagonal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_330set_diagonal};
static PyObject *__pyx_pw_9miniga4py_2ga_331set_diagonal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_v;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_diagonal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_v,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_diagonal", 1, 2, 2, 1); __PYX_ERR(0, 4029, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_diagonal") < 0)) __PYX_ERR(0, 4029, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4029, __pyx_L3_error)
    __pyx_v_g_v = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4029, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_diagonal", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4029, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.set_diagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_330set_diagonal(__pyx_self, __pyx_v_g_a, __pyx_v_g_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_330set_diagonal(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_v) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_diagonal", 0);

  /* "miniga4py/ga.pyx":4036
 * 
 *     """
 *     GA_Set_diagonal(g_a, g_v)             # <<<<<<<<<<<<<<
 * 
 * def set_ghosts(int g_a, width):
 */
  GA_Set_diagonal(__pyx_v_g_a, __pyx_v_g_v);

  /* "miniga4py/ga.pyx":4029
 *     GA_Set_debug(debug)
 * 
 * def set_diagonal(int g_a, int g_v):             # <<<<<<<<<<<<<<
 *     """Sets the diagonal elements of this matrix g_a with the elements of the
 *     vector g_v.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4038
 *     GA_Set_diagonal(g_a, g_v)
 * 
 * def set_ghosts(int g_a, width):             # <<<<<<<<<<<<<<
 *     """Sets the ghost cell widths for a global array handle that was obtained
 *     using the ga.create_handle function.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_333set_ghosts(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_332set_ghosts[] = "set_ghosts(int g_a, width)\nSets the ghost cell widths for a global array handle that was obtained\n    using the ga.create_handle function.\n    \n    The ghosts cells widths indicate how many ghost cells are used to pad the\n    locally held array data along each dimension. The padding can be set\n    independently for each coordinate dimension.\n\n    This is a collective operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_333set_ghosts = {"set_ghosts", (PyCFunction)__pyx_pw_9miniga4py_2ga_333set_ghosts, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_332set_ghosts};
static PyObject *__pyx_pw_9miniga4py_2ga_333set_ghosts(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_ghosts (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_width,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_ghosts", 1, 2, 2, 1); __PYX_ERR(0, 4038, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_ghosts") < 0)) __PYX_ERR(0, 4038, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4038, __pyx_L3_error)
    __pyx_v_width = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_ghosts", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4038, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.set_ghosts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_332set_ghosts(__pyx_self, __pyx_v_g_a, __pyx_v_width);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_332set_ghosts(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_width) {
  PyArrayObject *__pyx_v_width_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_width_nd;
  __Pyx_Buffer __pyx_pybuffer_width_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("set_ghosts", 0);
  __pyx_pybuffer_width_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_width_nd.refcount = 0;
  __pyx_pybuffernd_width_nd.data = NULL;
  __pyx_pybuffernd_width_nd.rcbuffer = &__pyx_pybuffer_width_nd;

  /* "miniga4py/ga.pyx":4050
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] width_nd
 *     width_nd = _inta64(width)             # <<<<<<<<<<<<<<
 *     GA_Set_ghosts64(g_a, <int64_t*>width_nd.data)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_width)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_width_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_width_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_width_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_width_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      }
      __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
    }
    __pyx_pybuffernd_width_nd.diminfo[0].strides = __pyx_pybuffernd_width_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_width_nd.diminfo[0].shape = __pyx_pybuffernd_width_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 4050, __pyx_L1_error)
  }
  __pyx_v_width_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":4051
 *     cdef np.ndarray[np.int64_t, ndim=1] width_nd
 *     width_nd = _inta64(width)
 *     GA_Set_ghosts64(g_a, <int64_t*>width_nd.data)             # <<<<<<<<<<<<<<
 * 
 * def set_irreg_distr(int g_a, mapc, nblock):
 */
  GA_Set_ghosts64(__pyx_v_g_a, ((int64_t *)__pyx_v_width_nd->data));

  /* "miniga4py/ga.pyx":4038
 *     GA_Set_diagonal(g_a, g_v)
 * 
 * def set_ghosts(int g_a, width):             # <<<<<<<<<<<<<<
 *     """Sets the ghost cell widths for a global array handle that was obtained
 *     using the ga.create_handle function.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_width_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.set_ghosts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_width_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_width_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4053
 *     GA_Set_ghosts64(g_a, <int64_t*>width_nd.data)
 * 
 * def set_irreg_distr(int g_a, mapc, nblock):             # <<<<<<<<<<<<<<
 *     """Partitions the array data among the individual processors for a global
 *     array handle obtained using the ga.create_handle function.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_335set_irreg_distr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_334set_irreg_distr[] = "set_irreg_distr(int g_a, mapc, nblock)\nPartitions the array data among the individual processors for a global\n    array handle obtained using the ga.create_handle function.\n\n    The distribution is specified as a Cartesian product of distributions for\n    each dimension. For example, the following figure demonstrates\n    distribution of a 2-dimensional array 8x10 on 6 (or more) processors.\n    nblock(2)={3,2}, the size of mapc array is s=5 and array mapc contains the\n    following elements mapc={1,3,7, 1, 6}. The distribution is nonuniform\n    because, P1 and P4 get 20 elements each and processors P0,P2,P3, and P5\n    only 10 elements each.\n     \n    +----+----++--+\n    |  5 |  5 ||  |\n    +====+====++==+\n    | P0 | P3 || 2|\n    | P1 | P4 || 4|\n    | P2 | P5 || 2|\n    +----+----++--+\n\n    The array width() is used to control the width of the ghost cell boundary\n    around the visible data on each processor. The local data of the global\n    array residing on each processor will have a layer width(n) ghosts cells\n    wide on either side of the visible data along the dimension n.\n\n    This is a collective operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_335set_irreg_distr = {"set_irreg_distr", (PyCFunction)__pyx_pw_9miniga4py_2ga_335set_irreg_distr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_334set_irreg_distr};
static PyObject *__pyx_pw_9miniga4py_2ga_335set_irreg_distr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_mapc = 0;
  PyObject *__pyx_v_nblock = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_irreg_distr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_mapc,&__pyx_n_s_nblock,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mapc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_irreg_distr", 1, 3, 3, 1); __PYX_ERR(0, 4053, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nblock)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_irreg_distr", 1, 3, 3, 2); __PYX_ERR(0, 4053, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_irreg_distr") < 0)) __PYX_ERR(0, 4053, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4053, __pyx_L3_error)
    __pyx_v_mapc = values[1];
    __pyx_v_nblock = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_irreg_distr", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4053, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.set_irreg_distr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_334set_irreg_distr(__pyx_self, __pyx_v_g_a, __pyx_v_mapc, __pyx_v_nblock);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_334set_irreg_distr(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_mapc, PyObject *__pyx_v_nblock) {
  PyArrayObject *__pyx_v_mapc_nd = 0;
  PyArrayObject *__pyx_v_nblock_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mapc_nd;
  __Pyx_Buffer __pyx_pybuffer_mapc_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nblock_nd;
  __Pyx_Buffer __pyx_pybuffer_nblock_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("set_irreg_distr", 0);
  __pyx_pybuffer_mapc_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_mapc_nd.refcount = 0;
  __pyx_pybuffernd_mapc_nd.data = NULL;
  __pyx_pybuffernd_mapc_nd.rcbuffer = &__pyx_pybuffer_mapc_nd;
  __pyx_pybuffer_nblock_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_nblock_nd.refcount = 0;
  __pyx_pybuffernd_nblock_nd.data = NULL;
  __pyx_pybuffernd_nblock_nd.rcbuffer = &__pyx_pybuffer_nblock_nd;

  /* "miniga4py/ga.pyx":4082
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] mapc_nd, nblock_nd
 *     mapc_nd = _inta64(mapc)             # <<<<<<<<<<<<<<
 *     nblock_nd = _inta64(nblock)
 *     GA_Set_irreg_distr64(g_a, <int64_t*>mapc_nd.data, <int64_t*>nblock_nd.data)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_mapc)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mapc_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mapc_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mapc_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_mapc_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      }
      __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
    }
    __pyx_pybuffernd_mapc_nd.diminfo[0].strides = __pyx_pybuffernd_mapc_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mapc_nd.diminfo[0].shape = __pyx_pybuffernd_mapc_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 4082, __pyx_L1_error)
  }
  __pyx_v_mapc_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":4083
 *     cdef np.ndarray[np.int64_t, ndim=1] mapc_nd, nblock_nd
 *     mapc_nd = _inta64(mapc)
 *     nblock_nd = _inta64(nblock)             # <<<<<<<<<<<<<<
 *     GA_Set_irreg_distr64(g_a, <int64_t*>mapc_nd.data, <int64_t*>nblock_nd.data)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta64(__pyx_v_nblock)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4083, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nblock_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nblock_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nblock_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_nblock_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_5, __pyx_t_4, __pyx_t_3);
      }
      __pyx_t_5 = __pyx_t_4 = __pyx_t_3 = 0;
    }
    __pyx_pybuffernd_nblock_nd.diminfo[0].strides = __pyx_pybuffernd_nblock_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nblock_nd.diminfo[0].shape = __pyx_pybuffernd_nblock_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 4083, __pyx_L1_error)
  }
  __pyx_v_nblock_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":4084
 *     mapc_nd = _inta64(mapc)
 *     nblock_nd = _inta64(nblock)
 *     GA_Set_irreg_distr64(g_a, <int64_t*>mapc_nd.data, <int64_t*>nblock_nd.data)             # <<<<<<<<<<<<<<
 * 
 * def set_memory_limit(size_t limit):
 */
  GA_Set_irreg_distr64(__pyx_v_g_a, ((int64_t *)__pyx_v_mapc_nd->data), ((int64_t *)__pyx_v_nblock_nd->data));

  /* "miniga4py/ga.pyx":4053
 *     GA_Set_ghosts64(g_a, <int64_t*>width_nd.data)
 * 
 * def set_irreg_distr(int g_a, mapc, nblock):             # <<<<<<<<<<<<<<
 *     """Partitions the array data among the individual processors for a global
 *     array handle obtained using the ga.create_handle function.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mapc_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nblock_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.set_irreg_distr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mapc_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nblock_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mapc_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_nblock_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4086
 *     GA_Set_irreg_distr64(g_a, <int64_t*>mapc_nd.data, <int64_t*>nblock_nd.data)
 * 
 * def set_memory_limit(size_t limit):             # <<<<<<<<<<<<<<
 *     """Sets the amount of memory to be used (in bytes) per process.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_337set_memory_limit(PyObject *__pyx_self, PyObject *__pyx_arg_limit); /*proto*/
static char __pyx_doc_9miniga4py_2ga_336set_memory_limit[] = "set_memory_limit(size_t limit)\nSets the amount of memory to be used (in bytes) per process.\n\n    This is a local operation. \n\n    :Parameters:\n        limit : size_t\n            the amount of memory in bytes per process\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_337set_memory_limit = {"set_memory_limit", (PyCFunction)__pyx_pw_9miniga4py_2ga_337set_memory_limit, METH_O, __pyx_doc_9miniga4py_2ga_336set_memory_limit};
static PyObject *__pyx_pw_9miniga4py_2ga_337set_memory_limit(PyObject *__pyx_self, PyObject *__pyx_arg_limit) {
  size_t __pyx_v_limit;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_memory_limit (wrapper)", 0);
  assert(__pyx_arg_limit); {
    __pyx_v_limit = __Pyx_PyInt_As_size_t(__pyx_arg_limit); if (unlikely((__pyx_v_limit == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4086, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.set_memory_limit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_336set_memory_limit(__pyx_self, ((size_t)__pyx_v_limit));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_336set_memory_limit(CYTHON_UNUSED PyObject *__pyx_self, size_t __pyx_v_limit) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_memory_limit", 0);

  /* "miniga4py/ga.pyx":4096
 * 
 *     """
 *     GA_Set_memory_limit(limit)             # <<<<<<<<<<<<<<
 * 
 * def set_pgroup(int g_a, int pgroup):
 */
  GA_Set_memory_limit(__pyx_v_limit);

  /* "miniga4py/ga.pyx":4086
 *     GA_Set_irreg_distr64(g_a, <int64_t*>mapc_nd.data, <int64_t*>nblock_nd.data)
 * 
 * def set_memory_limit(size_t limit):             # <<<<<<<<<<<<<<
 *     """Sets the amount of memory to be used (in bytes) per process.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4098
 *     GA_Set_memory_limit(limit)
 * 
 * def set_pgroup(int g_a, int pgroup):             # <<<<<<<<<<<<<<
 *     """Sets the processor configuration assigned to a global array handle that
 *     was obtained using the ga.create_handle function.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_339set_pgroup(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_338set_pgroup[] = "set_pgroup(int g_a, int pgroup)\nSets the processor configuration assigned to a global array handle that\n    was obtained using the ga.create_handle function.\n    \n    It can be used to create mirrored arrays by using the mirrored array\n    processor configuration in this function call. It can also be used to\n    create an array on a processor group by using a processor group handle in\n    this call.\n\n    This is a collective operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_339set_pgroup = {"set_pgroup", (PyCFunction)__pyx_pw_9miniga4py_2ga_339set_pgroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_338set_pgroup};
static PyObject *__pyx_pw_9miniga4py_2ga_339set_pgroup(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_pgroup;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_pgroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_pgroup,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pgroup)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_pgroup", 1, 2, 2, 1); __PYX_ERR(0, 4098, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_pgroup") < 0)) __PYX_ERR(0, 4098, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4098, __pyx_L3_error)
    __pyx_v_pgroup = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_pgroup == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4098, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_pgroup", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4098, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.set_pgroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_338set_pgroup(__pyx_self, __pyx_v_g_a, __pyx_v_pgroup);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_338set_pgroup(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_pgroup) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_pgroup", 0);

  /* "miniga4py/ga.pyx":4110
 * 
 *     """
 *     GA_Set_pgroup(g_a, pgroup)             # <<<<<<<<<<<<<<
 * 
 * def set_restricted(int g_a, list):
 */
  GA_Set_pgroup(__pyx_v_g_a, __pyx_v_pgroup);

  /* "miniga4py/ga.pyx":4098
 *     GA_Set_memory_limit(limit)
 * 
 * def set_pgroup(int g_a, int pgroup):             # <<<<<<<<<<<<<<
 *     """Sets the processor configuration assigned to a global array handle that
 *     was obtained using the ga.create_handle function.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4112
 *     GA_Set_pgroup(g_a, pgroup)
 * 
 * def set_restricted(int g_a, list):             # <<<<<<<<<<<<<<
 *     """Restrict data in the global array g_a to only the processors listed in
 *     the array list.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_341set_restricted(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_340set_restricted[] = "set_restricted(int g_a, list)\nRestrict data in the global array g_a to only the processors listed in\n    the array list.\n    \n    len(list) must be less than or equal to the number of available processors.\n    If this call is used in conjunction with set_irreg_distr, then the\n    decomposition in the set_irreg_distr call must be done assuming that the\n    number of processors is nproc. The data that ordinarily would be mapped to\n    process 0 is mapped to the process in list[0], the data that would be\n    mapped to process 1 will be mapped to list[1], etc. This can be used to\n    remap the data distribution to different processors, even if nproc equals\n    the number of available processors.\n\n    This is a collective operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_341set_restricted = {"set_restricted", (PyCFunction)__pyx_pw_9miniga4py_2ga_341set_restricted, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_340set_restricted};
static PyObject *__pyx_pw_9miniga4py_2ga_341set_restricted(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_list = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_restricted (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_list,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_list)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_restricted", 1, 2, 2, 1); __PYX_ERR(0, 4112, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_restricted") < 0)) __PYX_ERR(0, 4112, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4112, __pyx_L3_error)
    __pyx_v_list = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_restricted", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4112, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.set_restricted", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_340set_restricted(__pyx_self, __pyx_v_g_a, __pyx_v_list);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_340set_restricted(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_list) {
  PyArrayObject *__pyx_v_list_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_list_nd;
  __Pyx_Buffer __pyx_pybuffer_list_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  __Pyx_RefNannySetupContext("set_restricted", 0);
  __pyx_pybuffer_list_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_list_nd.refcount = 0;
  __pyx_pybuffernd_list_nd.data = NULL;
  __pyx_pybuffernd_list_nd.rcbuffer = &__pyx_pybuffer_list_nd;

  /* "miniga4py/ga.pyx":4129
 *     """
 *     cdef np.ndarray[np.int32_t, ndim=1] list_nd
 *     list_nd = _inta32(list)             # <<<<<<<<<<<<<<
 *     GA_Set_restricted(g_a, <int*>list_nd.data, len(list_nd))
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga__inta32(__pyx_v_list)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_list_nd.rcbuffer->pybuffer);
    __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_list_nd.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_2 < 0)) {
      PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_list_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_list_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      }
      __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
    }
    __pyx_pybuffernd_list_nd.diminfo[0].strides = __pyx_pybuffernd_list_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_list_nd.diminfo[0].shape = __pyx_pybuffernd_list_nd.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 4129, __pyx_L1_error)
  }
  __pyx_v_list_nd = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":4130
 *     cdef np.ndarray[np.int32_t, ndim=1] list_nd
 *     list_nd = _inta32(list)
 *     GA_Set_restricted(g_a, <int*>list_nd.data, len(list_nd))             # <<<<<<<<<<<<<<
 * 
 * def set_restricted_range(int g_a, int lo_proc, int hi_proc):
 */
  __pyx_t_6 = PyObject_Length(((PyObject *)__pyx_v_list_nd)); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 4130, __pyx_L1_error)
  GA_Set_restricted(__pyx_v_g_a, ((int *)__pyx_v_list_nd->data), __pyx_t_6);

  /* "miniga4py/ga.pyx":4112
 *     GA_Set_pgroup(g_a, pgroup)
 * 
 * def set_restricted(int g_a, list):             # <<<<<<<<<<<<<<
 *     """Restrict data in the global array g_a to only the processors listed in
 *     the array list.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_list_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.set_restricted", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_list_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_list_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4132
 *     GA_Set_restricted(g_a, <int*>list_nd.data, len(list_nd))
 * 
 * def set_restricted_range(int g_a, int lo_proc, int hi_proc):             # <<<<<<<<<<<<<<
 *     """Restrict data in the global array to the given range of processors.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_343set_restricted_range(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_342set_restricted_range[] = "set_restricted_range(int g_a, int lo_proc, int hi_proc)\nRestrict data in the global array to the given range of processors.\n\n    Both lo_proc and hi_proc must be less than or equal to the total number of\n    processors minus one (e.g., in the range [0,N-1], where N is the total\n    number of processors) and lo_proc must be less than or equal to hi_proc. If\n    lo_proc = 0 and hi_proc = N-1 then this call has no effect on the data\n    distribution.\n\n    This is a collective operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_343set_restricted_range = {"set_restricted_range", (PyCFunction)__pyx_pw_9miniga4py_2ga_343set_restricted_range, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_342set_restricted_range};
static PyObject *__pyx_pw_9miniga4py_2ga_343set_restricted_range(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_lo_proc;
  int __pyx_v_hi_proc;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_restricted_range (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_lo_proc,&__pyx_n_s_hi_proc,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo_proc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_restricted_range", 1, 3, 3, 1); __PYX_ERR(0, 4132, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi_proc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_restricted_range", 1, 3, 3, 2); __PYX_ERR(0, 4132, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_restricted_range") < 0)) __PYX_ERR(0, 4132, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4132, __pyx_L3_error)
    __pyx_v_lo_proc = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_lo_proc == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4132, __pyx_L3_error)
    __pyx_v_hi_proc = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_hi_proc == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4132, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_restricted_range", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4132, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.set_restricted_range", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_342set_restricted_range(__pyx_self, __pyx_v_g_a, __pyx_v_lo_proc, __pyx_v_hi_proc);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_342set_restricted_range(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_lo_proc, int __pyx_v_hi_proc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_restricted_range", 0);

  /* "miniga4py/ga.pyx":4144
 * 
 *     """
 *     GA_Set_restricted_range(g_a, lo_proc, hi_proc)             # <<<<<<<<<<<<<<
 * 
 * def shift_diagoal(int g_a, value=None):
 */
  GA_Set_restricted_range(__pyx_v_g_a, __pyx_v_lo_proc, __pyx_v_hi_proc);

  /* "miniga4py/ga.pyx":4132
 *     GA_Set_restricted(g_a, <int*>list_nd.data, len(list_nd))
 * 
 * def set_restricted_range(int g_a, int lo_proc, int hi_proc):             # <<<<<<<<<<<<<<
 *     """Restrict data in the global array to the given range of processors.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4146
 *     GA_Set_restricted_range(g_a, lo_proc, hi_proc)
 * 
 * def shift_diagoal(int g_a, value=None):             # <<<<<<<<<<<<<<
 *     """Adds this constant to the diagonal elements of the matrix.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_345shift_diagoal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_344shift_diagoal[] = "shift_diagoal(int g_a, value=None)\nAdds this constant to the diagonal elements of the matrix.\n\n    This is a collective operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_345shift_diagoal = {"shift_diagoal", (PyCFunction)__pyx_pw_9miniga4py_2ga_345shift_diagoal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_344shift_diagoal};
static PyObject *__pyx_pw_9miniga4py_2ga_345shift_diagoal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("shift_diagoal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_value,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "shift_diagoal") < 0)) __PYX_ERR(0, 4146, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4146, __pyx_L3_error)
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("shift_diagoal", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4146, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.shift_diagoal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_344shift_diagoal(__pyx_self, __pyx_v_g_a, __pyx_v_value);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_344shift_diagoal(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_value) {
  int __pyx_v_ivalue;
  long __pyx_v_lvalue;
  PY_LONG_LONG __pyx_v_llvalue;
  float __pyx_v_fvalue;
  double __pyx_v_dvalue;
  long double __pyx_v_ldvalue;
  SingleComplex __pyx_v_fcvalue;
  DoubleComplex __pyx_v_dcvalue;
  void *__pyx_v_vvalue;
  int __pyx_v_gtype;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("shift_diagoal", 0);
  __Pyx_INCREF(__pyx_v_value);

  /* "miniga4py/ga.pyx":4161
 *     cdef DoubleComplex  dcvalue
 *     cdef void          *vvalue
 *     cdef int gtype=inquire_type(g_a)             # <<<<<<<<<<<<<<
 *     if value is None:
 *         value = 1
 */
  __pyx_v_gtype = __pyx_f_9miniga4py_2ga_inquire_type(__pyx_v_g_a, 0);

  /* "miniga4py/ga.pyx":4162
 *     cdef void          *vvalue
 *     cdef int gtype=inquire_type(g_a)
 *     if value is None:             # <<<<<<<<<<<<<<
 *         value = 1
 *     vvalue = _convert_multiplier(gtype, value,
 */
  __pyx_t_1 = (__pyx_v_value == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "miniga4py/ga.pyx":4163
 *     cdef int gtype=inquire_type(g_a)
 *     if value is None:
 *         value = 1             # <<<<<<<<<<<<<<
 *     vvalue = _convert_multiplier(gtype, value,
 *             &ivalue,  &lvalue,  &llvalue,
 */
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_int_1);

    /* "miniga4py/ga.pyx":4162
 *     cdef void          *vvalue
 *     cdef int gtype=inquire_type(g_a)
 *     if value is None:             # <<<<<<<<<<<<<<
 *         value = 1
 *     vvalue = _convert_multiplier(gtype, value,
 */
  }

  /* "miniga4py/ga.pyx":4164
 *     if value is None:
 *         value = 1
 *     vvalue = _convert_multiplier(gtype, value,             # <<<<<<<<<<<<<<
 *             &ivalue,  &lvalue,  &llvalue,
 *             &fvalue,  &dvalue,  &ldvalue,
 */
  __pyx_v_vvalue = __pyx_f_9miniga4py_2ga__convert_multiplier(__pyx_v_gtype, __pyx_v_value, (&__pyx_v_ivalue), (&__pyx_v_lvalue), (&__pyx_v_llvalue), (&__pyx_v_fvalue), (&__pyx_v_dvalue), (&__pyx_v_ldvalue), (&__pyx_v_fcvalue), (&__pyx_v_dcvalue));

  /* "miniga4py/ga.pyx":4168
 *             &fvalue,  &dvalue,  &ldvalue,
 *             &fcvalue, &dcvalue)
 *     GA_Shift_diagonal(g_a, vvalue)             # <<<<<<<<<<<<<<
 * 
 * def solve(int g_a, int g_b):
 */
  GA_Shift_diagonal(__pyx_v_g_a, __pyx_v_vvalue);

  /* "miniga4py/ga.pyx":4146
 *     GA_Set_restricted_range(g_a, lo_proc, hi_proc)
 * 
 * def shift_diagoal(int g_a, value=None):             # <<<<<<<<<<<<<<
 *     """Adds this constant to the diagonal elements of the matrix.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4170
 *     GA_Shift_diagonal(g_a, vvalue)
 * 
 * def solve(int g_a, int g_b):             # <<<<<<<<<<<<<<
 *     """Solves a system of linear equations A * X = B.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_347solve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_346solve[] = "solve(int g_a, int g_b)\nSolves a system of linear equations A * X = B.\n\n    It first will call the Cholesky factorization routine and, if sucessfully,\n    will solve the system with the Cholesky solver. If Cholesky will be not be\n    able to factorize A, then it will call the LU factorization routine and\n    will solve the system with forward/backward substitution. On exit B will\n    contain the solution X.\n\n    This is a collective operation.\n\n    :returns: 0 if Cholesky factoriztion was succesful.  >0 if the leading minor of this order is not positive definite, Cholesky factorization could not be completed and LU factoriztion was used\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_347solve = {"solve", (PyCFunction)__pyx_pw_9miniga4py_2ga_347solve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_346solve};
static PyObject *__pyx_pw_9miniga4py_2ga_347solve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_b;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("solve (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_b,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("solve", 1, 2, 2, 1); __PYX_ERR(0, 4170, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "solve") < 0)) __PYX_ERR(0, 4170, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4170, __pyx_L3_error)
    __pyx_v_g_b = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_b == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4170, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("solve", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4170, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_346solve(__pyx_self, __pyx_v_g_a, __pyx_v_g_b);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_346solve(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("solve", 0);

  /* "miniga4py/ga.pyx":4184
 * 
 *     """
 *     return GA_Solve(g_a, g_b)             # <<<<<<<<<<<<<<
 * 
 * def spd_invert(int g_a):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Solve(__pyx_v_g_a, __pyx_v_g_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":4170
 *     GA_Shift_diagonal(g_a, vvalue)
 * 
 * def solve(int g_a, int g_b):             # <<<<<<<<<<<<<<
 *     """Solves a system of linear equations A * X = B.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4186
 *     return GA_Solve(g_a, g_b)
 * 
 * def spd_invert(int g_a):             # <<<<<<<<<<<<<<
 *     """Compute the inverse of a double precision using the Cholesky
 *     factorization of a NxN double precision symmetric positive definite matrix
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_349spd_invert(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_348spd_invert[] = "spd_invert(int g_a)\nCompute the inverse of a double precision using the Cholesky\n    factorization of a NxN double precision symmetric positive definite matrix\n    A stored in the global array represented by g_a. On successful exit, A\n    will contain the inverse.\n\n    This is a collective operation.\n\n    :returns: 0 if successful exit; >0 if the leading minor of this order is not positive definite and the factorization could not be completed; <0 if it returns the index i of the (i,i) element of the factor L/U that is zero and the inverse could not be computed\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_349spd_invert = {"spd_invert", (PyCFunction)__pyx_pw_9miniga4py_2ga_349spd_invert, METH_O, __pyx_doc_9miniga4py_2ga_348spd_invert};
static PyObject *__pyx_pw_9miniga4py_2ga_349spd_invert(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("spd_invert (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4186, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.spd_invert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_348spd_invert(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_348spd_invert(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("spd_invert", 0);

  /* "miniga4py/ga.pyx":4197
 * 
 *     """
 *     return GA_Spd_invert(g_a)             # <<<<<<<<<<<<<<
 * 
 * def step_max(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Spd_invert(__pyx_v_g_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":4186
 *     return GA_Solve(g_a, g_b)
 * 
 * def spd_invert(int g_a):             # <<<<<<<<<<<<<<
 *     """Compute the inverse of a double precision using the Cholesky
 *     factorization of a NxN double precision symmetric positive definite matrix
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.spd_invert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4199
 *     return GA_Spd_invert(g_a)
 * 
 * def step_max(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None):             # <<<<<<<<<<<<<<
 *     """Calculates the largest multiple of a vector g_b that can be added to
 *     this vector g_a while keeping each element of this vector non-negative.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_351step_max(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_350step_max[] = "step_max(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None)\nCalculates the largest multiple of a vector g_b that can be added to\n    this vector g_a while keeping each element of this vector non-negative.\n\n    This is a collective operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_351step_max = {"step_max", (PyCFunction)__pyx_pw_9miniga4py_2ga_351step_max, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_350step_max};
static PyObject *__pyx_pw_9miniga4py_2ga_351step_max(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_b;
  PyObject *__pyx_v_alo = 0;
  PyObject *__pyx_v_ahi = 0;
  PyObject *__pyx_v_blo = 0;
  PyObject *__pyx_v_bhi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("step_max (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_b,&__pyx_n_s_alo,&__pyx_n_s_ahi,&__pyx_n_s_blo,&__pyx_n_s_bhi,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("step_max", 0, 2, 6, 1); __PYX_ERR(0, 4199, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alo);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ahi);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_blo);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bhi);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "step_max") < 0)) __PYX_ERR(0, 4199, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4199, __pyx_L3_error)
    __pyx_v_g_b = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_b == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4199, __pyx_L3_error)
    __pyx_v_alo = values[2];
    __pyx_v_ahi = values[3];
    __pyx_v_blo = values[4];
    __pyx_v_bhi = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("step_max", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4199, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.step_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_350step_max(__pyx_self, __pyx_v_g_a, __pyx_v_g_b, __pyx_v_alo, __pyx_v_ahi, __pyx_v_blo, __pyx_v_bhi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_350step_max(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b, PyObject *__pyx_v_alo, PyObject *__pyx_v_ahi, PyObject *__pyx_v_blo, PyObject *__pyx_v_bhi) {
  PyArrayObject *__pyx_v_alo_nd = 0;
  PyArrayObject *__pyx_v_ahi_nd = 0;
  PyArrayObject *__pyx_v_blo_nd = 0;
  PyArrayObject *__pyx_v_bhi_nd = 0;
  double __pyx_v_step;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ahi_nd;
  __Pyx_Buffer __pyx_pybuffer_ahi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_alo_nd;
  __Pyx_Buffer __pyx_pybuffer_alo_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bhi_nd;
  __Pyx_Buffer __pyx_pybuffer_bhi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_blo_nd;
  __Pyx_Buffer __pyx_pybuffer_blo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyArrayObject *__pyx_t_14 = NULL;
  __Pyx_RefNannySetupContext("step_max", 0);
  __pyx_pybuffer_alo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_alo_nd.refcount = 0;
  __pyx_pybuffernd_alo_nd.data = NULL;
  __pyx_pybuffernd_alo_nd.rcbuffer = &__pyx_pybuffer_alo_nd;
  __pyx_pybuffer_ahi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_ahi_nd.refcount = 0;
  __pyx_pybuffernd_ahi_nd.data = NULL;
  __pyx_pybuffernd_ahi_nd.rcbuffer = &__pyx_pybuffer_ahi_nd;
  __pyx_pybuffer_blo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_blo_nd.refcount = 0;
  __pyx_pybuffernd_blo_nd.data = NULL;
  __pyx_pybuffernd_blo_nd.rcbuffer = &__pyx_pybuffer_blo_nd;
  __pyx_pybuffer_bhi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_bhi_nd.refcount = 0;
  __pyx_pybuffernd_bhi_nd.data = NULL;
  __pyx_pybuffernd_bhi_nd.rcbuffer = &__pyx_pybuffer_bhi_nd;

  /* "miniga4py/ga.pyx":4209
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef double step
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None):
 *         GA_Step_max(g_a, g_b, &step)
 */
  __pyx_t_2 = (__pyx_v_alo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":4210
 *     cdef double step
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None):             # <<<<<<<<<<<<<<
 *         GA_Step_max(g_a, g_b, &step)
 *     else:
 */
  __pyx_t_3 = (__pyx_v_ahi == Py_None);

  /* "miniga4py/ga.pyx":4209
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef double step
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None):
 *         GA_Step_max(g_a, g_b, &step)
 */
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "miniga4py/ga.pyx":4210
 *     cdef double step
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None):             # <<<<<<<<<<<<<<
 *         GA_Step_max(g_a, g_b, &step)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_blo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_bhi == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "miniga4py/ga.pyx":4209
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef double step
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None):
 *         GA_Step_max(g_a, g_b, &step)
 */
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":4211
 *     if (alo is None and ahi is None
 *             and blo is None and bhi is None):
 *         GA_Step_max(g_a, g_b, &step)             # <<<<<<<<<<<<<<
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 */
    GA_Step_max(__pyx_v_g_a, __pyx_v_g_b, (&__pyx_v_step));

    /* "miniga4py/ga.pyx":4209
 *     cdef np.ndarray[np.int64_t, ndim=1] blo_nd, bhi_nd
 *     cdef double step
 *     if (alo is None and ahi is None             # <<<<<<<<<<<<<<
 *             and blo is None and bhi is None):
 *         GA_Step_max(g_a, g_b, &step)
 */
    goto __pyx_L3;
  }

  /* "miniga4py/ga.pyx":4213
 *         GA_Step_max(g_a, g_b, &step)
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)             # <<<<<<<<<<<<<<
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         GA_Step_max_patch64(g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_alo, __pyx_v_ahi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4213, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 4213, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4213, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4213, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4213, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 4213, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L9_unpacking_done;
      __pyx_L8_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 4213, __pyx_L1_error)
      __pyx_L9_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4213, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4213, __pyx_L1_error)
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_alo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_alo_nd.diminfo[0].strides = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alo_nd.diminfo[0].shape = __pyx_pybuffernd_alo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 4213, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_alo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_ahi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_ahi_nd.diminfo[0].strides = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ahi_nd.diminfo[0].shape = __pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 4213, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_ahi_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":4214
 *     else:
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)             # <<<<<<<<<<<<<<
 *         GA_Step_max_patch64(g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                 g_b, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data, &step)
 */
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_b, __pyx_v_blo, __pyx_v_bhi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4214, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 4214, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4214, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4214, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4214, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 4214, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L11_unpacking_done;
      __pyx_L10_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 4214, __pyx_L1_error)
      __pyx_L11_unpacking_done:;
    }
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4214, __pyx_L1_error)
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4214, __pyx_L1_error)
    __pyx_t_14 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_blo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_blo_nd.diminfo[0].strides = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_blo_nd.diminfo[0].shape = __pyx_pybuffernd_blo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 4214, __pyx_L1_error)
    }
    __pyx_t_14 = 0;
    __pyx_v_blo_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_14 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_bhi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_bhi_nd.diminfo[0].strides = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bhi_nd.diminfo[0].shape = __pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 4214, __pyx_L1_error)
    }
    __pyx_t_14 = 0;
    __pyx_v_bhi_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "miniga4py/ga.pyx":4215
 *         alo_nd,ahi_nd = _lohi(g_a,alo,ahi)
 *         blo_nd,bhi_nd = _lohi(g_b,blo,bhi)
 *         GA_Step_max_patch64(g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,             # <<<<<<<<<<<<<<
 *                 g_b, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data, &step)
 *     return step
 */
    GA_Step_max_patch64(__pyx_v_g_a, ((int64_t *)__pyx_v_alo_nd->data), ((int64_t *)__pyx_v_ahi_nd->data), __pyx_v_g_b, ((int64_t *)__pyx_v_blo_nd->data), ((int64_t *)__pyx_v_bhi_nd->data), (&__pyx_v_step));
  }
  __pyx_L3:;

  /* "miniga4py/ga.pyx":4217
 *         GA_Step_max_patch64(g_a, <int64_t*>alo_nd.data, <int64_t*>ahi_nd.data,
 *                 g_b, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data, &step)
 *     return step             # <<<<<<<<<<<<<<
 * 
 * def strided_acc(int g_a, buffer, lo=None, hi=None, skip=None, alpha=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_step); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":4199
 *     return GA_Spd_invert(g_a)
 * 
 * def step_max(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None):             # <<<<<<<<<<<<<<
 *     """Calculates the largest multiple of a vector g_b that can be added to
 *     this vector g_a while keeping each element of this vector non-negative.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.step_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ahi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alo_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bhi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_blo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_alo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_ahi_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_blo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_bhi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4219
 *     return step
 * 
 * def strided_acc(int g_a, buffer, lo=None, hi=None, skip=None, alpha=None):             # <<<<<<<<<<<<<<
 *     """Strided version of ga.acc.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_353strided_acc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_352strided_acc[] = "strided_acc(int g_a, buffer, lo=None, hi=None, skip=None, alpha=None)\nStrided version of ga.acc.\n    \n    The values corresponding to dimension n in buf are accumulated to every\n    skip[n] values of the global array g_a.\n    \n    Combines data from buffer with data in the global array patch.\n    \n    The buffer array is assumed to be have the same number of dimensions as\n    the global array.  If the buffer is not contiguous, a contiguous copy will\n    be made.\n    \n        global array section (lo[],hi[]) += alpha * buffer\n\n    This is a one-sided and atomic operation.\n\n    :Parameters:\n        g_a : int\n            the array handle\n        buffer : array-like\n            must be contiguous and have same number of elements as patch\n        lo : 1D array-like of integers\n            lower bound patch coordinates, inclusive\n        hi : 1D array-like of integers\n            higher bound patch coordinates, exclusive\n        alpha : object\n            multiplier (converted to the appropriate type)\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_353strided_acc = {"strided_acc", (PyCFunction)__pyx_pw_9miniga4py_2ga_353strided_acc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_352strided_acc};
static PyObject *__pyx_pw_9miniga4py_2ga_353strided_acc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_buffer = 0;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_v_skip = 0;
  PyObject *__pyx_v_alpha = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strided_acc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_buffer,&__pyx_n_s_lo,&__pyx_n_s_hi,&__pyx_n_s_skip,&__pyx_n_s_alpha,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("strided_acc", 0, 2, 6, 1); __PYX_ERR(0, 4219, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_skip);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "strided_acc") < 0)) __PYX_ERR(0, 4219, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4219, __pyx_L3_error)
    __pyx_v_buffer = values[1];
    __pyx_v_lo = values[2];
    __pyx_v_hi = values[3];
    __pyx_v_skip = values[4];
    __pyx_v_alpha = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strided_acc", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4219, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.strided_acc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_352strided_acc(__pyx_self, __pyx_v_g_a, __pyx_v_buffer, __pyx_v_lo, __pyx_v_hi, __pyx_v_skip, __pyx_v_alpha);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_352strided_acc(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_buffer, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, PyObject *__pyx_v_skip, PyObject *__pyx_v_alpha) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_9miniga4py_2ga__acc_common __pyx_t_2;
  __Pyx_RefNannySetupContext("strided_acc", 0);

  /* "miniga4py/ga.pyx":4248
 * 
 *     """
 *     _acc_common(g_a, buffer, lo, hi, alpha, False, False, skip)             # <<<<<<<<<<<<<<
 * 
 * def strided_get(int g_a, lo=None, hi=None, skip=None, np.ndarray buffer=None):
 */
  __pyx_t_2.__pyx_n = 6;
  __pyx_t_2.lo = __pyx_v_lo;
  __pyx_t_2.hi = __pyx_v_hi;
  __pyx_t_2.alpha = __pyx_v_alpha;
  __pyx_t_2.nb = 0;
  __pyx_t_2.periodic = 0;
  __pyx_t_2.skip = __pyx_v_skip;
  __pyx_t_1 = __pyx_f_9miniga4py_2ga__acc_common(__pyx_v_g_a, __pyx_v_buffer, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":4219
 *     return step
 * 
 * def strided_acc(int g_a, buffer, lo=None, hi=None, skip=None, alpha=None):             # <<<<<<<<<<<<<<
 *     """Strided version of ga.acc.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.strided_acc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4250
 *     _acc_common(g_a, buffer, lo, hi, alpha, False, False, skip)
 * 
 * def strided_get(int g_a, lo=None, hi=None, skip=None, np.ndarray buffer=None):             # <<<<<<<<<<<<<<
 *     """Strided version of ga.get.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_355strided_get(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_354strided_get[] = "strided_get(int g_a, lo=None, hi=None, skip=None, ndarray buffer=None)\nStrided version of ga.get.\n    \n    Copies data from global array section to the local array buffer.\n    \n    The local array is assumed to be have the same number of dimensions as the\n    global array. Any detected inconsitencies/errors in the input arguments\n    are fatal.\n\n    This is a one-sided operation.\n\n    :Parameters:\n        g_a : int\n            the array handle\n        lo : 1D array-like of integers\n            lower bound patch coordinates, inclusive\n        hi : 1D array-like of integers\n            higher bound patch coordinates, exclusive\n        skip : 1D array-like of integers\n            strides for each dimension\n        buffer : ndarray\n            an ndarray of the appropriate type, large enough to hold lo,hi\n\n    :returns: The local array buffer.\n    \n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_355strided_get = {"strided_get", (PyCFunction)__pyx_pw_9miniga4py_2ga_355strided_get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_354strided_get};
static PyObject *__pyx_pw_9miniga4py_2ga_355strided_get(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_v_skip = 0;
  PyArrayObject *__pyx_v_buffer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strided_get (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_lo,&__pyx_n_s_hi,&__pyx_n_s_skip,&__pyx_n_s_buffer,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = (PyObject *)((PyArrayObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_skip);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "strided_get") < 0)) __PYX_ERR(0, 4250, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4250, __pyx_L3_error)
    __pyx_v_lo = values[1];
    __pyx_v_hi = values[2];
    __pyx_v_skip = values[3];
    __pyx_v_buffer = ((PyArrayObject *)values[4]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strided_get", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4250, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.strided_get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buffer), __pyx_ptype_5numpy_ndarray, 1, "buffer", 0))) __PYX_ERR(0, 4250, __pyx_L1_error)
  __pyx_r = __pyx_pf_9miniga4py_2ga_354strided_get(__pyx_self, __pyx_v_g_a, __pyx_v_lo, __pyx_v_hi, __pyx_v_skip, __pyx_v_buffer);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_354strided_get(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, PyObject *__pyx_v_skip, PyArrayObject *__pyx_v_buffer) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_9miniga4py_2ga__get_common __pyx_t_2;
  __Pyx_RefNannySetupContext("strided_get", 0);

  /* "miniga4py/ga.pyx":4276
 * 
 *     """
 *     return _get_common(g_a, lo, hi, buffer, False, False, skip)             # <<<<<<<<<<<<<<
 * 
 * def strided_put(int g_a, buffer, lo=None, hi=None, skip=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 6;
  __pyx_t_2.lo = __pyx_v_lo;
  __pyx_t_2.hi = __pyx_v_hi;
  __pyx_t_2.buffer = __pyx_v_buffer;
  __pyx_t_2.nb = 0;
  __pyx_t_2.periodic = 0;
  __pyx_t_2.skip = __pyx_v_skip;
  __pyx_t_1 = __pyx_f_9miniga4py_2ga__get_common(__pyx_v_g_a, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":4250
 *     _acc_common(g_a, buffer, lo, hi, alpha, False, False, skip)
 * 
 * def strided_get(int g_a, lo=None, hi=None, skip=None, np.ndarray buffer=None):             # <<<<<<<<<<<<<<
 *     """Strided version of ga.get.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.strided_get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4278
 *     return _get_common(g_a, lo, hi, buffer, False, False, skip)
 * 
 * def strided_put(int g_a, buffer, lo=None, hi=None, skip=None):             # <<<<<<<<<<<<<<
 *     """Strided version of ga.put.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_357strided_put(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_356strided_put[] = "strided_put(int g_a, buffer, lo=None, hi=None, skip=None)\nStrided version of ga.put.\n    \n    Copies data from local array buffer to the global array section.\n    \n    The local array is assumed to be have the same number of dimensions as the\n    global array.  Any detected inconsitencies/errors in input arguments are\n    fatal.\n\n    This is a one-sided operation. \n\n    :Parameters:\n        g_a : int\n            the array handle\n        buffer : array-like\n            the data to put\n        lo : 1D array-like of integers\n            lower bound patch coordinates, inclusive\n        hi : array-like of integers\n            higher bound patch coordinates, exclusive\n        skip : 1D array-like of integers\n            strides for each dimension\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_357strided_put = {"strided_put", (PyCFunction)__pyx_pw_9miniga4py_2ga_357strided_put, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_356strided_put};
static PyObject *__pyx_pw_9miniga4py_2ga_357strided_put(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_buffer = 0;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_v_skip = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strided_put (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_buffer,&__pyx_n_s_lo,&__pyx_n_s_hi,&__pyx_n_s_skip,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("strided_put", 0, 2, 5, 1); __PYX_ERR(0, 4278, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_skip);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "strided_put") < 0)) __PYX_ERR(0, 4278, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4278, __pyx_L3_error)
    __pyx_v_buffer = values[1];
    __pyx_v_lo = values[2];
    __pyx_v_hi = values[3];
    __pyx_v_skip = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("strided_put", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4278, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.strided_put", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_356strided_put(__pyx_self, __pyx_v_g_a, __pyx_v_buffer, __pyx_v_lo, __pyx_v_hi, __pyx_v_skip);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_356strided_put(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_buffer, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi, PyObject *__pyx_v_skip) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_9miniga4py_2ga__put_common __pyx_t_2;
  __Pyx_RefNannySetupContext("strided_put", 0);

  /* "miniga4py/ga.pyx":4302
 * 
 *     """
 *     _put_common(g_a, buffer, lo, hi, False, False, skip)             # <<<<<<<<<<<<<<
 * 
 * def summarize(bint verbose):
 */
  __pyx_t_2.__pyx_n = 5;
  __pyx_t_2.lo = __pyx_v_lo;
  __pyx_t_2.hi = __pyx_v_hi;
  __pyx_t_2.nb = 0;
  __pyx_t_2.periodic = 0;
  __pyx_t_2.skip = __pyx_v_skip;
  __pyx_t_1 = __pyx_f_9miniga4py_2ga__put_common(__pyx_v_g_a, __pyx_v_buffer, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":4278
 *     return _get_common(g_a, lo, hi, buffer, False, False, skip)
 * 
 * def strided_put(int g_a, buffer, lo=None, hi=None, skip=None):             # <<<<<<<<<<<<<<
 *     """Strided version of ga.put.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.strided_put", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4304
 *     _put_common(g_a, buffer, lo, hi, False, False, skip)
 * 
 * def summarize(bint verbose):             # <<<<<<<<<<<<<<
 *     """Prints info about allocated arrays."""
 *     GA_Summarize(verbose)
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_359summarize(PyObject *__pyx_self, PyObject *__pyx_arg_verbose); /*proto*/
static char __pyx_doc_9miniga4py_2ga_358summarize[] = "summarize(bool verbose)\nPrints info about allocated arrays.";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_359summarize = {"summarize", (PyCFunction)__pyx_pw_9miniga4py_2ga_359summarize, METH_O, __pyx_doc_9miniga4py_2ga_358summarize};
static PyObject *__pyx_pw_9miniga4py_2ga_359summarize(PyObject *__pyx_self, PyObject *__pyx_arg_verbose) {
  int __pyx_v_verbose;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("summarize (wrapper)", 0);
  assert(__pyx_arg_verbose); {
    __pyx_v_verbose = __Pyx_PyObject_IsTrue(__pyx_arg_verbose); if (unlikely((__pyx_v_verbose == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4304, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.summarize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_358summarize(__pyx_self, ((int)__pyx_v_verbose));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_358summarize(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_verbose) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("summarize", 0);

  /* "miniga4py/ga.pyx":4306
 * def summarize(bint verbose):
 *     """Prints info about allocated arrays."""
 *     GA_Summarize(verbose)             # <<<<<<<<<<<<<<
 * 
 * def symmetrize(int g_a):
 */
  GA_Summarize(__pyx_v_verbose);

  /* "miniga4py/ga.pyx":4304
 *     _put_common(g_a, buffer, lo, hi, False, False, skip)
 * 
 * def summarize(bint verbose):             # <<<<<<<<<<<<<<
 *     """Prints info about allocated arrays."""
 *     GA_Summarize(verbose)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4308
 *     GA_Summarize(verbose)
 * 
 * def symmetrize(int g_a):             # <<<<<<<<<<<<<<
 *     """Symmetrizes matrix A represented with handle g_a: A:= .5 * (A+A').
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_361symmetrize(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_360symmetrize[] = "symmetrize(int g_a)\nSymmetrizes matrix A represented with handle g_a: A:= .5 * (A+A').\n\n    This is a collective operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_361symmetrize = {"symmetrize", (PyCFunction)__pyx_pw_9miniga4py_2ga_361symmetrize, METH_O, __pyx_doc_9miniga4py_2ga_360symmetrize};
static PyObject *__pyx_pw_9miniga4py_2ga_361symmetrize(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("symmetrize (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4308, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.symmetrize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_360symmetrize(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_360symmetrize(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("symmetrize", 0);

  /* "miniga4py/ga.pyx":4314
 * 
 *     """
 *     GA_Symmetrize(g_a)             # <<<<<<<<<<<<<<
 * 
 * def sync():
 */
  GA_Symmetrize(__pyx_v_g_a);

  /* "miniga4py/ga.pyx":4308
 *     GA_Summarize(verbose)
 * 
 * def symmetrize(int g_a):             # <<<<<<<<<<<<<<
 *     """Symmetrizes matrix A represented with handle g_a: A:= .5 * (A+A').
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4316
 *     GA_Symmetrize(g_a)
 * 
 * def sync():             # <<<<<<<<<<<<<<
 *     """Synchronize processes (a barrier) and ensure that all GA operations
 *     completed.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_363sync(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_362sync[] = "sync()\nSynchronize processes (a barrier) and ensure that all GA operations\n    completed.\n\n    This is a collective operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_363sync = {"sync", (PyCFunction)__pyx_pw_9miniga4py_2ga_363sync, METH_NOARGS, __pyx_doc_9miniga4py_2ga_362sync};
static PyObject *__pyx_pw_9miniga4py_2ga_363sync(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sync (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_362sync(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_362sync(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sync", 0);

  /* "miniga4py/ga.pyx":4323
 * 
 *     """
 *     GA_Sync()             # <<<<<<<<<<<<<<
 * 
 * def terminate():
 */
  GA_Sync();

  /* "miniga4py/ga.pyx":4316
 *     GA_Symmetrize(g_a)
 * 
 * def sync():             # <<<<<<<<<<<<<<
 *     """Synchronize processes (a barrier) and ensure that all GA operations
 *     completed.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4325
 *     GA_Sync()
 * 
 * def terminate():             # <<<<<<<<<<<<<<
 *     """Delete all active arrays and destroy internal data structures.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_365terminate(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_364terminate[] = "terminate()\nDelete all active arrays and destroy internal data structures.\n\n    This is a collective operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_365terminate = {"terminate", (PyCFunction)__pyx_pw_9miniga4py_2ga_365terminate, METH_NOARGS, __pyx_doc_9miniga4py_2ga_364terminate};
static PyObject *__pyx_pw_9miniga4py_2ga_365terminate(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("terminate (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_364terminate(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_364terminate(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("terminate", 0);

  /* "miniga4py/ga.pyx":4332
 *     """
 *     global _initialized
 *     _initialized = False             # <<<<<<<<<<<<<<
 *     GA_Terminate()
 * 
 */
  __pyx_v_9miniga4py_2ga__initialized = 0;

  /* "miniga4py/ga.pyx":4333
 *     global _initialized
 *     _initialized = False
 *     GA_Terminate()             # <<<<<<<<<<<<<<
 * 
 * def total_blocks(int g_a):
 */
  GA_Terminate();

  /* "miniga4py/ga.pyx":4325
 *     GA_Sync()
 * 
 * def terminate():             # <<<<<<<<<<<<<<
 *     """Delete all active arrays and destroy internal data structures.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4335
 *     GA_Terminate()
 * 
 * def total_blocks(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns the total number of blocks contained in a global
 *     array with a block-cyclic data distribution.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_367total_blocks(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_366total_blocks[] = "total_blocks(int g_a)\nReturns the total number of blocks contained in a global\n    array with a block-cyclic data distribution.\n    \n    This is a local operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_367total_blocks = {"total_blocks", (PyCFunction)__pyx_pw_9miniga4py_2ga_367total_blocks, METH_O, __pyx_doc_9miniga4py_2ga_366total_blocks};
static PyObject *__pyx_pw_9miniga4py_2ga_367total_blocks(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("total_blocks (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4335, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.total_blocks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_366total_blocks(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_366total_blocks(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("total_blocks", 0);

  /* "miniga4py/ga.pyx":4342
 * 
 *     """
 *     return GA_Total_blocks(g_a)             # <<<<<<<<<<<<<<
 * 
 * def transpose(int g_a, int g_b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(GA_Total_blocks(__pyx_v_g_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":4335
 *     GA_Terminate()
 * 
 * def total_blocks(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns the total number of blocks contained in a global
 *     array with a block-cyclic data distribution.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.total_blocks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4344
 *     return GA_Total_blocks(g_a)
 * 
 * def transpose(int g_a, int g_b):             # <<<<<<<<<<<<<<
 *     """Transposes a matrix: B = A', where A and B are represented by handles
 *     g_a and g_b.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_369transpose(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_368transpose[] = "transpose(int g_a, int g_b)\nTransposes a matrix: B = A', where A and B are represented by handles\n    g_a and g_b.\n\n    This is a collective operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_369transpose = {"transpose", (PyCFunction)__pyx_pw_9miniga4py_2ga_369transpose, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_368transpose};
static PyObject *__pyx_pw_9miniga4py_2ga_369transpose(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_g_b;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("transpose (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_g_b,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("transpose", 1, 2, 2, 1); __PYX_ERR(0, 4344, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "transpose") < 0)) __PYX_ERR(0, 4344, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4344, __pyx_L3_error)
    __pyx_v_g_b = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_b == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4344, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("transpose", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4344, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.transpose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_368transpose(__pyx_self, __pyx_v_g_a, __pyx_v_g_b);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_368transpose(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_g_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("transpose", 0);

  /* "miniga4py/ga.pyx":4351
 * 
 *     """
 *     GA_Transpose(g_a, g_b)             # <<<<<<<<<<<<<<
 * 
 * def unlock(int mutex):
 */
  GA_Transpose(__pyx_v_g_a, __pyx_v_g_b);

  /* "miniga4py/ga.pyx":4344
 *     return GA_Total_blocks(g_a)
 * 
 * def transpose(int g_a, int g_b):             # <<<<<<<<<<<<<<
 *     """Transposes a matrix: B = A', where A and B are represented by handles
 *     g_a and g_b.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4353
 *     GA_Transpose(g_a, g_b)
 * 
 * def unlock(int mutex):             # <<<<<<<<<<<<<<
 *     """Unlocks a mutex object identified by the mutex number. It is a fatal
 *     error for a process to attempt to unlock a mutex which has not been locked
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_371unlock(PyObject *__pyx_self, PyObject *__pyx_arg_mutex); /*proto*/
static char __pyx_doc_9miniga4py_2ga_370unlock[] = "unlock(int mutex)\nUnlocks a mutex object identified by the mutex number. It is a fatal\n    error for a process to attempt to unlock a mutex which has not been locked\n    by this process.";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_371unlock = {"unlock", (PyCFunction)__pyx_pw_9miniga4py_2ga_371unlock, METH_O, __pyx_doc_9miniga4py_2ga_370unlock};
static PyObject *__pyx_pw_9miniga4py_2ga_371unlock(PyObject *__pyx_self, PyObject *__pyx_arg_mutex) {
  int __pyx_v_mutex;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unlock (wrapper)", 0);
  assert(__pyx_arg_mutex); {
    __pyx_v_mutex = __Pyx_PyInt_As_int(__pyx_arg_mutex); if (unlikely((__pyx_v_mutex == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4353, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.unlock", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_370unlock(__pyx_self, ((int)__pyx_v_mutex));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_370unlock(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_mutex) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unlock", 0);

  /* "miniga4py/ga.pyx":4357
 *     error for a process to attempt to unlock a mutex which has not been locked
 *     by this process."""
 *     GA_Unlock(mutex)             # <<<<<<<<<<<<<<
 * 
 * def unpack(int g_src, int g_dst, int g_msk, lo=None, hi=None):
 */
  GA_Unlock(__pyx_v_mutex);

  /* "miniga4py/ga.pyx":4353
 *     GA_Transpose(g_a, g_b)
 * 
 * def unlock(int mutex):             # <<<<<<<<<<<<<<
 *     """Unlocks a mutex object identified by the mutex number. It is a fatal
 *     error for a process to attempt to unlock a mutex which has not been locked
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4359
 *     GA_Unlock(mutex)
 * 
 * def unpack(int g_src, int g_dst, int g_msk, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Expands the values in the source vector into a larger destination vector.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_373unpack(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_372unpack[] = "unpack(int g_src, int g_dst, int g_msk, lo=None, hi=None)\nExpands the values in the source vector into a larger destination vector.\n\n    The unpack subroutine is designed to expand the values in the source\n    vector g_src into a larger destination array g_dst based on the values in\n    an integer mask array g_msk. The values lo and hi denote the range of\n    elements that should be uncompressed and icount is a variable that on\n    output lists the number of values placed in the uncompressed array. This\n    operation is the complement of the ga.pack operation. An example is shown\n    below::\n\n        ga.unpack(g_src, g_dst, g_msk, 1, n, &icount);\n        g_src:   1  7  9 12 15 16\n        g_msk:   1  0  0  0  0  0  1  0  1  0  0  1  0  0  1  1  0\n        g_dst:   1  0  0  0  0  0  7  0  9  0  0 12  0  0 15 16  0\n        icount:  6\n\n    This is a collective operation.\n\n    :Parameters:\n        g_src : int\n            handle for source arrray\n        g_dst : int\n            handle for destination array\n        g_msk : int\n            handle for integer array representing mask\n        lo : 1D array-like of integers\n            low value of range on which operation is performed\n        hi : 1D array-like of integers\n            hi value of range on which operation is performed\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_373unpack = {"unpack", (PyCFunction)__pyx_pw_9miniga4py_2ga_373unpack, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_372unpack};
static PyObject *__pyx_pw_9miniga4py_2ga_373unpack(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_src;
  int __pyx_v_g_dst;
  int __pyx_v_g_msk;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unpack (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_src,&__pyx_n_s_g_dst,&__pyx_n_s_g_msk,&__pyx_n_s_lo,&__pyx_n_s_hi,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_src)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_dst)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("unpack", 0, 3, 5, 1); __PYX_ERR(0, 4359, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_msk)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("unpack", 0, 3, 5, 2); __PYX_ERR(0, 4359, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "unpack") < 0)) __PYX_ERR(0, 4359, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_src = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_src == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4359, __pyx_L3_error)
    __pyx_v_g_dst = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_g_dst == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4359, __pyx_L3_error)
    __pyx_v_g_msk = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_g_msk == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4359, __pyx_L3_error)
    __pyx_v_lo = values[3];
    __pyx_v_hi = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("unpack", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4359, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.unpack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_372unpack(__pyx_self, __pyx_v_g_src, __pyx_v_g_dst, __pyx_v_g_msk, __pyx_v_lo, __pyx_v_hi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_372unpack(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_src, int __pyx_v_g_dst, int __pyx_v_g_msk, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
  PyArrayObject *__pyx_v_hi_nd = 0;
  CYTHON_UNUSED int64_t __pyx_v_c_lo;
  CYTHON_UNUSED int64_t __pyx_v_c_hi;
  int64_t __pyx_v_icount;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_nd;
  __Pyx_Buffer __pyx_pybuffer_hi_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyArrayObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int64_t __pyx_t_8;
  int64_t __pyx_t_9;
  __Pyx_RefNannySetupContext("unpack", 0);
  __pyx_pybuffer_hi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_nd.refcount = 0;
  __pyx_pybuffernd_hi_nd.data = NULL;
  __pyx_pybuffernd_hi_nd.rcbuffer = &__pyx_pybuffer_hi_nd;

  /* "miniga4py/ga.pyx":4391
 * 
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] hi_nd = inquire_dims(g_src)-1             # <<<<<<<<<<<<<<
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0], icount
 *     if lo is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_9miniga4py_2ga_inquire_dims(__pyx_v_g_src, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4391, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4391, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4391, __pyx_L1_error)
  __pyx_t_3 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_hi_nd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 4391, __pyx_L1_error)
    } else {__pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_3 = 0;
  __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "miniga4py/ga.pyx":4392
 *     """
 *     cdef np.ndarray[np.int64_t, ndim=1] hi_nd = inquire_dims(g_src)-1
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0], icount             # <<<<<<<<<<<<<<
 *     if lo is not None:
 *         c_lo = lo
 */
  __pyx_v_c_lo = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = -1;
  if (__pyx_t_4 < 0) {
    __pyx_t_4 += __pyx_pybuffernd_hi_nd.diminfo[0].shape;
    if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_hi_nd.diminfo[0].shape)) __pyx_t_5 = 0;
  if (unlikely(__pyx_t_5 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_5);
    __PYX_ERR(0, 4392, __pyx_L1_error)
  }
  __pyx_v_c_hi = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_hi_nd.diminfo[0].strides));

  /* "miniga4py/ga.pyx":4393
 *     cdef np.ndarray[np.int64_t, ndim=1] hi_nd = inquire_dims(g_src)-1
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0], icount
 *     if lo is not None:             # <<<<<<<<<<<<<<
 *         c_lo = lo
 *     if hi is not None:
 */
  __pyx_t_6 = (__pyx_v_lo != Py_None);
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "miniga4py/ga.pyx":4394
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0], icount
 *     if lo is not None:
 *         c_lo = lo             # <<<<<<<<<<<<<<
 *     if hi is not None:
 *         c_hi = hi
 */
    __pyx_t_8 = __Pyx_PyInt_As_int64_t(__pyx_v_lo); if (unlikely((__pyx_t_8 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4394, __pyx_L1_error)
    __pyx_v_c_lo = __pyx_t_8;

    /* "miniga4py/ga.pyx":4393
 *     cdef np.ndarray[np.int64_t, ndim=1] hi_nd = inquire_dims(g_src)-1
 *     cdef int64_t c_lo=0, c_hi=hi_nd[0], icount
 *     if lo is not None:             # <<<<<<<<<<<<<<
 *         c_lo = lo
 *     if hi is not None:
 */
  }

  /* "miniga4py/ga.pyx":4395
 *     if lo is not None:
 *         c_lo = lo
 *     if hi is not None:             # <<<<<<<<<<<<<<
 *         c_hi = hi
 *     GA_Unpack64(g_src, g_dst, g_msk, lo, hi, &icount)
 */
  __pyx_t_7 = (__pyx_v_hi != Py_None);
  __pyx_t_6 = (__pyx_t_7 != 0);
  if (__pyx_t_6) {

    /* "miniga4py/ga.pyx":4396
 *         c_lo = lo
 *     if hi is not None:
 *         c_hi = hi             # <<<<<<<<<<<<<<
 *     GA_Unpack64(g_src, g_dst, g_msk, lo, hi, &icount)
 *     return icount
 */
    __pyx_t_8 = __Pyx_PyInt_As_int64_t(__pyx_v_hi); if (unlikely((__pyx_t_8 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4396, __pyx_L1_error)
    __pyx_v_c_hi = __pyx_t_8;

    /* "miniga4py/ga.pyx":4395
 *     if lo is not None:
 *         c_lo = lo
 *     if hi is not None:             # <<<<<<<<<<<<<<
 *         c_hi = hi
 *     GA_Unpack64(g_src, g_dst, g_msk, lo, hi, &icount)
 */
  }

  /* "miniga4py/ga.pyx":4397
 *     if hi is not None:
 *         c_hi = hi
 *     GA_Unpack64(g_src, g_dst, g_msk, lo, hi, &icount)             # <<<<<<<<<<<<<<
 *     return icount
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_As_int64_t(__pyx_v_lo); if (unlikely((__pyx_t_8 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4397, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyInt_As_int64_t(__pyx_v_hi); if (unlikely((__pyx_t_9 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4397, __pyx_L1_error)
  GA_Unpack64(__pyx_v_g_src, __pyx_v_g_dst, __pyx_v_g_msk, __pyx_t_8, __pyx_t_9, (&__pyx_v_icount));

  /* "miniga4py/ga.pyx":4398
 *         c_hi = hi
 *     GA_Unpack64(g_src, g_dst, g_msk, lo, hi, &icount)
 *     return icount             # <<<<<<<<<<<<<<
 * 
 * def update_ghosts(int g_a):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_v_icount); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":4359
 *     GA_Unlock(mutex)
 * 
 * def unpack(int g_src, int g_dst, int g_msk, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Expands the values in the source vector into a larger destination vector.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.unpack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4400
 *     return icount
 * 
 * def update_ghosts(int g_a):             # <<<<<<<<<<<<<<
 *     """This call updates the ghost cell regions on each processor with the
 *     corresponding neighbor data from other processors.
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_375update_ghosts(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_374update_ghosts[] = "update_ghosts(int g_a)\nThis call updates the ghost cell regions on each processor with the\n    corresponding neighbor data from other processors.\n    \n    The operation assumes that all data is wrapped around using periodic\n    boundary data so that ghost cell data that goes beyound an array boundary\n    is wrapped around to the other end of the array. The ga.update_ghosts call\n    contains two ga.sync calls before and after the actual update operation.\n    For some applications these calls may be unecessary, if so they can be\n    removed using the ga.mask_sync subroutine.\n\n    This is a collective operation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_375update_ghosts = {"update_ghosts", (PyCFunction)__pyx_pw_9miniga4py_2ga_375update_ghosts, METH_O, __pyx_doc_9miniga4py_2ga_374update_ghosts};
static PyObject *__pyx_pw_9miniga4py_2ga_375update_ghosts(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_ghosts (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4400, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.update_ghosts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_374update_ghosts(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_374update_ghosts(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_ghosts", 0);

  /* "miniga4py/ga.pyx":4414
 * 
 *     """
 *     GA_Update_ghosts(g_a)             # <<<<<<<<<<<<<<
 * 
 * def update_ghost_dir(int g_a, int dimension, int dir, int flag):
 */
  GA_Update_ghosts(__pyx_v_g_a);

  /* "miniga4py/ga.pyx":4400
 *     return icount
 * 
 * def update_ghosts(int g_a):             # <<<<<<<<<<<<<<
 *     """This call updates the ghost cell regions on each processor with the
 *     corresponding neighbor data from other processors.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4416
 *     GA_Update_ghosts(g_a)
 * 
 * def update_ghost_dir(int g_a, int dimension, int dir, int flag):             # <<<<<<<<<<<<<<
 *     """This function can be used to update the ghost cells along individual
 *     directions. It is designed for algorithms that can overlap updates with
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_377update_ghost_dir(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_376update_ghost_dir[] = "update_ghost_dir(int g_a, int dimension, int dir, int flag)\nThis function can be used to update the ghost cells along individual\n    directions. It is designed for algorithms that can overlap updates with\n    computation. The variable dimension indicates which coordinate direction\n    is to be updated (e.g. dimension = 1 would correspond to the y axis in a\n    two or three dimensional system), the variable idir can take the values\n    +/-1 and indicates whether the side that is to be updated lies in the\n    positive or negative direction, and cflag indicates whether or not the\n    corners on the side being updated are to be included in the update. The\n    following calls would be equivalent to a call to GA_Update_ghosts  for a\n    2-dimensional system:\n     \n\n    status = NGA_Update_ghost_dir(g_a,0,-1,1);\n    status = NGA_Update_ghost_dir(g_a,0,1,1);\n    status = NGA_Update_ghost_dir(g_a,1,-1,0);\n    status = NGA_Update_ghost_dir(g_a,1,1,0);\n\n    The variable cflag is set equal to 1 (or non-zero) in the first two calls\n    so that the corner ghost cells are update, it is set equal to 0 in the\n    second two calls to avoid redundant updates of the corners. Note that\n    updating the ghosts cells using several independent calls to the\n    nga_update_ghost_dir functions is generally not as efficient as using\n    GA_Update_ghosts  unless the individual calls can be effectively\n    overlapped with computation.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_377update_ghost_dir = {"update_ghost_dir", (PyCFunction)__pyx_pw_9miniga4py_2ga_377update_ghost_dir, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_376update_ghost_dir};
static PyObject *__pyx_pw_9miniga4py_2ga_377update_ghost_dir(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  int __pyx_v_dimension;
  int __pyx_v_dir;
  int __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_ghost_dir (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_dimension,&__pyx_n_s_dir,&__pyx_n_s_flag,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dimension)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update_ghost_dir", 1, 4, 4, 1); __PYX_ERR(0, 4416, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dir)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update_ghost_dir", 1, 4, 4, 2); __PYX_ERR(0, 4416, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update_ghost_dir", 1, 4, 4, 3); __PYX_ERR(0, 4416, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update_ghost_dir") < 0)) __PYX_ERR(0, 4416, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4416, __pyx_L3_error)
    __pyx_v_dimension = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_dimension == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4416, __pyx_L3_error)
    __pyx_v_dir = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_dir == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4416, __pyx_L3_error)
    __pyx_v_flag = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_flag == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4416, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update_ghost_dir", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4416, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.update_ghost_dir", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_376update_ghost_dir(__pyx_self, __pyx_v_g_a, __pyx_v_dimension, __pyx_v_dir, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_376update_ghost_dir(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, int __pyx_v_dimension, int __pyx_v_dir, int __pyx_v_flag) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_ghost_dir", 0);

  /* "miniga4py/ga.pyx":4443
 * 
 *     """
 *     NGA_Update_ghost_dir(g_a, dimension, dir, flag)             # <<<<<<<<<<<<<<
 * 
 * def uses_ma():
 */
  (void)(NGA_Update_ghost_dir(__pyx_v_g_a, __pyx_v_dimension, __pyx_v_dir, __pyx_v_flag));

  /* "miniga4py/ga.pyx":4416
 *     GA_Update_ghosts(g_a)
 * 
 * def update_ghost_dir(int g_a, int dimension, int dir, int flag):             # <<<<<<<<<<<<<<
 *     """This function can be used to update the ghost cells along individual
 *     directions. It is designed for algorithms that can overlap updates with
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4445
 *     NGA_Update_ghost_dir(g_a, dimension, dir, flag)
 * 
 * def uses_ma():             # <<<<<<<<<<<<<<
 *     """TODO"""
 *     if GA_Uses_ma() == 1:
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_379uses_ma(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_378uses_ma[] = "uses_ma()\nTODO";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_379uses_ma = {"uses_ma", (PyCFunction)__pyx_pw_9miniga4py_2ga_379uses_ma, METH_NOARGS, __pyx_doc_9miniga4py_2ga_378uses_ma};
static PyObject *__pyx_pw_9miniga4py_2ga_379uses_ma(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("uses_ma (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_378uses_ma(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_378uses_ma(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("uses_ma", 0);

  /* "miniga4py/ga.pyx":4447
 * def uses_ma():
 *     """TODO"""
 *     if GA_Uses_ma() == 1:             # <<<<<<<<<<<<<<
 *         return True
 *     return False
 */
  __pyx_t_1 = ((GA_Uses_ma() == 1) != 0);
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":4448
 *     """TODO"""
 *     if GA_Uses_ma() == 1:
 *         return True             # <<<<<<<<<<<<<<
 *     return False
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "miniga4py/ga.pyx":4447
 * def uses_ma():
 *     """TODO"""
 *     if GA_Uses_ma() == 1:             # <<<<<<<<<<<<<<
 *         return True
 *     return False
 */
  }

  /* "miniga4py/ga.pyx":4449
 *     if GA_Uses_ma() == 1:
 *         return True
 *     return False             # <<<<<<<<<<<<<<
 * 
 * def wtime():
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":4445
 *     NGA_Update_ghost_dir(g_a, dimension, dir, flag)
 * 
 * def uses_ma():             # <<<<<<<<<<<<<<
 *     """TODO"""
 *     if GA_Uses_ma() == 1:
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4451
 *     return False
 * 
 * def wtime():             # <<<<<<<<<<<<<<
 *     """This function return a wall (or elapsed) time on the calling processor.
 *     Returns time in seconds representing elapsed wall-clock time since an
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_381wtime(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_9miniga4py_2ga_380wtime[] = "wtime()\nThis function return a wall (or elapsed) time on the calling processor.\n    Returns time in seconds representing elapsed wall-clock time since an\n    arbitrary time in the past. Example:\n\n    starttime = ga.wtime()\n    # .... code snippet to be timed ....\n    endtime   = ga.wtime()\n    print \"Time taken = %s seconds\" % endtime-starttime\n\n    This is a local operation.\n\n    This function is only available in release 4.1 or greater.\n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_381wtime = {"wtime", (PyCFunction)__pyx_pw_9miniga4py_2ga_381wtime, METH_NOARGS, __pyx_doc_9miniga4py_2ga_380wtime};
static PyObject *__pyx_pw_9miniga4py_2ga_381wtime(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("wtime (wrapper)", 0);
  __pyx_r = __pyx_pf_9miniga4py_2ga_380wtime(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_380wtime(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("wtime", 0);

  /* "miniga4py/ga.pyx":4466
 * 
 *     """
 *     return GA_Wtime()             # <<<<<<<<<<<<<<
 * 
 * def zero(int g_a, lo=None, hi=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(GA_Wtime()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "miniga4py/ga.pyx":4451
 *     return False
 * 
 * def wtime():             # <<<<<<<<<<<<<<
 *     """This function return a wall (or elapsed) time on the calling processor.
 *     Returns time in seconds representing elapsed wall-clock time since an
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("miniga4py.ga.wtime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4468
 *     return GA_Wtime()
 * 
 * def zero(int g_a, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Set all the elements in the array or patch to zero."""
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_383zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9miniga4py_2ga_382zero[] = "zero(int g_a, lo=None, hi=None)\nSet all the elements in the array or patch to zero.";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_383zero = {"zero", (PyCFunction)__pyx_pw_9miniga4py_2ga_383zero, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_382zero};
static PyObject *__pyx_pw_9miniga4py_2ga_383zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_g_a;
  PyObject *__pyx_v_lo = 0;
  PyObject *__pyx_v_hi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zero (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g_a,&__pyx_n_s_lo,&__pyx_n_s_hi,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lo);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hi);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zero") < 0)) __PYX_ERR(0, 4468, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4468, __pyx_L3_error)
    __pyx_v_lo = values[1];
    __pyx_v_hi = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zero", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4468, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_382zero(__pyx_self, __pyx_v_g_a, __pyx_v_lo, __pyx_v_hi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_382zero(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
  PyArrayObject *__pyx_v_lo_nd = 0;
  PyArrayObject *__pyx_v_hi_nd = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_hi_nd;
  __Pyx_Buffer __pyx_pybuffer_hi_nd;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lo_nd;
  __Pyx_Buffer __pyx_pybuffer_lo_nd;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  __Pyx_RefNannySetupContext("zero", 0);
  __pyx_pybuffer_lo_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_lo_nd.refcount = 0;
  __pyx_pybuffernd_lo_nd.data = NULL;
  __pyx_pybuffernd_lo_nd.rcbuffer = &__pyx_pybuffer_lo_nd;
  __pyx_pybuffer_hi_nd.pybuffer.buf = NULL;
  __pyx_pybuffer_hi_nd.refcount = 0;
  __pyx_pybuffernd_hi_nd.data = NULL;
  __pyx_pybuffernd_hi_nd.rcbuffer = &__pyx_pybuffer_hi_nd;

  /* "miniga4py/ga.pyx":4471
 *     """Set all the elements in the array or patch to zero."""
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 *     if lo is None and hi is None:             # <<<<<<<<<<<<<<
 *         GA_Zero(g_a)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_lo == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_hi == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "miniga4py/ga.pyx":4472
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 *     if lo is None and hi is None:
 *         GA_Zero(g_a)             # <<<<<<<<<<<<<<
 *     else:
 *         lo_nd,hi_nd = _lohi(g_a,lo,hi)
 */
    GA_Zero(__pyx_v_g_a);

    /* "miniga4py/ga.pyx":4471
 *     """Set all the elements in the array or patch to zero."""
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 *     if lo is None and hi is None:             # <<<<<<<<<<<<<<
 *         GA_Zero(g_a)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "miniga4py/ga.pyx":4474
 *         GA_Zero(g_a)
 *     else:
 *         lo_nd,hi_nd = _lohi(g_a,lo,hi)             # <<<<<<<<<<<<<<
 *         NGA_Zero_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_9miniga4py_2ga__lohi(__pyx_v_g_a, __pyx_v_lo, __pyx_v_hi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 4474, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4474, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4474, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4474, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 4474, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 4474, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4474, __pyx_L1_error)
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 4474, __pyx_L1_error)
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_lo_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
        }
        __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_lo_nd.diminfo[0].strides = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lo_nd.diminfo[0].shape = __pyx_pybuffernd_lo_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 4474, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_lo_nd = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_9 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer, (PyObject*)__pyx_v_hi_nd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
        }
        __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
      }
      __pyx_pybuffernd_hi_nd.diminfo[0].strides = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hi_nd.diminfo[0].shape = __pyx_pybuffernd_hi_nd.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 4474, __pyx_L1_error)
    }
    __pyx_t_9 = 0;
    __pyx_v_hi_nd = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":4475
 *     else:
 *         lo_nd,hi_nd = _lohi(g_a,lo,hi)
 *         NGA_Zero_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)             # <<<<<<<<<<<<<<
 * 
 * def zero_diagonal(int g_a):
 */
    NGA_Zero_patch64(__pyx_v_g_a, ((int64_t *)__pyx_v_lo_nd->data), ((int64_t *)__pyx_v_hi_nd->data));
  }
  __pyx_L3:;

  /* "miniga4py/ga.pyx":4468
 *     return GA_Wtime()
 * 
 * def zero(int g_a, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Set all the elements in the array or patch to zero."""
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("miniga4py.ga.zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hi_nd.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lo_nd.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lo_nd);
  __Pyx_XDECREF((PyObject *)__pyx_v_hi_nd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "miniga4py/ga.pyx":4477
 *         NGA_Zero_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 * def zero_diagonal(int g_a):             # <<<<<<<<<<<<<<
 *     """Sets the diagonal elements of this matrix g_a with zeros.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_9miniga4py_2ga_385zero_diagonal(PyObject *__pyx_self, PyObject *__pyx_arg_g_a); /*proto*/
static char __pyx_doc_9miniga4py_2ga_384zero_diagonal[] = "zero_diagonal(int g_a)\nSets the diagonal elements of this matrix g_a with zeros.\n    \n    This is a collective operation. \n\n    ";
static PyMethodDef __pyx_mdef_9miniga4py_2ga_385zero_diagonal = {"zero_diagonal", (PyCFunction)__pyx_pw_9miniga4py_2ga_385zero_diagonal, METH_O, __pyx_doc_9miniga4py_2ga_384zero_diagonal};
static PyObject *__pyx_pw_9miniga4py_2ga_385zero_diagonal(PyObject *__pyx_self, PyObject *__pyx_arg_g_a) {
  int __pyx_v_g_a;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zero_diagonal (wrapper)", 0);
  assert(__pyx_arg_g_a); {
    __pyx_v_g_a = __Pyx_PyInt_As_int(__pyx_arg_g_a); if (unlikely((__pyx_v_g_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4477, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("miniga4py.ga.zero_diagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_9miniga4py_2ga_384zero_diagonal(__pyx_self, ((int)__pyx_v_g_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_9miniga4py_2ga_384zero_diagonal(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_g_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zero_diagonal", 0);

  /* "miniga4py/ga.pyx":4483
 * 
 *     """
 *     GA_Zero_diagonal(g_a)             # <<<<<<<<<<<<<<
 * 
 * initialize()
 */
  GA_Zero_diagonal(__pyx_v_g_a);

  /* "miniga4py/ga.pyx":4477
 *         NGA_Zero_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 * def zero_diagonal(int g_a):             # <<<<<<<<<<<<<<
 *     """Sets the diagonal elements of this matrix g_a with zeros.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":215
 *         # experimental exception made for __getbuffer__ and __releasebuffer__
 *         # -- the details of this may change.
 *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fulfill the PEP.
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_v_i;
  int __pyx_v_ndim;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  int __pyx_v_t;
  char *__pyx_v_f;
  PyArray_Descr *__pyx_v_descr = 0;
  int __pyx_v_offset;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  char *__pyx_t_8;
  if (__pyx_v_info == NULL) {
    PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
    return -1;
  }
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_info->obj);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":222
 * 
 *             cdef int i, ndim
 *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 */
  __pyx_v_endian_detector = 1;

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":223
 *             cdef int i, ndim
 *             cdef int endian_detector = 1
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 * 
 *             ndim = PyArray_NDIM(self)
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":225
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 */
  __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":227
 *             ndim = PyArray_NDIM(self)
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")
 */
  __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":228
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 */
  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":227
 *             ndim = PyArray_NDIM(self)
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")
 */
  if (unlikely(__pyx_t_1)) {

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":229
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 229, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 229, __pyx_L1_error)

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":227
 *             ndim = PyArray_NDIM(self)
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")
 */
  }

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":231
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 */
  __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L7_bool_binop_done;
  }

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":232
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 */
  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L7_bool_binop_done:;

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":231
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 */
  if (unlikely(__pyx_t_1)) {

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":233
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 233, __pyx_L1_error)

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":231
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 */
  }

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":235
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
 *             info.ndim = ndim
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":236
 * 
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim             # <<<<<<<<<<<<<<
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 # Allocate new buffer for strides and shape info.
 */
  __pyx_v_info->ndim = __pyx_v_ndim;

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":237
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 */
  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  if (__pyx_t_1) {

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":240
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)             # <<<<<<<<<<<<<<
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 */
    __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":241
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
 *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 */
    __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":242
 *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):             # <<<<<<<<<<<<<<
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 */
    __pyx_t_4 = __pyx_v_ndim;
    __pyx_t_5 = __pyx_t_4;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_i = __pyx_t_6;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":243
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 */
      (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":244
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 */
      (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
    }

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":237
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 */
    goto __pyx_L9;
  }

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":246
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL
 */
  /*else*/ {
    __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":247
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 */
    __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
  }
  __pyx_L9:;

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":248
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 */
  __pyx_v_info->suboffsets = NULL;

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":249
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 * 
 */
  __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":250
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
 * 
 *             cdef int t
 */
  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":253
 * 
 *             cdef int t
 *             cdef char* f = NULL             # <<<<<<<<<<<<<<
 *             cdef dtype descr = self.descr
 *             cdef int offset
 */
  __pyx_v_f = NULL;

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":254
 *             cdef int t
 *             cdef char* f = NULL
 *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
 *             cdef int offset
 * 
 */
  __pyx_t_3 = ((PyObject *)__pyx_v_self->descr);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":257
 *             cdef int offset
 * 
 *             info.obj = self             # <<<<<<<<<<<<<<
 * 
 *             if not PyDataType_HASFIELDS(descr):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_GOTREF(__pyx_v_info->obj);
  __Pyx_DECREF(__pyx_v_info->obj);
  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":259
 *             info.obj = self
 * 
 *             if not PyDataType_HASFIELDS(descr):             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 */
  __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
  if (__pyx_t_1) {

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":260
 * 
 *             if not PyDataType_HASFIELDS(descr):
 *                 t = descr.type_num             # <<<<<<<<<<<<<<
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 */
    __pyx_t_4 = __pyx_v_descr->type_num;
    __pyx_v_t = __pyx_t_4;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":261
 *             if not PyDataType_HASFIELDS(descr):
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
    if (!__pyx_t_2) {
      goto __pyx_L15_next_or;
    } else {
    }
    __pyx_t_2 = (__pyx_v_little_endian != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_L15_next_or:;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":262
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 */
    __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L14_bool_binop_done:;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":261
 *             if not PyDataType_HASFIELDS(descr):
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    if (unlikely(__pyx_t_1)) {

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":263
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 263, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 263, __pyx_L1_error)

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":261
 *             if not PyDataType_HASFIELDS(descr):
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    }

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":264
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 */
    switch (__pyx_v_t) {
      case NPY_BYTE:
      __pyx_v_f = ((char *)"b");
      break;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":265
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 */
      case NPY_UBYTE:
      __pyx_v_f = ((char *)"B");
      break;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":266
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 */
      case NPY_SHORT:
      __pyx_v_f = ((char *)"h");
      break;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":267
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 */
      case NPY_USHORT:
      __pyx_v_f = ((char *)"H");
      break;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":268
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 */
      case NPY_INT:
      __pyx_v_f = ((char *)"i");
      break;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":269
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 */
      case NPY_UINT:
      __pyx_v_f = ((char *)"I");
      break;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":270
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 */
      case NPY_LONG:
      __pyx_v_f = ((char *)"l");
      break;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":271
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 */
      case NPY_ULONG:
      __pyx_v_f = ((char *)"L");
      break;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":272
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 */
      case NPY_LONGLONG:
      __pyx_v_f = ((char *)"q");
      break;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":273
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 */
      case NPY_ULONGLONG:
      __pyx_v_f = ((char *)"Q");
      break;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":274
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 */
      case NPY_FLOAT:
      __pyx_v_f = ((char *)"f");
      break;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":275
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 */
      case NPY_DOUBLE:
      __pyx_v_f = ((char *)"d");
      break;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":276
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 */
      case NPY_LONGDOUBLE:
      __pyx_v_f = ((char *)"g");
      break;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":277
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 */
      case NPY_CFLOAT:
      __pyx_v_f = ((char *)"Zf");
      break;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":278
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"
 */
      case NPY_CDOUBLE:
      __pyx_v_f = ((char *)"Zd");
      break;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":279
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 */
      case NPY_CLONGDOUBLE:
      __pyx_v_f = ((char *)"Zg");
      break;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":280
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
      case NPY_OBJECT:
      __pyx_v_f = ((char *)"O");
      break;
      default:

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":282
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *                 info.format = f
 *                 return
 */
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 282, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 282, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 282, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 282, __pyx_L1_error)
      break;
    }

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":283
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f             # <<<<<<<<<<<<<<
 *                 return
 *             else:
 */
    __pyx_v_info->format = __pyx_v_f;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":284
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f
 *                 return             # <<<<<<<<<<<<<<
 *             else:
 *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":259
 *             info.obj = self
 * 
 *             if not PyDataType_HASFIELDS(descr):             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 */
  }

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":286
 *                 return
 *             else:
 *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
 *                 info.format[0] = c'^' # Native data types, manual alignment
 *                 offset = 0
 */
  /*else*/ {
    __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":287
 *             else:
 *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
 *                 info.format[0] = c'^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
 *                 offset = 0
 *                 f = _util_dtypestring(descr, info.format + 1,
 */
    (__pyx_v_info->format[0]) = '^';

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":288
 *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
 *                 info.format[0] = c'^' # Native data types, manual alignment
 *                 offset = 0             # <<<<<<<<<<<<<<
 *                 f = _util_dtypestring(descr, info.format + 1,
 *                                       info.format + _buffer_format_string_len,
 */
    __pyx_v_offset = 0;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":289
 *                 info.format[0] = c'^' # Native data types, manual alignment
 *                 offset = 0
 *                 f = _util_dtypestring(descr, info.format + 1,             # <<<<<<<<<<<<<<
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)
 */
    __pyx_t_8 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_8 == ((char *)NULL))) __PYX_ERR(1, 289, __pyx_L1_error)
    __pyx_v_f = __pyx_t_8;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":292
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)
 *                 f[0] = c'\0' # Terminate format string             # <<<<<<<<<<<<<<
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 */
    (__pyx_v_f[0]) = '\x00';
  }

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":215
 *         # experimental exception made for __getbuffer__ and __releasebuffer__
 *         # -- the details of this may change.
 *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fulfill the PEP.
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  }
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":294
 *                 f[0] = c'\0' # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 PyObject_Free(info.format)
 */

/* Python wrapper */
static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__releasebuffer__", 0);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":295
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
 *                 PyObject_Free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
  if (__pyx_t_1) {

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":296
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):
 *                 PyObject_Free(info.format)             # <<<<<<<<<<<<<<
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 PyObject_Free(info.strides)
 */
    PyObject_Free(__pyx_v_info->format);

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":295
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
 *                 PyObject_Free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  }

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":297
 *             if PyArray_HASFIELDS(self):
 *                 PyObject_Free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 PyObject_Free(info.strides)
 *                 # info.shape was stored after info.strides in the same block
 */
  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  if (__pyx_t_1) {

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":298
 *                 PyObject_Free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 PyObject_Free(info.strides)             # <<<<<<<<<<<<<<
 *                 # info.shape was stored after info.strides in the same block
 * 
 */
    PyObject_Free(__pyx_v_info->strides);

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":297
 *             if PyArray_HASFIELDS(self):
 *                 PyObject_Free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 PyObject_Free(info.strides)
 *                 # info.shape was stored after info.strides in the same block
 */
  }

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":294
 *                 f[0] = c'\0' # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 PyObject_Free(info.format)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":775
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":776
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":775
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":778
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":779
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":778
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":781
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":782
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":781
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":784
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":785
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 785, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":784
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":787
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":788
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":787
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":790
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":791
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
 *         return <tuple>d.subarray.shape
 *     else:
 */
  __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
  if (__pyx_t_1) {

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":792
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
 *     else:
 *         return ()
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
    __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
    goto __pyx_L0;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":791
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
 *         return <tuple>d.subarray.shape
 *     else:
 */
  }

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":794
 *         return <tuple>d.subarray.shape
 *     else:
 *         return ()             # <<<<<<<<<<<<<<
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_empty_tuple);
    __pyx_r = __pyx_empty_tuple;
    goto __pyx_L0;
  }

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":790
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":796
 *         return ()
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
 *     # Recursive utility function used in __getbuffer__ to get format
 *     # string. The new location in the format string is returned.
 */

static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
  PyArray_Descr *__pyx_v_child = 0;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  PyObject *__pyx_v_fields = 0;
  PyObject *__pyx_v_childname = NULL;
  PyObject *__pyx_v_new_offset = NULL;
  PyObject *__pyx_v_t = NULL;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  long __pyx_t_8;
  char *__pyx_t_9;
  __Pyx_RefNannySetupContext("_util_dtypestring", 0);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":801
 * 
 *     cdef dtype child
 *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 *     cdef tuple fields
 */
  __pyx_v_endian_detector = 1;

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":802
 *     cdef dtype child
 *     cdef int endian_detector = 1
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 *     cdef tuple fields
 * 
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":805
 *     cdef tuple fields
 * 
 *     for childname in descr.names:             # <<<<<<<<<<<<<<
 *         fields = descr.fields[childname]
 *         child, new_offset = fields
 */
  if (unlikely(__pyx_v_descr->names == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(1, 805, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 805, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 805, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":806
 * 
 *     for childname in descr.names:
 *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
 *         child, new_offset = fields
 * 
 */
    if (unlikely(__pyx_v_descr->fields == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 806, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 806, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 806, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":807
 *     for childname in descr.names:
 *         fields = descr.fields[childname]
 *         child, new_offset = fields             # <<<<<<<<<<<<<<
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:
 */
    if (likely(__pyx_v_fields != Py_None)) {
      PyObject* sequence = __pyx_v_fields;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(1, 807, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 807, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 807, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 807, __pyx_L1_error)
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 807, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":809
 *         child, new_offset = fields
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 */
    __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 809, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
    if (unlikely(__pyx_t_6)) {

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":810
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 810, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 810, __pyx_L1_error)

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":809
 *         child, new_offset = fields
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 */
    }

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":812
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
    if (!__pyx_t_7) {
      goto __pyx_L8_next_or;
    } else {
    }
    __pyx_t_7 = (__pyx_v_little_endian != 0);
    if (!__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_L8_next_or:;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":813
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
 *             raise ValueError(u"Non-native byte order not supported")
 *             # One could encode it in the format string and have Cython
 */
    __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
    if (__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
    __pyx_t_6 = __pyx_t_7;
    __pyx_L7_bool_binop_done:;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":812
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    if (unlikely(__pyx_t_6)) {

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":814
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *             # One could encode it in the format string and have Cython
 *             # complain instead, BUT: < and > in format strings also imply
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 814, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 814, __pyx_L1_error)

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":812
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    }

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":824
 * 
 *         # Output padding bytes
 *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 */
    while (1) {
      __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 824, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 824, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 824, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!__pyx_t_6) break;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":825
 *         # Output padding bytes
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
 *             f += 1
 *             offset[0] += 1
 */
      (__pyx_v_f[0]) = 0x78;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":826
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte
 *             f += 1             # <<<<<<<<<<<<<<
 *             offset[0] += 1
 * 
 */
      __pyx_v_f = (__pyx_v_f + 1);

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":827
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 *             offset[0] += 1             # <<<<<<<<<<<<<<
 * 
 *         offset[0] += child.itemsize
 */
      __pyx_t_8 = 0;
      (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
    }

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":829
 *             offset[0] += 1
 * 
 *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not PyDataType_HASFIELDS(child):
 */
    __pyx_t_8 = 0;
    (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":831
 *         offset[0] += child.itemsize
 * 
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 *             t = child.type_num
 *             if end - f < 5:
 */
    __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
    if (__pyx_t_6) {

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":832
 * 
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num             # <<<<<<<<<<<<<<
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 832, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":833
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 *             if end - f < 5:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(u"Format string allocated too short.")
 * 
 */
      __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
      if (unlikely(__pyx_t_6)) {

        /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":834
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 834, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_Raise(__pyx_t_4, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __PYX_ERR(1, 834, __pyx_L1_error)

        /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":833
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 *             if end - f < 5:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(u"Format string allocated too short.")
 * 
 */
      }

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":837
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 837, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 837, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 837, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 98;
        goto __pyx_L15;
      }

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":838
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 838, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 838, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 838, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 66;
        goto __pyx_L15;
      }

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":839
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 839, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 839, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 839, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x68;
        goto __pyx_L15;
      }

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":840
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 840, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 840, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 840, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 72;
        goto __pyx_L15;
      }

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":841
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 841, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 841, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 841, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x69;
        goto __pyx_L15;
      }

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":842
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 842, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 842, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 842, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 73;
        goto __pyx_L15;
      }

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":843
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 843, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 843, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 843, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x6C;
        goto __pyx_L15;
      }

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":844
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 844, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 844, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 844, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 76;
        goto __pyx_L15;
      }

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":845
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 845, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 845, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 845, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x71;
        goto __pyx_L15;
      }

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":846
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 846, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 846, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 846, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 81;
        goto __pyx_L15;
      }

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":847
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 847, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 847, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 847, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x66;
        goto __pyx_L15;
      }

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":848
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 848, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 848, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 848, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x64;
        goto __pyx_L15;
      }

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":849
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 849, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 849, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 849, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x67;
        goto __pyx_L15;
      }

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":850
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 850, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 850, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 850, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 0x66;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L15;
      }

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":851
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 851, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 851, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 0x64;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L15;
      }

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":852
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 852, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 852, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 0x67;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L15;
      }

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":853
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 853, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (likely(__pyx_t_6)) {
        (__pyx_v_f[0]) = 79;
        goto __pyx_L15;
      }

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":855
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *             f += 1
 *         else:
 */
      /*else*/ {
        __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_t_4, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __PYX_ERR(1, 855, __pyx_L1_error)
      }
      __pyx_L15:;

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":856
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *             f += 1             # <<<<<<<<<<<<<<
 *         else:
 *             # Cython ignores struct boundary information ("T{...}"),
 */
      __pyx_v_f = (__pyx_v_f + 1);

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":831
 *         offset[0] += child.itemsize
 * 
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 *             t = child.type_num
 *             if end - f < 5:
 */
      goto __pyx_L13;
    }

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":860
 *             # Cython ignores struct boundary information ("T{...}"),
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
 *     return f
 * 
 */
    /*else*/ {
      __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 860, __pyx_L1_error)
      __pyx_v_f = __pyx_t_9;
    }
    __pyx_L13:;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":805
 *     cdef tuple fields
 * 
 *     for childname in descr.names:             # <<<<<<<<<<<<<<
 *         fields = descr.fields[childname]
 *         child, new_offset = fields
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":861
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)
 *     return f             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_f;
  goto __pyx_L0;

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":796
 *         return ()
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
 *     # Recursive utility function used in __getbuffer__ to get format
 *     # string. The new location in the format string is returned.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_fields);
  __Pyx_XDECREF(__pyx_v_childname);
  __Pyx_XDECREF(__pyx_v_new_offset);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":977
 * 
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *      cdef PyObject* baseptr
 *      if base is None:
 */

static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  PyObject *__pyx_v_baseptr;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("set_array_base", 0);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":979
 * cdef inline void set_array_base(ndarray arr, object base):
 *      cdef PyObject* baseptr
 *      if base is None:             # <<<<<<<<<<<<<<
 *          baseptr = NULL
 *      else:
 */
  __pyx_t_1 = (__pyx_v_base == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":980
 *      cdef PyObject* baseptr
 *      if base is None:
 *          baseptr = NULL             # <<<<<<<<<<<<<<
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 */
    __pyx_v_baseptr = NULL;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":979
 * cdef inline void set_array_base(ndarray arr, object base):
 *      cdef PyObject* baseptr
 *      if base is None:             # <<<<<<<<<<<<<<
 *          baseptr = NULL
 *      else:
 */
    goto __pyx_L3;
  }

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":982
 *          baseptr = NULL
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!             # <<<<<<<<<<<<<<
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)
 */
  /*else*/ {
    Py_INCREF(__pyx_v_base);

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":983
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 *          baseptr = <PyObject*>base             # <<<<<<<<<<<<<<
 *      Py_XDECREF(arr.base)
 *      arr.base = baseptr
 */
    __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
  }
  __pyx_L3:;

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":984
 *          Py_INCREF(base) # important to do this before decref below!
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)             # <<<<<<<<<<<<<<
 *      arr.base = baseptr
 * 
 */
  Py_XDECREF(__pyx_v_arr->base);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":985
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)
 *      arr.base = baseptr             # <<<<<<<<<<<<<<
 * 
 * cdef inline object get_array_base(ndarray arr):
 */
  __pyx_v_arr->base = __pyx_v_baseptr;

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":977
 * 
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *      cdef PyObject* baseptr
 *      if base is None:
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":987
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("get_array_base", 0);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":988
 * 
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
  if (__pyx_t_1) {

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":989
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     else:
 *         return <object>arr.base
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":988
 * 
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  }

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":991
 *         return None
 *     else:
 *         return <object>arr.base             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
    __pyx_r = ((PyObject *)__pyx_v_arr->base);
    goto __pyx_L0;
  }

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":987
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":996
 * # Versions of the import_* functions which are more suitable for
 * # Cython code.
 * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_array()
 */

static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("import_array", 0);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":997
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_array()
 *     except Exception:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":998
 * cdef inline int import_array() except -1:
 *     try:
 *         _import_array()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")
 */
      __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 998, __pyx_L3_error)

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":997
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_array()
 *     except Exception:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":999
 *     try:
 *         _import_array()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 999, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1000
 *         _import_array()
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_umath() except -1:
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1000, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(1, 1000, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":997
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_array()
 *     except Exception:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":996
 * # Versions of the import_* functions which are more suitable for
 * # Cython code.
 * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_array()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1002
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("import_umath", 0);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1003
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1004
 * cdef inline int import_umath() except -1:
 *     try:
 *         _import_umath()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")
 */
      __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1004, __pyx_L3_error)

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1003
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1005
 *     try:
 *         _import_umath()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1005, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1006
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_ufunc() except -1:
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__48, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1006, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(1, 1006, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1003
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1002
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1008
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("import_ufunc", 0);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1009
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1010
 * cdef inline int import_ufunc() except -1:
 *     try:
 *         _import_umath()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")
 */
      __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1010, __pyx_L3_error)

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1009
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1011
 *     try:
 *         _import_umath()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.umath failed to import")
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1011, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1012
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1012, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(1, 1012, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1009
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1008
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyMethodDef __pyx_methods[] = {
  {"distribution", (PyCFunction)__pyx_pw_9miniga4py_2ga_87distribution, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9miniga4py_2ga_86distribution},
  {"inquire", (PyCFunction)__pyx_pw_9miniga4py_2ga_143inquire, METH_O, __pyx_doc_9miniga4py_2ga_142inquire},
  {"inquire_dims", (PyCFunction)__pyx_pw_9miniga4py_2ga_145inquire_dims, METH_O, __pyx_doc_9miniga4py_2ga_144inquire_dims},
  {"inquire_type", (PyCFunction)__pyx_pw_9miniga4py_2ga_151inquire_type, METH_O, __pyx_doc_9miniga4py_2ga_150inquire_type},
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_ga(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_ga},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "ga",
    __pyx_k_The_Global_Arrays_GA_Python_inte, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_n_s_C_CHAR, __pyx_k_C_CHAR, sizeof(__pyx_k_C_CHAR), 0, 0, 1, 1},
  {&__pyx_n_s_C_CONTIGUOUS, __pyx_k_C_CONTIGUOUS, sizeof(__pyx_k_C_CONTIGUOUS), 0, 0, 1, 1},
  {&__pyx_n_s_C_DBL, __pyx_k_C_DBL, sizeof(__pyx_k_C_DBL), 0, 0, 1, 1},
  {&__pyx_n_s_C_DCPL, __pyx_k_C_DCPL, sizeof(__pyx_k_C_DCPL), 0, 0, 1, 1},
  {&__pyx_n_s_C_FLOAT, __pyx_k_C_FLOAT, sizeof(__pyx_k_C_FLOAT), 0, 0, 1, 1},
  {&__pyx_n_s_C_INT, __pyx_k_C_INT, sizeof(__pyx_k_C_INT), 0, 0, 1, 1},
  {&__pyx_kp_s_C_INT_not_supported, __pyx_k_C_INT_not_supported, sizeof(__pyx_k_C_INT_not_supported), 0, 0, 1, 0},
  {&__pyx_n_s_C_LDBL, __pyx_k_C_LDBL, sizeof(__pyx_k_C_LDBL), 0, 0, 1, 1},
  {&__pyx_kp_s_C_LDBL_not_supported, __pyx_k_C_LDBL_not_supported, sizeof(__pyx_k_C_LDBL_not_supported), 0, 0, 1, 0},
  {&__pyx_n_s_C_LDCPL, __pyx_k_C_LDCPL, sizeof(__pyx_k_C_LDCPL), 0, 0, 1, 1},
  {&__pyx_kp_s_C_LDCPL_not_supported_yet, __pyx_k_C_LDCPL_not_supported_yet, sizeof(__pyx_k_C_LDCPL_not_supported_yet), 0, 0, 1, 0},
  {&__pyx_n_s_C_LONG, __pyx_k_C_LONG, sizeof(__pyx_k_C_LONG), 0, 0, 1, 1},
  {&__pyx_n_s_C_LONGLONG, __pyx_k_C_LONGLONG, sizeof(__pyx_k_C_LONGLONG), 0, 0, 1, 1},
  {&__pyx_kp_s_C_LONGLONG_not_supported, __pyx_k_C_LONGLONG_not_supported, sizeof(__pyx_k_C_LONGLONG_not_supported), 0, 0, 1, 0},
  {&__pyx_kp_s_C_LONG_not_supported, __pyx_k_C_LONG_not_supported, sizeof(__pyx_k_C_LONG_not_supported), 0, 0, 1, 0},
  {&__pyx_n_s_C_SCPL, __pyx_k_C_SCPL, sizeof(__pyx_k_C_SCPL), 0, 0, 1, 1},
  {&__pyx_n_s_F_BYTE, __pyx_k_F_BYTE, sizeof(__pyx_k_F_BYTE), 0, 0, 1, 1},
  {&__pyx_n_s_F_DBL, __pyx_k_F_DBL, sizeof(__pyx_k_F_DBL), 0, 0, 1, 1},
  {&__pyx_n_s_F_DCPL, __pyx_k_F_DCPL, sizeof(__pyx_k_F_DCPL), 0, 0, 1, 1},
  {&__pyx_n_s_F_INT, __pyx_k_F_INT, sizeof(__pyx_k_F_INT), 0, 0, 1, 1},
  {&__pyx_n_s_F_LOG, __pyx_k_F_LOG, sizeof(__pyx_k_F_LOG), 0, 0, 1, 1},
  {&__pyx_n_s_F_REAL, __pyx_k_F_REAL, sizeof(__pyx_k_F_REAL), 0, 0, 1, 1},
  {&__pyx_n_s_F_SCPL, __pyx_k_F_SCPL, sizeof(__pyx_k_F_SCPL), 0, 0, 1, 1},
  {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
  {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
  {&__pyx_kp_u_Global_operation_X_1_N_is_a_vect, __pyx_k_Global_operation_X_1_N_is_a_vect, sizeof(__pyx_k_Global_operation_X_1_N_is_a_vect), 0, 1, 0, 0},
  {&__pyx_kp_u_Global_operation_X_1_N_is_a_vect_2, __pyx_k_Global_operation_X_1_N_is_a_vect_2, sizeof(__pyx_k_Global_operation_X_1_N_is_a_vect_2), 0, 1, 0, 0},
  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
  {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s_TYPE_BASE, __pyx_k_TYPE_BASE, sizeof(__pyx_k_TYPE_BASE), 0, 0, 1, 1},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_n_s_WORLD_PROC_GROUP, __pyx_k_WORLD_PROC_GROUP, sizeof(__pyx_k_WORLD_PROC_GROUP), 0, 0, 1, 1},
  {&__pyx_n_s_X, __pyx_k_X, sizeof(__pyx_k_X), 0, 0, 1, 1},
  {&__pyx_kp_s_X_must_be_contiguous, __pyx_k_X_must_be_contiguous, sizeof(__pyx_k_X_must_be_contiguous), 0, 0, 1, 0},
  {&__pyx_n_s_X_nd, __pyx_k_X_nd, sizeof(__pyx_k_X_nd), 0, 0, 1, 1},
  {&__pyx_kp_s__22, __pyx_k__22, sizeof(__pyx_k__22), 0, 0, 1, 0},
  {&__pyx_kp_s__23, __pyx_k__23, sizeof(__pyx_k__23), 0, 0, 1, 0},
  {&__pyx_kp_s__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 1, 0},
  {&__pyx_n_s_abs_value, __pyx_k_abs_value, sizeof(__pyx_k_abs_value), 0, 0, 1, 1},
  {&__pyx_n_s_absmax, __pyx_k_absmax, sizeof(__pyx_k_absmax), 0, 0, 1, 1},
  {&__pyx_n_s_absmin, __pyx_k_absmin, sizeof(__pyx_k_absmin), 0, 0, 1, 1},
  {&__pyx_n_s_acc, __pyx_k_acc, sizeof(__pyx_k_acc), 0, 0, 1, 1},
  {&__pyx_n_s_access, __pyx_k_access, sizeof(__pyx_k_access), 0, 0, 1, 1},
  {&__pyx_n_s_access_block, __pyx_k_access_block, sizeof(__pyx_k_access_block), 0, 0, 1, 1},
  {&__pyx_n_s_access_block_grid, __pyx_k_access_block_grid, sizeof(__pyx_k_access_block_grid), 0, 0, 1, 1},
  {&__pyx_n_s_access_block_segment, __pyx_k_access_block_segment, sizeof(__pyx_k_access_block_segment), 0, 0, 1, 1},
  {&__pyx_n_s_access_ghost_element, __pyx_k_access_ghost_element, sizeof(__pyx_k_access_ghost_element), 0, 0, 1, 1},
  {&__pyx_n_s_access_ghosts, __pyx_k_access_ghosts, sizeof(__pyx_k_access_ghosts), 0, 0, 1, 1},
  {&__pyx_n_s_add, __pyx_k_add, sizeof(__pyx_k_add), 0, 0, 1, 1},
  {&__pyx_n_s_add_constant, __pyx_k_add_constant, sizeof(__pyx_k_add_constant), 0, 0, 1, 1},
  {&__pyx_n_s_add_diagonal, __pyx_k_add_diagonal, sizeof(__pyx_k_add_diagonal), 0, 0, 1, 1},
  {&__pyx_n_s_ahi, __pyx_k_ahi, sizeof(__pyx_k_ahi), 0, 0, 1, 1},
  {&__pyx_n_s_ahi_nd, __pyx_k_ahi_nd, sizeof(__pyx_k_ahi_nd), 0, 0, 1, 1},
  {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
  {&__pyx_n_s_allocate, __pyx_k_allocate, sizeof(__pyx_k_allocate), 0, 0, 1, 1},
  {&__pyx_n_s_alo, __pyx_k_alo, sizeof(__pyx_k_alo), 0, 0, 1, 1},
  {&__pyx_n_s_alo_nd, __pyx_k_alo_nd, sizeof(__pyx_k_alo_nd), 0, 0, 1, 1},
  {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1},
  {&__pyx_n_s_any, __pyx_k_any, sizeof(__pyx_k_any), 0, 0, 1, 1},
  {&__pyx_n_s_apretty, __pyx_k_apretty, sizeof(__pyx_k_apretty), 0, 0, 1, 1},
  {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
  {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1},
  {&__pyx_n_s_ascontiguousarray, __pyx_k_ascontiguousarray, sizeof(__pyx_k_ascontiguousarray), 0, 0, 1, 1},
  {&__pyx_n_s_atexit, __pyx_k_atexit, sizeof(__pyx_k_atexit), 0, 0, 1, 1},
  {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
  {&__pyx_n_s_beta, __pyx_k_beta, sizeof(__pyx_k_beta), 0, 0, 1, 1},
  {&__pyx_n_s_bhi, __pyx_k_bhi, sizeof(__pyx_k_bhi), 0, 0, 1, 1},
  {&__pyx_n_s_bhi_nd, __pyx_k_bhi_nd, sizeof(__pyx_k_bhi_nd), 0, 0, 1, 1},
  {&__pyx_n_s_blo, __pyx_k_blo, sizeof(__pyx_k_blo), 0, 0, 1, 1},
  {&__pyx_n_s_blo_nd, __pyx_k_blo_nd, sizeof(__pyx_k_blo_nd), 0, 0, 1, 1},
  {&__pyx_n_s_block, __pyx_k_block, sizeof(__pyx_k_block), 0, 0, 1, 1},
  {&__pyx_n_s_block_dims, __pyx_k_block_dims, sizeof(__pyx_k_block_dims), 0, 0, 1, 1},
  {&__pyx_n_s_block_nd, __pyx_k_block_nd, sizeof(__pyx_k_block_nd), 0, 0, 1, 1},
  {&__pyx_n_s_brdcst, __pyx_k_brdcst, sizeof(__pyx_k_brdcst), 0, 0, 1, 1},
  {&__pyx_n_s_buffer, __pyx_k_buffer, sizeof(__pyx_k_buffer), 0, 0, 1, 1},
  {&__pyx_kp_s_buffer_cannot_have_negative_stri, __pyx_k_buffer_cannot_have_negative_stri, sizeof(__pyx_k_buffer_cannot_have_negative_stri), 0, 0, 1, 0},
  {&__pyx_kp_s_buffer_is_wrong_type_buffer_s_s, __pyx_k_buffer_is_wrong_type_buffer_s_s, sizeof(__pyx_k_buffer_is_wrong_type_buffer_s_s), 0, 0, 1, 0},
  {&__pyx_n_s_buffer_nd, __pyx_k_buffer_nd, sizeof(__pyx_k_buffer_nd), 0, 0, 1, 1},
  {&__pyx_kp_s_buffer_shape_does_not_match_requ, __pyx_k_buffer_shape_does_not_match_requ, sizeof(__pyx_k_buffer_shape_does_not_match_requ), 0, 0, 1, 0},
  {&__pyx_kp_s_buffer_size_does_not_match_shape, __pyx_k_buffer_size_does_not_match_shape, sizeof(__pyx_k_buffer_size_does_not_match_shape), 0, 0, 1, 0},
  {&__pyx_n_s_builtin, __pyx_k_builtin, sizeof(__pyx_k_builtin), 0, 0, 1, 1},
  {&__pyx_n_s_builtins, __pyx_k_builtins, sizeof(__pyx_k_builtins), 0, 0, 1, 1},
  {&__pyx_n_s_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 0, 1, 1},
  {&__pyx_n_s_c_excl, __pyx_k_c_excl, sizeof(__pyx_k_c_excl), 0, 0, 1, 1},
  {&__pyx_n_s_c_hi, __pyx_k_c_hi, sizeof(__pyx_k_c_hi), 0, 0, 1, 1},
  {&__pyx_n_s_c_lo, __pyx_k_c_lo, sizeof(__pyx_k_c_lo), 0, 0, 1, 1},
  {&__pyx_kp_s_cannot_convert_None, __pyx_k_cannot_convert_None, sizeof(__pyx_k_cannot_convert_None), 0, 0, 1, 0},
  {&__pyx_n_s_char_transa, __pyx_k_char_transa, sizeof(__pyx_k_char_transa), 0, 0, 1, 1},
  {&__pyx_n_s_char_transb, __pyx_k_char_transb, sizeof(__pyx_k_char_transb), 0, 0, 1, 1},
  {&__pyx_n_s_check_handle, __pyx_k_check_handle, sizeof(__pyx_k_check_handle), 0, 0, 1, 1},
  {&__pyx_n_s_chi, __pyx_k_chi, sizeof(__pyx_k_chi), 0, 0, 1, 1},
  {&__pyx_n_s_chi_nd, __pyx_k_chi_nd, sizeof(__pyx_k_chi_nd), 0, 0, 1, 1},
  {&__pyx_n_s_chunk, __pyx_k_chunk, sizeof(__pyx_k_chunk), 0, 0, 1, 1},
  {&__pyx_n_s_chunk_nd, __pyx_k_chunk_nd, sizeof(__pyx_k_chunk_nd), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_clo, __pyx_k_clo, sizeof(__pyx_k_clo), 0, 0, 1, 1},
  {&__pyx_n_s_clo_nd, __pyx_k_clo_nd, sizeof(__pyx_k_clo_nd), 0, 0, 1, 1},
  {&__pyx_n_s_cluster_nnodes, __pyx_k_cluster_nnodes, sizeof(__pyx_k_cluster_nnodes), 0, 0, 1, 1},
  {&__pyx_n_s_cluster_nodeid, __pyx_k_cluster_nodeid, sizeof(__pyx_k_cluster_nodeid), 0, 0, 1, 1},
  {&__pyx_n_s_cluster_nprocs, __pyx_k_cluster_nprocs, sizeof(__pyx_k_cluster_nprocs), 0, 0, 1, 1},
  {&__pyx_n_s_cluster_proc_nodeid, __pyx_k_cluster_proc_nodeid, sizeof(__pyx_k_cluster_proc_nodeid), 0, 0, 1, 1},
  {&__pyx_n_s_cluster_procid, __pyx_k_cluster_procid, sizeof(__pyx_k_cluster_procid), 0, 0, 1, 1},
  {&__pyx_n_s_code, __pyx_k_code, sizeof(__pyx_k_code), 0, 0, 1, 1},
  {&__pyx_n_s_codecs, __pyx_k_codecs, sizeof(__pyx_k_codecs), 0, 0, 1, 1},
  {&__pyx_n_s_color, __pyx_k_color, sizeof(__pyx_k_color), 0, 0, 1, 1},
  {&__pyx_n_s_compare_distr, __pyx_k_compare_distr, sizeof(__pyx_k_compare_distr), 0, 0, 1, 1},
  {&__pyx_n_s_complex128, __pyx_k_complex128, sizeof(__pyx_k_complex128), 0, 0, 1, 1},
  {&__pyx_n_s_complex256, __pyx_k_complex256, sizeof(__pyx_k_complex256), 0, 0, 1, 1},
  {&__pyx_n_s_complex64, __pyx_k_complex64, sizeof(__pyx_k_complex64), 0, 0, 1, 1},
  {&__pyx_n_s_control, __pyx_k_control, sizeof(__pyx_k_control), 0, 0, 1, 1},
  {&__pyx_n_s_coord, __pyx_k_coord, sizeof(__pyx_k_coord), 0, 0, 1, 1},
  {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
  {&__pyx_n_s_create, __pyx_k_create, sizeof(__pyx_k_create), 0, 0, 1, 1},
  {&__pyx_n_s_create_ghosts, __pyx_k_create_ghosts, sizeof(__pyx_k_create_ghosts), 0, 0, 1, 1},
  {&__pyx_n_s_create_ghosts_irreg, __pyx_k_create_ghosts_irreg, sizeof(__pyx_k_create_ghosts_irreg), 0, 0, 1, 1},
  {&__pyx_n_s_create_handle, __pyx_k_create_handle, sizeof(__pyx_k_create_handle), 0, 0, 1, 1},
  {&__pyx_n_s_create_irreg, __pyx_k_create_irreg, sizeof(__pyx_k_create_irreg), 0, 0, 1, 1},
  {&__pyx_n_s_create_mutexes, __pyx_k_create_mutexes, sizeof(__pyx_k_create_mutexes), 0, 0, 1, 1},
  {&__pyx_n_s_ctrans, __pyx_k_ctrans, sizeof(__pyx_k_ctrans), 0, 0, 1, 1},
  {&__pyx_kp_s_d_was_not_a_recognized_GA_type, __pyx_k_d_was_not_a_recognized_GA_type, sizeof(__pyx_k_d_was_not_a_recognized_GA_type), 0, 0, 1, 0},
  {&__pyx_n_s_dalpha, __pyx_k_dalpha, sizeof(__pyx_k_dalpha), 0, 0, 1, 1},
  {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
  {&__pyx_n_s_dbeta, __pyx_k_dbeta, sizeof(__pyx_k_dbeta), 0, 0, 1, 1},
  {&__pyx_n_s_dcalpha, __pyx_k_dcalpha, sizeof(__pyx_k_dcalpha), 0, 0, 1, 1},
  {&__pyx_n_s_dcbeta, __pyx_k_dcbeta, sizeof(__pyx_k_dcbeta), 0, 0, 1, 1},
  {&__pyx_n_s_dcinc, __pyx_k_dcinc, sizeof(__pyx_k_dcinc), 0, 0, 1, 1},
  {&__pyx_n_s_dcstart, __pyx_k_dcstart, sizeof(__pyx_k_dcstart), 0, 0, 1, 1},
  {&__pyx_n_s_dcval, __pyx_k_dcval, sizeof(__pyx_k_dcval), 0, 0, 1, 1},
  {&__pyx_n_s_dcvalue, __pyx_k_dcvalue, sizeof(__pyx_k_dcvalue), 0, 0, 1, 1},
  {&__pyx_n_s_debug, __pyx_k_debug, sizeof(__pyx_k_debug), 0, 0, 1, 1},
  {&__pyx_n_s_deregister_type, __pyx_k_deregister_type, sizeof(__pyx_k_deregister_type), 0, 0, 1, 1},
  {&__pyx_n_s_destroy, __pyx_k_destroy, sizeof(__pyx_k_destroy), 0, 0, 1, 1},
  {&__pyx_n_s_destroy_mutexes, __pyx_k_destroy_mutexes, sizeof(__pyx_k_destroy_mutexes), 0, 0, 1, 1},
  {&__pyx_n_s_diag, __pyx_k_diag, sizeof(__pyx_k_diag), 0, 0, 1, 1},
  {&__pyx_n_s_diag_reuse, __pyx_k_diag_reuse, sizeof(__pyx_k_diag_reuse), 0, 0, 1, 1},
  {&__pyx_n_s_diag_std, __pyx_k_diag_std, sizeof(__pyx_k_diag_std), 0, 0, 1, 1},
  {&__pyx_n_s_dimension, __pyx_k_dimension, sizeof(__pyx_k_dimension), 0, 0, 1, 1},
  {&__pyx_n_s_dimlen, __pyx_k_dimlen, sizeof(__pyx_k_dimlen), 0, 0, 1, 1},
  {&__pyx_n_s_dims, __pyx_k_dims, sizeof(__pyx_k_dims), 0, 0, 1, 1},
  {&__pyx_n_s_dims_nd, __pyx_k_dims_nd, sizeof(__pyx_k_dims_nd), 0, 0, 1, 1},
  {&__pyx_n_s_dinc, __pyx_k_dinc, sizeof(__pyx_k_dinc), 0, 0, 1, 1},
  {&__pyx_n_s_dir, __pyx_k_dir, sizeof(__pyx_k_dir), 0, 0, 1, 1},
  {&__pyx_n_s_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 0, 1, 1},
  {&__pyx_n_s_double, __pyx_k_double, sizeof(__pyx_k_double), 0, 0, 1, 1},
  {&__pyx_n_s_dstart, __pyx_k_dstart, sizeof(__pyx_k_dstart), 0, 0, 1, 1},
  {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
  {&__pyx_n_s_duplicate, __pyx_k_duplicate, sizeof(__pyx_k_duplicate), 0, 0, 1, 1},
  {&__pyx_n_s_dval, __pyx_k_dval, sizeof(__pyx_k_dval), 0, 0, 1, 1},
  {&__pyx_n_s_dvalue, __pyx_k_dvalue, sizeof(__pyx_k_dvalue), 0, 0, 1, 1},
  {&__pyx_n_s_elem_divide, __pyx_k_elem_divide, sizeof(__pyx_k_elem_divide), 0, 0, 1, 1},
  {&__pyx_n_s_elem_maximum, __pyx_k_elem_maximum, sizeof(__pyx_k_elem_maximum), 0, 0, 1, 1},
  {&__pyx_n_s_elem_minimum, __pyx_k_elem_minimum, sizeof(__pyx_k_elem_minimum), 0, 0, 1, 1},
  {&__pyx_n_s_elem_multiply, __pyx_k_elem_multiply, sizeof(__pyx_k_elem_multiply), 0, 0, 1, 1},
  {&__pyx_n_s_elems, __pyx_k_elems, sizeof(__pyx_k_elems), 0, 0, 1, 1},
  {&__pyx_n_s_enum, __pyx_k_enum, sizeof(__pyx_k_enum), 0, 0, 1, 1},
  {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
  {&__pyx_n_s_evalues, __pyx_k_evalues, sizeof(__pyx_k_evalues), 0, 0, 1, 1},
  {&__pyx_n_s_excl, __pyx_k_excl, sizeof(__pyx_k_excl), 0, 0, 1, 1},
  {&__pyx_n_s_falpha, __pyx_k_falpha, sizeof(__pyx_k_falpha), 0, 0, 1, 1},
  {&__pyx_n_s_fbeta, __pyx_k_fbeta, sizeof(__pyx_k_fbeta), 0, 0, 1, 1},
  {&__pyx_n_s_fcalpha, __pyx_k_fcalpha, sizeof(__pyx_k_fcalpha), 0, 0, 1, 1},
  {&__pyx_n_s_fcbeta, __pyx_k_fcbeta, sizeof(__pyx_k_fcbeta), 0, 0, 1, 1},
  {&__pyx_n_s_fcinc, __pyx_k_fcinc, sizeof(__pyx_k_fcinc), 0, 0, 1, 1},
  {&__pyx_n_s_fcstart, __pyx_k_fcstart, sizeof(__pyx_k_fcstart), 0, 0, 1, 1},
  {&__pyx_n_s_fcval, __pyx_k_fcval, sizeof(__pyx_k_fcval), 0, 0, 1, 1},
  {&__pyx_n_s_fcvalue, __pyx_k_fcvalue, sizeof(__pyx_k_fcvalue), 0, 0, 1, 1},
  {&__pyx_n_s_fence, __pyx_k_fence, sizeof(__pyx_k_fence), 0, 0, 1, 1},
  {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
  {&__pyx_n_s_fill, __pyx_k_fill, sizeof(__pyx_k_fill), 0, 0, 1, 1},
  {&__pyx_n_s_finc, __pyx_k_finc, sizeof(__pyx_k_finc), 0, 0, 1, 1},
  {&__pyx_n_s_first, __pyx_k_first, sizeof(__pyx_k_first), 0, 0, 1, 1},
  {&__pyx_kp_s_first_dimension_of_buffer_cannot, __pyx_k_first_dimension_of_buffer_cannot, sizeof(__pyx_k_first_dimension_of_buffer_cannot), 0, 0, 1, 0},
  {&__pyx_n_s_flag, __pyx_k_flag, sizeof(__pyx_k_flag), 0, 0, 1, 1},
  {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
  {&__pyx_n_s_float128, __pyx_k_float128, sizeof(__pyx_k_float128), 0, 0, 1, 1},
  {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1},
  {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1},
  {&__pyx_n_s_fstart, __pyx_k_fstart, sizeof(__pyx_k_fstart), 0, 0, 1, 1},
  {&__pyx_n_s_fval, __pyx_k_fval, sizeof(__pyx_k_fval), 0, 0, 1, 1},
  {&__pyx_n_s_fvalue, __pyx_k_fvalue, sizeof(__pyx_k_fvalue), 0, 0, 1, 1},
  {&__pyx_n_s_g_a, __pyx_k_g_a, sizeof(__pyx_k_g_a), 0, 0, 1, 1},
  {&__pyx_n_s_g_b, __pyx_k_g_b, sizeof(__pyx_k_g_b), 0, 0, 1, 1},
  {&__pyx_n_s_g_c, __pyx_k_g_c, sizeof(__pyx_k_g_c), 0, 0, 1, 1},
  {&__pyx_n_s_g_dst, __pyx_k_g_dst, sizeof(__pyx_k_g_dst), 0, 0, 1, 1},
  {&__pyx_n_s_g_m, __pyx_k_g_m, sizeof(__pyx_k_g_m), 0, 0, 1, 1},
  {&__pyx_n_s_g_msk, __pyx_k_g_msk, sizeof(__pyx_k_g_msk), 0, 0, 1, 1},
  {&__pyx_n_s_g_s, __pyx_k_g_s, sizeof(__pyx_k_g_s), 0, 0, 1, 1},
  {&__pyx_n_s_g_src, __pyx_k_g_src, sizeof(__pyx_k_g_src), 0, 0, 1, 1},
  {&__pyx_n_s_g_v, __pyx_k_g_v, sizeof(__pyx_k_g_v), 0, 0, 1, 1},
  {&__pyx_n_s_ga_dcalpha, __pyx_k_ga_dcalpha, sizeof(__pyx_k_ga_dcalpha), 0, 0, 1, 1},
  {&__pyx_n_s_ga_dcbeta, __pyx_k_ga_dcbeta, sizeof(__pyx_k_ga_dcbeta), 0, 0, 1, 1},
  {&__pyx_n_s_ga_fcalpha, __pyx_k_ga_fcalpha, sizeof(__pyx_k_ga_fcalpha), 0, 0, 1, 1},
  {&__pyx_n_s_ga_fcbeta, __pyx_k_ga_fcbeta, sizeof(__pyx_k_ga_fcbeta), 0, 0, 1, 1},
  {&__pyx_n_s_gather, __pyx_k_gather, sizeof(__pyx_k_gather), 0, 0, 1, 1},
  {&__pyx_n_s_gatype, __pyx_k_gatype, sizeof(__pyx_k_gatype), 0, 0, 1, 1},
  {&__pyx_n_s_gdcv, __pyx_k_gdcv, sizeof(__pyx_k_gdcv), 0, 0, 1, 1},
  {&__pyx_n_s_gemm, __pyx_k_gemm, sizeof(__pyx_k_gemm), 0, 0, 1, 1},
  {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
  {&__pyx_n_s_get_block_info, __pyx_k_get_block_info, sizeof(__pyx_k_get_block_info), 0, 0, 1, 1},
  {&__pyx_n_s_get_debug, __pyx_k_get_debug, sizeof(__pyx_k_get_debug), 0, 0, 1, 1},
  {&__pyx_n_s_get_diag, __pyx_k_get_diag, sizeof(__pyx_k_get_diag), 0, 0, 1, 1},
  {&__pyx_n_s_gfcv, __pyx_k_gfcv, sizeof(__pyx_k_gfcv), 0, 0, 1, 1},
  {&__pyx_n_s_gop, __pyx_k_gop, sizeof(__pyx_k_gop), 0, 0, 1, 1},
  {&__pyx_n_s_gop_absmax, __pyx_k_gop_absmax, sizeof(__pyx_k_gop_absmax), 0, 0, 1, 1},
  {&__pyx_n_s_gop_absmin, __pyx_k_gop_absmin, sizeof(__pyx_k_gop_absmin), 0, 0, 1, 1},
  {&__pyx_n_s_gop_add, __pyx_k_gop_add, sizeof(__pyx_k_gop_add), 0, 0, 1, 1},
  {&__pyx_kp_u_gop_line_2073, __pyx_k_gop_line_2073, sizeof(__pyx_k_gop_line_2073), 0, 1, 0, 0},
  {&__pyx_n_s_gop_max, __pyx_k_gop_max, sizeof(__pyx_k_gop_max), 0, 0, 1, 1},
  {&__pyx_n_s_gop_min, __pyx_k_gop_min, sizeof(__pyx_k_gop_min), 0, 0, 1, 1},
  {&__pyx_n_s_gop_multiply, __pyx_k_gop_multiply, sizeof(__pyx_k_gop_multiply), 0, 0, 1, 1},
  {&__pyx_n_s_gtype, __pyx_k_gtype, sizeof(__pyx_k_gtype), 0, 0, 1, 1},
  {&__pyx_n_s_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 1, 1},
  {&__pyx_n_s_has_ghosts, __pyx_k_has_ghosts, sizeof(__pyx_k_has_ghosts), 0, 0, 1, 1},
  {&__pyx_n_s_hi, __pyx_k_hi, sizeof(__pyx_k_hi), 0, 0, 1, 1},
  {&__pyx_n_s_hi_dst, __pyx_k_hi_dst, sizeof(__pyx_k_hi_dst), 0, 0, 1, 1},
  {&__pyx_n_s_hi_nd, __pyx_k_hi_nd, sizeof(__pyx_k_hi_nd), 0, 0, 1, 1},
  {&__pyx_kp_s_hi_out_of_bounds_hi_dst_s_hi_s, __pyx_k_hi_out_of_bounds_hi_dst_s_hi_s, sizeof(__pyx_k_hi_out_of_bounds_hi_dst_s_hi_s), 0, 0, 1, 0},
  {&__pyx_n_s_hi_proc, __pyx_k_hi_proc, sizeof(__pyx_k_hi_proc), 0, 0, 1, 1},
  {&__pyx_kp_s_how_did_this_happen, __pyx_k_how_did_this_happen, sizeof(__pyx_k_how_did_this_happen), 0, 0, 1, 0},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_n_s_ialpha, __pyx_k_ialpha, sizeof(__pyx_k_ialpha), 0, 0, 1, 1},
  {&__pyx_n_s_ibeta, __pyx_k_ibeta, sizeof(__pyx_k_ibeta), 0, 0, 1, 1},
  {&__pyx_n_s_icount, __pyx_k_icount, sizeof(__pyx_k_icount), 0, 0, 1, 1},
  {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1},
  {&__pyx_n_s_iinc, __pyx_k_iinc, sizeof(__pyx_k_iinc), 0, 0, 1, 1},
  {&__pyx_n_s_imag, __pyx_k_imag, sizeof(__pyx_k_imag), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_inc, __pyx_k_inc, sizeof(__pyx_k_inc), 0, 0, 1, 1},
  {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
  {&__pyx_n_s_init_fence, __pyx_k_init_fence, sizeof(__pyx_k_init_fence), 0, 0, 1, 1},
  {&__pyx_n_s_initialize, __pyx_k_initialize, sizeof(__pyx_k_initialize), 0, 0, 1, 1},
  {&__pyx_n_s_initialize_ltd, __pyx_k_initialize_ltd, sizeof(__pyx_k_initialize_ltd), 0, 0, 1, 1},
  {&__pyx_n_s_initialized, __pyx_k_initialized, sizeof(__pyx_k_initialized), 0, 0, 1, 1},
  {&__pyx_n_s_inquire_dtype, __pyx_k_inquire_dtype, sizeof(__pyx_k_inquire_dtype), 0, 0, 1, 1},
  {&__pyx_n_s_inquire_memory, __pyx_k_inquire_memory, sizeof(__pyx_k_inquire_memory), 0, 0, 1, 1},
  {&__pyx_n_s_inquire_name, __pyx_k_inquire_name, sizeof(__pyx_k_inquire_name), 0, 0, 1, 1},
  {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1},
  {&__pyx_n_s_int64, __pyx_k_int64, sizeof(__pyx_k_int64), 0, 0, 1, 1},
  {&__pyx_n_s_int8, __pyx_k_int8, sizeof(__pyx_k_int8), 0, 0, 1, 1},
  {&__pyx_n_s_intc, __pyx_k_intc, sizeof(__pyx_k_intc), 0, 0, 1, 1},
  {&__pyx_n_s_is_mirrored, __pyx_k_is_mirrored, sizeof(__pyx_k_is_mirrored), 0, 0, 1, 1},
  {&__pyx_n_s_isbytes, __pyx_k_isbytes, sizeof(__pyx_k_isbytes), 0, 0, 1, 1},
  {&__pyx_n_s_isstr, __pyx_k_isstr, sizeof(__pyx_k_isstr), 0, 0, 1, 1},
  {&__pyx_n_s_istart, __pyx_k_istart, sizeof(__pyx_k_istart), 0, 0, 1, 1},
  {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
  {&__pyx_n_s_ival, __pyx_k_ival, sizeof(__pyx_k_ival), 0, 0, 1, 1},
  {&__pyx_n_s_ivalue, __pyx_k_ivalue, sizeof(__pyx_k_ivalue), 0, 0, 1, 1},
  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
  {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1},
  {&__pyx_n_s_lalpha, __pyx_k_lalpha, sizeof(__pyx_k_lalpha), 0, 0, 1, 1},
  {&__pyx_n_s_last, __pyx_k_last, sizeof(__pyx_k_last), 0, 0, 1, 1},
  {&__pyx_n_s_latin_1_decode, __pyx_k_latin_1_decode, sizeof(__pyx_k_latin_1_decode), 0, 0, 1, 1},
  {&__pyx_n_s_latin_1_encode, __pyx_k_latin_1_encode, sizeof(__pyx_k_latin_1_encode), 0, 0, 1, 1},
  {&__pyx_n_s_lbeta, __pyx_k_lbeta, sizeof(__pyx_k_lbeta), 0, 0, 1, 1},
  {&__pyx_n_s_ld_nd, __pyx_k_ld_nd, sizeof(__pyx_k_ld_nd), 0, 0, 1, 1},
  {&__pyx_n_s_ldalpha, __pyx_k_ldalpha, sizeof(__pyx_k_ldalpha), 0, 0, 1, 1},
  {&__pyx_n_s_ldbeta, __pyx_k_ldbeta, sizeof(__pyx_k_ldbeta), 0, 0, 1, 1},
  {&__pyx_n_s_ldinc, __pyx_k_ldinc, sizeof(__pyx_k_ldinc), 0, 0, 1, 1},
  {&__pyx_n_s_ldstart, __pyx_k_ldstart, sizeof(__pyx_k_ldstart), 0, 0, 1, 1},
  {&__pyx_n_s_ldval, __pyx_k_ldval, sizeof(__pyx_k_ldval), 0, 0, 1, 1},
  {&__pyx_n_s_ldvalue, __pyx_k_ldvalue, sizeof(__pyx_k_ldvalue), 0, 0, 1, 1},
  {&__pyx_kp_s_len_hi_nd_ndim_len_s_s, __pyx_k_len_hi_nd_ndim_len_s_s, sizeof(__pyx_k_len_hi_nd_ndim_len_s_s), 0, 0, 1, 0},
  {&__pyx_kp_s_len_lo_nd_ndim_len_s_s, __pyx_k_len_lo_nd_ndim_len_s_s, sizeof(__pyx_k_len_lo_nd_ndim_len_s_s), 0, 0, 1, 0},
  {&__pyx_n_s_limit, __pyx_k_limit, sizeof(__pyx_k_limit), 0, 0, 1, 1},
  {&__pyx_n_s_linc, __pyx_k_linc, sizeof(__pyx_k_linc), 0, 0, 1, 1},
  {&__pyx_n_s_list, __pyx_k_list, sizeof(__pyx_k_list), 0, 0, 1, 1},
  {&__pyx_n_s_list_nd, __pyx_k_list_nd, sizeof(__pyx_k_list_nd), 0, 0, 1, 1},
  {&__pyx_n_s_llalpha, __pyx_k_llalpha, sizeof(__pyx_k_llalpha), 0, 0, 1, 1},
  {&__pyx_n_s_llbeta, __pyx_k_llbeta, sizeof(__pyx_k_llbeta), 0, 0, 1, 1},
  {&__pyx_n_s_llinc, __pyx_k_llinc, sizeof(__pyx_k_llinc), 0, 0, 1, 1},
  {&__pyx_n_s_llstart, __pyx_k_llstart, sizeof(__pyx_k_llstart), 0, 0, 1, 1},
  {&__pyx_n_s_llt_solve, __pyx_k_llt_solve, sizeof(__pyx_k_llt_solve), 0, 0, 1, 1},
  {&__pyx_n_s_llval, __pyx_k_llval, sizeof(__pyx_k_llval), 0, 0, 1, 1},
  {&__pyx_n_s_llvalue, __pyx_k_llvalue, sizeof(__pyx_k_llvalue), 0, 0, 1, 1},
  {&__pyx_n_s_lo, __pyx_k_lo, sizeof(__pyx_k_lo), 0, 0, 1, 1},
  {&__pyx_kp_s_lo_cannot_be_None_if_hi_is_None, __pyx_k_lo_cannot_be_None_if_hi_is_None, sizeof(__pyx_k_lo_cannot_be_None_if_hi_is_None), 0, 0, 1, 0},
  {&__pyx_n_s_lo_dst, __pyx_k_lo_dst, sizeof(__pyx_k_lo_dst), 0, 0, 1, 1},
  {&__pyx_kp_s_lo_hi_lo_s_hi_s, __pyx_k_lo_hi_lo_s_hi_s, sizeof(__pyx_k_lo_hi_lo_s_hi_s), 0, 0, 1, 0},
  {&__pyx_n_s_lo_nd, __pyx_k_lo_nd, sizeof(__pyx_k_lo_nd), 0, 0, 1, 1},
  {&__pyx_kp_s_lo_out_of_bounds_lo_dst_s_lo_s, __pyx_k_lo_out_of_bounds_lo_dst_s_lo_s, sizeof(__pyx_k_lo_out_of_bounds_lo_dst_s_lo_s), 0, 0, 1, 0},
  {&__pyx_n_s_lo_proc, __pyx_k_lo_proc, sizeof(__pyx_k_lo_proc), 0, 0, 1, 1},
  {&__pyx_n_s_locate, __pyx_k_locate, sizeof(__pyx_k_locate), 0, 0, 1, 1},
  {&__pyx_n_s_locate_nnodes, __pyx_k_locate_nnodes, sizeof(__pyx_k_locate_nnodes), 0, 0, 1, 1},
  {&__pyx_n_s_locate_region, __pyx_k_locate_region, sizeof(__pyx_k_locate_region), 0, 0, 1, 1},
  {&__pyx_n_s_lock, __pyx_k_lock, sizeof(__pyx_k_lock), 0, 0, 1, 1},
  {&__pyx_n_s_long, __pyx_k_long, sizeof(__pyx_k_long), 0, 0, 1, 1},
  {&__pyx_n_s_longlong, __pyx_k_longlong, sizeof(__pyx_k_longlong), 0, 0, 1, 1},
  {&__pyx_n_s_lstart, __pyx_k_lstart, sizeof(__pyx_k_lstart), 0, 0, 1, 1},
  {&__pyx_n_s_lu_solve, __pyx_k_lu_solve, sizeof(__pyx_k_lu_solve), 0, 0, 1, 1},
  {&__pyx_n_s_lval, __pyx_k_lval, sizeof(__pyx_k_lval), 0, 0, 1, 1},
  {&__pyx_n_s_lvalue, __pyx_k_lvalue, sizeof(__pyx_k_lvalue), 0, 0, 1, 1},
  {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_major, __pyx_k_major, sizeof(__pyx_k_major), 0, 0, 1, 1},
  {&__pyx_n_s_map, __pyx_k_map, sizeof(__pyx_k_map), 0, 0, 1, 1},
  {&__pyx_n_s_map_nd, __pyx_k_map_nd, sizeof(__pyx_k_map_nd), 0, 0, 1, 1},
  {&__pyx_n_s_map_reshape, __pyx_k_map_reshape, sizeof(__pyx_k_map_reshape), 0, 0, 1, 1},
  {&__pyx_n_s_mapc, __pyx_k_mapc, sizeof(__pyx_k_mapc), 0, 0, 1, 1},
  {&__pyx_n_s_mapc_nd, __pyx_k_mapc_nd, sizeof(__pyx_k_mapc_nd), 0, 0, 1, 1},
  {&__pyx_n_s_mask_sync, __pyx_k_mask_sync, sizeof(__pyx_k_mask_sync), 0, 0, 1, 1},
  {&__pyx_n_s_matmul_patch, __pyx_k_matmul_patch, sizeof(__pyx_k_matmul_patch), 0, 0, 1, 1},
  {&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1},
  {&__pyx_n_s_median, __pyx_k_median, sizeof(__pyx_k_median), 0, 0, 1, 1},
  {&__pyx_n_s_memory_avail, __pyx_k_memory_avail, sizeof(__pyx_k_memory_avail), 0, 0, 1, 1},
  {&__pyx_n_s_memory_limited, __pyx_k_memory_limited, sizeof(__pyx_k_memory_limited), 0, 0, 1, 1},
  {&__pyx_n_s_merge_distr_patch, __pyx_k_merge_distr_patch, sizeof(__pyx_k_merge_distr_patch), 0, 0, 1, 1},
  {&__pyx_n_s_merge_mirrored, __pyx_k_merge_mirrored, sizeof(__pyx_k_merge_mirrored), 0, 0, 1, 1},
  {&__pyx_n_s_message, __pyx_k_message, sizeof(__pyx_k_message), 0, 0, 1, 1},
  {&__pyx_n_s_mhi, __pyx_k_mhi, sizeof(__pyx_k_mhi), 0, 0, 1, 1},
  {&__pyx_n_s_mhi_nd, __pyx_k_mhi_nd, sizeof(__pyx_k_mhi_nd), 0, 0, 1, 1},
  {&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1},
  {&__pyx_n_s_miniga4py_ga, __pyx_k_miniga4py_ga, sizeof(__pyx_k_miniga4py_ga), 0, 0, 1, 1},
  {&__pyx_kp_s_miniga4py_ga_pyx, __pyx_k_miniga4py_ga_pyx, sizeof(__pyx_k_miniga4py_ga_pyx), 0, 0, 1, 0},
  {&__pyx_n_s_mlo, __pyx_k_mlo, sizeof(__pyx_k_mlo), 0, 0, 1, 1},
  {&__pyx_n_s_mlo_nd, __pyx_k_mlo_nd, sizeof(__pyx_k_mlo_nd), 0, 0, 1, 1},
  {&__pyx_n_s_mutex, __pyx_k_mutex, sizeof(__pyx_k_mutex), 0, 0, 1, 1},
  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_nbacc, __pyx_k_nbacc, sizeof(__pyx_k_nbacc), 0, 0, 1, 1},
  {&__pyx_n_s_nbget, __pyx_k_nbget, sizeof(__pyx_k_nbget), 0, 0, 1, 1},
  {&__pyx_n_s_nbhandle, __pyx_k_nbhandle, sizeof(__pyx_k_nbhandle), 0, 0, 1, 1},
  {&__pyx_n_s_nblock, __pyx_k_nblock, sizeof(__pyx_k_nblock), 0, 0, 1, 1},
  {&__pyx_n_s_nblock_nd, __pyx_k_nblock_nd, sizeof(__pyx_k_nblock_nd), 0, 0, 1, 1},
  {&__pyx_n_s_nbput, __pyx_k_nbput, sizeof(__pyx_k_nbput), 0, 0, 1, 1},
  {&__pyx_n_s_nbwait, __pyx_k_nbwait, sizeof(__pyx_k_nbwait), 0, 0, 1, 1},
  {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0},
  {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0},
  {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
  {&__pyx_n_s_nm, __pyx_k_nm, sizeof(__pyx_k_nm), 0, 0, 1, 1},
  {&__pyx_n_s_nnodes, __pyx_k_nnodes, sizeof(__pyx_k_nnodes), 0, 0, 1, 1},
  {&__pyx_n_s_node, __pyx_k_node, sizeof(__pyx_k_node), 0, 0, 1, 1},
  {&__pyx_n_s_nodeid, __pyx_k_nodeid, sizeof(__pyx_k_nodeid), 0, 0, 1, 1},
  {&__pyx_n_s_norm1, __pyx_k_norm1, sizeof(__pyx_k_norm1), 0, 0, 1, 1},
  {&__pyx_n_s_norm_infinity, __pyx_k_norm_infinity, sizeof(__pyx_k_norm_infinity), 0, 0, 1, 1},
  {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  {&__pyx_n_s_np_guess, __pyx_k_np_guess, sizeof(__pyx_k_np_guess), 0, 0, 1, 1},
  {&__pyx_n_s_np_result, __pyx_k_np_result, sizeof(__pyx_k_np_result), 0, 0, 1, 1},
  {&__pyx_n_s_num, __pyx_k_num, sizeof(__pyx_k_num), 0, 0, 1, 1},
  {&__pyx_n_s_num_blocks, __pyx_k_num_blocks, sizeof(__pyx_k_num_blocks), 0, 0, 1, 1},
  {&__pyx_n_s_num_group, __pyx_k_num_group, sizeof(__pyx_k_num_group), 0, 0, 1, 1},
  {&__pyx_n_s_number, __pyx_k_number, sizeof(__pyx_k_number), 0, 0, 1, 1},
  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
  {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
  {&__pyx_n_s_ones, __pyx_k_ones, sizeof(__pyx_k_ones), 0, 0, 1, 1},
  {&__pyx_n_s_op, __pyx_k_op, sizeof(__pyx_k_op), 0, 0, 1, 1},
  {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
  {&__pyx_n_s_pdcv, __pyx_k_pdcv, sizeof(__pyx_k_pdcv), 0, 0, 1, 1},
  {&__pyx_n_s_periodic_acc, __pyx_k_periodic_acc, sizeof(__pyx_k_periodic_acc), 0, 0, 1, 1},
  {&__pyx_n_s_periodic_get, __pyx_k_periodic_get, sizeof(__pyx_k_periodic_get), 0, 0, 1, 1},
  {&__pyx_n_s_periodic_put, __pyx_k_periodic_put, sizeof(__pyx_k_periodic_put), 0, 0, 1, 1},
  {&__pyx_n_s_pfcv, __pyx_k_pfcv, sizeof(__pyx_k_pfcv), 0, 0, 1, 1},
  {&__pyx_n_s_pgroup, __pyx_k_pgroup, sizeof(__pyx_k_pgroup), 0, 0, 1, 1},
  {&__pyx_n_s_pgroup_absolute_id, __pyx_k_pgroup_absolute_id, sizeof(__pyx_k_pgroup_absolute_id), 0, 0, 1, 1},
  {&__pyx_n_s_pgroup_brdcst, __pyx_k_pgroup_brdcst, sizeof(__pyx_k_pgroup_brdcst), 0, 0, 1, 1},
  {&__pyx_n_s_pgroup_create, __pyx_k_pgroup_create, sizeof(__pyx_k_pgroup_create), 0, 0, 1, 1},
  {&__pyx_n_s_pgroup_destroy, __pyx_k_pgroup_destroy, sizeof(__pyx_k_pgroup_destroy), 0, 0, 1, 1},
  {&__pyx_n_s_pgroup_get_default, __pyx_k_pgroup_get_default, sizeof(__pyx_k_pgroup_get_default), 0, 0, 1, 1},
  {&__pyx_n_s_pgroup_get_mirror, __pyx_k_pgroup_get_mirror, sizeof(__pyx_k_pgroup_get_mirror), 0, 0, 1, 1},
  {&__pyx_n_s_pgroup_get_world, __pyx_k_pgroup_get_world, sizeof(__pyx_k_pgroup_get_world), 0, 0, 1, 1},
  {&__pyx_n_s_pgroup_gop, __pyx_k_pgroup_gop, sizeof(__pyx_k_pgroup_gop), 0, 0, 1, 1},
  {&__pyx_n_s_pgroup_gop_absmax, __pyx_k_pgroup_gop_absmax, sizeof(__pyx_k_pgroup_gop_absmax), 0, 0, 1, 1},
  {&__pyx_n_s_pgroup_gop_absmin, __pyx_k_pgroup_gop_absmin, sizeof(__pyx_k_pgroup_gop_absmin), 0, 0, 1, 1},
  {&__pyx_n_s_pgroup_gop_add, __pyx_k_pgroup_gop_add, sizeof(__pyx_k_pgroup_gop_add), 0, 0, 1, 1},
  {&__pyx_kp_u_pgroup_gop_line_3055, __pyx_k_pgroup_gop_line_3055, sizeof(__pyx_k_pgroup_gop_line_3055), 0, 1, 0, 0},
  {&__pyx_n_s_pgroup_gop_max, __pyx_k_pgroup_gop_max, sizeof(__pyx_k_pgroup_gop_max), 0, 0, 1, 1},
  {&__pyx_n_s_pgroup_gop_min, __pyx_k_pgroup_gop_min, sizeof(__pyx_k_pgroup_gop_min), 0, 0, 1, 1},
  {&__pyx_n_s_pgroup_gop_multiply, __pyx_k_pgroup_gop_multiply, sizeof(__pyx_k_pgroup_gop_multiply), 0, 0, 1, 1},
  {&__pyx_n_s_pgroup_nnodes, __pyx_k_pgroup_nnodes, sizeof(__pyx_k_pgroup_nnodes), 0, 0, 1, 1},
  {&__pyx_n_s_pgroup_nodeid, __pyx_k_pgroup_nodeid, sizeof(__pyx_k_pgroup_nodeid), 0, 0, 1, 1},
  {&__pyx_n_s_pgroup_set_default, __pyx_k_pgroup_set_default, sizeof(__pyx_k_pgroup_set_default), 0, 0, 1, 1},
  {&__pyx_n_s_pgroup_split, __pyx_k_pgroup_split, sizeof(__pyx_k_pgroup_split), 0, 0, 1, 1},
  {&__pyx_n_s_pgroup_split_irreg, __pyx_k_pgroup_split_irreg, sizeof(__pyx_k_pgroup_split_irreg), 0, 0, 1, 1},
  {&__pyx_n_s_pgroup_sync, __pyx_k_pgroup_sync, sizeof(__pyx_k_pgroup_sync), 0, 0, 1, 1},
  {&__pyx_n_s_pid, __pyx_k_pid, sizeof(__pyx_k_pid), 0, 0, 1, 1},
  {&__pyx_n_s_pretty, __pyx_k_pretty, sizeof(__pyx_k_pretty), 0, 0, 1, 1},
  {&__pyx_n_s_print_distribution, __pyx_k_print_distribution, sizeof(__pyx_k_print_distribution), 0, 0, 1, 1},
  {&__pyx_n_s_print_file, __pyx_k_print_file, sizeof(__pyx_k_print_file), 0, 0, 1, 1},
  {&__pyx_n_s_print_patch, __pyx_k_print_patch, sizeof(__pyx_k_print_patch), 0, 0, 1, 1},
  {&__pyx_n_s_print_stats, __pyx_k_print_stats, sizeof(__pyx_k_print_stats), 0, 0, 1, 1},
  {&__pyx_n_s_print_stdout, __pyx_k_print_stdout, sizeof(__pyx_k_print_stdout), 0, 0, 1, 1},
  {&__pyx_n_s_proc, __pyx_k_proc, sizeof(__pyx_k_proc), 0, 0, 1, 1},
  {&__pyx_n_s_proc_grid, __pyx_k_proc_grid, sizeof(__pyx_k_proc_grid), 0, 0, 1, 1},
  {&__pyx_n_s_proc_grid_nd, __pyx_k_proc_grid_nd, sizeof(__pyx_k_proc_grid_nd), 0, 0, 1, 1},
  {&__pyx_n_s_proc_topology, __pyx_k_proc_topology, sizeof(__pyx_k_proc_topology), 0, 0, 1, 1},
  {&__pyx_n_s_procs, __pyx_k_procs, sizeof(__pyx_k_procs), 0, 0, 1, 1},
  {&__pyx_n_s_prod, __pyx_k_prod, sizeof(__pyx_k_prod), 0, 0, 1, 1},
  {&__pyx_n_s_ptr, __pyx_k_ptr, sizeof(__pyx_k_ptr), 0, 0, 1, 1},
  {&__pyx_n_s_put, __pyx_k_put, sizeof(__pyx_k_put), 0, 0, 1, 1},
  {&__pyx_n_s_randomize, __pyx_k_randomize, sizeof(__pyx_k_randomize), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_read_inc, __pyx_k_read_inc, sizeof(__pyx_k_read_inc), 0, 0, 1, 1},
  {&__pyx_n_s_real, __pyx_k_real, sizeof(__pyx_k_real), 0, 0, 1, 1},
  {&__pyx_n_s_recip, __pyx_k_recip, sizeof(__pyx_k_recip), 0, 0, 1, 1},
  {&__pyx_n_s_register, __pyx_k_register, sizeof(__pyx_k_register), 0, 0, 1, 1},
  {&__pyx_n_s_register_dtype, __pyx_k_register_dtype, sizeof(__pyx_k_register_dtype), 0, 0, 1, 1},
  {&__pyx_n_s_register_type, __pyx_k_register_type, sizeof(__pyx_k_register_type), 0, 0, 1, 1},
  {&__pyx_n_s_release, __pyx_k_release, sizeof(__pyx_k_release), 0, 0, 1, 1},
  {&__pyx_n_s_release_block, __pyx_k_release_block, sizeof(__pyx_k_release_block), 0, 0, 1, 1},
  {&__pyx_n_s_release_block_grid, __pyx_k_release_block_grid, sizeof(__pyx_k_release_block_grid), 0, 0, 1, 1},
  {&__pyx_n_s_release_block_segment, __pyx_k_release_block_segment, sizeof(__pyx_k_release_block_segment), 0, 0, 1, 1},
  {&__pyx_n_s_release_ghost_element, __pyx_k_release_ghost_element, sizeof(__pyx_k_release_ghost_element), 0, 0, 1, 1},
  {&__pyx_n_s_release_ghosts, __pyx_k_release_ghosts, sizeof(__pyx_k_release_ghosts), 0, 0, 1, 1},
  {&__pyx_n_s_release_update, __pyx_k_release_update, sizeof(__pyx_k_release_update), 0, 0, 1, 1},
  {&__pyx_n_s_release_update_block, __pyx_k_release_update_block, sizeof(__pyx_k_release_update_block), 0, 0, 1, 1},
  {&__pyx_n_s_release_update_block_grid, __pyx_k_release_update_block_grid, sizeof(__pyx_k_release_update_block_grid), 0, 0, 1, 1},
  {&__pyx_n_s_release_update_block_segment, __pyx_k_release_update_block_segment, sizeof(__pyx_k_release_update_block_segment), 0, 0, 1, 1},
  {&__pyx_n_s_release_update_ghost_element, __pyx_k_release_update_ghost_element, sizeof(__pyx_k_release_update_ghost_element), 0, 0, 1, 1},
  {&__pyx_n_s_release_update_ghosts, __pyx_k_release_update_ghosts, sizeof(__pyx_k_release_update_ghosts), 0, 0, 1, 1},
  {&__pyx_n_s_reshape, __pyx_k_reshape, sizeof(__pyx_k_reshape), 0, 0, 1, 1},
  {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1},
  {&__pyx_n_s_root, __pyx_k_root, sizeof(__pyx_k_root), 0, 0, 1, 1},
  {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1},
  {&__pyx_n_s_scale, __pyx_k_scale, sizeof(__pyx_k_scale), 0, 0, 1, 1},
  {&__pyx_n_s_scale_cols, __pyx_k_scale_cols, sizeof(__pyx_k_scale_cols), 0, 0, 1, 1},
  {&__pyx_n_s_scale_rows, __pyx_k_scale_rows, sizeof(__pyx_k_scale_rows), 0, 0, 1, 1},
  {&__pyx_n_s_scan_add, __pyx_k_scan_add, sizeof(__pyx_k_scan_add), 0, 0, 1, 1},
  {&__pyx_n_s_scan_copy, __pyx_k_scan_copy, sizeof(__pyx_k_scan_copy), 0, 0, 1, 1},
  {&__pyx_n_s_scatter, __pyx_k_scatter, sizeof(__pyx_k_scatter), 0, 0, 1, 1},
  {&__pyx_n_s_scatter_acc, __pyx_k_scatter_acc, sizeof(__pyx_k_scatter_acc), 0, 0, 1, 1},
  {&__pyx_n_s_select_elem, __pyx_k_select_elem, sizeof(__pyx_k_select_elem), 0, 0, 1, 1},
  {&__pyx_n_s_select_elem_max, __pyx_k_select_elem_max, sizeof(__pyx_k_select_elem_max), 0, 0, 1, 1},
  {&__pyx_n_s_select_elem_min, __pyx_k_select_elem_min, sizeof(__pyx_k_select_elem_min), 0, 0, 1, 1},
  {&__pyx_n_s_set_array_name, __pyx_k_set_array_name, sizeof(__pyx_k_set_array_name), 0, 0, 1, 1},
  {&__pyx_n_s_set_block_cyclic, __pyx_k_set_block_cyclic, sizeof(__pyx_k_set_block_cyclic), 0, 0, 1, 1},
  {&__pyx_n_s_set_block_cyclic_proc_grid, __pyx_k_set_block_cyclic_proc_grid, sizeof(__pyx_k_set_block_cyclic_proc_grid), 0, 0, 1, 1},
  {&__pyx_n_s_set_chunk, __pyx_k_set_chunk, sizeof(__pyx_k_set_chunk), 0, 0, 1, 1},
  {&__pyx_n_s_set_data, __pyx_k_set_data, sizeof(__pyx_k_set_data), 0, 0, 1, 1},
  {&__pyx_n_s_set_debug, __pyx_k_set_debug, sizeof(__pyx_k_set_debug), 0, 0, 1, 1},
  {&__pyx_n_s_set_diagonal, __pyx_k_set_diagonal, sizeof(__pyx_k_set_diagonal), 0, 0, 1, 1},
  {&__pyx_n_s_set_ghosts, __pyx_k_set_ghosts, sizeof(__pyx_k_set_ghosts), 0, 0, 1, 1},
  {&__pyx_n_s_set_irreg_distr, __pyx_k_set_irreg_distr, sizeof(__pyx_k_set_irreg_distr), 0, 0, 1, 1},
  {&__pyx_n_s_set_memory_limit, __pyx_k_set_memory_limit, sizeof(__pyx_k_set_memory_limit), 0, 0, 1, 1},
  {&__pyx_n_s_set_pgroup, __pyx_k_set_pgroup, sizeof(__pyx_k_set_pgroup), 0, 0, 1, 1},
  {&__pyx_n_s_set_restricted, __pyx_k_set_restricted, sizeof(__pyx_k_set_restricted), 0, 0, 1, 1},
  {&__pyx_n_s_set_restricted_range, __pyx_k_set_restricted_range, sizeof(__pyx_k_set_restricted_range), 0, 0, 1, 1},
  {&__pyx_n_s_shift_diagoal, __pyx_k_shift_diagoal, sizeof(__pyx_k_shift_diagoal), 0, 0, 1, 1},
  {&__pyx_n_s_single, __pyx_k_single, sizeof(__pyx_k_single), 0, 0, 1, 1},
  {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
  {&__pyx_n_s_skip, __pyx_k_skip, sizeof(__pyx_k_skip), 0, 0, 1, 1},
  {&__pyx_n_s_slices, __pyx_k_slices, sizeof(__pyx_k_slices), 0, 0, 1, 1},
  {&__pyx_n_s_solve, __pyx_k_solve, sizeof(__pyx_k_solve), 0, 0, 1, 1},
  {&__pyx_n_s_sometrue, __pyx_k_sometrue, sizeof(__pyx_k_sometrue), 0, 0, 1, 1},
  {&__pyx_n_s_spd_invert, __pyx_k_spd_invert, sizeof(__pyx_k_spd_invert), 0, 0, 1, 1},
  {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
  {&__pyx_n_s_step_max, __pyx_k_step_max, sizeof(__pyx_k_step_max), 0, 0, 1, 1},
  {&__pyx_n_s_strided_acc, __pyx_k_strided_acc, sizeof(__pyx_k_strided_acc), 0, 0, 1, 1},
  {&__pyx_n_s_strided_get, __pyx_k_strided_get, sizeof(__pyx_k_strided_get), 0, 0, 1, 1},
  {&__pyx_n_s_strided_put, __pyx_k_strided_put, sizeof(__pyx_k_strided_put), 0, 0, 1, 1},
  {&__pyx_n_s_strides, __pyx_k_strides, sizeof(__pyx_k_strides), 0, 0, 1, 1},
  {&__pyx_n_s_subsarray, __pyx_k_subsarray, sizeof(__pyx_k_subsarray), 0, 0, 1, 1},
  {&__pyx_n_s_subsarray1_nd, __pyx_k_subsarray1_nd, sizeof(__pyx_k_subsarray1_nd), 0, 0, 1, 1},
  {&__pyx_n_s_subsarray2_nd, __pyx_k_subsarray2_nd, sizeof(__pyx_k_subsarray2_nd), 0, 0, 1, 1},
  {&__pyx_kp_s_subsarray_must_be_either_1_or_2, __pyx_k_subsarray_must_be_either_1_or_2, sizeof(__pyx_k_subsarray_must_be_either_1_or_2), 0, 0, 1, 0},
  {&__pyx_n_s_subscript, __pyx_k_subscript, sizeof(__pyx_k_subscript), 0, 0, 1, 1},
  {&__pyx_n_s_subscript_nd, __pyx_k_subscript_nd, sizeof(__pyx_k_subscript_nd), 0, 0, 1, 1},
  {&__pyx_n_s_summarize, __pyx_k_summarize, sizeof(__pyx_k_summarize), 0, 0, 1, 1},
  {&__pyx_n_s_symmetrize, __pyx_k_symmetrize, sizeof(__pyx_k_symmetrize), 0, 0, 1, 1},
  {&__pyx_n_s_sync, __pyx_k_sync, sizeof(__pyx_k_sync), 0, 0, 1, 1},
  {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
  {&__pyx_n_s_ta, __pyx_k_ta, sizeof(__pyx_k_ta), 0, 0, 1, 1},
  {&__pyx_n_s_ta_c, __pyx_k_ta_c, sizeof(__pyx_k_ta_c), 0, 0, 1, 1},
  {&__pyx_n_s_ta_char, __pyx_k_ta_char, sizeof(__pyx_k_ta_char), 0, 0, 1, 1},
  {&__pyx_n_s_tb, __pyx_k_tb, sizeof(__pyx_k_tb), 0, 0, 1, 1},
  {&__pyx_n_s_tb_c, __pyx_k_tb_c, sizeof(__pyx_k_tb_c), 0, 0, 1, 1},
  {&__pyx_n_s_tb_char, __pyx_k_tb_char, sizeof(__pyx_k_tb_char), 0, 0, 1, 1},
  {&__pyx_n_s_terminate, __pyx_k_terminate, sizeof(__pyx_k_terminate), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_kp_s_the_buffer_must_be_contiguous, __pyx_k_the_buffer_must_be_contiguous, sizeof(__pyx_k_the_buffer_must_be_contiguous), 0, 0, 1, 0},
  {&__pyx_n_s_to_dtype, __pyx_k_to_dtype, sizeof(__pyx_k_to_dtype), 0, 0, 1, 1},
  {&__pyx_n_s_total_blocks, __pyx_k_total_blocks, sizeof(__pyx_k_total_blocks), 0, 0, 1, 1},
  {&__pyx_n_s_trans, __pyx_k_trans, sizeof(__pyx_k_trans), 0, 0, 1, 1},
  {&__pyx_n_s_trans_c, __pyx_k_trans_c, sizeof(__pyx_k_trans_c), 0, 0, 1, 1},
  {&__pyx_n_s_transa, __pyx_k_transa, sizeof(__pyx_k_transa), 0, 0, 1, 1},
  {&__pyx_n_s_transb, __pyx_k_transb, sizeof(__pyx_k_transb), 0, 0, 1, 1},
  {&__pyx_n_s_transpose, __pyx_k_transpose, sizeof(__pyx_k_transpose), 0, 0, 1, 1},
  {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1},
  {&__pyx_kp_s_type_not_supported_by_ga_gop_s, __pyx_k_type_not_supported_by_ga_gop_s, sizeof(__pyx_k_type_not_supported_by_ga_gop_s), 0, 0, 1, 0},
  {&__pyx_kp_s_type_not_supported_by_ga_pgroup, __pyx_k_type_not_supported_by_ga_pgroup, sizeof(__pyx_k_type_not_supported_by_ga_pgroup), 0, 0, 1, 0},
  {&__pyx_kp_s_type_of_g_a_not_recognized, __pyx_k_type_of_g_a_not_recognized, sizeof(__pyx_k_type_of_g_a_not_recognized), 0, 0, 1, 0},
  {&__pyx_n_s_typenum, __pyx_k_typenum, sizeof(__pyx_k_typenum), 0, 0, 1, 1},
  {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
  {&__pyx_n_s_unlock, __pyx_k_unlock, sizeof(__pyx_k_unlock), 0, 0, 1, 1},
  {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
  {&__pyx_n_s_update_ghost_dir, __pyx_k_update_ghost_dir, sizeof(__pyx_k_update_ghost_dir), 0, 0, 1, 1},
  {&__pyx_n_s_update_ghosts, __pyx_k_update_ghosts, sizeof(__pyx_k_update_ghosts), 0, 0, 1, 1},
  {&__pyx_kp_s_use_access_ghosts_g_a_instead, __pyx_k_use_access_ghosts_g_a_instead, sizeof(__pyx_k_use_access_ghosts_g_a_instead), 0, 0, 1, 0},
  {&__pyx_n_s_uses_ma, __pyx_k_uses_ma, sizeof(__pyx_k_uses_ma), 0, 0, 1, 1},
  {&__pyx_n_s_val, __pyx_k_val, sizeof(__pyx_k_val), 0, 0, 1, 1},
  {&__pyx_n_s_valpha, __pyx_k_valpha, sizeof(__pyx_k_valpha), 0, 0, 1, 1},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1},
  {&__pyx_kp_s_values_must_be_contiguous, __pyx_k_values_must_be_contiguous, sizeof(__pyx_k_values_must_be_contiguous), 0, 0, 1, 0},
  {&__pyx_kp_s_values_must_be_one_dimensional, __pyx_k_values_must_be_one_dimensional, sizeof(__pyx_k_values_must_be_one_dimensional), 0, 0, 1, 0},
  {&__pyx_n_s_values_nd, __pyx_k_values_nd, sizeof(__pyx_k_values_nd), 0, 0, 1, 1},
  {&__pyx_kp_s_values_was_not_large_enough, __pyx_k_values_was_not_large_enough, sizeof(__pyx_k_values_was_not_large_enough), 0, 0, 1, 0},
  {&__pyx_n_s_vbeta, __pyx_k_vbeta, sizeof(__pyx_k_vbeta), 0, 0, 1, 1},
  {&__pyx_n_s_verbose, __pyx_k_verbose, sizeof(__pyx_k_verbose), 0, 0, 1, 1},
  {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1},
  {&__pyx_n_s_vinc, __pyx_k_vinc, sizeof(__pyx_k_vinc), 0, 0, 1, 1},
  {&__pyx_n_s_vstart, __pyx_k_vstart, sizeof(__pyx_k_vstart), 0, 0, 1, 1},
  {&__pyx_n_s_vval, __pyx_k_vval, sizeof(__pyx_k_vval), 0, 0, 1, 1},
  {&__pyx_n_s_vvalue, __pyx_k_vvalue, sizeof(__pyx_k_vvalue), 0, 0, 1, 1},
  {&__pyx_n_s_width, __pyx_k_width, sizeof(__pyx_k_width), 0, 0, 1, 1},
  {&__pyx_n_s_width_nd, __pyx_k_width_nd, sizeof(__pyx_k_width_nd), 0, 0, 1, 1},
  {&__pyx_n_s_wtime, __pyx_k_wtime, sizeof(__pyx_k_wtime), 0, 0, 1, 1},
  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
  {&__pyx_n_s_zero, __pyx_k_zero, sizeof(__pyx_k_zero), 0, 0, 1, 1},
  {&__pyx_n_s_zero_diagonal, __pyx_k_zero_diagonal, sizeof(__pyx_k_zero_diagonal), 0, 0, 1, 1},
  {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
  {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 111, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 261, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 387, __pyx_L1_error)
  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 592, __pyx_L1_error)
  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 810, __pyx_L1_error)
  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1000, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "miniga4py/ga.pyx":202
 *         hi_nd = lo_nd+1
 *     elif lo is None and hi is not None:
 *         raise ValueError('lo cannot be None if hi is None')             # <<<<<<<<<<<<<<
 *     else: # lo and hi are not None
 *         lo_nd = _inta64(lo)
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_lo_cannot_be_None_if_hi_is_None); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "miniga4py/ga.pyx":231
 *     cdef double complex pdcv=1.0
 *     if value is None:
 *         raise ValueError("cannot convert None")             # <<<<<<<<<<<<<<
 *     if gtype == C_INT:
 *         iv[0] = value
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_cannot_convert_None); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "miniga4py/ga.pyx":261
 *         return dcv
 *     else:
 *         raise TypeError("type of g_a not recognized")             # <<<<<<<<<<<<<<
 * 
 * def zip(lo, hi):
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_type_of_g_a_not_recognized); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "miniga4py/ga.pyx":397
 *                     'buffer.size=%s != np.prod(shape)=%s' % (
 *                     buffer_nd.size, np.prod(shape)))
 *         ld_nd = shape[1:]             # <<<<<<<<<<<<<<
 *     else:
 *         buffer_shape = [buffer_nd.shape[i] for i in range(buffer_nd.ndim)]
 */
  __pyx_slice__4 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__4)) __PYX_ERR(0, 397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__4);
  __Pyx_GIVEREF(__pyx_slice__4);

  /* "miniga4py/ga.pyx":650
 * 
 *     """
 *     raise NotImplementedError("use access_ghosts(g_a) instead")             # <<<<<<<<<<<<<<
 * 
 * def access_ghosts(int g_a):
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_use_access_ghosts_g_a_instead); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 650, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "miniga4py/ga.pyx":863
 *     buffer_nd = np.asarray(buffer)
 *     if not buffer_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("the buffer must be contiguous")             # <<<<<<<<<<<<<<
 *     #if buffer_nd.ndim != 1:
 *     #    raise ValueError("the buffer must be one-dimensional")
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_the_buffer_must_be_contiguous); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "miniga4py/ga.pyx":1797
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 *         except ValueError:
 *             raise ValueError("subsarray must be either 1- or 2-dimensional")             # <<<<<<<<<<<<<<
 *     # prepare values array
 *     if values is None:
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_subsarray_must_be_either_1_or_2); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 1797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "miniga4py/ga.pyx":1803
 *     else:
 *         if values.ndim != 1:
 *             raise ValueError("values must be one-dimensional")             # <<<<<<<<<<<<<<
 *         if not values.flags['C_CONTIGUOUS']:
 *             raise ValueError("values must be contiguous")
 */
  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_values_must_be_one_dimensional); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 1803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "miniga4py/ga.pyx":1805
 *             raise ValueError("values must be one-dimensional")
 *         if not values.flags['C_CONTIGUOUS']:
 *             raise ValueError("values must be contiguous")             # <<<<<<<<<<<<<<
 *         if len(values) < n:
 *             raise ValueError("values was not large enough")
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_values_must_be_contiguous); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 1805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "miniga4py/ga.pyx":1807
 *             raise ValueError("values must be contiguous")
 *         if len(values) < n:
 *             raise ValueError("values was not large enough")             # <<<<<<<<<<<<<<
 *     # call the wrapped function
 *     if subsarray1_nd is not None:
 */
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_values_was_not_large_enough); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 1807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "miniga4py/ga.pyx":1816
 *                 <int64_t*>subsarray2_nd.data, n)
 *     else:
 *         raise ValueError("how did this happen?")             # <<<<<<<<<<<<<<
 *     return values
 * 
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_how_did_this_happen); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 1816, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "miniga4py/ga.pyx":1879
 *         tb_char = 'T'
 *     if gtype == C_INT:
 *         raise TypeError("C_INT not supported")             # <<<<<<<<<<<<<<
 *     elif gtype == C_LONG:
 *         raise TypeError("C_LONG not supported")
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_C_INT_not_supported); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 1879, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "miniga4py/ga.pyx":1881
 *         raise TypeError("C_INT not supported")
 *     elif gtype == C_LONG:
 *         raise TypeError("C_LONG not supported")             # <<<<<<<<<<<<<<
 *     elif gtype == C_LONGLONG:
 *         raise TypeError("C_LONGLONG not supported")
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_C_LONG_not_supported); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 1881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "miniga4py/ga.pyx":1883
 *         raise TypeError("C_LONG not supported")
 *     elif gtype == C_LONGLONG:
 *         raise TypeError("C_LONGLONG not supported")             # <<<<<<<<<<<<<<
 *     elif gtype == C_FLOAT:
 *         falpha = alpha
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_C_LONGLONG_not_supported); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 1883, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "miniga4py/ga.pyx":1893
 *         GA_Dgemm64(ta_char, tb_char, m, n, k, dalpha, g_a, g_b, dbeta, g_c)
 *     elif gtype == C_LDBL:
 *         raise TypeError("C_LDBL not supported")             # <<<<<<<<<<<<<<
 *     elif gtype == C_SCPL:
 *         fcalpha = alpha
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_C_LDBL_not_supported); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 1893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "miniga4py/ga.pyx":1911
 *         GA_Zgemm64(ta_char, tb_char, m, n, k, ga_dcalpha, g_a, g_b, ga_dcbeta, g_c)
 *     elif gtype == C_LDCPL:
 *         raise TypeError("C_LDCPL not supported (yet)")             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_C_LDCPL_not_supported_yet); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 1911, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "miniga4py/ga.pyx":1991
 *     strides = [buffer.strides[i]/buffer.itemsize for i in range(buffer.ndim)]
 *     if strides[-1] != 1:
 *         raise ValueError("first dimension of buffer cannot be strided")             # <<<<<<<<<<<<<<
 *     if np.any(np.asarray(strides) < 0):
 *         raise ValueError("buffer cannot have negative strides")
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_first_dimension_of_buffer_cannot); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 1991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "miniga4py/ga.pyx":1993
 *         raise ValueError("first dimension of buffer cannot be strided")
 *     if np.any(np.asarray(strides) < 0):
 *         raise ValueError("buffer cannot have negative strides")             # <<<<<<<<<<<<<<
 *     # we allow 1-d "flat" buffers in addition to buffers matching the shape of
 *     # requested region
 */
  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_buffer_cannot_have_negative_stri); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 1993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "miniga4py/ga.pyx":2001
 *                     'buffer.size=%s != np.prod(shape)=%s' % (
 *                     buffer.size, np.prod(shape)))
 *         ld_nd = shape[1:]             # <<<<<<<<<<<<<<
 *     else:
 *         buffer_shape = [buffer.shape[i] for i in range(buffer.ndim)]
 */
  __pyx_slice__20 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__20)) __PYX_ERR(0, 2001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__20);
  __Pyx_GIVEREF(__pyx_slice__20);

  /* "miniga4py/ga.pyx":2096
 *     cdef int size = 0
 *     if not X_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("X must be contiguous")             # <<<<<<<<<<<<<<
 *     try:
 *         size = len(X_nd)
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_X_must_be_contiguous); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 2096, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "miniga4py/ga.pyx":2334
 *     map_reshape = map.reshape(np_result,2,ndim)
 *     # need to add 1 to every 'hi' value
 *     map_reshape[:,1,:] += 1             # <<<<<<<<<<<<<<
 *     return map_reshape,procs
 * 
 */
  __pyx_slice__24 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__24)) __PYX_ERR(0, 2334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__24);
  __Pyx_GIVEREF(__pyx_slice__24);
  __pyx_slice__25 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__25)) __PYX_ERR(0, 2334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__25);
  __Pyx_GIVEREF(__pyx_slice__25);
  __pyx_tuple__26 = PyTuple_Pack(3, __pyx_slice__24, __pyx_int_1, __pyx_slice__25); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 2334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);

  /* "miniga4py/ga.pyx":2986
 *     buffer_nd = np.asarray(buffer)
 *     if not buffer_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("the buffer must be contiguous")             # <<<<<<<<<<<<<<
 *     #if buffer_nd.ndim != 1:
 *     #    raise ValueError("the buffer must be one-dimensional")
 */
  __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_the_buffer_must_be_contiguous); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 2986, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "miniga4py/ga.pyx":3077
 *     cdef np.ndarray X_nd = np.asarray(X)
 *     if not X_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("X must be contiguous")             # <<<<<<<<<<<<<<
 *     if X_nd.dtype == np.intc:
 *         GA_Pgroup_igop(pgroup, <int*>X_nd.data, len(X_nd), b(op))
 */
  __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_X_must_be_contiguous); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 3077, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "miniga4py/ga.pyx":3353
 *                     'buffer.size=%s != np.prod(shape)=%s' % (
 *                     buffer_nd.size, np.prod(shape)))
 *         ld_nd = shape[1:]             # <<<<<<<<<<<<<<
 *     else:
 *         buffer_shape = [buffer_nd.shape[i] for i in range(buffer_nd.ndim)]
 */
  __pyx_slice__29 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__29)) __PYX_ERR(0, 3353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__29);
  __Pyx_GIVEREF(__pyx_slice__29);

  /* "miniga4py/ga.pyx":3779
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 *         except ValueError:
 *             raise ValueError("subsarray must be either 1- or 2-dimensional")             # <<<<<<<<<<<<<<
 *     # prepare values array
 *     values_nd = np.asarray(values, dtype=_to_dtype[gtype])
 */
  __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_subsarray_must_be_either_1_or_2); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 3779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);

  /* "miniga4py/ga.pyx":3783
 *     values_nd = np.asarray(values, dtype=_to_dtype[gtype])
 *     if values_nd.ndim != 1:
 *         raise ValueError("values must be one-dimensional")             # <<<<<<<<<<<<<<
 *     if not values_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("values must be contiguous")
 */
  __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_values_must_be_one_dimensional); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 3783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "miniga4py/ga.pyx":3785
 *         raise ValueError("values must be one-dimensional")
 *     if not values_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("values must be contiguous")             # <<<<<<<<<<<<<<
 *     if len(values_nd) < n:
 *         raise ValueError("values was not large enough")
 */
  __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_values_must_be_contiguous); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 3785, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);

  /* "miniga4py/ga.pyx":3787
 *         raise ValueError("values must be contiguous")
 *     if len(values_nd) < n:
 *         raise ValueError("values was not large enough")             # <<<<<<<<<<<<<<
 *     # call the wrapped function
 *     if subsarray1_nd is not None:
 */
  __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_values_was_not_large_enough); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 3787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);

  /* "miniga4py/ga.pyx":3796
 *                 <int64_t*>subsarray2_nd.data, n)
 *     else:
 *         raise ValueError("how did this happen?")             # <<<<<<<<<<<<<<
 * 
 * def scatter_acc(int g_a, values, subsarray, alpha=None):
 */
  __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_how_did_this_happen); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 3796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);

  /* "miniga4py/ga.pyx":3848
 *             n = len(subsarray2_nd) # length of first dimension of subsarray2_nd
 *         except ValueError:
 *             raise ValueError("subsarray must be either 1- or 2-dimensional")             # <<<<<<<<<<<<<<
 *     # prepare values array
 *     values_nd = np.asarray(values, dtype=_to_dtype[gtype])
 */
  __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_subsarray_must_be_either_1_or_2); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 3848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);

  /* "miniga4py/ga.pyx":3852
 *     values_nd = np.asarray(values, dtype=_to_dtype[gtype])
 *     if values_nd.ndim != 1:
 *         raise ValueError("values must be one-dimensional")             # <<<<<<<<<<<<<<
 *     if not values_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("values must be contiguous")
 */
  __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_values_must_be_one_dimensional); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 3852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "miniga4py/ga.pyx":3854
 *         raise ValueError("values must be one-dimensional")
 *     if not values_nd.flags['C_CONTIGUOUS']:
 *         raise ValueError("values must be contiguous")             # <<<<<<<<<<<<<<
 *     if len(values_nd) < n:
 *         raise ValueError("values was not large enough")
 */
  __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_s_values_must_be_contiguous); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 3854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);

  /* "miniga4py/ga.pyx":3856
 *         raise ValueError("values must be contiguous")
 *     if len(values_nd) < n:
 *         raise ValueError("values was not large enough")             # <<<<<<<<<<<<<<
 *     # prepare alpha
 *     if alpha is None:
 */
  __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_s_values_was_not_large_enough); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 3856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);

  /* "miniga4py/ga.pyx":3872
 *                 <int64_t*>subsarray2_nd.data, n, valpha)
 *     else:
 *         raise ValueError("how did this happen?")             # <<<<<<<<<<<<<<
 * 
 * def select_elem(int g_a, op):
 */
  __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_s_how_did_this_happen); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 3872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "miniga4py/ga.pyx":3919
 *         return dcalpha,index
 *     else:
 *         raise TypeError("type of g_a not recognized")             # <<<<<<<<<<<<<<
 * 
 * def select_elem_min(int g_a):
 */
  __pyx_tuple__40 = PyTuple_Pack(1, __pyx_kp_s_type_of_g_a_not_recognized); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 3919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":229
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
  __pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(1, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":233
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
  __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(1, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":263
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
  __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(1, 263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":810
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 */
  __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(1, 810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":814
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *             # One could encode it in the format string and have Cython
 *             # complain instead, BUT: < and > in format strings also imply
 */
  __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(1, 814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":834
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
  __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(1, 834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1000
 *         _import_array()
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_umath() except -1:
 */
  __pyx_tuple__47 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(1, 1000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1006
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_ufunc() except -1:
 */
  __pyx_tuple__48 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(1, 1006, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1012
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__49 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(1, 1012, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);

  /* "miniga4py/ga.pyx":25
 * 
 * if sys.version_info.major < 3:
 *     def b(x):             # <<<<<<<<<<<<<<
 *         return str(x)
 *     def s(x):
 */
  __pyx_tuple__50 = PyTuple_Pack(1, __pyx_n_s_x); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);
  __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_b, 25, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 25, __pyx_L1_error)

  /* "miniga4py/ga.pyx":27
 *     def b(x):
 *         return str(x)
 *     def s(x):             # <<<<<<<<<<<<<<
 *         return str(x)
 *     def isstr(s):
 */
  __pyx_tuple__52 = PyTuple_Pack(1, __pyx_n_s_x); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__52);
  __Pyx_GIVEREF(__pyx_tuple__52);
  __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_s, 27, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 27, __pyx_L1_error)

  /* "miniga4py/ga.pyx":29
 *     def s(x):
 *         return str(x)
 *     def isstr(s):             # <<<<<<<<<<<<<<
 *         return isinstance(s, basestring)
 * else:
 */
  __pyx_tuple__54 = PyTuple_Pack(1, __pyx_n_s_s); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__54);
  __Pyx_GIVEREF(__pyx_tuple__54);
  __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_isstr, 29, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 29, __pyx_L1_error)

  /* "miniga4py/ga.pyx":33
 * else:
 *     import codecs
 *     def isstr(s):             # <<<<<<<<<<<<<<
 *         return isinstance(s, str)
 *     def isbytes(s):
 */
  __pyx_tuple__56 = PyTuple_Pack(1, __pyx_n_s_s); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__56);
  __Pyx_GIVEREF(__pyx_tuple__56);
  __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_isstr, 33, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 33, __pyx_L1_error)

  /* "miniga4py/ga.pyx":35
 *     def isstr(s):
 *         return isinstance(s, str)
 *     def isbytes(s):             # <<<<<<<<<<<<<<
 *         return isinstance(s, (bytes, bytearray))
 *     def b(x):
 */
  __pyx_tuple__58 = PyTuple_Pack(1, __pyx_n_s_s); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);
  __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_isbytes, 35, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 35, __pyx_L1_error)

  /* "miniga4py/ga.pyx":37
 *     def isbytes(s):
 *         return isinstance(s, (bytes, bytearray))
 *     def b(x):             # <<<<<<<<<<<<<<
 *         if isstr(x):
 *             return codecs.latin_1_encode(str(x))[0]
 */
  __pyx_tuple__60 = PyTuple_Pack(1, __pyx_n_s_x); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);
  __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_b, 37, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 37, __pyx_L1_error)

  /* "miniga4py/ga.pyx":42
 *         else:
 *             return x
 *     def s(x):             # <<<<<<<<<<<<<<
 *         if isbytes(x):
 *             return codecs.latin_1_decode(x)[0]
 */
  __pyx_tuple__62 = PyTuple_Pack(1, __pyx_n_s_x); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__62);
  __Pyx_GIVEREF(__pyx_tuple__62);
  __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_s, 42, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 42, __pyx_L1_error)

  /* "miniga4py/ga.pyx":107
 * #############################################################################
 * 
 * def dtype(int gatype):             # <<<<<<<<<<<<<<
 *     """Converts the given GA type to a numpy dtype."""
 *     if gatype in _to_dtype:
 */
  __pyx_tuple__64 = PyTuple_Pack(2, __pyx_n_s_gatype, __pyx_n_s_gatype); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__64);
  __Pyx_GIVEREF(__pyx_tuple__64);
  __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_dtype, 107, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 107, __pyx_L1_error)

  /* "miniga4py/ga.pyx":113
 *     raise ValueError("%d was not a recognized GA type" % gatype)
 * 
 * def inquire_dtype(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns the numpy dtype of the given GA."""
 *     gatype = inquire_type(g_a)
 */
  __pyx_tuple__66 = PyTuple_Pack(3, __pyx_n_s_g_a, __pyx_n_s_g_a, __pyx_n_s_gatype); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__66);
  __Pyx_GIVEREF(__pyx_tuple__66);
  __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_inquire_dtype, 113, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(0, 113, __pyx_L1_error)

  /* "miniga4py/ga.pyx":263
 *         raise TypeError("type of g_a not recognized")
 * 
 * def zip(lo, hi):             # <<<<<<<<<<<<<<
 *     """Transforms a GA lo,hi combination into a slice list."""
 *     return [slice(l,h) for l,h in __builtin__.zip(lo,hi)]
 */
  __pyx_tuple__68 = PyTuple_Pack(4, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_l, __pyx_n_s_h); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__68);
  __Pyx_GIVEREF(__pyx_tuple__68);
  __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_zip, 263, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 263, __pyx_L1_error)

  /* "miniga4py/ga.pyx":271
 * #############################################################################
 * 
 * def abs_value(int g_a, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Take element-wise absolute value of the array or patch.
 * 
 */
  __pyx_tuple__70 = PyTuple_Pack(5, __pyx_n_s_g_a, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_lo_nd, __pyx_n_s_hi_nd); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__70);
  __Pyx_GIVEREF(__pyx_tuple__70);
  __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_abs_value, 271, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(0, 271, __pyx_L1_error)

  /* "miniga4py/ga.pyx":292
 *         GA_Abs_value_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 * def acc(int g_a, buffer, lo=None, hi=None, alpha=None):             # <<<<<<<<<<<<<<
 *     """Combines data from buffer with data in the global array patch.
 * 
 */
  __pyx_tuple__72 = PyTuple_Pack(5, __pyx_n_s_g_a, __pyx_n_s_buffer, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_alpha); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__72);
  __Pyx_GIVEREF(__pyx_tuple__72);
  __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_acc, 292, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 292, __pyx_L1_error)

  /* "miniga4py/ga.pyx":427
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, valpha)
 * 
 * def access(int g_a, lo=None, hi=None, int proc=-1):             # <<<<<<<<<<<<<<
 *     """Returns local array patch.
 * 
 */
  __pyx_tuple__74 = PyTuple_Pack(19, __pyx_n_s_g_a, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_proc, __pyx_n_s_lo_nd, __pyx_n_s_hi_nd, __pyx_n_s_ld_nd, __pyx_n_s_lo_dst, __pyx_n_s_hi_dst, __pyx_n_s_dims_nd, __pyx_n_s_i, __pyx_n_s_gtype, __pyx_n_s_dimlen, __pyx_n_s_dtype, __pyx_n_s_ptr, __pyx_n_s_dims, __pyx_n_s_strides, __pyx_n_s_array, __pyx_n_s_slices); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__74);
  __Pyx_GIVEREF(__pyx_tuple__74);
  __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(4, 0, 19, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_access, 427, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(0, 427, __pyx_L1_error)

  /* "miniga4py/ga.pyx":523
 *     return array
 * 
 * def access_block(int g_a, int idx):             # <<<<<<<<<<<<<<
 *     """Returns local array patch for a block-cyclic distribution.
 * 
 */
  __pyx_tuple__76 = PyTuple_Pack(13, __pyx_n_s_g_a, __pyx_n_s_idx, __pyx_n_s_ld_nd, __pyx_n_s_lo_dst, __pyx_n_s_hi_dst, __pyx_n_s_dims_nd, __pyx_n_s_i, __pyx_n_s_gtype, __pyx_n_s_dimlen, __pyx_n_s_typenum, __pyx_n_s_ptr, __pyx_n_s_dims, __pyx_n_s_array); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__76);
  __Pyx_GIVEREF(__pyx_tuple__76);
  __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(2, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_access_block, 523, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(0, 523, __pyx_L1_error)

  /* "miniga4py/ga.pyx":568
 *     return array
 * 
 * def access_block_grid(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Returns local array patch for a SCALAPACK block-cyclic distribution.
 * 
 */
  __pyx_tuple__78 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_subscript); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(0, 568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__78);
  __Pyx_GIVEREF(__pyx_tuple__78);
  __pyx_codeobj__79 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_access_block_grid, 568, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(0, 568, __pyx_L1_error)

  /* "miniga4py/ga.pyx":594
 *     raise NotImplementedError
 * 
 * def access_block_segment(int g_a, int proc):             # <<<<<<<<<<<<<<
 *     """This function can be used to gain access to the all the locally held
 *     data on a particular processor that is associated with a block-cyclic
 */
  __pyx_tuple__80 = PyTuple_Pack(8, __pyx_n_s_g_a, __pyx_n_s_proc, __pyx_n_s_elems, __pyx_n_s_gtype, __pyx_n_s_typenum, __pyx_n_s_ptr, __pyx_n_s_dims, __pyx_n_s_array); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(0, 594, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__80);
  __Pyx_GIVEREF(__pyx_tuple__80);
  __pyx_codeobj__81 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__80, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_access_block_segment, 594, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__81)) __PYX_ERR(0, 594, __pyx_L1_error)

  /* "miniga4py/ga.pyx":630
 *     return array
 * 
 * def access_ghost_element(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Returns a scalar ndarray representing the requested ghost element.
 * 
 */
  __pyx_tuple__82 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_subscript); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(0, 630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__82);
  __Pyx_GIVEREF(__pyx_tuple__82);
  __pyx_codeobj__83 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__82, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_access_ghost_element, 630, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__83)) __PYX_ERR(0, 630, __pyx_L1_error)

  /* "miniga4py/ga.pyx":652
 *     raise NotImplementedError("use access_ghosts(g_a) instead")
 * 
 * def access_ghosts(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns ndarray representing local patch with ghost cells.
 * 
 */
  __pyx_tuple__84 = PyTuple_Pack(13, __pyx_n_s_g_a, __pyx_n_s_g_a, __pyx_n_s_ld_nd, __pyx_n_s_lo_dst, __pyx_n_s_hi_dst, __pyx_n_s_dims_nd, __pyx_n_s_i, __pyx_n_s_gtype, __pyx_n_s_dimlen, __pyx_n_s_typenum, __pyx_n_s_ptr, __pyx_n_s_dims, __pyx_n_s_array); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(0, 652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__84);
  __Pyx_GIVEREF(__pyx_tuple__84);
  __pyx_codeobj__85 = (PyObject*)__Pyx_PyCode_New(1, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__84, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_access_ghosts, 652, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__85)) __PYX_ERR(0, 652, __pyx_L1_error)

  /* "miniga4py/ga.pyx":693
 *     return array
 * 
 * def add(int g_a, int g_b, int g_c, alpha=None, beta=None, alo=None, ahi=None,             # <<<<<<<<<<<<<<
 *         blo=None, bhi=None, clo=None, chi=None):
 *     """Element-wise addition of two arrays.
 */
  __pyx_tuple__86 = PyTuple_Pack(36, __pyx_n_s_g_a, __pyx_n_s_g_b, __pyx_n_s_g_c, __pyx_n_s_alpha, __pyx_n_s_beta, __pyx_n_s_alo, __pyx_n_s_ahi, __pyx_n_s_blo, __pyx_n_s_bhi, __pyx_n_s_clo, __pyx_n_s_chi, __pyx_n_s_alo_nd, __pyx_n_s_ahi_nd, __pyx_n_s_blo_nd, __pyx_n_s_bhi_nd, __pyx_n_s_clo_nd, __pyx_n_s_chi_nd, __pyx_n_s_gtype, __pyx_n_s_ialpha, __pyx_n_s_ibeta, __pyx_n_s_lalpha, __pyx_n_s_lbeta, __pyx_n_s_llalpha, __pyx_n_s_llbeta, __pyx_n_s_falpha, __pyx_n_s_fbeta, __pyx_n_s_dalpha, __pyx_n_s_dbeta, __pyx_n_s_ldalpha, __pyx_n_s_ldbeta, __pyx_n_s_fcalpha, __pyx_n_s_fcbeta, __pyx_n_s_dcalpha, __pyx_n_s_dcbeta, __pyx_n_s_valpha, __pyx_n_s_vbeta); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__86);
  __Pyx_GIVEREF(__pyx_tuple__86);
  __pyx_codeobj__87 = (PyObject*)__Pyx_PyCode_New(11, 0, 36, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__86, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_add, 693, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__87)) __PYX_ERR(0, 693, __pyx_L1_error)

  /* "miniga4py/ga.pyx":770
 *                         g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def add_constant(int g_a, alpha, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Adds the constant alpha to each element of the array.
 * 
 */
  __pyx_tuple__88 = PyTuple_Pack(16, __pyx_n_s_g_a, __pyx_n_s_alpha, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_lo_nd, __pyx_n_s_hi_nd, __pyx_n_s_gtype, __pyx_n_s_ialpha, __pyx_n_s_lalpha, __pyx_n_s_llalpha, __pyx_n_s_falpha, __pyx_n_s_dalpha, __pyx_n_s_ldalpha, __pyx_n_s_fcalpha, __pyx_n_s_dcalpha, __pyx_n_s_valpha); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__88);
  __Pyx_GIVEREF(__pyx_tuple__88);
  __pyx_codeobj__89 = (PyObject*)__Pyx_PyCode_New(4, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__88, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_add_constant, 770, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__89)) __PYX_ERR(0, 770, __pyx_L1_error)

  /* "miniga4py/ga.pyx":808
 *                 g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, valpha)
 * 
 * def add_diagonal(int g_a, int g_v):             # <<<<<<<<<<<<<<
 *     """Adds the elements of the vector g_v to the diagonal of matrix g_a.
 * 
 */
  __pyx_tuple__90 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_v); if (unlikely(!__pyx_tuple__90)) __PYX_ERR(0, 808, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__90);
  __Pyx_GIVEREF(__pyx_tuple__90);
  __pyx_codeobj__91 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__90, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_add_diagonal, 808, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__91)) __PYX_ERR(0, 808, __pyx_L1_error)

  /* "miniga4py/ga.pyx":822
 *     GA_Add_diagonal(g_a, g_v)
 * 
 * def allocate(int g_a):             # <<<<<<<<<<<<<<
 *     """Allocates memory for the handle obtained using ga.create_handle.
 * 
 */
  __pyx_tuple__92 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_a); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__92);
  __Pyx_GIVEREF(__pyx_tuple__92);
  __pyx_codeobj__93 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__92, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_allocate, 822, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__93)) __PYX_ERR(0, 822, __pyx_L1_error)

  /* "miniga4py/ga.pyx":842
 *     return False
 * 
 * def brdcst(buffer, int root=0):             # <<<<<<<<<<<<<<
 *     """Broadcast from process root to all other processes.
 * 
 */
  __pyx_tuple__94 = PyTuple_Pack(3, __pyx_n_s_buffer, __pyx_n_s_root, __pyx_n_s_buffer_nd); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(0, 842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__94);
  __Pyx_GIVEREF(__pyx_tuple__94);
  __pyx_codeobj__95 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__94, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_brdcst, 842, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__95)) __PYX_ERR(0, 842, __pyx_L1_error)

  /* "miniga4py/ga.pyx":869
 *     return buffer_nd
 * 
 * def check_handle(int g_a, message):             # <<<<<<<<<<<<<<
 *     """Checks that the array handle g_a is valid.
 * 
 */
  __pyx_tuple__96 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_message); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(0, 869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__96);
  __Pyx_GIVEREF(__pyx_tuple__96);
  __pyx_codeobj__97 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__96, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_check_handle, 869, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__97)) __PYX_ERR(0, 869, __pyx_L1_error)

  /* "miniga4py/ga.pyx":879
 *     GA_Check_handle(g_a, b(message))
 * 
 * def cluster_nnodes():             # <<<<<<<<<<<<<<
 *     """Returns the total number of nodes that the program is running on.
 * 
 */
  __pyx_codeobj__98 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_cluster_nnodes, 879, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__98)) __PYX_ERR(0, 879, __pyx_L1_error)

  /* "miniga4py/ga.pyx":890
 *     return GA_Cluster_nnodes()
 * 
 * def cluster_nodeid(int proc=-1):             # <<<<<<<<<<<<<<
 *     """Returns the node ID of this process or the given process.
 * 
 */
  __pyx_tuple__99 = PyTuple_Pack(1, __pyx_n_s_proc); if (unlikely(!__pyx_tuple__99)) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__99);
  __Pyx_GIVEREF(__pyx_tuple__99);
  __pyx_codeobj__100 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__99, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_cluster_nodeid, 890, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__100)) __PYX_ERR(0, 890, __pyx_L1_error)

  /* "miniga4py/ga.pyx":907
 *     return GA_Cluster_nodeid()
 * 
 * def cluster_proc_nodeid(int proc):             # <<<<<<<<<<<<<<
 *     """Returns the node ID of the specified process.
 * 
 */
  __pyx_tuple__101 = PyTuple_Pack(2, __pyx_n_s_proc, __pyx_n_s_proc); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__101);
  __Pyx_GIVEREF(__pyx_tuple__101);
  __pyx_codeobj__102 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__101, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_cluster_proc_nodeid, 907, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__102)) __PYX_ERR(0, 907, __pyx_L1_error)

  /* "miniga4py/ga.pyx":918
 *     return GA_Cluster_proc_nodeid(proc)
 * 
 * def cluster_nprocs(int node):             # <<<<<<<<<<<<<<
 *     """Returns the number of processors available on the given node.
 * 
 */
  __pyx_tuple__103 = PyTuple_Pack(2, __pyx_n_s_node, __pyx_n_s_node); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(0, 918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__103);
  __Pyx_GIVEREF(__pyx_tuple__103);
  __pyx_codeobj__104 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__103, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_cluster_nprocs, 918, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__104)) __PYX_ERR(0, 918, __pyx_L1_error)

  /* "miniga4py/ga.pyx":926
 *     return GA_Cluster_nprocs(node)
 * 
 * def cluster_procid(int node, int proc):             # <<<<<<<<<<<<<<
 *     """Returns the proc ID associated with node and local proc ID.
 * 
 */
  __pyx_tuple__105 = PyTuple_Pack(2, __pyx_n_s_node, __pyx_n_s_proc); if (unlikely(!__pyx_tuple__105)) __PYX_ERR(0, 926, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__105);
  __Pyx_GIVEREF(__pyx_tuple__105);
  __pyx_codeobj__106 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__105, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_cluster_procid, 926, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__106)) __PYX_ERR(0, 926, __pyx_L1_error)

  /* "miniga4py/ga.pyx":937
 *     return GA_Cluster_procid(node, proc)
 * 
 * def compare_distr(int g_a, int g_b):             # <<<<<<<<<<<<<<
 *     """Compares the distributions of two global arrays.
 * 
 */
  __pyx_tuple__107 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_b); if (unlikely(!__pyx_tuple__107)) __PYX_ERR(0, 937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__107);
  __Pyx_GIVEREF(__pyx_tuple__107);
  __pyx_codeobj__108 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__107, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_compare_distr, 937, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__108)) __PYX_ERR(0, 937, __pyx_L1_error)

  /* "miniga4py/ga.pyx":949
 *     return False
 * 
 * def copy(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None,             # <<<<<<<<<<<<<<
 *         bint trans=False):
 *     """Copies elements from array g_a into array g_b.
 */
  __pyx_tuple__109 = PyTuple_Pack(12, __pyx_n_s_g_a, __pyx_n_s_g_b, __pyx_n_s_alo, __pyx_n_s_ahi, __pyx_n_s_blo, __pyx_n_s_bhi, __pyx_n_s_trans, __pyx_n_s_alo_nd, __pyx_n_s_ahi_nd, __pyx_n_s_blo_nd, __pyx_n_s_bhi_nd, __pyx_n_s_trans_c); if (unlikely(!__pyx_tuple__109)) __PYX_ERR(0, 949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__109);
  __Pyx_GIVEREF(__pyx_tuple__109);
  __pyx_codeobj__110 = (PyObject*)__Pyx_PyCode_New(7, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__109, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_copy, 949, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__110)) __PYX_ERR(0, 949, __pyx_L1_error)

  /* "miniga4py/ga.pyx":996
 *                 g_b, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 * 
 * def create(int gtype, dims, name="", chunk=None, int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Creates an n-dimensional array using the regular distribution model.
 * 
 */
  __pyx_tuple__111 = PyTuple_Pack(7, __pyx_n_s_gtype, __pyx_n_s_dims, __pyx_n_s_name, __pyx_n_s_chunk, __pyx_n_s_pgroup, __pyx_n_s_dims_nd, __pyx_n_s_chunk_nd); if (unlikely(!__pyx_tuple__111)) __PYX_ERR(0, 996, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__111);
  __Pyx_GIVEREF(__pyx_tuple__111);
  __pyx_codeobj__112 = (PyObject*)__Pyx_PyCode_New(5, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__111, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_create, 996, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__112)) __PYX_ERR(0, 996, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1041
 *                 b(name), NULL, pgroup)
 * 
 * def create_ghosts(int gtype, dims, width, name="", chunk=None,             # <<<<<<<<<<<<<<
 *         int pgroup=-1):
 *     """Creates an array with a layer of ghost cells around the visible data.
 */
  __pyx_tuple__113 = PyTuple_Pack(9, __pyx_n_s_gtype, __pyx_n_s_dims, __pyx_n_s_width, __pyx_n_s_name, __pyx_n_s_chunk, __pyx_n_s_pgroup, __pyx_n_s_dims_nd, __pyx_n_s_chunk_nd, __pyx_n_s_width_nd); if (unlikely(!__pyx_tuple__113)) __PYX_ERR(0, 1041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__113);
  __Pyx_GIVEREF(__pyx_tuple__113);
  __pyx_codeobj__114 = (PyObject*)__Pyx_PyCode_New(6, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_create_ghosts, 1041, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__114)) __PYX_ERR(0, 1041, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1093
 *                 NULL, pgroup)
 * 
 * def create_handle():             # <<<<<<<<<<<<<<
 *     """Returns a global array handle that can be used to create a new array.
 * 
 */
  __pyx_codeobj__115 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_create_handle, 1093, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__115)) __PYX_ERR(0, 1093, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1108
 *     return GA_Create_handle()
 * 
 * def create_irreg(int gtype, dims, block, map, name="", int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Creates an array by following the user-specified distribution.
 * 
 */
  __pyx_tuple__116 = PyTuple_Pack(9, __pyx_n_s_gtype, __pyx_n_s_dims, __pyx_n_s_block, __pyx_n_s_map, __pyx_n_s_name, __pyx_n_s_pgroup, __pyx_n_s_dims_nd, __pyx_n_s_block_nd, __pyx_n_s_map_nd); if (unlikely(!__pyx_tuple__116)) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__116);
  __Pyx_GIVEREF(__pyx_tuple__116);
  __pyx_codeobj__117 = (PyObject*)__Pyx_PyCode_New(6, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__116, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_create_irreg, 1108, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__117)) __PYX_ERR(0, 1108, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1149
 *             <int64_t*>block_nd.data, <int64_t*>map_nd.data, pgroup)
 * 
 * def create_ghosts_irreg(int gtype, dims, width, block, map, name="",             # <<<<<<<<<<<<<<
 *         int pgroup=-1):
 *     """Creates an array with a layer of ghost cells around the visible data.
 */
  __pyx_tuple__118 = PyTuple_Pack(11, __pyx_n_s_gtype, __pyx_n_s_dims, __pyx_n_s_width, __pyx_n_s_block, __pyx_n_s_map, __pyx_n_s_name, __pyx_n_s_pgroup, __pyx_n_s_dims_nd, __pyx_n_s_width_nd, __pyx_n_s_block_nd, __pyx_n_s_map_nd); if (unlikely(!__pyx_tuple__118)) __PYX_ERR(0, 1149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__118);
  __Pyx_GIVEREF(__pyx_tuple__118);
  __pyx_codeobj__119 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__118, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_create_ghosts_irreg, 1149, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__119)) __PYX_ERR(0, 1149, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1199
 *             <int64_t*>block_nd.data, <int64_t*>map_nd.data, pgroup)
 * 
 * def create_mutexes(int number):             # <<<<<<<<<<<<<<
 *     """Creates a set containing the number of mutexes.
 * 
 */
  __pyx_tuple__120 = PyTuple_Pack(2, __pyx_n_s_number, __pyx_n_s_number); if (unlikely(!__pyx_tuple__120)) __PYX_ERR(0, 1199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__120);
  __Pyx_GIVEREF(__pyx_tuple__120);
  __pyx_codeobj__121 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__120, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_create_mutexes, 1199, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__121)) __PYX_ERR(0, 1199, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1221
 *     return False
 * 
 * def deregister_type(int type):             # <<<<<<<<<<<<<<
 *     """Removes the data type previously registered using register_type.
 * 
 */
  __pyx_tuple__122 = PyTuple_Pack(2, __pyx_n_s_type, __pyx_n_s_type); if (unlikely(!__pyx_tuple__122)) __PYX_ERR(0, 1221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__122);
  __Pyx_GIVEREF(__pyx_tuple__122);
  __pyx_codeobj__123 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__122, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_deregister_type, 1221, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__123)) __PYX_ERR(0, 1221, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1231
 *     return NGA_Deregister_type(type)
 * 
 * def destroy(int g_a):             # <<<<<<<<<<<<<<
 *     """Deallocates the array and frees any associated resources.
 * 
 */
  __pyx_tuple__124 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_a); if (unlikely(!__pyx_tuple__124)) __PYX_ERR(0, 1231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__124);
  __Pyx_GIVEREF(__pyx_tuple__124);
  __pyx_codeobj__125 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__124, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_destroy, 1231, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__125)) __PYX_ERR(0, 1231, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1239
 *     GA_Destroy(g_a)
 * 
 * def destroy_mutexes():             # <<<<<<<<<<<<<<
 *     """Destroys the set of mutexes created with ga_create_mutexes.
 * 
 */
  __pyx_codeobj__126 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_destroy_mutexes, 1239, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__126)) __PYX_ERR(0, 1239, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1251
 *     return False
 * 
 * def diag(int g_a, int g_s, int g_v, evalues=None):             # <<<<<<<<<<<<<<
 *     """Solve the generalized eigen-value problem.
 * 
 */
  __pyx_tuple__127 = PyTuple_Pack(6, __pyx_n_s_g_a, __pyx_n_s_g_s, __pyx_n_s_g_v, __pyx_n_s_evalues, __pyx_n_s_gtype, __pyx_n_s_dims); if (unlikely(!__pyx_tuple__127)) __PYX_ERR(0, 1251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__127);
  __Pyx_GIVEREF(__pyx_tuple__127);
  __pyx_codeobj__128 = (PyObject*)__Pyx_PyCode_New(4, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__127, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_diag, 1251, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__128)) __PYX_ERR(0, 1251, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1277
 *     return evalues
 * 
 * def diag_reuse(int control, int g_a, int g_s, int g_v, evalues=None):             # <<<<<<<<<<<<<<
 *     """Solve the generalized eigen-value problem.
 * 
 */
  __pyx_tuple__129 = PyTuple_Pack(7, __pyx_n_s_control, __pyx_n_s_g_a, __pyx_n_s_g_s, __pyx_n_s_g_v, __pyx_n_s_evalues, __pyx_n_s_gtype, __pyx_n_s_dims); if (unlikely(!__pyx_tuple__129)) __PYX_ERR(0, 1277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__129);
  __Pyx_GIVEREF(__pyx_tuple__129);
  __pyx_codeobj__130 = (PyObject*)__Pyx_PyCode_New(5, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__129, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_diag_reuse, 1277, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__130)) __PYX_ERR(0, 1277, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1311
 *     return evalues
 * 
 * def diag_std(int g_a, int g_v, evalues=None):             # <<<<<<<<<<<<<<
 *     """Solve the standard (non-generalized) eigenvalue problem.
 * 
 */
  __pyx_tuple__131 = PyTuple_Pack(5, __pyx_n_s_g_a, __pyx_n_s_g_v, __pyx_n_s_evalues, __pyx_n_s_gtype, __pyx_n_s_dims); if (unlikely(!__pyx_tuple__131)) __PYX_ERR(0, 1311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__131);
  __Pyx_GIVEREF(__pyx_tuple__131);
  __pyx_codeobj__132 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__131, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_diag_std, 1311, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__132)) __PYX_ERR(0, 1311, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1353
 *     return lo,hi
 * 
 * def dot(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None,             # <<<<<<<<<<<<<<
 *         bint ta=False, bint tb=False):
 *     """Computes the element-wise dot product of two arrays.
 */
  __pyx_tuple__133 = PyTuple_Pack(19, __pyx_n_s_g_a, __pyx_n_s_g_b, __pyx_n_s_alo, __pyx_n_s_ahi, __pyx_n_s_blo, __pyx_n_s_bhi, __pyx_n_s_ta, __pyx_n_s_tb, __pyx_n_s_alo_nd, __pyx_n_s_ahi_nd, __pyx_n_s_blo_nd, __pyx_n_s_bhi_nd, __pyx_n_s_ta_c, __pyx_n_s_tb_c, __pyx_n_s_gtype, __pyx_n_s_pfcv, __pyx_n_s_pdcv, __pyx_n_s_gfcv, __pyx_n_s_gdcv); if (unlikely(!__pyx_tuple__133)) __PYX_ERR(0, 1353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__133);
  __Pyx_GIVEREF(__pyx_tuple__133);
  __pyx_codeobj__134 = (PyObject*)__Pyx_PyCode_New(8, 0, 19, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__133, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_dot, 1353, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__134)) __PYX_ERR(0, 1353, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1462
 *             raise TypeError
 * 
 * def duplicate(int g_a, name=""):             # <<<<<<<<<<<<<<
 *     """Creates a new array by applying all the properties of another existing
 *     array.
 */
  __pyx_tuple__135 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_name); if (unlikely(!__pyx_tuple__135)) __PYX_ERR(0, 1462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__135);
  __Pyx_GIVEREF(__pyx_tuple__135);
  __pyx_codeobj__136 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__135, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_duplicate, 1462, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__136)) __PYX_ERR(0, 1462, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1479
 *     return GA_Duplicate(g_a, b(name))
 * 
 * def elem_divide(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,             # <<<<<<<<<<<<<<
 *         bhi=None, clo=None, chi=None):
 *     """Computes the element-wise quotient of the two arrays.
 */
  __pyx_tuple__137 = PyTuple_Pack(15, __pyx_n_s_g_a, __pyx_n_s_g_b, __pyx_n_s_g_c, __pyx_n_s_alo, __pyx_n_s_ahi, __pyx_n_s_blo, __pyx_n_s_bhi, __pyx_n_s_clo, __pyx_n_s_chi, __pyx_n_s_alo_nd, __pyx_n_s_ahi_nd, __pyx_n_s_blo_nd, __pyx_n_s_bhi_nd, __pyx_n_s_clo_nd, __pyx_n_s_chi_nd); if (unlikely(!__pyx_tuple__137)) __PYX_ERR(0, 1479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__137);
  __Pyx_GIVEREF(__pyx_tuple__137);
  __pyx_codeobj__138 = (PyObject*)__Pyx_PyCode_New(9, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__137, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_elem_divide, 1479, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__138)) __PYX_ERR(0, 1479, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1531
 *                 g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def elem_maximum(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,             # <<<<<<<<<<<<<<
 *         bhi=None, clo=None, chi=None):
 *     """Computes the element-wise maximum of the two arrays.
 */
  __pyx_tuple__139 = PyTuple_Pack(15, __pyx_n_s_g_a, __pyx_n_s_g_b, __pyx_n_s_g_c, __pyx_n_s_alo, __pyx_n_s_ahi, __pyx_n_s_blo, __pyx_n_s_bhi, __pyx_n_s_clo, __pyx_n_s_chi, __pyx_n_s_alo_nd, __pyx_n_s_ahi_nd, __pyx_n_s_blo_nd, __pyx_n_s_bhi_nd, __pyx_n_s_clo_nd, __pyx_n_s_chi_nd); if (unlikely(!__pyx_tuple__139)) __PYX_ERR(0, 1531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__139);
  __Pyx_GIVEREF(__pyx_tuple__139);
  __pyx_codeobj__140 = (PyObject*)__Pyx_PyCode_New(9, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__139, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_elem_maximum, 1531, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__140)) __PYX_ERR(0, 1531, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1585
 *                 g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def elem_minimum(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,             # <<<<<<<<<<<<<<
 *         bhi=None, clo=None, chi=None):
 *     """Computes the element-wise minimum of the two arrays.
 */
  __pyx_tuple__141 = PyTuple_Pack(15, __pyx_n_s_g_a, __pyx_n_s_g_b, __pyx_n_s_g_c, __pyx_n_s_alo, __pyx_n_s_ahi, __pyx_n_s_blo, __pyx_n_s_bhi, __pyx_n_s_clo, __pyx_n_s_chi, __pyx_n_s_alo_nd, __pyx_n_s_ahi_nd, __pyx_n_s_blo_nd, __pyx_n_s_bhi_nd, __pyx_n_s_clo_nd, __pyx_n_s_chi_nd); if (unlikely(!__pyx_tuple__141)) __PYX_ERR(0, 1585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__141);
  __Pyx_GIVEREF(__pyx_tuple__141);
  __pyx_codeobj__142 = (PyObject*)__Pyx_PyCode_New(9, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__141, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_elem_minimum, 1585, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__142)) __PYX_ERR(0, 1585, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1639
 *                 g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def elem_multiply(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,             # <<<<<<<<<<<<<<
 *         bhi=None, clo=None, chi=None):
 *     """Computes the element-wise product of the two arrays.
 */
  __pyx_tuple__143 = PyTuple_Pack(15, __pyx_n_s_g_a, __pyx_n_s_g_b, __pyx_n_s_g_c, __pyx_n_s_alo, __pyx_n_s_ahi, __pyx_n_s_blo, __pyx_n_s_bhi, __pyx_n_s_clo, __pyx_n_s_chi, __pyx_n_s_alo_nd, __pyx_n_s_ahi_nd, __pyx_n_s_blo_nd, __pyx_n_s_bhi_nd, __pyx_n_s_clo_nd, __pyx_n_s_chi_nd); if (unlikely(!__pyx_tuple__143)) __PYX_ERR(0, 1639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__143);
  __Pyx_GIVEREF(__pyx_tuple__143);
  __pyx_codeobj__144 = (PyObject*)__Pyx_PyCode_New(9, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__143, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_elem_multiply, 1639, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__144)) __PYX_ERR(0, 1639, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1689
 *                 g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def error(message, int code=1):             # <<<<<<<<<<<<<<
 *     """Prints message and aborts safely with code."""
 *     GA_Error(b(message), code)
 */
  __pyx_tuple__145 = PyTuple_Pack(2, __pyx_n_s_message, __pyx_n_s_code); if (unlikely(!__pyx_tuple__145)) __PYX_ERR(0, 1689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__145);
  __Pyx_GIVEREF(__pyx_tuple__145);
  __pyx_codeobj__146 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__145, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_error, 1689, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__146)) __PYX_ERR(0, 1689, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1693
 *     GA_Error(b(message), code)
 * 
 * def fence():             # <<<<<<<<<<<<<<
 *     """Blocks the calling process until all the data transfers corresponding
 *     to GA operations called after ga.init_fence() complete.
 */
  __pyx_codeobj__147 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_fence, 1693, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__147)) __PYX_ERR(0, 1693, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1726
 *     GA_Fence()
 * 
 * def fill(int g_a, value, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Assign a single value to all elements in the array or patch.
 * 
 */
  __pyx_tuple__148 = PyTuple_Pack(16, __pyx_n_s_g_a, __pyx_n_s_value, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_lo_nd, __pyx_n_s_hi_nd, __pyx_n_s_ivalue, __pyx_n_s_lvalue, __pyx_n_s_llvalue, __pyx_n_s_fvalue, __pyx_n_s_dvalue, __pyx_n_s_ldvalue, __pyx_n_s_fcvalue, __pyx_n_s_dcvalue, __pyx_n_s_vvalue, __pyx_n_s_gtype); if (unlikely(!__pyx_tuple__148)) __PYX_ERR(0, 1726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__148);
  __Pyx_GIVEREF(__pyx_tuple__148);
  __pyx_codeobj__149 = (PyObject*)__Pyx_PyCode_New(4, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__148, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_fill, 1726, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__149)) __PYX_ERR(0, 1726, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1760
 *                 g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, vvalue)
 * 
 * def gather(int g_a, subsarray, np.ndarray values=None):             # <<<<<<<<<<<<<<
 *     """Gathers array elements from a global array into a local array.
 * 
 */
  __pyx_tuple__150 = PyTuple_Pack(8, __pyx_n_s_g_a, __pyx_n_s_subsarray, __pyx_n_s_values, __pyx_n_s_subsarray1_nd, __pyx_n_s_subsarray2_nd, __pyx_n_s_gtype, __pyx_n_s_ndim, __pyx_n_s_n); if (unlikely(!__pyx_tuple__150)) __PYX_ERR(0, 1760, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__150);
  __Pyx_GIVEREF(__pyx_tuple__150);
  __pyx_codeobj__151 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__150, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_gather, 1760, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__151)) __PYX_ERR(0, 1760, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1819
 *     return values
 * 
 * def gemm(bint ta, bint tb, int64_t m, int64_t n, int64_t k,             # <<<<<<<<<<<<<<
 *         alpha, int g_a, int g_b, beta, int g_c):
 *     """Performs one of the matrix-matrix operations.
 */
  __pyx_tuple__152 = PyTuple_Pack(25, __pyx_n_s_ta, __pyx_n_s_tb, __pyx_n_s_m, __pyx_n_s_n, __pyx_n_s_k, __pyx_n_s_alpha, __pyx_n_s_g_a, __pyx_n_s_g_b, __pyx_n_s_beta, __pyx_n_s_g_c, __pyx_n_s_gtype, __pyx_n_s_falpha, __pyx_n_s_fbeta, __pyx_n_s_dalpha, __pyx_n_s_dbeta, __pyx_n_s_fcalpha, __pyx_n_s_fcbeta, __pyx_n_s_dcalpha, __pyx_n_s_dcbeta, __pyx_n_s_ga_fcalpha, __pyx_n_s_ga_fcbeta, __pyx_n_s_ga_dcalpha, __pyx_n_s_ga_dcbeta, __pyx_n_s_ta_char, __pyx_n_s_tb_char); if (unlikely(!__pyx_tuple__152)) __PYX_ERR(0, 1819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__152);
  __Pyx_GIVEREF(__pyx_tuple__152);
  __pyx_codeobj__153 = (PyObject*)__Pyx_PyCode_New(10, 0, 25, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__152, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_gemm, 1819, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__153)) __PYX_ERR(0, 1819, __pyx_L1_error)

  /* "miniga4py/ga.pyx":1915
 *         raise TypeError
 * 
 * def get(int g_a, lo=None, hi=None, np.ndarray buffer=None):             # <<<<<<<<<<<<<<
 *     """Copies data from global array section to the local array buffer.
 * 
 */
  __pyx_tuple__154 = PyTuple_Pack(4, __pyx_n_s_g_a, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_buffer); if (unlikely(!__pyx_tuple__154)) __PYX_ERR(0, 1915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__154);
  __Pyx_GIVEREF(__pyx_tuple__154);
  __pyx_codeobj__155 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__154, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_get, 1915, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__155)) __PYX_ERR(0, 1915, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2028
 *         return buffer
 * 
 * def get_block_info(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns information about the block-cyclic distribution.
 * 
 */
  __pyx_tuple__156 = PyTuple_Pack(5, __pyx_n_s_g_a, __pyx_n_s_g_a, __pyx_n_s_num_blocks, __pyx_n_s_block_dims, __pyx_n_s_ndim); if (unlikely(!__pyx_tuple__156)) __PYX_ERR(0, 2028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__156);
  __Pyx_GIVEREF(__pyx_tuple__156);
  __pyx_codeobj__157 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__156, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_get_block_info, 2028, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__157)) __PYX_ERR(0, 2028, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2052
 *     return num_blocks,block_dims
 * 
 * def get_diag(int g_a, int g_v):             # <<<<<<<<<<<<<<
 *     """Inserts the diagonal elements of this matrix g_a into the vector g_v.
 * 
 */
  __pyx_tuple__158 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_v); if (unlikely(!__pyx_tuple__158)) __PYX_ERR(0, 2052, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__158);
  __Pyx_GIVEREF(__pyx_tuple__158);
  __pyx_codeobj__159 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__158, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_get_diag, 2052, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__159)) __PYX_ERR(0, 2052, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2064
 *     GA_Get_diag(g_a, g_v)
 * 
 * def get_debug():             # <<<<<<<<<<<<<<
 *     """Returns the value of an internal flag in the GA library whose value can
 *     be set using the ga.set_debug() subroutine.
 */
  __pyx_codeobj__160 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_get_debug, 2064, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__160)) __PYX_ERR(0, 2064, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2073
 *     return GA_Get_debug()
 * 
 * def gop(X, op):             # <<<<<<<<<<<<<<
 *     """Global operation.
 * 
 */
  __pyx_tuple__161 = PyTuple_Pack(4, __pyx_n_s_X, __pyx_n_s_op, __pyx_n_s_X_nd, __pyx_n_s_size); if (unlikely(!__pyx_tuple__161)) __PYX_ERR(0, 2073, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__161);
  __Pyx_GIVEREF(__pyx_tuple__161);
  __pyx_codeobj__162 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__161, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_gop, 2073, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__162)) __PYX_ERR(0, 2073, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2119
 *     return X_nd
 * 
 * def gop_add(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "+")
 * 
 */
  __pyx_tuple__163 = PyTuple_Pack(1, __pyx_n_s_X); if (unlikely(!__pyx_tuple__163)) __PYX_ERR(0, 2119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__163);
  __Pyx_GIVEREF(__pyx_tuple__163);
  __pyx_codeobj__164 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__163, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_gop_add, 2119, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__164)) __PYX_ERR(0, 2119, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2122
 *     return gop(X, "+")
 * 
 * def gop_multiply(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "*")
 * 
 */
  __pyx_tuple__165 = PyTuple_Pack(1, __pyx_n_s_X); if (unlikely(!__pyx_tuple__165)) __PYX_ERR(0, 2122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__165);
  __Pyx_GIVEREF(__pyx_tuple__165);
  __pyx_codeobj__166 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__165, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_gop_multiply, 2122, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__166)) __PYX_ERR(0, 2122, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2125
 *     return gop(X, "*")
 * 
 * def gop_max(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "max")
 * 
 */
  __pyx_tuple__167 = PyTuple_Pack(1, __pyx_n_s_X); if (unlikely(!__pyx_tuple__167)) __PYX_ERR(0, 2125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__167);
  __Pyx_GIVEREF(__pyx_tuple__167);
  __pyx_codeobj__168 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__167, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_gop_max, 2125, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__168)) __PYX_ERR(0, 2125, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2128
 *     return gop(X, "max")
 * 
 * def gop_min(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "min")
 * 
 */
  __pyx_tuple__169 = PyTuple_Pack(1, __pyx_n_s_X); if (unlikely(!__pyx_tuple__169)) __PYX_ERR(0, 2128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__169);
  __Pyx_GIVEREF(__pyx_tuple__169);
  __pyx_codeobj__170 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__169, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_gop_min, 2128, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__170)) __PYX_ERR(0, 2128, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2131
 *     return gop(X, "min")
 * 
 * def gop_absmax(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "absmax")
 * 
 */
  __pyx_tuple__171 = PyTuple_Pack(1, __pyx_n_s_X); if (unlikely(!__pyx_tuple__171)) __PYX_ERR(0, 2131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__171);
  __Pyx_GIVEREF(__pyx_tuple__171);
  __pyx_codeobj__172 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__171, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_gop_absmax, 2131, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__172)) __PYX_ERR(0, 2131, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2134
 *     return gop(X, "absmax")
 * 
 * def gop_absmin(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "absmin")
 * 
 */
  __pyx_tuple__173 = PyTuple_Pack(1, __pyx_n_s_X); if (unlikely(!__pyx_tuple__173)) __PYX_ERR(0, 2134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__173);
  __Pyx_GIVEREF(__pyx_tuple__173);
  __pyx_codeobj__174 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__173, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_gop_absmin, 2134, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__174)) __PYX_ERR(0, 2134, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2137
 *     return gop(X, "absmin")
 * 
 * def has_ghosts(int g_a):             # <<<<<<<<<<<<<<
 *     """Determines whether any dimension of the given array has ghost cells.
 * 
 */
  __pyx_tuple__175 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_a); if (unlikely(!__pyx_tuple__175)) __PYX_ERR(0, 2137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__175);
  __Pyx_GIVEREF(__pyx_tuple__175);
  __pyx_codeobj__176 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__175, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_has_ghosts, 2137, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__176)) __PYX_ERR(0, 2137, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2153
 *     return False
 * 
 * def init_fence():             # <<<<<<<<<<<<<<
 *     """Initializes tracing of completion status of data movement operations.
 * 
 */
  __pyx_codeobj__177 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_init_fence, 2153, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__177)) __PYX_ERR(0, 2153, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2161
 *     GA_Init_fence()
 * 
 * def initialize():             # <<<<<<<<<<<<<<
 *     """Allocates and initializes internal data structures in Global Arrays.
 * 
 */
  __pyx_tuple__178 = PyTuple_Pack(1, __pyx_n_s_atexit); if (unlikely(!__pyx_tuple__178)) __PYX_ERR(0, 2161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__178);
  __Pyx_GIVEREF(__pyx_tuple__178);
  __pyx_codeobj__179 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__178, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_initialize, 2161, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__179)) __PYX_ERR(0, 2161, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2174
 *     _initialized = True
 * 
 * def initialize_ltd(size_t limit):             # <<<<<<<<<<<<<<
 *     """Allocates and initializes internal data structures and sets limit for
 *     memory used in global arrays.
 */
  __pyx_tuple__180 = PyTuple_Pack(2, __pyx_n_s_limit, __pyx_n_s_limit); if (unlikely(!__pyx_tuple__180)) __PYX_ERR(0, 2174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__180);
  __Pyx_GIVEREF(__pyx_tuple__180);
  __pyx_codeobj__181 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__180, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_initialize_ltd, 2174, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__181)) __PYX_ERR(0, 2174, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2193
 *     _initialized = True
 * 
 * def initialized():             # <<<<<<<<<<<<<<
 *     """Returns whether ga has been initialized."""
 *     return _initialized
 */
  __pyx_codeobj__182 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_initialized, 2193, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__182)) __PYX_ERR(0, 2193, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2210
 *     return dims
 * 
 * def inquire_memory():             # <<<<<<<<<<<<<<
 *     """Returns amount of memory (in bytes) used in the allocated global arrays
 *     on the calling processor.
 */
  __pyx_codeobj__183 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_inquire_memory, 2210, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__183)) __PYX_ERR(0, 2210, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2219
 *     return GA_Inquire_memory()
 * 
 * def inquire_name(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns the name of an array represented by the handle g_a.
 * 
 */
  __pyx_tuple__184 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_a); if (unlikely(!__pyx_tuple__184)) __PYX_ERR(0, 2219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__184);
  __Pyx_GIVEREF(__pyx_tuple__184);
  __pyx_codeobj__185 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__184, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_inquire_name, 2219, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__185)) __PYX_ERR(0, 2219, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2237
 *     return gtype
 * 
 * def is_mirrored(int g_a):             # <<<<<<<<<<<<<<
 *     """Checks whether the array is mirrored.
 * 
 */
  __pyx_tuple__186 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_a); if (unlikely(!__pyx_tuple__186)) __PYX_ERR(0, 2237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__186);
  __Pyx_GIVEREF(__pyx_tuple__186);
  __pyx_codeobj__187 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__186, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_is_mirrored, 2237, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__187)) __PYX_ERR(0, 2237, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2249
 *     return False
 * 
 * def llt_solve(int g_a, int g_b):             # <<<<<<<<<<<<<<
 *     """Solves a system of linear equations
 * 
 */
  __pyx_tuple__188 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_b); if (unlikely(!__pyx_tuple__188)) __PYX_ERR(0, 2249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__188);
  __Pyx_GIVEREF(__pyx_tuple__188);
  __pyx_codeobj__189 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__188, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_llt_solve, 2249, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__189)) __PYX_ERR(0, 2249, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2271
 *     return GA_Llt_solve(g_a, g_b)
 * 
 * def locate(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Return the GA compute process id that 'owns' the data.
 * 
 */
  __pyx_tuple__190 = PyTuple_Pack(3, __pyx_n_s_g_a, __pyx_n_s_subscript, __pyx_n_s_subscript_nd); if (unlikely(!__pyx_tuple__190)) __PYX_ERR(0, 2271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__190);
  __Pyx_GIVEREF(__pyx_tuple__190);
  __pyx_codeobj__191 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__190, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_locate, 2271, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__191)) __PYX_ERR(0, 2271, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2289
 *     return NGA_Locate64(g_a, <int64_t*>subscript_nd.data)
 * 
 * def locate_nnodes(int g_a, lo, hi):             # <<<<<<<<<<<<<<
 *     """Return the number of process which own the specified patch.
 * 
 */
  __pyx_tuple__192 = PyTuple_Pack(6, __pyx_n_s_g_a, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_lo_nd, __pyx_n_s_hi_nd, __pyx_n_s_result); if (unlikely(!__pyx_tuple__192)) __PYX_ERR(0, 2289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__192);
  __Pyx_GIVEREF(__pyx_tuple__192);
  __pyx_codeobj__193 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__192, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_locate_nnodes, 2289, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__193)) __PYX_ERR(0, 2289, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2300
 *     return NGA_Locate_nnodes64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 * def locate_region(int g_a, lo, hi):             # <<<<<<<<<<<<<<
 *     """Return the list of the GA processes id that 'own' the data.
 * 
 */
  __pyx_tuple__194 = PyTuple_Pack(11, __pyx_n_s_g_a, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_lo_nd, __pyx_n_s_hi_nd, __pyx_n_s_map, __pyx_n_s_map_reshape, __pyx_n_s_procs, __pyx_n_s_np_result, __pyx_n_s_np_guess, __pyx_n_s_ndim); if (unlikely(!__pyx_tuple__194)) __PYX_ERR(0, 2300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__194);
  __Pyx_GIVEREF(__pyx_tuple__194);
  __pyx_codeobj__195 = (PyObject*)__Pyx_PyCode_New(3, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__194, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_locate_region, 2300, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__195)) __PYX_ERR(0, 2300, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2337
 *     return map_reshape,procs
 * 
 * def lock(int mutex):             # <<<<<<<<<<<<<<
 *     """Locks a mutex object identified by the mutex number.
 * 
 */
  __pyx_tuple__196 = PyTuple_Pack(2, __pyx_n_s_mutex, __pyx_n_s_mutex); if (unlikely(!__pyx_tuple__196)) __PYX_ERR(0, 2337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__196);
  __Pyx_GIVEREF(__pyx_tuple__196);
  __pyx_codeobj__197 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__196, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_lock, 2337, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__197)) __PYX_ERR(0, 2337, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2346
 *     GA_Lock(mutex)
 * 
 * def lu_solve(int g_a, int g_b, bint trans=False):             # <<<<<<<<<<<<<<
 *     """Solve the system of linear equations op(A)X = B based on the LU
 *     factorization.
 */
  __pyx_tuple__198 = PyTuple_Pack(4, __pyx_n_s_g_a, __pyx_n_s_g_b, __pyx_n_s_trans, __pyx_n_s_ctrans); if (unlikely(!__pyx_tuple__198)) __PYX_ERR(0, 2346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__198);
  __Pyx_GIVEREF(__pyx_tuple__198);
  __pyx_codeobj__199 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__198, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_lu_solve, 2346, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__199)) __PYX_ERR(0, 2346, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2374
 *     GA_Lu_solve(ctrans, g_a, g_b)
 * 
 * def mask_sync(bint first, bint last):             # <<<<<<<<<<<<<<
 *     """This subroutine can be used to remove synchronization calls from around
 *     collective operations.
 */
  __pyx_tuple__200 = PyTuple_Pack(2, __pyx_n_s_first, __pyx_n_s_last); if (unlikely(!__pyx_tuple__200)) __PYX_ERR(0, 2374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__200);
  __Pyx_GIVEREF(__pyx_tuple__200);
  __pyx_codeobj__201 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__200, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_mask_sync, 2374, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__201)) __PYX_ERR(0, 2374, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2394
 *     GA_Mask_sync(first,last)
 * 
 * def matmul_patch(bint transa, bint transb, alpha, beta,             # <<<<<<<<<<<<<<
 *         int g_a, alo, ahi,
 *         int g_b, blo, bhi,
 */
  __pyx_tuple__202 = PyTuple_Pack(40, __pyx_n_s_transa, __pyx_n_s_transb, __pyx_n_s_alpha, __pyx_n_s_beta, __pyx_n_s_g_a, __pyx_n_s_alo, __pyx_n_s_ahi, __pyx_n_s_g_b, __pyx_n_s_blo, __pyx_n_s_bhi, __pyx_n_s_g_c, __pyx_n_s_clo, __pyx_n_s_chi, __pyx_n_s_alo_nd, __pyx_n_s_ahi_nd, __pyx_n_s_blo_nd, __pyx_n_s_bhi_nd, __pyx_n_s_clo_nd, __pyx_n_s_chi_nd, __pyx_n_s_gtype, __pyx_n_s_ialpha, __pyx_n_s_ibeta, __pyx_n_s_lalpha, __pyx_n_s_lbeta, __pyx_n_s_llalpha, __pyx_n_s_llbeta, __pyx_n_s_falpha, __pyx_n_s_fbeta, __pyx_n_s_dalpha, __pyx_n_s_dbeta, __pyx_n_s_ldalpha, __pyx_n_s_ldbeta, __pyx_n_s_fcalpha, __pyx_n_s_fcbeta, __pyx_n_s_dcalpha, __pyx_n_s_dcbeta, __pyx_n_s_valpha, __pyx_n_s_vbeta, __pyx_n_s_char_transa, __pyx_n_s_char_transb); if (unlikely(!__pyx_tuple__202)) __PYX_ERR(0, 2394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__202);
  __Pyx_GIVEREF(__pyx_tuple__202);
  __pyx_codeobj__203 = (PyObject*)__Pyx_PyCode_New(13, 0, 40, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__202, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_matmul_patch, 2394, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__203)) __PYX_ERR(0, 2394, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2452
 *             g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def median(int g_a, int g_b, int g_c, int g_m,             # <<<<<<<<<<<<<<
 *         alo=None, ahi=None, blo=None, bhi=None,
 *         clo=None, chi=None, mlo=None, mhi=None):
 */
  __pyx_tuple__204 = PyTuple_Pack(20, __pyx_n_s_g_a, __pyx_n_s_g_b, __pyx_n_s_g_c, __pyx_n_s_g_m, __pyx_n_s_alo, __pyx_n_s_ahi, __pyx_n_s_blo, __pyx_n_s_bhi, __pyx_n_s_clo, __pyx_n_s_chi, __pyx_n_s_mlo, __pyx_n_s_mhi, __pyx_n_s_alo_nd, __pyx_n_s_ahi_nd, __pyx_n_s_blo_nd, __pyx_n_s_bhi_nd, __pyx_n_s_clo_nd, __pyx_n_s_chi_nd, __pyx_n_s_mlo_nd, __pyx_n_s_mhi_nd); if (unlikely(!__pyx_tuple__204)) __PYX_ERR(0, 2452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__204);
  __Pyx_GIVEREF(__pyx_tuple__204);
  __pyx_codeobj__205 = (PyObject*)__Pyx_PyCode_New(12, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__204, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_median, 2452, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__205)) __PYX_ERR(0, 2452, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2509
 *                 g_m, <int64_t*>mlo_nd.data, <int64_t*>mhi_nd.data)
 * 
 * def memory_avail():             # <<<<<<<<<<<<<<
 *     """Returns amount of memory (in bytes) left for allocation of new global
 *     arrays on the calling processor.
 */
  __pyx_codeobj__206 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_memory_avail, 2509, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__206)) __PYX_ERR(0, 2509, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2526
 *     return GA_Memory_avail()
 * 
 * def memory_limited():             # <<<<<<<<<<<<<<
 *     """Indicates if limit is set on memory usage in Global Arrays on the
 *     calling processor.
 */
  __pyx_codeobj__207 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_memory_limited, 2526, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__207)) __PYX_ERR(0, 2526, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2539
 *     return False
 * 
 * def merge_distr_patch(int g_a, alo, ahi, int g_b, blo, bhi):             # <<<<<<<<<<<<<<
 *     """This function merges all copies of a patch of a mirrored array (g_a)
 *     into a patch in a distributed array (g_b).
 */
  __pyx_tuple__208 = PyTuple_Pack(10, __pyx_n_s_g_a, __pyx_n_s_alo, __pyx_n_s_ahi, __pyx_n_s_g_b, __pyx_n_s_blo, __pyx_n_s_bhi, __pyx_n_s_alo_nd, __pyx_n_s_ahi_nd, __pyx_n_s_blo_nd, __pyx_n_s_bhi_nd); if (unlikely(!__pyx_tuple__208)) __PYX_ERR(0, 2539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__208);
  __Pyx_GIVEREF(__pyx_tuple__208);
  __pyx_codeobj__209 = (PyObject*)__Pyx_PyCode_New(6, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__208, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_merge_distr_patch, 2539, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__209)) __PYX_ERR(0, 2539, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2568
 *             g_b, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 * 
 * def merge_mirrored(int g_a):             # <<<<<<<<<<<<<<
 *     """This subroutine merges mirrored arrays by adding the contents of each
 *     array across nodes.
 */
  __pyx_tuple__210 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_a); if (unlikely(!__pyx_tuple__210)) __PYX_ERR(0, 2568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__210);
  __Pyx_GIVEREF(__pyx_tuple__210);
  __pyx_codeobj__211 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__210, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_merge_mirrored, 2568, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__211)) __PYX_ERR(0, 2568, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2585
 *     GA_Merge_mirrored(g_a)
 * 
 * def nbacc(int g_a, buffer, lo=None, hi=None, alpha=None):             # <<<<<<<<<<<<<<
 *     """Non-blocking version of ga.acc.
 * 
 */
  __pyx_tuple__212 = PyTuple_Pack(5, __pyx_n_s_g_a, __pyx_n_s_buffer, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_alpha); if (unlikely(!__pyx_tuple__212)) __PYX_ERR(0, 2585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__212);
  __Pyx_GIVEREF(__pyx_tuple__212);
  __pyx_codeobj__213 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__212, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_nbacc, 2585, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__213)) __PYX_ERR(0, 2585, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2618
 *     return _acc_common(g_a, buffer, lo, hi, alpha, True)
 * 
 * def nbget(int g_a, lo=None, hi=None, np.ndarray buffer=None):             # <<<<<<<<<<<<<<
 *     """Non-blocking version of the blocking ga.get operation.
 * 
 */
  __pyx_tuple__214 = PyTuple_Pack(4, __pyx_n_s_g_a, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_buffer); if (unlikely(!__pyx_tuple__214)) __PYX_ERR(0, 2618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__214);
  __Pyx_GIVEREF(__pyx_tuple__214);
  __pyx_codeobj__215 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__214, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_nbget, 2618, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__215)) __PYX_ERR(0, 2618, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2648
 *     return _get_common(g_a, lo, hi, buffer, True)
 * 
 * def nblock(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns the number of partitions of each array dimension for g_a.
 * 
 */
  __pyx_tuple__216 = PyTuple_Pack(4, __pyx_n_s_g_a, __pyx_n_s_g_a, __pyx_n_s_nblock_nd, __pyx_n_s_ndim); if (unlikely(!__pyx_tuple__216)) __PYX_ERR(0, 2648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__216);
  __Pyx_GIVEREF(__pyx_tuple__216);
  __pyx_codeobj__217 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__216, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_nblock, 2648, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__217)) __PYX_ERR(0, 2648, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2664
 *     return nblock_nd
 * 
 * def nbput(int g_a, buffer, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Non-blocking version of the blocking put operation.
 * 
 */
  __pyx_tuple__218 = PyTuple_Pack(4, __pyx_n_s_g_a, __pyx_n_s_buffer, __pyx_n_s_lo, __pyx_n_s_hi); if (unlikely(!__pyx_tuple__218)) __PYX_ERR(0, 2664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__218);
  __Pyx_GIVEREF(__pyx_tuple__218);
  __pyx_codeobj__219 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__218, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_nbput, 2664, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__219)) __PYX_ERR(0, 2664, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2691
 *     return _put_common(g_a, buffer, lo, hi, True, False)
 * 
 * def nbwait(ga_nbhdl_t nbhandle):             # <<<<<<<<<<<<<<
 *     """This function completes a non-blocking one-sided operation locally.
 * 
 */
  __pyx_tuple__220 = PyTuple_Pack(2, __pyx_n_s_nbhandle, __pyx_n_s_nbhandle); if (unlikely(!__pyx_tuple__220)) __PYX_ERR(0, 2691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__220);
  __Pyx_GIVEREF(__pyx_tuple__220);
  __pyx_codeobj__221 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__220, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_nbwait, 2691, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__221)) __PYX_ERR(0, 2691, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2709
 *     NGA_NbWait(&nbhandle)
 * 
 * def ndim(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns the number of dimensions in array represented by the handle g_a.
 * 
 */
  __pyx_tuple__222 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_a); if (unlikely(!__pyx_tuple__222)) __PYX_ERR(0, 2709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__222);
  __Pyx_GIVEREF(__pyx_tuple__222);
  __pyx_codeobj__223 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__222, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_ndim, 2709, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__223)) __PYX_ERR(0, 2709, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2723
 *     return GA_Ndim(g_a)
 * 
 * def nnodes():             # <<<<<<<<<<<<<<
 *     """Returns the number of the GA compute (user) processes.
 * 
 */
  __pyx_codeobj__224 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_nnodes, 2723, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__224)) __PYX_ERR(0, 2723, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2733
 *     return GA_Nnodes()
 * 
 * def nodeid():             # <<<<<<<<<<<<<<
 *     """Returns the GA process id (0, ..., ga.nnodes()-1) of the requesting
 *     compute process.
 */
  __pyx_codeobj__225 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_nodeid, 2733, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__225)) __PYX_ERR(0, 2733, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2744
 *     return GA_Nodeid()
 * 
 * def norm1(int g_a):             # <<<<<<<<<<<<<<
 *     """Computes the 1-norm of the matrix or vector g_a.
 * 
 */
  __pyx_tuple__226 = PyTuple_Pack(3, __pyx_n_s_g_a, __pyx_n_s_g_a, __pyx_n_s_nm); if (unlikely(!__pyx_tuple__226)) __PYX_ERR(0, 2744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__226);
  __Pyx_GIVEREF(__pyx_tuple__226);
  __pyx_codeobj__227 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__226, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_norm1, 2744, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__227)) __PYX_ERR(0, 2744, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2760
 *     return nm
 * 
 * def norm_infinity(int g_a):             # <<<<<<<<<<<<<<
 *     """Computes the 1-norm of the matrix or vector g_a.
 * 
 */
  __pyx_tuple__228 = PyTuple_Pack(3, __pyx_n_s_g_a, __pyx_n_s_g_a, __pyx_n_s_nm); if (unlikely(!__pyx_tuple__228)) __PYX_ERR(0, 2760, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__228);
  __Pyx_GIVEREF(__pyx_tuple__228);
  __pyx_codeobj__229 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__228, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_norm_infinity, 2760, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__229)) __PYX_ERR(0, 2760, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2776
 *     return nm
 * 
 * def enum(int g_a, lo=None, hi=None, start=None, inc=None):             # <<<<<<<<<<<<<<
 *     """This subroutine enumerates the values of an array between elements lo
 *     and hi starting with the value istart and incrementing each subsequent
 */
  __pyx_tuple__230 = PyTuple_Pack(27, __pyx_n_s_g_a, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_start, __pyx_n_s_inc, __pyx_n_s_hi_nd, __pyx_n_s_c_lo, __pyx_n_s_c_hi, __pyx_n_s_gtype, __pyx_n_s_istart, __pyx_n_s_iinc, __pyx_n_s_lstart, __pyx_n_s_linc, __pyx_n_s_llstart, __pyx_n_s_llinc, __pyx_n_s_fstart, __pyx_n_s_finc, __pyx_n_s_dstart, __pyx_n_s_dinc, __pyx_n_s_ldstart, __pyx_n_s_ldinc, __pyx_n_s_fcstart, __pyx_n_s_fcinc, __pyx_n_s_dcstart, __pyx_n_s_dcinc, __pyx_n_s_vstart, __pyx_n_s_vinc); if (unlikely(!__pyx_tuple__230)) __PYX_ERR(0, 2776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__230);
  __Pyx_GIVEREF(__pyx_tuple__230);
  __pyx_codeobj__231 = (PyObject*)__Pyx_PyCode_New(5, 0, 27, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__230, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_enum, 2776, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__231)) __PYX_ERR(0, 2776, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2834
 *     GA_Patch_enum64(g_a, c_lo, c_hi, vstart, vinc)
 * 
 * def pack(int g_src, int g_dst, int g_msk, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """The pack subroutine is designed to compress the values in the source
 *     vector g_src into a smaller destination array g_dst based on the values
 */
  __pyx_tuple__232 = PyTuple_Pack(9, __pyx_n_s_g_src, __pyx_n_s_g_dst, __pyx_n_s_g_msk, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_hi_nd, __pyx_n_s_c_lo, __pyx_n_s_c_hi, __pyx_n_s_icount); if (unlikely(!__pyx_tuple__232)) __PYX_ERR(0, 2834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__232);
  __Pyx_GIVEREF(__pyx_tuple__232);
  __pyx_codeobj__233 = (PyObject*)__Pyx_PyCode_New(5, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__232, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pack, 2834, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__233)) __PYX_ERR(0, 2834, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2872
 *     return icount
 * 
 * def periodic_acc(int g_a, buffer, lo=None, hi=None, alpha=None):             # <<<<<<<<<<<<<<
 *     """Periodic version of ga.acc.
 * 
 */
  __pyx_tuple__234 = PyTuple_Pack(5, __pyx_n_s_g_a, __pyx_n_s_buffer, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_alpha); if (unlikely(!__pyx_tuple__234)) __PYX_ERR(0, 2872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__234);
  __Pyx_GIVEREF(__pyx_tuple__234);
  __pyx_codeobj__235 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__234, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_periodic_acc, 2872, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__235)) __PYX_ERR(0, 2872, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2903
 *     _acc_common(g_a, buffer, lo, hi, alpha, False, True)
 * 
 * def periodic_get(int g_a, lo=None, hi=None, np.ndarray buffer=None):             # <<<<<<<<<<<<<<
 *     """Periodic version of ga.get.
 * 
 */
  __pyx_tuple__236 = PyTuple_Pack(4, __pyx_n_s_g_a, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_buffer); if (unlikely(!__pyx_tuple__236)) __PYX_ERR(0, 2903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__236);
  __Pyx_GIVEREF(__pyx_tuple__236);
  __pyx_codeobj__237 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__236, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_periodic_get, 2903, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__237)) __PYX_ERR(0, 2903, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2932
 *     return _get_common(g_a, lo, hi, buffer, False, True)
 * 
 * def periodic_put(int g_a, buffer, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Periodic version of ga.put.
 * 
 */
  __pyx_tuple__238 = PyTuple_Pack(4, __pyx_n_s_g_a, __pyx_n_s_buffer, __pyx_n_s_lo, __pyx_n_s_hi); if (unlikely(!__pyx_tuple__238)) __PYX_ERR(0, 2932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__238);
  __Pyx_GIVEREF(__pyx_tuple__238);
  __pyx_codeobj__239 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__238, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_periodic_put, 2932, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__239)) __PYX_ERR(0, 2932, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2959
 *     _put_common(g_a, buffer, lo, hi, False, True)
 * 
 * def pgroup_absolute_id(int pgroup, int pid):             # <<<<<<<<<<<<<<
 *     """TODO"""
 *     return GA_Pgroup_absolute_id(pgroup, pid)
 */
  __pyx_tuple__240 = PyTuple_Pack(2, __pyx_n_s_pgroup, __pyx_n_s_pid); if (unlikely(!__pyx_tuple__240)) __PYX_ERR(0, 2959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__240);
  __Pyx_GIVEREF(__pyx_tuple__240);
  __pyx_codeobj__241 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__240, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pgroup_absolute_id, 2959, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__241)) __PYX_ERR(0, 2959, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2963
 *     return GA_Pgroup_absolute_id(pgroup, pid)
 * 
 * def pgroup_brdcst(int pgroup, buffer, int root=0):             # <<<<<<<<<<<<<<
 *     """Broadcast from process root to all other processes in the same group.
 * 
 */
  __pyx_tuple__242 = PyTuple_Pack(4, __pyx_n_s_pgroup, __pyx_n_s_buffer, __pyx_n_s_root, __pyx_n_s_buffer_nd); if (unlikely(!__pyx_tuple__242)) __PYX_ERR(0, 2963, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__242);
  __Pyx_GIVEREF(__pyx_tuple__242);
  __pyx_codeobj__243 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__242, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pgroup_brdcst, 2963, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__243)) __PYX_ERR(0, 2963, __pyx_L1_error)

  /* "miniga4py/ga.pyx":2993
 *     return buffer_nd
 * 
 * def pgroup_create(list):             # <<<<<<<<<<<<<<
 *     """Creates a processor group.
 * 
 */
  __pyx_tuple__244 = PyTuple_Pack(2, __pyx_n_s_list, __pyx_n_s_list_nd); if (unlikely(!__pyx_tuple__244)) __PYX_ERR(0, 2993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__244);
  __Pyx_GIVEREF(__pyx_tuple__244);
  __pyx_codeobj__245 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__244, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pgroup_create, 2993, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__245)) __PYX_ERR(0, 2993, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3010
 *     return GA_Pgroup_create(<int*>list_nd.data, len(list_nd))
 * 
 * def pgroup_destroy(int pgroup):             # <<<<<<<<<<<<<<
 *     """Frees up a processor group handle.
 * 
 */
  __pyx_tuple__246 = PyTuple_Pack(2, __pyx_n_s_pgroup, __pyx_n_s_pgroup); if (unlikely(!__pyx_tuple__246)) __PYX_ERR(0, 3010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__246);
  __Pyx_GIVEREF(__pyx_tuple__246);
  __pyx_codeobj__247 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__246, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pgroup_destroy, 3010, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__247)) __PYX_ERR(0, 3010, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3022
 *     return True
 * 
 * def pgroup_get_default():             # <<<<<<<<<<<<<<
 *     """Returns a handle to the default processor group.
 * 
 */
  __pyx_codeobj__248 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pgroup_get_default, 3022, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__248)) __PYX_ERR(0, 3022, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3033
 *     return GA_Pgroup_get_default()
 * 
 * def pgroup_get_mirror():             # <<<<<<<<<<<<<<
 *     """Returns a handle to the mirrored processor group.
 * 
 */
  __pyx_codeobj__249 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pgroup_get_mirror, 3033, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__249)) __PYX_ERR(0, 3033, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3044
 *     return GA_Pgroup_get_mirror()
 * 
 * def pgroup_get_world():             # <<<<<<<<<<<<<<
 *     """Returns a handle to the world processor group.
 * 
 */
  __pyx_codeobj__250 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pgroup_get_world, 3044, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__250)) __PYX_ERR(0, 3044, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3055
 *     return GA_Pgroup_get_world()
 * 
 * def pgroup_gop(int pgroup, X, op):             # <<<<<<<<<<<<<<
 *     """Global operation.
 * 
 */
  __pyx_tuple__251 = PyTuple_Pack(4, __pyx_n_s_pgroup, __pyx_n_s_X, __pyx_n_s_op, __pyx_n_s_X_nd); if (unlikely(!__pyx_tuple__251)) __PYX_ERR(0, 3055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__251);
  __Pyx_GIVEREF(__pyx_tuple__251);
  __pyx_codeobj__252 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__251, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pgroup_gop, 3055, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__252)) __PYX_ERR(0, 3055, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3096
 *     return X_nd
 * 
 * def pgroup_gop_add(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "+")
 * 
 */
  __pyx_tuple__253 = PyTuple_Pack(2, __pyx_n_s_pgroup, __pyx_n_s_X); if (unlikely(!__pyx_tuple__253)) __PYX_ERR(0, 3096, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__253);
  __Pyx_GIVEREF(__pyx_tuple__253);
  __pyx_codeobj__254 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__253, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pgroup_gop_add, 3096, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__254)) __PYX_ERR(0, 3096, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3099
 *     return pgroup_gop(pgroup, X, "+")
 * 
 * def pgroup_gop_multiply(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "*")
 * 
 */
  __pyx_tuple__255 = PyTuple_Pack(2, __pyx_n_s_pgroup, __pyx_n_s_X); if (unlikely(!__pyx_tuple__255)) __PYX_ERR(0, 3099, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__255);
  __Pyx_GIVEREF(__pyx_tuple__255);
  __pyx_codeobj__256 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__255, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pgroup_gop_multiply, 3099, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__256)) __PYX_ERR(0, 3099, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3102
 *     return pgroup_gop(pgroup, X, "*")
 * 
 * def pgroup_gop_max(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "max")
 * 
 */
  __pyx_tuple__257 = PyTuple_Pack(2, __pyx_n_s_pgroup, __pyx_n_s_X); if (unlikely(!__pyx_tuple__257)) __PYX_ERR(0, 3102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__257);
  __Pyx_GIVEREF(__pyx_tuple__257);
  __pyx_codeobj__258 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__257, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pgroup_gop_max, 3102, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__258)) __PYX_ERR(0, 3102, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3105
 *     return pgroup_gop(pgroup, X, "max")
 * 
 * def pgroup_gop_min(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "min")
 * 
 */
  __pyx_tuple__259 = PyTuple_Pack(2, __pyx_n_s_pgroup, __pyx_n_s_X); if (unlikely(!__pyx_tuple__259)) __PYX_ERR(0, 3105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__259);
  __Pyx_GIVEREF(__pyx_tuple__259);
  __pyx_codeobj__260 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__259, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pgroup_gop_min, 3105, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__260)) __PYX_ERR(0, 3105, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3108
 *     return pgroup_gop(pgroup, X, "min")
 * 
 * def pgroup_gop_absmax(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "absmax")
 * 
 */
  __pyx_tuple__261 = PyTuple_Pack(2, __pyx_n_s_pgroup, __pyx_n_s_X); if (unlikely(!__pyx_tuple__261)) __PYX_ERR(0, 3108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__261);
  __Pyx_GIVEREF(__pyx_tuple__261);
  __pyx_codeobj__262 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__261, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pgroup_gop_absmax, 3108, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__262)) __PYX_ERR(0, 3108, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3111
 *     return pgroup_gop(pgroup, X, "absmax")
 * 
 * def pgroup_gop_absmin(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "absmin")
 * 
 */
  __pyx_tuple__263 = PyTuple_Pack(2, __pyx_n_s_pgroup, __pyx_n_s_X); if (unlikely(!__pyx_tuple__263)) __PYX_ERR(0, 3111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__263);
  __Pyx_GIVEREF(__pyx_tuple__263);
  __pyx_codeobj__264 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__263, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pgroup_gop_absmin, 3111, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__264)) __PYX_ERR(0, 3111, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3114
 *     return pgroup_gop(pgroup, X, "absmin")
 * 
 * def pgroup_nnodes(int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Returns the number of processors contained in the group specified by
 *     pgroup.
 */
  __pyx_tuple__265 = PyTuple_Pack(1, __pyx_n_s_pgroup); if (unlikely(!__pyx_tuple__265)) __PYX_ERR(0, 3114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__265);
  __Pyx_GIVEREF(__pyx_tuple__265);
  __pyx_codeobj__266 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__265, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pgroup_nnodes, 3114, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__266)) __PYX_ERR(0, 3114, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3129
 *     return GA_Pgroup_nnodes(pgroup)
 * 
 * def pgroup_nodeid(int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Returns the relative index of the processor in the processor group
 *     specified by pgroup.
 */
  __pyx_tuple__267 = PyTuple_Pack(1, __pyx_n_s_pgroup); if (unlikely(!__pyx_tuple__267)) __PYX_ERR(0, 3129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__267);
  __Pyx_GIVEREF(__pyx_tuple__267);
  __pyx_codeobj__268 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__267, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pgroup_nodeid, 3129, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__268)) __PYX_ERR(0, 3129, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3147
 *     return GA_Pgroup_nodeid(pgroup)
 * 
 * def pgroup_set_default(int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Resets the default processor group on a collection of processors.
 * 
 */
  __pyx_tuple__269 = PyTuple_Pack(1, __pyx_n_s_pgroup); if (unlikely(!__pyx_tuple__269)) __PYX_ERR(0, 3147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__269);
  __Pyx_GIVEREF(__pyx_tuple__269);
  __pyx_codeobj__270 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__269, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pgroup_set_default, 3147, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__270)) __PYX_ERR(0, 3147, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3170
 *     GA_Pgroup_set_default(pgroup)
 * 
 * def pgroup_split(int pgroup, int num_group):             # <<<<<<<<<<<<<<
 *     """TODO"""
 *     return GA_Pgroup_split(pgroup, num_group)
 */
  __pyx_tuple__271 = PyTuple_Pack(2, __pyx_n_s_pgroup, __pyx_n_s_num_group); if (unlikely(!__pyx_tuple__271)) __PYX_ERR(0, 3170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__271);
  __Pyx_GIVEREF(__pyx_tuple__271);
  __pyx_codeobj__272 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__271, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pgroup_split, 3170, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__272)) __PYX_ERR(0, 3170, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3174
 *     return GA_Pgroup_split(pgroup, num_group)
 * 
 * def pgroup_split_irreg(int pgroup, int color):             # <<<<<<<<<<<<<<
 *     """TODO"""
 *     return GA_Pgroup_split_irreg(pgroup, color)
 */
  __pyx_tuple__273 = PyTuple_Pack(2, __pyx_n_s_pgroup, __pyx_n_s_color); if (unlikely(!__pyx_tuple__273)) __PYX_ERR(0, 3174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__273);
  __Pyx_GIVEREF(__pyx_tuple__273);
  __pyx_codeobj__274 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__273, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pgroup_split_irreg, 3174, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__274)) __PYX_ERR(0, 3174, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3178
 *     return GA_Pgroup_split_irreg(pgroup, color)
 * 
 * def pgroup_sync(int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Executes a synchronization group across the processors in the processor
 *     group specified by pgroup.
 */
  __pyx_tuple__275 = PyTuple_Pack(1, __pyx_n_s_pgroup); if (unlikely(!__pyx_tuple__275)) __PYX_ERR(0, 3178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__275);
  __Pyx_GIVEREF(__pyx_tuple__275);
  __pyx_codeobj__276 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__275, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_pgroup_sync, 3178, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__276)) __PYX_ERR(0, 3178, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3192
 *     GA_Pgroup_sync(pgroup)
 * 
 * def print_distribution(int g_a):             # <<<<<<<<<<<<<<
 *     """Prints the array distribution.
 * 
 */
  __pyx_tuple__277 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_a); if (unlikely(!__pyx_tuple__277)) __PYX_ERR(0, 3192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__277);
  __Pyx_GIVEREF(__pyx_tuple__277);
  __pyx_codeobj__278 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__277, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_print_distribution, 3192, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__278)) __PYX_ERR(0, 3192, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3200
 *     GA_Print_distribution(g_a)
 * 
 * def print_file(int g_a, file):             # <<<<<<<<<<<<<<
 *     """Prints an entire array to a file.
 * 
 */
  __pyx_tuple__279 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_file); if (unlikely(!__pyx_tuple__279)) __PYX_ERR(0, 3200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__279);
  __Pyx_GIVEREF(__pyx_tuple__279);
  __pyx_codeobj__280 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__279, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_print_file, 3200, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__280)) __PYX_ERR(0, 3200, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3215
 *     raise NotImplementedError
 * 
 * def print_patch(int g_a, lo=None, hi=None, bint pretty=True):             # <<<<<<<<<<<<<<
 *     """Prints a patch of g_a array to the standard output.
 * 
 */
  __pyx_tuple__281 = PyTuple_Pack(7, __pyx_n_s_g_a, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_pretty, __pyx_n_s_lo_nd, __pyx_n_s_hi_nd, __pyx_n_s_apretty); if (unlikely(!__pyx_tuple__281)) __PYX_ERR(0, 3215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__281);
  __Pyx_GIVEREF(__pyx_tuple__281);
  __pyx_codeobj__282 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__281, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_print_patch, 3215, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__282)) __PYX_ERR(0, 3215, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3231
 *     NGA_Print_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, apretty)
 * 
 * def print_stats():             # <<<<<<<<<<<<<<
 *     """This non-collective (MIMD) operation prints information about:
 * 
 */
  __pyx_codeobj__283 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_print_stats, 3231, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__283)) __PYX_ERR(0, 3231, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3248
 *     GA_Print_stats()
 * 
 * def print_stdout(int g_a):             # <<<<<<<<<<<<<<
 *     """Prints an entire array to the standard output."""
 *     GA_Print(g_a)
 */
  __pyx_tuple__284 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_a); if (unlikely(!__pyx_tuple__284)) __PYX_ERR(0, 3248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__284);
  __Pyx_GIVEREF(__pyx_tuple__284);
  __pyx_codeobj__285 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__284, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_print_stdout, 3248, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__285)) __PYX_ERR(0, 3248, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3252
 *     GA_Print(g_a)
 * 
 * def proc_topology(int g_a, int proc):             # <<<<<<<<<<<<<<
 *     """Based on the distribution of an array associated with handle g_a,
 *     determines coordinates of the specified processor in the virtual processor
 */
  __pyx_tuple__286 = PyTuple_Pack(4, __pyx_n_s_g_a, __pyx_n_s_proc, __pyx_n_s_ndim, __pyx_n_s_coord); if (unlikely(!__pyx_tuple__286)) __PYX_ERR(0, 3252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__286);
  __Pyx_GIVEREF(__pyx_tuple__286);
  __pyx_codeobj__287 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__286, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_proc_topology, 3252, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__287)) __PYX_ERR(0, 3252, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3269
 *     return coord
 * 
 * def put(int g_a, buffer, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Copies data from local array buffer to the global array section.
 * 
 */
  __pyx_tuple__288 = PyTuple_Pack(4, __pyx_n_s_g_a, __pyx_n_s_buffer, __pyx_n_s_lo, __pyx_n_s_hi); if (unlikely(!__pyx_tuple__288)) __PYX_ERR(0, 3269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__288);
  __Pyx_GIVEREF(__pyx_tuple__288);
  __pyx_codeobj__289 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_put, 3269, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__289)) __PYX_ERR(0, 3269, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3377
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data)
 * 
 * def randomize(int g_a, val=None):             # <<<<<<<<<<<<<<
 *     """Fill array with random values in [0,val)."""
 *     cdef int gtype=inquire_type(g_a)
 */
  __pyx_tuple__290 = PyTuple_Pack(12, __pyx_n_s_g_a, __pyx_n_s_val, __pyx_n_s_gtype, __pyx_n_s_ival, __pyx_n_s_lval, __pyx_n_s_llval, __pyx_n_s_fval, __pyx_n_s_dval, __pyx_n_s_ldval, __pyx_n_s_fcval, __pyx_n_s_dcval, __pyx_n_s_vval); if (unlikely(!__pyx_tuple__290)) __PYX_ERR(0, 3377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__290);
  __Pyx_GIVEREF(__pyx_tuple__290);
  __pyx_codeobj__291 = (PyObject*)__Pyx_PyCode_New(2, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__290, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_randomize, 3377, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__291)) __PYX_ERR(0, 3377, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3397
 *     GA_Randomize(g_a, vval)
 * 
 * def read_inc(int g_a, subscript, long inc=1):             # <<<<<<<<<<<<<<
 *     """Atomically read and increment an element in an integer array.
 * 
 */
  __pyx_tuple__292 = PyTuple_Pack(4, __pyx_n_s_g_a, __pyx_n_s_subscript, __pyx_n_s_inc, __pyx_n_s_subscript_nd); if (unlikely(!__pyx_tuple__292)) __PYX_ERR(0, 3397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__292);
  __Pyx_GIVEREF(__pyx_tuple__292);
  __pyx_codeobj__293 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__292, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_read_inc, 3397, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__293)) __PYX_ERR(0, 3397, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3415
 *     return NGA_Read_inc64(g_a, <int64_t*>subscript_nd.data, inc)
 * 
 * def register_dtype(dtype):             # <<<<<<<<<<<<<<
 *     """Creates a new data type based on the given dtype.
 * 
 */
  __pyx_tuple__294 = PyTuple_Pack(2, __pyx_n_s_dtype, __pyx_n_s_gatype); if (unlikely(!__pyx_tuple__294)) __PYX_ERR(0, 3415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__294);
  __Pyx_GIVEREF(__pyx_tuple__294);
  __pyx_codeobj__295 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__294, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_register_dtype, 3415, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__295)) __PYX_ERR(0, 3415, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3429
 *     return gatype
 * 
 * def register_type(size_t bytes):             # <<<<<<<<<<<<<<
 *     """Creates a new data type of size bytes.
 * 
 */
  __pyx_tuple__296 = PyTuple_Pack(2, __pyx_n_s_bytes, __pyx_n_s_bytes); if (unlikely(!__pyx_tuple__296)) __PYX_ERR(0, 3429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__296);
  __Pyx_GIVEREF(__pyx_tuple__296);
  __pyx_codeobj__297 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__296, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_register_type, 3429, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__297)) __PYX_ERR(0, 3429, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3439
 *     return NGA_Register_type(bytes)
 * 
 * def recip(int g_a, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Take element-wise reciprocal of the array or patch.
 * 
 */
  __pyx_tuple__298 = PyTuple_Pack(5, __pyx_n_s_g_a, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_lo_nd, __pyx_n_s_hi_nd); if (unlikely(!__pyx_tuple__298)) __PYX_ERR(0, 3439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__298);
  __Pyx_GIVEREF(__pyx_tuple__298);
  __pyx_codeobj__299 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__298, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_recip, 3439, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__299)) __PYX_ERR(0, 3439, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3452
 *         GA_Recip_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 * def release(int g_a, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Releases access to a global array when the data was read only.
 * 
 */
  __pyx_tuple__300 = PyTuple_Pack(3, __pyx_n_s_g_a, __pyx_n_s_lo, __pyx_n_s_hi); if (unlikely(!__pyx_tuple__300)) __PYX_ERR(0, 3452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__300);
  __Pyx_GIVEREF(__pyx_tuple__300);
  __pyx_codeobj__301 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__300, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_release, 3452, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__301)) __PYX_ERR(0, 3452, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3468
 *     _release_common(g_a, lo, hi, False)
 * 
 * def release_block(int g_a, int index):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of data specified by the integer index
 *     when data was accessed as read only.
 */
  __pyx_tuple__302 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_index); if (unlikely(!__pyx_tuple__302)) __PYX_ERR(0, 3468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__302);
  __Pyx_GIVEREF(__pyx_tuple__302);
  __pyx_codeobj__303 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__302, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_release_block, 3468, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__303)) __PYX_ERR(0, 3468, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3478
 *     NGA_Release_block(g_a, index)
 * 
 * def release_block_grid(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of data specified by the subscript array
 *     when data was accessed as read only.
 */
  __pyx_tuple__304 = PyTuple_Pack(3, __pyx_n_s_g_a, __pyx_n_s_subscript, __pyx_n_s_subscript_nd); if (unlikely(!__pyx_tuple__304)) __PYX_ERR(0, 3478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__304);
  __Pyx_GIVEREF(__pyx_tuple__304);
  __pyx_codeobj__305 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__304, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_release_block_grid, 3478, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__305)) __PYX_ERR(0, 3478, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3492
 *     NGA_Release_block_grid(g_a, <int*>subscript_nd.data)
 * 
 * def release_block_segment(int g_a, int proc):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of locally held data for a block-cyclic
 *     array, when data was accessed as read-only.
 */
  __pyx_tuple__306 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_proc); if (unlikely(!__pyx_tuple__306)) __PYX_ERR(0, 3492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__306);
  __Pyx_GIVEREF(__pyx_tuple__306);
  __pyx_codeobj__307 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__306, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_release_block_segment, 3492, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__307)) __PYX_ERR(0, 3492, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3530
 *         NGA_Release64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 * def release_ghost_element(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Releases access to the locally held data for an array with ghost
 *     elements, when data was accessed as read-only.
 */
  __pyx_tuple__308 = PyTuple_Pack(3, __pyx_n_s_g_a, __pyx_n_s_subscript, __pyx_n_s_subscript_nd); if (unlikely(!__pyx_tuple__308)) __PYX_ERR(0, 3530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__308);
  __Pyx_GIVEREF(__pyx_tuple__308);
  __pyx_codeobj__309 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__308, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_release_ghost_element, 3530, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__309)) __PYX_ERR(0, 3530, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3541
 *     NGA_Release_ghost_element64(g_a, <int64_t*>subscript_nd.data)
 * 
 * def release_ghosts(int g_a):             # <<<<<<<<<<<<<<
 *     """Releases access to the locally held block of data containing ghost
 *     elements, when data was accessed as read-only.
 */
  __pyx_tuple__310 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_a); if (unlikely(!__pyx_tuple__310)) __PYX_ERR(0, 3541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__310);
  __Pyx_GIVEREF(__pyx_tuple__310);
  __pyx_codeobj__311 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__310, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_release_ghosts, 3541, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__311)) __PYX_ERR(0, 3541, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3550
 *     NGA_Release_ghosts(g_a)
 * 
 * def release_update(int g_a, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Releases access to the data.
 * 
 */
  __pyx_tuple__312 = PyTuple_Pack(3, __pyx_n_s_g_a, __pyx_n_s_lo, __pyx_n_s_hi); if (unlikely(!__pyx_tuple__312)) __PYX_ERR(0, 3550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__312);
  __Pyx_GIVEREF(__pyx_tuple__312);
  __pyx_codeobj__313 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__312, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_release_update, 3550, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__313)) __PYX_ERR(0, 3550, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3561
 *     _release_common(g_a, lo, hi, True)
 * 
 * def release_update_block(int g_a, int index):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of data specified by the integer index
 *     when data was accessed in read-write mode.
 */
  __pyx_tuple__314 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_index); if (unlikely(!__pyx_tuple__314)) __PYX_ERR(0, 3561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__314);
  __Pyx_GIVEREF(__pyx_tuple__314);
  __pyx_codeobj__315 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__314, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_release_update_block, 3561, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__315)) __PYX_ERR(0, 3561, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3573
 *     NGA_Release_update_block(g_a, index)
 * 
 * def release_update_block_grid(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of data specified by the subscript array
 *     when data was accessed in read-write mode.
 */
  __pyx_tuple__316 = PyTuple_Pack(3, __pyx_n_s_g_a, __pyx_n_s_subscript, __pyx_n_s_subscript_nd); if (unlikely(!__pyx_tuple__316)) __PYX_ERR(0, 3573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__316);
  __Pyx_GIVEREF(__pyx_tuple__316);
  __pyx_codeobj__317 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__316, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_release_update_block_grid, 3573, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__317)) __PYX_ERR(0, 3573, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3587
 *     NGA_Release_update_block_grid(g_a, <int*>subscript_nd.data)
 * 
 * def release_update_block_segment(int g_a, int proc):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of locally held data for a block-cyclic
 *     array, when data was accessed as read-only.
 */
  __pyx_tuple__318 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_proc); if (unlikely(!__pyx_tuple__318)) __PYX_ERR(0, 3587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__318);
  __Pyx_GIVEREF(__pyx_tuple__318);
  __pyx_codeobj__319 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__318, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_release_update_block_segment, 3587, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__319)) __PYX_ERR(0, 3587, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3596
 *     NGA_Release_update_block_segment(g_a, proc)
 * 
 * def release_update_ghost_element(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Releases access to the locally held data for an array with ghost
 *     elements, when data was accessed in read-write mode.
 */
  __pyx_tuple__320 = PyTuple_Pack(3, __pyx_n_s_g_a, __pyx_n_s_subscript, __pyx_n_s_subscript_nd); if (unlikely(!__pyx_tuple__320)) __PYX_ERR(0, 3596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__320);
  __Pyx_GIVEREF(__pyx_tuple__320);
  __pyx_codeobj__321 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__320, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_release_update_ghost_element, 3596, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__321)) __PYX_ERR(0, 3596, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3608
 *     pass
 * 
 * def release_update_ghosts(int g_a):             # <<<<<<<<<<<<<<
 *     """Releases access to the locally held block of data containing ghost
 *     elements, when data was accessed in read-write mode.
 */
  __pyx_tuple__322 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_a); if (unlikely(!__pyx_tuple__322)) __PYX_ERR(0, 3608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__322);
  __Pyx_GIVEREF(__pyx_tuple__322);
  __pyx_codeobj__323 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__322, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_release_update_ghosts, 3608, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__323)) __PYX_ERR(0, 3608, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3617
 *     NGA_Release_update_ghosts(g_a)
 * 
 * def scale(int g_a, value, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Scales an array by the constant s.
 * 
 */
  __pyx_tuple__324 = PyTuple_Pack(16, __pyx_n_s_g_a, __pyx_n_s_value, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_lo_nd, __pyx_n_s_hi_nd, __pyx_n_s_gtype, __pyx_n_s_ivalue, __pyx_n_s_lvalue, __pyx_n_s_llvalue, __pyx_n_s_fvalue, __pyx_n_s_dvalue, __pyx_n_s_ldvalue, __pyx_n_s_fcvalue, __pyx_n_s_dcvalue, __pyx_n_s_vvalue); if (unlikely(!__pyx_tuple__324)) __PYX_ERR(0, 3617, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__324);
  __Pyx_GIVEREF(__pyx_tuple__324);
  __pyx_codeobj__325 = (PyObject*)__Pyx_PyCode_New(4, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__324, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_scale, 3617, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__325)) __PYX_ERR(0, 3617, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3648
 *                 g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, vvalue)
 * 
 * def scale_rows(int g_a, int g_v):             # <<<<<<<<<<<<<<
 *     """Scales the rows of this matrix g_a using the vector g_v.
 * 
 */
  __pyx_tuple__326 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_v); if (unlikely(!__pyx_tuple__326)) __PYX_ERR(0, 3648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__326);
  __Pyx_GIVEREF(__pyx_tuple__326);
  __pyx_codeobj__327 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__326, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_scale_rows, 3648, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__327)) __PYX_ERR(0, 3648, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3656
 *     GA_Scale_rows(g_a, g_v)
 * 
 * def scale_cols(int g_a, int g_v):             # <<<<<<<<<<<<<<
 *     """Scales the columns of this matrix g_a using the vector g_v.
 * 
 */
  __pyx_tuple__328 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_v); if (unlikely(!__pyx_tuple__328)) __PYX_ERR(0, 3656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__328);
  __Pyx_GIVEREF(__pyx_tuple__328);
  __pyx_codeobj__329 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__328, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_scale_cols, 3656, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__329)) __PYX_ERR(0, 3656, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3664
 *     GA_Scale_cols(g_a, g_v)
 * 
 * def scan_add(int g_src, int g_dst, int g_msk, lo=None, hi=None,             # <<<<<<<<<<<<<<
 *         bint excl=False):
 *     """Adds successive elements in a source vector g_src and put the results
 */
  __pyx_tuple__330 = PyTuple_Pack(10, __pyx_n_s_g_src, __pyx_n_s_g_dst, __pyx_n_s_g_msk, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_excl, __pyx_n_s_hi_nd, __pyx_n_s_c_lo, __pyx_n_s_c_hi, __pyx_n_s_c_excl); if (unlikely(!__pyx_tuple__330)) __PYX_ERR(0, 3664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__330);
  __Pyx_GIVEREF(__pyx_tuple__330);
  __pyx_codeobj__331 = (PyObject*)__Pyx_PyCode_New(6, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__330, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_scan_add, 3664, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__331)) __PYX_ERR(0, 3664, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3715
 *     GA_Scan_add64(g_src, g_dst, g_msk, c_lo, c_hi, c_excl)
 * 
 * def scan_copy(int g_src, int g_dst, int g_msk, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """This subroutine does a segmented scan-copy of values in the source
 *     array g_src into a destination array g_dst with segments defined by
 */
  __pyx_tuple__332 = PyTuple_Pack(9, __pyx_n_s_g_src, __pyx_n_s_g_dst, __pyx_n_s_g_msk, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_hi_nd, __pyx_n_s_c_lo, __pyx_n_s_c_hi, __pyx_n_s_c_excl); if (unlikely(!__pyx_tuple__332)) __PYX_ERR(0, 3715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__332);
  __Pyx_GIVEREF(__pyx_tuple__332);
  __pyx_codeobj__333 = (PyObject*)__Pyx_PyCode_New(5, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__332, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_scan_copy, 3715, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__333)) __PYX_ERR(0, 3715, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3741
 *     GA_Scan_copy64(g_src, g_dst, g_msk, c_lo, c_hi)
 * 
 * def scatter(int g_a, values, subsarray):             # <<<<<<<<<<<<<<
 *     """Scatters array elements from a global array into a local array.
 * 
 */
  __pyx_tuple__334 = PyTuple_Pack(9, __pyx_n_s_g_a, __pyx_n_s_values, __pyx_n_s_subsarray, __pyx_n_s_subsarray1_nd, __pyx_n_s_subsarray2_nd, __pyx_n_s_values_nd, __pyx_n_s_gtype, __pyx_n_s_ndim, __pyx_n_s_n); if (unlikely(!__pyx_tuple__334)) __PYX_ERR(0, 3741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__334);
  __Pyx_GIVEREF(__pyx_tuple__334);
  __pyx_codeobj__335 = (PyObject*)__Pyx_PyCode_New(3, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__334, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_scatter, 3741, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__335)) __PYX_ERR(0, 3741, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3798
 *         raise ValueError("how did this happen?")
 * 
 * def scatter_acc(int g_a, values, subsarray, alpha=None):             # <<<<<<<<<<<<<<
 *     """Scatters array elements from a global array into a local array.
 * 
 */
  __pyx_tuple__336 = PyTuple_Pack(19, __pyx_n_s_g_a, __pyx_n_s_values, __pyx_n_s_subsarray, __pyx_n_s_alpha, __pyx_n_s_subsarray1_nd, __pyx_n_s_subsarray2_nd, __pyx_n_s_values_nd, __pyx_n_s_gtype, __pyx_n_s_ndim, __pyx_n_s_n, __pyx_n_s_ialpha, __pyx_n_s_lalpha, __pyx_n_s_llalpha, __pyx_n_s_falpha, __pyx_n_s_dalpha, __pyx_n_s_ldalpha, __pyx_n_s_fcalpha, __pyx_n_s_dcalpha, __pyx_n_s_valpha); if (unlikely(!__pyx_tuple__336)) __PYX_ERR(0, 3798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__336);
  __Pyx_GIVEREF(__pyx_tuple__336);
  __pyx_codeobj__337 = (PyObject*)__Pyx_PyCode_New(4, 0, 19, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__336, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_scatter_acc, 3798, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__337)) __PYX_ERR(0, 3798, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3874
 *         raise ValueError("how did this happen?")
 * 
 * def select_elem(int g_a, op):             # <<<<<<<<<<<<<<
 *     """Returns the value and index for an element that is selected by the
 *     specified operator in a global array corresponding to g_a handle.
 */
  __pyx_tuple__338 = PyTuple_Pack(13, __pyx_n_s_g_a, __pyx_n_s_op, __pyx_n_s_index, __pyx_n_s_gtype, __pyx_n_s_ialpha, __pyx_n_s_lalpha, __pyx_n_s_llalpha, __pyx_n_s_falpha, __pyx_n_s_dalpha, __pyx_n_s_ldalpha, __pyx_n_s_fcalpha, __pyx_n_s_dcalpha, __pyx_n_s_valpha); if (unlikely(!__pyx_tuple__338)) __PYX_ERR(0, 3874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__338);
  __Pyx_GIVEREF(__pyx_tuple__338);
  __pyx_codeobj__339 = (PyObject*)__Pyx_PyCode_New(2, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__338, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_select_elem, 3874, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__339)) __PYX_ERR(0, 3874, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3921
 *         raise TypeError("type of g_a not recognized")
 * 
 * def select_elem_min(int g_a):             # <<<<<<<<<<<<<<
 *     """Equivalent to ga.select_elem(g_a, "min")."""
 *     return select_elem(g_a, "min")
 */
  __pyx_tuple__340 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_a); if (unlikely(!__pyx_tuple__340)) __PYX_ERR(0, 3921, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__340);
  __Pyx_GIVEREF(__pyx_tuple__340);
  __pyx_codeobj__341 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__340, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_select_elem_min, 3921, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__341)) __PYX_ERR(0, 3921, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3925
 *     return select_elem(g_a, "min")
 * 
 * def select_elem_max(int g_a):             # <<<<<<<<<<<<<<
 *     """Equivalent to ga.select_elem(g_a, "max")."""
 *     return select_elem(g_a, "max")
 */
  __pyx_tuple__342 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_a); if (unlikely(!__pyx_tuple__342)) __PYX_ERR(0, 3925, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__342);
  __Pyx_GIVEREF(__pyx_tuple__342);
  __pyx_codeobj__343 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__342, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_select_elem_max, 3925, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__343)) __PYX_ERR(0, 3925, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3929
 *     return select_elem(g_a, "max")
 * 
 * def set_array_name(int g_a, name):             # <<<<<<<<<<<<<<
 *     """Assigns a unique character string name to a global array handle that
 *     was obtained using the GA_Create_handle function.
 */
  __pyx_tuple__344 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_name); if (unlikely(!__pyx_tuple__344)) __PYX_ERR(0, 3929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__344);
  __Pyx_GIVEREF(__pyx_tuple__344);
  __pyx_codeobj__345 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__344, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_set_array_name, 3929, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__345)) __PYX_ERR(0, 3929, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3938
 *     GA_Set_array_name(g_a, b(name))
 * 
 * def set_block_cyclic(int g_a, dims):             # <<<<<<<<<<<<<<
 *     """Creates a global array with a simple block-cyclic data distribution.
 * 
 */
  __pyx_tuple__346 = PyTuple_Pack(3, __pyx_n_s_g_a, __pyx_n_s_dims, __pyx_n_s_dims_nd); if (unlikely(!__pyx_tuple__346)) __PYX_ERR(0, 3938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__346);
  __Pyx_GIVEREF(__pyx_tuple__346);
  __pyx_codeobj__347 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__346, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_set_block_cyclic, 3938, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__347)) __PYX_ERR(0, 3938, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3961
 *     GA_Set_block_cyclic(g_a, <int*>dims_nd.data)
 * 
 * def set_block_cyclic_proc_grid(int g_a, block, proc_grid):             # <<<<<<<<<<<<<<
 *     """Creates a global array with a SCALAPACK-type block cyclic data
 *     distribution.
 */
  __pyx_tuple__348 = PyTuple_Pack(5, __pyx_n_s_g_a, __pyx_n_s_block, __pyx_n_s_proc_grid, __pyx_n_s_block_nd, __pyx_n_s_proc_grid_nd); if (unlikely(!__pyx_tuple__348)) __PYX_ERR(0, 3961, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__348);
  __Pyx_GIVEREF(__pyx_tuple__348);
  __pyx_codeobj__349 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__348, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_set_block_cyclic_proc_grid, 3961, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__349)) __PYX_ERR(0, 3961, __pyx_L1_error)

  /* "miniga4py/ga.pyx":3990
 *             <int*>proc_grid_nd.data)
 * 
 * def set_chunk(int g_a, chunk):             # <<<<<<<<<<<<<<
 *     """This function is used to set the chunk array for a global array handle
 *     that was obtained using the GA_Create_handle function. The chunk array is
 */
  __pyx_tuple__350 = PyTuple_Pack(3, __pyx_n_s_g_a, __pyx_n_s_chunk, __pyx_n_s_chunk_nd); if (unlikely(!__pyx_tuple__350)) __PYX_ERR(0, 3990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__350);
  __Pyx_GIVEREF(__pyx_tuple__350);
  __pyx_codeobj__351 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__350, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_set_chunk, 3990, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__351)) __PYX_ERR(0, 3990, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4003
 *     GA_Set_chunk64(g_a, <int64_t*>chunk_nd.data)
 * 
 * def set_data(int g_a, dims, int type):             # <<<<<<<<<<<<<<
 *     """Sets the array dimension, the coordinate dimensions, and the data type
 *     assigned to a global array handle obtained using the ga.create_handle
 */
  __pyx_tuple__352 = PyTuple_Pack(4, __pyx_n_s_g_a, __pyx_n_s_dims, __pyx_n_s_type, __pyx_n_s_dims_nd); if (unlikely(!__pyx_tuple__352)) __PYX_ERR(0, 4003, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__352);
  __Pyx_GIVEREF(__pyx_tuple__352);
  __pyx_codeobj__353 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__352, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_set_data, 4003, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__353)) __PYX_ERR(0, 4003, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4015
 *     GA_Set_data64(g_a, len(dims_nd), <int64_t*>dims_nd.data, type)
 * 
 * def set_debug(bint debug):             # <<<<<<<<<<<<<<
 *     """Sets an internal flag in the GA library to either True or False.
 * 
 */
  __pyx_tuple__354 = PyTuple_Pack(2, __pyx_n_s_debug, __pyx_n_s_debug); if (unlikely(!__pyx_tuple__354)) __PYX_ERR(0, 4015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__354);
  __Pyx_GIVEREF(__pyx_tuple__354);
  __pyx_codeobj__355 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__354, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_set_debug, 4015, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__355)) __PYX_ERR(0, 4015, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4029
 *     GA_Set_debug(debug)
 * 
 * def set_diagonal(int g_a, int g_v):             # <<<<<<<<<<<<<<
 *     """Sets the diagonal elements of this matrix g_a with the elements of the
 *     vector g_v.
 */
  __pyx_tuple__356 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_v); if (unlikely(!__pyx_tuple__356)) __PYX_ERR(0, 4029, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__356);
  __Pyx_GIVEREF(__pyx_tuple__356);
  __pyx_codeobj__357 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__356, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_set_diagonal, 4029, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__357)) __PYX_ERR(0, 4029, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4038
 *     GA_Set_diagonal(g_a, g_v)
 * 
 * def set_ghosts(int g_a, width):             # <<<<<<<<<<<<<<
 *     """Sets the ghost cell widths for a global array handle that was obtained
 *     using the ga.create_handle function.
 */
  __pyx_tuple__358 = PyTuple_Pack(3, __pyx_n_s_g_a, __pyx_n_s_width, __pyx_n_s_width_nd); if (unlikely(!__pyx_tuple__358)) __PYX_ERR(0, 4038, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__358);
  __Pyx_GIVEREF(__pyx_tuple__358);
  __pyx_codeobj__359 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__358, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_set_ghosts, 4038, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__359)) __PYX_ERR(0, 4038, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4053
 *     GA_Set_ghosts64(g_a, <int64_t*>width_nd.data)
 * 
 * def set_irreg_distr(int g_a, mapc, nblock):             # <<<<<<<<<<<<<<
 *     """Partitions the array data among the individual processors for a global
 *     array handle obtained using the ga.create_handle function.
 */
  __pyx_tuple__360 = PyTuple_Pack(5, __pyx_n_s_g_a, __pyx_n_s_mapc, __pyx_n_s_nblock, __pyx_n_s_mapc_nd, __pyx_n_s_nblock_nd); if (unlikely(!__pyx_tuple__360)) __PYX_ERR(0, 4053, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__360);
  __Pyx_GIVEREF(__pyx_tuple__360);
  __pyx_codeobj__361 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__360, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_set_irreg_distr, 4053, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__361)) __PYX_ERR(0, 4053, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4086
 *     GA_Set_irreg_distr64(g_a, <int64_t*>mapc_nd.data, <int64_t*>nblock_nd.data)
 * 
 * def set_memory_limit(size_t limit):             # <<<<<<<<<<<<<<
 *     """Sets the amount of memory to be used (in bytes) per process.
 * 
 */
  __pyx_tuple__362 = PyTuple_Pack(2, __pyx_n_s_limit, __pyx_n_s_limit); if (unlikely(!__pyx_tuple__362)) __PYX_ERR(0, 4086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__362);
  __Pyx_GIVEREF(__pyx_tuple__362);
  __pyx_codeobj__363 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__362, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_set_memory_limit, 4086, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__363)) __PYX_ERR(0, 4086, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4098
 *     GA_Set_memory_limit(limit)
 * 
 * def set_pgroup(int g_a, int pgroup):             # <<<<<<<<<<<<<<
 *     """Sets the processor configuration assigned to a global array handle that
 *     was obtained using the ga.create_handle function.
 */
  __pyx_tuple__364 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_pgroup); if (unlikely(!__pyx_tuple__364)) __PYX_ERR(0, 4098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__364);
  __Pyx_GIVEREF(__pyx_tuple__364);
  __pyx_codeobj__365 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__364, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_set_pgroup, 4098, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__365)) __PYX_ERR(0, 4098, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4112
 *     GA_Set_pgroup(g_a, pgroup)
 * 
 * def set_restricted(int g_a, list):             # <<<<<<<<<<<<<<
 *     """Restrict data in the global array g_a to only the processors listed in
 *     the array list.
 */
  __pyx_tuple__366 = PyTuple_Pack(3, __pyx_n_s_g_a, __pyx_n_s_list, __pyx_n_s_list_nd); if (unlikely(!__pyx_tuple__366)) __PYX_ERR(0, 4112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__366);
  __Pyx_GIVEREF(__pyx_tuple__366);
  __pyx_codeobj__367 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__366, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_set_restricted, 4112, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__367)) __PYX_ERR(0, 4112, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4132
 *     GA_Set_restricted(g_a, <int*>list_nd.data, len(list_nd))
 * 
 * def set_restricted_range(int g_a, int lo_proc, int hi_proc):             # <<<<<<<<<<<<<<
 *     """Restrict data in the global array to the given range of processors.
 * 
 */
  __pyx_tuple__368 = PyTuple_Pack(3, __pyx_n_s_g_a, __pyx_n_s_lo_proc, __pyx_n_s_hi_proc); if (unlikely(!__pyx_tuple__368)) __PYX_ERR(0, 4132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__368);
  __Pyx_GIVEREF(__pyx_tuple__368);
  __pyx_codeobj__369 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__368, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_set_restricted_range, 4132, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__369)) __PYX_ERR(0, 4132, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4146
 *     GA_Set_restricted_range(g_a, lo_proc, hi_proc)
 * 
 * def shift_diagoal(int g_a, value=None):             # <<<<<<<<<<<<<<
 *     """Adds this constant to the diagonal elements of the matrix.
 * 
 */
  __pyx_tuple__370 = PyTuple_Pack(12, __pyx_n_s_g_a, __pyx_n_s_value, __pyx_n_s_ivalue, __pyx_n_s_lvalue, __pyx_n_s_llvalue, __pyx_n_s_fvalue, __pyx_n_s_dvalue, __pyx_n_s_ldvalue, __pyx_n_s_fcvalue, __pyx_n_s_dcvalue, __pyx_n_s_vvalue, __pyx_n_s_gtype); if (unlikely(!__pyx_tuple__370)) __PYX_ERR(0, 4146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__370);
  __Pyx_GIVEREF(__pyx_tuple__370);
  __pyx_codeobj__371 = (PyObject*)__Pyx_PyCode_New(2, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__370, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_shift_diagoal, 4146, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__371)) __PYX_ERR(0, 4146, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4170
 *     GA_Shift_diagonal(g_a, vvalue)
 * 
 * def solve(int g_a, int g_b):             # <<<<<<<<<<<<<<
 *     """Solves a system of linear equations A * X = B.
 * 
 */
  __pyx_tuple__372 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_b); if (unlikely(!__pyx_tuple__372)) __PYX_ERR(0, 4170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__372);
  __Pyx_GIVEREF(__pyx_tuple__372);
  __pyx_codeobj__373 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__372, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_solve, 4170, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__373)) __PYX_ERR(0, 4170, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4186
 *     return GA_Solve(g_a, g_b)
 * 
 * def spd_invert(int g_a):             # <<<<<<<<<<<<<<
 *     """Compute the inverse of a double precision using the Cholesky
 *     factorization of a NxN double precision symmetric positive definite matrix
 */
  __pyx_tuple__374 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_a); if (unlikely(!__pyx_tuple__374)) __PYX_ERR(0, 4186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__374);
  __Pyx_GIVEREF(__pyx_tuple__374);
  __pyx_codeobj__375 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__374, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_spd_invert, 4186, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__375)) __PYX_ERR(0, 4186, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4199
 *     return GA_Spd_invert(g_a)
 * 
 * def step_max(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None):             # <<<<<<<<<<<<<<
 *     """Calculates the largest multiple of a vector g_b that can be added to
 *     this vector g_a while keeping each element of this vector non-negative.
 */
  __pyx_tuple__376 = PyTuple_Pack(11, __pyx_n_s_g_a, __pyx_n_s_g_b, __pyx_n_s_alo, __pyx_n_s_ahi, __pyx_n_s_blo, __pyx_n_s_bhi, __pyx_n_s_alo_nd, __pyx_n_s_ahi_nd, __pyx_n_s_blo_nd, __pyx_n_s_bhi_nd, __pyx_n_s_step); if (unlikely(!__pyx_tuple__376)) __PYX_ERR(0, 4199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__376);
  __Pyx_GIVEREF(__pyx_tuple__376);
  __pyx_codeobj__377 = (PyObject*)__Pyx_PyCode_New(6, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__376, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_step_max, 4199, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__377)) __PYX_ERR(0, 4199, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4219
 *     return step
 * 
 * def strided_acc(int g_a, buffer, lo=None, hi=None, skip=None, alpha=None):             # <<<<<<<<<<<<<<
 *     """Strided version of ga.acc.
 * 
 */
  __pyx_tuple__378 = PyTuple_Pack(6, __pyx_n_s_g_a, __pyx_n_s_buffer, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_skip, __pyx_n_s_alpha); if (unlikely(!__pyx_tuple__378)) __PYX_ERR(0, 4219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__378);
  __Pyx_GIVEREF(__pyx_tuple__378);
  __pyx_codeobj__379 = (PyObject*)__Pyx_PyCode_New(6, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__378, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_strided_acc, 4219, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__379)) __PYX_ERR(0, 4219, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4250
 *     _acc_common(g_a, buffer, lo, hi, alpha, False, False, skip)
 * 
 * def strided_get(int g_a, lo=None, hi=None, skip=None, np.ndarray buffer=None):             # <<<<<<<<<<<<<<
 *     """Strided version of ga.get.
 * 
 */
  __pyx_tuple__380 = PyTuple_Pack(5, __pyx_n_s_g_a, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_skip, __pyx_n_s_buffer); if (unlikely(!__pyx_tuple__380)) __PYX_ERR(0, 4250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__380);
  __Pyx_GIVEREF(__pyx_tuple__380);
  __pyx_codeobj__381 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_strided_get, 4250, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__381)) __PYX_ERR(0, 4250, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4278
 *     return _get_common(g_a, lo, hi, buffer, False, False, skip)
 * 
 * def strided_put(int g_a, buffer, lo=None, hi=None, skip=None):             # <<<<<<<<<<<<<<
 *     """Strided version of ga.put.
 * 
 */
  __pyx_tuple__382 = PyTuple_Pack(5, __pyx_n_s_g_a, __pyx_n_s_buffer, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_skip); if (unlikely(!__pyx_tuple__382)) __PYX_ERR(0, 4278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__382);
  __Pyx_GIVEREF(__pyx_tuple__382);
  __pyx_codeobj__383 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__382, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_strided_put, 4278, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__383)) __PYX_ERR(0, 4278, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4304
 *     _put_common(g_a, buffer, lo, hi, False, False, skip)
 * 
 * def summarize(bint verbose):             # <<<<<<<<<<<<<<
 *     """Prints info about allocated arrays."""
 *     GA_Summarize(verbose)
 */
  __pyx_tuple__384 = PyTuple_Pack(2, __pyx_n_s_verbose, __pyx_n_s_verbose); if (unlikely(!__pyx_tuple__384)) __PYX_ERR(0, 4304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__384);
  __Pyx_GIVEREF(__pyx_tuple__384);
  __pyx_codeobj__385 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__384, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_summarize, 4304, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__385)) __PYX_ERR(0, 4304, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4308
 *     GA_Summarize(verbose)
 * 
 * def symmetrize(int g_a):             # <<<<<<<<<<<<<<
 *     """Symmetrizes matrix A represented with handle g_a: A:= .5 * (A+A').
 * 
 */
  __pyx_tuple__386 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_a); if (unlikely(!__pyx_tuple__386)) __PYX_ERR(0, 4308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__386);
  __Pyx_GIVEREF(__pyx_tuple__386);
  __pyx_codeobj__387 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__386, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_symmetrize, 4308, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__387)) __PYX_ERR(0, 4308, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4316
 *     GA_Symmetrize(g_a)
 * 
 * def sync():             # <<<<<<<<<<<<<<
 *     """Synchronize processes (a barrier) and ensure that all GA operations
 *     completed.
 */
  __pyx_codeobj__388 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_sync, 4316, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__388)) __PYX_ERR(0, 4316, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4325
 *     GA_Sync()
 * 
 * def terminate():             # <<<<<<<<<<<<<<
 *     """Delete all active arrays and destroy internal data structures.
 * 
 */
  __pyx_codeobj__389 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_terminate, 4325, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__389)) __PYX_ERR(0, 4325, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4335
 *     GA_Terminate()
 * 
 * def total_blocks(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns the total number of blocks contained in a global
 *     array with a block-cyclic data distribution.
 */
  __pyx_tuple__390 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_a); if (unlikely(!__pyx_tuple__390)) __PYX_ERR(0, 4335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__390);
  __Pyx_GIVEREF(__pyx_tuple__390);
  __pyx_codeobj__391 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__390, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_total_blocks, 4335, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__391)) __PYX_ERR(0, 4335, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4344
 *     return GA_Total_blocks(g_a)
 * 
 * def transpose(int g_a, int g_b):             # <<<<<<<<<<<<<<
 *     """Transposes a matrix: B = A', where A and B are represented by handles
 *     g_a and g_b.
 */
  __pyx_tuple__392 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_b); if (unlikely(!__pyx_tuple__392)) __PYX_ERR(0, 4344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__392);
  __Pyx_GIVEREF(__pyx_tuple__392);
  __pyx_codeobj__393 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__392, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_transpose, 4344, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__393)) __PYX_ERR(0, 4344, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4353
 *     GA_Transpose(g_a, g_b)
 * 
 * def unlock(int mutex):             # <<<<<<<<<<<<<<
 *     """Unlocks a mutex object identified by the mutex number. It is a fatal
 *     error for a process to attempt to unlock a mutex which has not been locked
 */
  __pyx_tuple__394 = PyTuple_Pack(2, __pyx_n_s_mutex, __pyx_n_s_mutex); if (unlikely(!__pyx_tuple__394)) __PYX_ERR(0, 4353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__394);
  __Pyx_GIVEREF(__pyx_tuple__394);
  __pyx_codeobj__395 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__394, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_unlock, 4353, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__395)) __PYX_ERR(0, 4353, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4359
 *     GA_Unlock(mutex)
 * 
 * def unpack(int g_src, int g_dst, int g_msk, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Expands the values in the source vector into a larger destination vector.
 * 
 */
  __pyx_tuple__396 = PyTuple_Pack(9, __pyx_n_s_g_src, __pyx_n_s_g_dst, __pyx_n_s_g_msk, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_hi_nd, __pyx_n_s_c_lo, __pyx_n_s_c_hi, __pyx_n_s_icount); if (unlikely(!__pyx_tuple__396)) __PYX_ERR(0, 4359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__396);
  __Pyx_GIVEREF(__pyx_tuple__396);
  __pyx_codeobj__397 = (PyObject*)__Pyx_PyCode_New(5, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__396, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_unpack, 4359, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__397)) __PYX_ERR(0, 4359, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4400
 *     return icount
 * 
 * def update_ghosts(int g_a):             # <<<<<<<<<<<<<<
 *     """This call updates the ghost cell regions on each processor with the
 *     corresponding neighbor data from other processors.
 */
  __pyx_tuple__398 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_a); if (unlikely(!__pyx_tuple__398)) __PYX_ERR(0, 4400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__398);
  __Pyx_GIVEREF(__pyx_tuple__398);
  __pyx_codeobj__399 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__398, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_update_ghosts, 4400, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__399)) __PYX_ERR(0, 4400, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4416
 *     GA_Update_ghosts(g_a)
 * 
 * def update_ghost_dir(int g_a, int dimension, int dir, int flag):             # <<<<<<<<<<<<<<
 *     """This function can be used to update the ghost cells along individual
 *     directions. It is designed for algorithms that can overlap updates with
 */
  __pyx_tuple__400 = PyTuple_Pack(4, __pyx_n_s_g_a, __pyx_n_s_dimension, __pyx_n_s_dir, __pyx_n_s_flag); if (unlikely(!__pyx_tuple__400)) __PYX_ERR(0, 4416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__400);
  __Pyx_GIVEREF(__pyx_tuple__400);
  __pyx_codeobj__401 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__400, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_update_ghost_dir, 4416, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__401)) __PYX_ERR(0, 4416, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4445
 *     NGA_Update_ghost_dir(g_a, dimension, dir, flag)
 * 
 * def uses_ma():             # <<<<<<<<<<<<<<
 *     """TODO"""
 *     if GA_Uses_ma() == 1:
 */
  __pyx_codeobj__402 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_uses_ma, 4445, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__402)) __PYX_ERR(0, 4445, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4451
 *     return False
 * 
 * def wtime():             # <<<<<<<<<<<<<<
 *     """This function return a wall (or elapsed) time on the calling processor.
 *     Returns time in seconds representing elapsed wall-clock time since an
 */
  __pyx_codeobj__403 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_wtime, 4451, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__403)) __PYX_ERR(0, 4451, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4468
 *     return GA_Wtime()
 * 
 * def zero(int g_a, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Set all the elements in the array or patch to zero."""
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 */
  __pyx_tuple__404 = PyTuple_Pack(5, __pyx_n_s_g_a, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_lo_nd, __pyx_n_s_hi_nd); if (unlikely(!__pyx_tuple__404)) __PYX_ERR(0, 4468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__404);
  __Pyx_GIVEREF(__pyx_tuple__404);
  __pyx_codeobj__405 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__404, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_zero, 4468, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__405)) __PYX_ERR(0, 4468, __pyx_L1_error)

  /* "miniga4py/ga.pyx":4477
 *         NGA_Zero_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 * def zero_diagonal(int g_a):             # <<<<<<<<<<<<<<
 *     """Sets the diagonal elements of this matrix g_a with zeros.
 * 
 */
  __pyx_tuple__406 = PyTuple_Pack(2, __pyx_n_s_g_a, __pyx_n_s_g_a); if (unlikely(!__pyx_tuple__406)) __PYX_ERR(0, 4477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__406);
  __Pyx_GIVEREF(__pyx_tuple__406);
  __pyx_codeobj__407 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__406, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_miniga4py_ga_pyx, __pyx_n_s_zero_diagonal, 4477, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__407)) __PYX_ERR(0, 4477, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_9 = PyInt_FromLong(9); if (unlikely(!__pyx_int_9)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_11 = PyInt_FromLong(11); if (unlikely(!__pyx_int_11)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_12 = PyInt_FromLong(12); if (unlikely(!__pyx_int_12)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_13 = PyInt_FromLong(13); if (unlikely(!__pyx_int_13)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_14 = PyInt_FromLong(14); if (unlikely(!__pyx_int_14)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1000 = PyInt_FromLong(1000); if (unlikely(!__pyx_int_1000)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_modinit_global_init_code(void); /*proto*/
static int __Pyx_modinit_variable_export_code(void); /*proto*/
static int __Pyx_modinit_function_export_code(void); /*proto*/
static int __Pyx_modinit_type_init_code(void); /*proto*/
static int __Pyx_modinit_type_import_code(void); /*proto*/
static int __Pyx_modinit_variable_import_code(void); /*proto*/
static int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(2, 9, __pyx_L1_error)
  __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) __PYX_ERR(1, 164, __pyx_L1_error)
  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) __PYX_ERR(1, 186, __pyx_L1_error)
  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) __PYX_ERR(1, 190, __pyx_L1_error)
  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) __PYX_ERR(1, 199, __pyx_L1_error)
  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) __PYX_ERR(1, 872, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}


#if PY_MAJOR_VERSION < 3
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC void
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#else
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__)
    #define CYTHON_SMALL_CODE __attribute__((optimize("Os")))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initga(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initga(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_ga(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_ga(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        result = PyDict_SetItemString(moddict, to_name, value);
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__") < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static int __pyx_pymod_exec_ga(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m && __pyx_m == __pyx_pyinit_module) return 0;
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  #if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
  PyErr_Clear();
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  if (!__Pyx_RefNanny)
      Py_FatalError("failed to import 'refnanny' module");
}
#endif
  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_ga(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("ga", __pyx_methods, __pyx_k_The_Global_Arrays_GA_Python_inte, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_miniga4py__ga) {
    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "miniga4py.ga")) {
      if (unlikely(PyDict_SetItemString(modules, "miniga4py.ga", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  (void)__Pyx_modinit_function_export_code();
  (void)__Pyx_modinit_type_init_code();
  if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
  (void)__Pyx_modinit_variable_import_code();
  (void)__Pyx_modinit_function_import_code();
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "miniga4py/ga.pyx":14
 * from libc.stdlib cimport malloc,free
 * from gah cimport *
 * import numpy as np             # <<<<<<<<<<<<<<
 * cimport numpy as np
 * from cpython.ref cimport Py_INCREF
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":18
 * from cpython.ref cimport Py_INCREF
 * from cpython.ref cimport PyTypeObject
 * import sys             # <<<<<<<<<<<<<<
 * try:
 *     import __builtin__
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":19
 * from cpython.ref cimport PyTypeObject
 * import sys
 * try:             # <<<<<<<<<<<<<<
 *     import __builtin__
 * except:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "miniga4py/ga.pyx":20
 * import sys
 * try:
 *     import __builtin__             # <<<<<<<<<<<<<<
 * except:
 *     import builtins as __builtin__
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_builtin, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_builtin, __pyx_t_1) < 0) __PYX_ERR(0, 20, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "miniga4py/ga.pyx":19
 * from cpython.ref cimport PyTypeObject
 * import sys
 * try:             # <<<<<<<<<<<<<<
 *     import __builtin__
 * except:
 */
    }
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L7_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "miniga4py/ga.pyx":21
 * try:
 *     import __builtin__
 * except:             # <<<<<<<<<<<<<<
 *     import builtins as __builtin__
 * 
 */
    /*except:*/ {
      __Pyx_AddTraceback("miniga4py.ga", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 21, __pyx_L4_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);

      /* "miniga4py/ga.pyx":22
 *     import __builtin__
 * except:
 *     import builtins as __builtin__             # <<<<<<<<<<<<<<
 * 
 * if sys.version_info.major < 3:
 */
      __pyx_t_7 = __Pyx_Import(__pyx_n_s_builtins, 0, -1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 22, __pyx_L4_except_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_builtin, __pyx_t_7) < 0) __PYX_ERR(0, 22, __pyx_L4_except_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L3_exception_handled;
    }
    __pyx_L4_except_error:;

    /* "miniga4py/ga.pyx":19
 * from cpython.ref cimport PyTypeObject
 * import sys
 * try:             # <<<<<<<<<<<<<<
 *     import __builtin__
 * except:
 */
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L3_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    __pyx_L7_try_end:;
  }

  /* "miniga4py/ga.pyx":24
 *     import builtins as __builtin__
 * 
 * if sys.version_info.major < 3:             # <<<<<<<<<<<<<<
 *     def b(x):
 *         return str(x)
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_version_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_major); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_int_3, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_8) {

    /* "miniga4py/ga.pyx":25
 * 
 * if sys.version_info.major < 3:
 *     def b(x):             # <<<<<<<<<<<<<<
 *         return str(x)
 *     def s(x):
 */
    __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_1b, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 25, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_b, __pyx_t_5) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "miniga4py/ga.pyx":27
 *     def b(x):
 *         return str(x)
 *     def s(x):             # <<<<<<<<<<<<<<
 *         return str(x)
 *     def isstr(s):
 */
    __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_3s, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 27, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_s, __pyx_t_5) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "miniga4py/ga.pyx":29
 *     def s(x):
 *         return str(x)
 *     def isstr(s):             # <<<<<<<<<<<<<<
 *         return isinstance(s, basestring)
 * else:
 */
    __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_5isstr, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 29, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_isstr, __pyx_t_5) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "miniga4py/ga.pyx":24
 *     import builtins as __builtin__
 * 
 * if sys.version_info.major < 3:             # <<<<<<<<<<<<<<
 *     def b(x):
 *         return str(x)
 */
    goto __pyx_L10;
  }

  /* "miniga4py/ga.pyx":32
 *         return isinstance(s, basestring)
 * else:
 *     import codecs             # <<<<<<<<<<<<<<
 *     def isstr(s):
 *         return isinstance(s, str)
 */
  /*else*/ {
    __pyx_t_5 = __Pyx_Import(__pyx_n_s_codecs, 0, -1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_codecs, __pyx_t_5) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "miniga4py/ga.pyx":33
 * else:
 *     import codecs
 *     def isstr(s):             # <<<<<<<<<<<<<<
 *         return isinstance(s, str)
 *     def isbytes(s):
 */
    __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_7isstr, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 33, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_isstr, __pyx_t_5) < 0) __PYX_ERR(0, 33, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "miniga4py/ga.pyx":35
 *     def isstr(s):
 *         return isinstance(s, str)
 *     def isbytes(s):             # <<<<<<<<<<<<<<
 *         return isinstance(s, (bytes, bytearray))
 *     def b(x):
 */
    __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_9isbytes, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_isbytes, __pyx_t_5) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "miniga4py/ga.pyx":37
 *     def isbytes(s):
 *         return isinstance(s, (bytes, bytearray))
 *     def b(x):             # <<<<<<<<<<<<<<
 *         if isstr(x):
 *             return codecs.latin_1_encode(str(x))[0]
 */
    __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_11b, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 37, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_b, __pyx_t_5) < 0) __PYX_ERR(0, 37, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "miniga4py/ga.pyx":42
 *         else:
 *             return x
 *     def s(x):             # <<<<<<<<<<<<<<
 *         if isbytes(x):
 *             return codecs.latin_1_decode(x)[0]
 */
    __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_13s, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 42, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_s, __pyx_t_5) < 0) __PYX_ERR(0, 42, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_L10:;

  /* "miniga4py/ga.pyx":50
 * DEF EXCLUSIVE = 0
 * 
 * np.import_array()             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "numpy/arrayobject.h":
 */
  __pyx_t_9 = __pyx_f_5numpy_import_array(); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 50, __pyx_L1_error)

  /* "miniga4py/ga.pyx":62
 *                                 object obj)
 * 
 * cdef bint _initialized = False             # <<<<<<<<<<<<<<
 * 
 * TYPE_BASE  = 1000
 */
  __pyx_v_9miniga4py_2ga__initialized = 0;

  /* "miniga4py/ga.pyx":64
 * cdef bint _initialized = False
 * 
 * TYPE_BASE  = 1000             # <<<<<<<<<<<<<<
 * C_CHAR     = (TYPE_BASE + 0)
 * C_INT      = (TYPE_BASE + 1)
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TYPE_BASE, __pyx_int_1000) < 0) __PYX_ERR(0, 64, __pyx_L1_error)

  /* "miniga4py/ga.pyx":65
 * 
 * TYPE_BASE  = 1000
 * C_CHAR     = (TYPE_BASE + 0)             # <<<<<<<<<<<<<<
 * C_INT      = (TYPE_BASE + 1)
 * C_LONG     = (TYPE_BASE + 2)
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_TYPE_BASE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_C_CHAR, __pyx_t_6) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":66
 * TYPE_BASE  = 1000
 * C_CHAR     = (TYPE_BASE + 0)
 * C_INT      = (TYPE_BASE + 1)             # <<<<<<<<<<<<<<
 * C_LONG     = (TYPE_BASE + 2)
 * C_FLOAT    = (TYPE_BASE + 3)
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_TYPE_BASE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_6, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_C_INT, __pyx_t_5) < 0) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":67
 * C_CHAR     = (TYPE_BASE + 0)
 * C_INT      = (TYPE_BASE + 1)
 * C_LONG     = (TYPE_BASE + 2)             # <<<<<<<<<<<<<<
 * C_FLOAT    = (TYPE_BASE + 3)
 * C_DBL      = (TYPE_BASE + 4)
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_TYPE_BASE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_C_LONG, __pyx_t_6) < 0) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":68
 * C_INT      = (TYPE_BASE + 1)
 * C_LONG     = (TYPE_BASE + 2)
 * C_FLOAT    = (TYPE_BASE + 3)             # <<<<<<<<<<<<<<
 * C_DBL      = (TYPE_BASE + 4)
 * C_LDBL     = (TYPE_BASE + 5)
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_TYPE_BASE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_6, __pyx_int_3, 3, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_C_FLOAT, __pyx_t_5) < 0) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":69
 * C_LONG     = (TYPE_BASE + 2)
 * C_FLOAT    = (TYPE_BASE + 3)
 * C_DBL      = (TYPE_BASE + 4)             # <<<<<<<<<<<<<<
 * C_LDBL     = (TYPE_BASE + 5)
 * C_SCPL     = (TYPE_BASE + 6)
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_TYPE_BASE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_4, 4, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_C_DBL, __pyx_t_6) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":70
 * C_FLOAT    = (TYPE_BASE + 3)
 * C_DBL      = (TYPE_BASE + 4)
 * C_LDBL     = (TYPE_BASE + 5)             # <<<<<<<<<<<<<<
 * C_SCPL     = (TYPE_BASE + 6)
 * C_DCPL     = (TYPE_BASE + 7)
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_TYPE_BASE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_6, __pyx_int_5, 5, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_C_LDBL, __pyx_t_5) < 0) __PYX_ERR(0, 70, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":71
 * C_DBL      = (TYPE_BASE + 4)
 * C_LDBL     = (TYPE_BASE + 5)
 * C_SCPL     = (TYPE_BASE + 6)             # <<<<<<<<<<<<<<
 * C_DCPL     = (TYPE_BASE + 7)
 * C_LDCPL    = (TYPE_BASE + 8)
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_TYPE_BASE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_6, 6, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_C_SCPL, __pyx_t_6) < 0) __PYX_ERR(0, 71, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":72
 * C_LDBL     = (TYPE_BASE + 5)
 * C_SCPL     = (TYPE_BASE + 6)
 * C_DCPL     = (TYPE_BASE + 7)             # <<<<<<<<<<<<<<
 * C_LDCPL    = (TYPE_BASE + 8)
 * F_BYTE     = (TYPE_BASE + 9)
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_TYPE_BASE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_6, __pyx_int_7, 7, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_C_DCPL, __pyx_t_5) < 0) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":73
 * C_SCPL     = (TYPE_BASE + 6)
 * C_DCPL     = (TYPE_BASE + 7)
 * C_LDCPL    = (TYPE_BASE + 8)             # <<<<<<<<<<<<<<
 * F_BYTE     = (TYPE_BASE + 9)
 * F_INT      = (TYPE_BASE + 10)
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_TYPE_BASE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_8, 8, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_C_LDCPL, __pyx_t_6) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":74
 * C_DCPL     = (TYPE_BASE + 7)
 * C_LDCPL    = (TYPE_BASE + 8)
 * F_BYTE     = (TYPE_BASE + 9)             # <<<<<<<<<<<<<<
 * F_INT      = (TYPE_BASE + 10)
 * F_LOG      = (TYPE_BASE + 11)
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_TYPE_BASE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_6, __pyx_int_9, 9, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_F_BYTE, __pyx_t_5) < 0) __PYX_ERR(0, 74, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":75
 * C_LDCPL    = (TYPE_BASE + 8)
 * F_BYTE     = (TYPE_BASE + 9)
 * F_INT      = (TYPE_BASE + 10)             # <<<<<<<<<<<<<<
 * F_LOG      = (TYPE_BASE + 11)
 * F_REAL     = (TYPE_BASE + 12)
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_TYPE_BASE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_10, 10, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_F_INT, __pyx_t_6) < 0) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":76
 * F_BYTE     = (TYPE_BASE + 9)
 * F_INT      = (TYPE_BASE + 10)
 * F_LOG      = (TYPE_BASE + 11)             # <<<<<<<<<<<<<<
 * F_REAL     = (TYPE_BASE + 12)
 * F_DBL      = (TYPE_BASE + 13)
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_TYPE_BASE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_6, __pyx_int_11, 11, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_F_LOG, __pyx_t_5) < 0) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":77
 * F_INT      = (TYPE_BASE + 10)
 * F_LOG      = (TYPE_BASE + 11)
 * F_REAL     = (TYPE_BASE + 12)             # <<<<<<<<<<<<<<
 * F_DBL      = (TYPE_BASE + 13)
 * F_SCPL     = (TYPE_BASE + 14)
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_TYPE_BASE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_12, 12, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_F_REAL, __pyx_t_6) < 0) __PYX_ERR(0, 77, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":78
 * F_LOG      = (TYPE_BASE + 11)
 * F_REAL     = (TYPE_BASE + 12)
 * F_DBL      = (TYPE_BASE + 13)             # <<<<<<<<<<<<<<
 * F_SCPL     = (TYPE_BASE + 14)
 * F_DCPL     = (TYPE_BASE + 15)
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_TYPE_BASE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_6, __pyx_int_13, 13, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_F_DBL, __pyx_t_5) < 0) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":79
 * F_REAL     = (TYPE_BASE + 12)
 * F_DBL      = (TYPE_BASE + 13)
 * F_SCPL     = (TYPE_BASE + 14)             # <<<<<<<<<<<<<<
 * F_DCPL     = (TYPE_BASE + 15)
 * C_LONGLONG = (TYPE_BASE + 16)
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_TYPE_BASE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_14, 14, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_F_SCPL, __pyx_t_6) < 0) __PYX_ERR(0, 79, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":80
 * F_DBL      = (TYPE_BASE + 13)
 * F_SCPL     = (TYPE_BASE + 14)
 * F_DCPL     = (TYPE_BASE + 15)             # <<<<<<<<<<<<<<
 * C_LONGLONG = (TYPE_BASE + 16)
 * 
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_TYPE_BASE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_6, __pyx_int_15, 15, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_F_DCPL, __pyx_t_5) < 0) __PYX_ERR(0, 80, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":81
 * F_SCPL     = (TYPE_BASE + 14)
 * F_DCPL     = (TYPE_BASE + 15)
 * C_LONGLONG = (TYPE_BASE + 16)             # <<<<<<<<<<<<<<
 * 
 * WORLD_PROC_GROUP = -1
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_TYPE_BASE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_16, 16, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_C_LONGLONG, __pyx_t_6) < 0) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":83
 * C_LONGLONG = (TYPE_BASE + 16)
 * 
 * WORLD_PROC_GROUP = -1             # <<<<<<<<<<<<<<
 * 
 * _to_dtype = {
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_WORLD_PROC_GROUP, __pyx_int_neg_1) < 0) __PYX_ERR(0, 83, __pyx_L1_error)

  /* "miniga4py/ga.pyx":86
 * 
 * _to_dtype = {
 *         C_CHAR:     np.dtype(np.int8),             # <<<<<<<<<<<<<<
 *         C_INT:      np.dtype(np.int32),
 *         C_LONG:     np.dtype(np.int64),
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_CHAR); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyDict_SetItem(__pyx_t_6, __pyx_t_5, __pyx_t_1) < 0) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":87
 * _to_dtype = {
 *         C_CHAR:     np.dtype(np.int8),
 *         C_INT:      np.dtype(np.int32),             # <<<<<<<<<<<<<<
 *         C_LONG:     np.dtype(np.int64),
 *         C_LONGLONG: np.dtype(np.int64),
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_INT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int32); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyDict_SetItem(__pyx_t_6, __pyx_t_1, __pyx_t_5) < 0) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":88
 *         C_CHAR:     np.dtype(np.int8),
 *         C_INT:      np.dtype(np.int32),
 *         C_LONG:     np.dtype(np.int64),             # <<<<<<<<<<<<<<
 *         C_LONGLONG: np.dtype(np.int64),
 *         C_FLOAT:    np.dtype(np.float32),
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_LONG); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyDict_SetItem(__pyx_t_6, __pyx_t_5, __pyx_t_1) < 0) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":89
 *         C_INT:      np.dtype(np.int32),
 *         C_LONG:     np.dtype(np.int64),
 *         C_LONGLONG: np.dtype(np.int64),             # <<<<<<<<<<<<<<
 *         C_FLOAT:    np.dtype(np.float32),
 *         C_DBL:      np.dtype(np.float64),
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_LONGLONG); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyDict_SetItem(__pyx_t_6, __pyx_t_1, __pyx_t_5) < 0) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":90
 *         C_LONG:     np.dtype(np.int64),
 *         C_LONGLONG: np.dtype(np.int64),
 *         C_FLOAT:    np.dtype(np.float32),             # <<<<<<<<<<<<<<
 *         C_DBL:      np.dtype(np.float64),
 *         C_SCPL:     np.dtype(np.complex64),
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_FLOAT); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyDict_SetItem(__pyx_t_6, __pyx_t_5, __pyx_t_1) < 0) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":91
 *         C_LONGLONG: np.dtype(np.int64),
 *         C_FLOAT:    np.dtype(np.float32),
 *         C_DBL:      np.dtype(np.float64),             # <<<<<<<<<<<<<<
 *         C_SCPL:     np.dtype(np.complex64),
 *         C_DCPL:     np.dtype(np.complex128),
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_DBL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyDict_SetItem(__pyx_t_6, __pyx_t_1, __pyx_t_5) < 0) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":92
 *         C_FLOAT:    np.dtype(np.float32),
 *         C_DBL:      np.dtype(np.float64),
 *         C_SCPL:     np.dtype(np.complex64),             # <<<<<<<<<<<<<<
 *         C_DCPL:     np.dtype(np.complex128),
 *         }
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_SCPL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_complex64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyDict_SetItem(__pyx_t_6, __pyx_t_5, __pyx_t_1) < 0) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "miniga4py/ga.pyx":93
 *         C_DBL:      np.dtype(np.float64),
 *         C_SCPL:     np.dtype(np.complex64),
 *         C_DCPL:     np.dtype(np.complex128),             # <<<<<<<<<<<<<<
 *         }
 * # numpy doesn't always have these types depending on the system
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_DCPL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_complex128); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyDict_SetItem(__pyx_t_6, __pyx_t_1, __pyx_t_5) < 0) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_to_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":96
 *         }
 * # numpy doesn't always have these types depending on the system
 * cdef bint float128_in_np = ('float128' in dir(np))             # <<<<<<<<<<<<<<
 * cdef bint complex256_in_np = ('complex256' in dir(np))
 * if float128_in_np:
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyObject_Dir(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_8 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_float128, __pyx_t_5, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 96, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_9miniga4py_2ga_float128_in_np = __pyx_t_8;

  /* "miniga4py/ga.pyx":97
 * # numpy doesn't always have these types depending on the system
 * cdef bint float128_in_np = ('float128' in dir(np))
 * cdef bint complex256_in_np = ('complex256' in dir(np))             # <<<<<<<<<<<<<<
 * if float128_in_np:
 *     _to_dtype[C_LDBL] = np.dtype(np.float128)
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_Dir(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_8 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_complex256, __pyx_t_6, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_9miniga4py_2ga_complex256_in_np = __pyx_t_8;

  /* "miniga4py/ga.pyx":98
 * cdef bint float128_in_np = ('float128' in dir(np))
 * cdef bint complex256_in_np = ('complex256' in dir(np))
 * if float128_in_np:             # <<<<<<<<<<<<<<
 *     _to_dtype[C_LDBL] = np.dtype(np.float128)
 * if complex256_in_np:
 */
  __pyx_t_8 = (__pyx_v_9miniga4py_2ga_float128_in_np != 0);
  if (__pyx_t_8) {

    /* "miniga4py/ga.pyx":99
 * cdef bint complex256_in_np = ('complex256' in dir(np))
 * if float128_in_np:
 *     _to_dtype[C_LDBL] = np.dtype(np.float128)             # <<<<<<<<<<<<<<
 * if complex256_in_np:
 *     _to_dtype[C_LDCPL] = np.dtype(np.complex256)
 */
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float128); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_to_dtype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_LDBL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(PyObject_SetItem(__pyx_t_5, __pyx_t_1, __pyx_t_6) < 0)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":98
 * cdef bint float128_in_np = ('float128' in dir(np))
 * cdef bint complex256_in_np = ('complex256' in dir(np))
 * if float128_in_np:             # <<<<<<<<<<<<<<
 *     _to_dtype[C_LDBL] = np.dtype(np.float128)
 * if complex256_in_np:
 */
  }

  /* "miniga4py/ga.pyx":100
 * if float128_in_np:
 *     _to_dtype[C_LDBL] = np.dtype(np.float128)
 * if complex256_in_np:             # <<<<<<<<<<<<<<
 *     _to_dtype[C_LDCPL] = np.dtype(np.complex256)
 * 
 */
  __pyx_t_8 = (__pyx_v_9miniga4py_2ga_complex256_in_np != 0);
  if (__pyx_t_8) {

    /* "miniga4py/ga.pyx":101
 *     _to_dtype[C_LDBL] = np.dtype(np.float128)
 * if complex256_in_np:
 *     _to_dtype[C_LDCPL] = np.dtype(np.complex256)             # <<<<<<<<<<<<<<
 * 
 * #############################################################################
 */
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_complex256); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_to_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_C_LDCPL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_t_5, __pyx_t_6) < 0)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "miniga4py/ga.pyx":100
 * if float128_in_np:
 *     _to_dtype[C_LDBL] = np.dtype(np.float128)
 * if complex256_in_np:             # <<<<<<<<<<<<<<
 *     _to_dtype[C_LDCPL] = np.dtype(np.complex256)
 * 
 */
  }

  /* "miniga4py/ga.pyx":107
 * #############################################################################
 * 
 * def dtype(int gatype):             # <<<<<<<<<<<<<<
 *     """Converts the given GA type to a numpy dtype."""
 *     if gatype in _to_dtype:
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_15dtype, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":113
 *     raise ValueError("%d was not a recognized GA type" % gatype)
 * 
 * def inquire_dtype(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns the numpy dtype of the given GA."""
 *     gatype = inquire_type(g_a)
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_17inquire_dtype, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_inquire_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 113, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":263
 *         raise TypeError("type of g_a not recognized")
 * 
 * def zip(lo, hi):             # <<<<<<<<<<<<<<
 *     """Transforms a GA lo,hi combination into a slice list."""
 *     return [slice(l,h) for l,h in __builtin__.zip(lo,hi)]
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_19zip, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_zip, __pyx_t_6) < 0) __PYX_ERR(0, 263, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":271
 * #############################################################################
 * 
 * def abs_value(int g_a, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Take element-wise absolute value of the array or patch.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_21abs_value, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_abs_value, __pyx_t_6) < 0) __PYX_ERR(0, 271, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":292
 *         GA_Abs_value_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 * def acc(int g_a, buffer, lo=None, hi=None, alpha=None):             # <<<<<<<<<<<<<<
 *     """Combines data from buffer with data in the global array patch.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_23acc, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_acc, __pyx_t_6) < 0) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":427
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data, valpha)
 * 
 * def access(int g_a, lo=None, hi=None, int proc=-1):             # <<<<<<<<<<<<<<
 *     """Returns local array patch.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_25access, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_access, __pyx_t_6) < 0) __PYX_ERR(0, 427, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":523
 *     return array
 * 
 * def access_block(int g_a, int idx):             # <<<<<<<<<<<<<<
 *     """Returns local array patch for a block-cyclic distribution.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_27access_block, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_access_block, __pyx_t_6) < 0) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":568
 *     return array
 * 
 * def access_block_grid(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Returns local array patch for a SCALAPACK block-cyclic distribution.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_29access_block_grid, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_access_block_grid, __pyx_t_6) < 0) __PYX_ERR(0, 568, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":594
 *     raise NotImplementedError
 * 
 * def access_block_segment(int g_a, int proc):             # <<<<<<<<<<<<<<
 *     """This function can be used to gain access to the all the locally held
 *     data on a particular processor that is associated with a block-cyclic
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_31access_block_segment, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 594, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_access_block_segment, __pyx_t_6) < 0) __PYX_ERR(0, 594, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":630
 *     return array
 * 
 * def access_ghost_element(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Returns a scalar ndarray representing the requested ghost element.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_33access_ghost_element, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_access_ghost_element, __pyx_t_6) < 0) __PYX_ERR(0, 630, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":652
 *     raise NotImplementedError("use access_ghosts(g_a) instead")
 * 
 * def access_ghosts(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns ndarray representing local patch with ghost cells.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_35access_ghosts, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_access_ghosts, __pyx_t_6) < 0) __PYX_ERR(0, 652, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":693
 *     return array
 * 
 * def add(int g_a, int g_b, int g_c, alpha=None, beta=None, alo=None, ahi=None,             # <<<<<<<<<<<<<<
 *         blo=None, bhi=None, clo=None, chi=None):
 *     """Element-wise addition of two arrays.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_37add, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_add, __pyx_t_6) < 0) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":770
 *                         g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def add_constant(int g_a, alpha, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Adds the constant alpha to each element of the array.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_39add_constant, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_add_constant, __pyx_t_6) < 0) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":808
 *                 g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, valpha)
 * 
 * def add_diagonal(int g_a, int g_v):             # <<<<<<<<<<<<<<
 *     """Adds the elements of the vector g_v to the diagonal of matrix g_a.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_41add_diagonal, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 808, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_add_diagonal, __pyx_t_6) < 0) __PYX_ERR(0, 808, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":822
 *     GA_Add_diagonal(g_a, g_v)
 * 
 * def allocate(int g_a):             # <<<<<<<<<<<<<<
 *     """Allocates memory for the handle obtained using ga.create_handle.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_43allocate, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_allocate, __pyx_t_6) < 0) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":842
 *     return False
 * 
 * def brdcst(buffer, int root=0):             # <<<<<<<<<<<<<<
 *     """Broadcast from process root to all other processes.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_45brdcst, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_brdcst, __pyx_t_6) < 0) __PYX_ERR(0, 842, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":869
 *     return buffer_nd
 * 
 * def check_handle(int g_a, message):             # <<<<<<<<<<<<<<
 *     """Checks that the array handle g_a is valid.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_47check_handle, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_handle, __pyx_t_6) < 0) __PYX_ERR(0, 869, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":879
 *     GA_Check_handle(g_a, b(message))
 * 
 * def cluster_nnodes():             # <<<<<<<<<<<<<<
 *     """Returns the total number of nodes that the program is running on.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_49cluster_nnodes, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 879, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_cluster_nnodes, __pyx_t_6) < 0) __PYX_ERR(0, 879, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":890
 *     return GA_Cluster_nnodes()
 * 
 * def cluster_nodeid(int proc=-1):             # <<<<<<<<<<<<<<
 *     """Returns the node ID of this process or the given process.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_51cluster_nodeid, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_cluster_nodeid, __pyx_t_6) < 0) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":907
 *     return GA_Cluster_nodeid()
 * 
 * def cluster_proc_nodeid(int proc):             # <<<<<<<<<<<<<<
 *     """Returns the node ID of the specified process.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_53cluster_proc_nodeid, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_cluster_proc_nodeid, __pyx_t_6) < 0) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":918
 *     return GA_Cluster_proc_nodeid(proc)
 * 
 * def cluster_nprocs(int node):             # <<<<<<<<<<<<<<
 *     """Returns the number of processors available on the given node.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_55cluster_nprocs, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_cluster_nprocs, __pyx_t_6) < 0) __PYX_ERR(0, 918, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":926
 *     return GA_Cluster_nprocs(node)
 * 
 * def cluster_procid(int node, int proc):             # <<<<<<<<<<<<<<
 *     """Returns the proc ID associated with node and local proc ID.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_57cluster_procid, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 926, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_cluster_procid, __pyx_t_6) < 0) __PYX_ERR(0, 926, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":937
 *     return GA_Cluster_procid(node, proc)
 * 
 * def compare_distr(int g_a, int g_b):             # <<<<<<<<<<<<<<
 *     """Compares the distributions of two global arrays.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_59compare_distr, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_compare_distr, __pyx_t_6) < 0) __PYX_ERR(0, 937, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":949
 *     return False
 * 
 * def copy(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None,             # <<<<<<<<<<<<<<
 *         bint trans=False):
 *     """Copies elements from array g_a into array g_b.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_61copy, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_copy, __pyx_t_6) < 0) __PYX_ERR(0, 949, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":996
 *                 g_b, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 * 
 * def create(int gtype, dims, name="", chunk=None, int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Creates an n-dimensional array using the regular distribution model.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_63create, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 996, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_create, __pyx_t_6) < 0) __PYX_ERR(0, 996, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1041
 *                 b(name), NULL, pgroup)
 * 
 * def create_ghosts(int gtype, dims, width, name="", chunk=None,             # <<<<<<<<<<<<<<
 *         int pgroup=-1):
 *     """Creates an array with a layer of ghost cells around the visible data.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_65create_ghosts, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_create_ghosts, __pyx_t_6) < 0) __PYX_ERR(0, 1041, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1093
 *                 NULL, pgroup)
 * 
 * def create_handle():             # <<<<<<<<<<<<<<
 *     """Returns a global array handle that can be used to create a new array.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_67create_handle, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_create_handle, __pyx_t_6) < 0) __PYX_ERR(0, 1093, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1108
 *     return GA_Create_handle()
 * 
 * def create_irreg(int gtype, dims, block, map, name="", int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Creates an array by following the user-specified distribution.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_69create_irreg, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_create_irreg, __pyx_t_6) < 0) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1149
 *             <int64_t*>block_nd.data, <int64_t*>map_nd.data, pgroup)
 * 
 * def create_ghosts_irreg(int gtype, dims, width, block, map, name="",             # <<<<<<<<<<<<<<
 *         int pgroup=-1):
 *     """Creates an array with a layer of ghost cells around the visible data.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_71create_ghosts_irreg, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_create_ghosts_irreg, __pyx_t_6) < 0) __PYX_ERR(0, 1149, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1199
 *             <int64_t*>block_nd.data, <int64_t*>map_nd.data, pgroup)
 * 
 * def create_mutexes(int number):             # <<<<<<<<<<<<<<
 *     """Creates a set containing the number of mutexes.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_73create_mutexes, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_create_mutexes, __pyx_t_6) < 0) __PYX_ERR(0, 1199, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1221
 *     return False
 * 
 * def deregister_type(int type):             # <<<<<<<<<<<<<<
 *     """Removes the data type previously registered using register_type.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_75deregister_type, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_deregister_type, __pyx_t_6) < 0) __PYX_ERR(0, 1221, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1231
 *     return NGA_Deregister_type(type)
 * 
 * def destroy(int g_a):             # <<<<<<<<<<<<<<
 *     """Deallocates the array and frees any associated resources.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_77destroy, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_destroy, __pyx_t_6) < 0) __PYX_ERR(0, 1231, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1239
 *     GA_Destroy(g_a)
 * 
 * def destroy_mutexes():             # <<<<<<<<<<<<<<
 *     """Destroys the set of mutexes created with ga_create_mutexes.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_79destroy_mutexes, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_destroy_mutexes, __pyx_t_6) < 0) __PYX_ERR(0, 1239, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1251
 *     return False
 * 
 * def diag(int g_a, int g_s, int g_v, evalues=None):             # <<<<<<<<<<<<<<
 *     """Solve the generalized eigen-value problem.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_81diag, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_diag, __pyx_t_6) < 0) __PYX_ERR(0, 1251, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1277
 *     return evalues
 * 
 * def diag_reuse(int control, int g_a, int g_s, int g_v, evalues=None):             # <<<<<<<<<<<<<<
 *     """Solve the generalized eigen-value problem.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_83diag_reuse, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_diag_reuse, __pyx_t_6) < 0) __PYX_ERR(0, 1277, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1311
 *     return evalues
 * 
 * def diag_std(int g_a, int g_v, evalues=None):             # <<<<<<<<<<<<<<
 *     """Solve the standard (non-generalized) eigenvalue problem.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_85diag_std, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_diag_std, __pyx_t_6) < 0) __PYX_ERR(0, 1311, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1353
 *     return lo,hi
 * 
 * def dot(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None,             # <<<<<<<<<<<<<<
 *         bint ta=False, bint tb=False):
 *     """Computes the element-wise dot product of two arrays.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_89dot, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_dot, __pyx_t_6) < 0) __PYX_ERR(0, 1353, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1462
 *             raise TypeError
 * 
 * def duplicate(int g_a, name=""):             # <<<<<<<<<<<<<<
 *     """Creates a new array by applying all the properties of another existing
 *     array.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_91duplicate, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_duplicate, __pyx_t_6) < 0) __PYX_ERR(0, 1462, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1479
 *     return GA_Duplicate(g_a, b(name))
 * 
 * def elem_divide(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,             # <<<<<<<<<<<<<<
 *         bhi=None, clo=None, chi=None):
 *     """Computes the element-wise quotient of the two arrays.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_93elem_divide, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_elem_divide, __pyx_t_6) < 0) __PYX_ERR(0, 1479, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1531
 *                 g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def elem_maximum(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,             # <<<<<<<<<<<<<<
 *         bhi=None, clo=None, chi=None):
 *     """Computes the element-wise maximum of the two arrays.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_95elem_maximum, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_elem_maximum, __pyx_t_6) < 0) __PYX_ERR(0, 1531, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1585
 *                 g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def elem_minimum(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,             # <<<<<<<<<<<<<<
 *         bhi=None, clo=None, chi=None):
 *     """Computes the element-wise minimum of the two arrays.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_97elem_minimum, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_elem_minimum, __pyx_t_6) < 0) __PYX_ERR(0, 1585, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1639
 *                 g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def elem_multiply(int g_a, int g_b, int g_c, alo=None, ahi=None, blo=None,             # <<<<<<<<<<<<<<
 *         bhi=None, clo=None, chi=None):
 *     """Computes the element-wise product of the two arrays.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_99elem_multiply, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_elem_multiply, __pyx_t_6) < 0) __PYX_ERR(0, 1639, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1689
 *                 g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def error(message, int code=1):             # <<<<<<<<<<<<<<
 *     """Prints message and aborts safely with code."""
 *     GA_Error(b(message), code)
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_101error, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_error, __pyx_t_6) < 0) __PYX_ERR(0, 1689, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1693
 *     GA_Error(b(message), code)
 * 
 * def fence():             # <<<<<<<<<<<<<<
 *     """Blocks the calling process until all the data transfers corresponding
 *     to GA operations called after ga.init_fence() complete.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_103fence, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_fence, __pyx_t_6) < 0) __PYX_ERR(0, 1693, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1726
 *     GA_Fence()
 * 
 * def fill(int g_a, value, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Assign a single value to all elements in the array or patch.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_105fill, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_fill, __pyx_t_6) < 0) __PYX_ERR(0, 1726, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1760
 *                 g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, vvalue)
 * 
 * def gather(int g_a, subsarray, np.ndarray values=None):             # <<<<<<<<<<<<<<
 *     """Gathers array elements from a global array into a local array.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_107gather, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1760, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gather, __pyx_t_6) < 0) __PYX_ERR(0, 1760, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1819
 *     return values
 * 
 * def gemm(bint ta, bint tb, int64_t m, int64_t n, int64_t k,             # <<<<<<<<<<<<<<
 *         alpha, int g_a, int g_b, beta, int g_c):
 *     """Performs one of the matrix-matrix operations.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_109gemm, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gemm, __pyx_t_6) < 0) __PYX_ERR(0, 1819, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":1915
 *         raise TypeError
 * 
 * def get(int g_a, lo=None, hi=None, np.ndarray buffer=None):             # <<<<<<<<<<<<<<
 *     """Copies data from global array section to the local array buffer.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_111get, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get, __pyx_t_6) < 0) __PYX_ERR(0, 1915, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2028
 *         return buffer
 * 
 * def get_block_info(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns information about the block-cyclic distribution.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_113get_block_info, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_block_info, __pyx_t_6) < 0) __PYX_ERR(0, 2028, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2052
 *     return num_blocks,block_dims
 * 
 * def get_diag(int g_a, int g_v):             # <<<<<<<<<<<<<<
 *     """Inserts the diagonal elements of this matrix g_a into the vector g_v.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_115get_diag, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2052, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_diag, __pyx_t_6) < 0) __PYX_ERR(0, 2052, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2064
 *     GA_Get_diag(g_a, g_v)
 * 
 * def get_debug():             # <<<<<<<<<<<<<<
 *     """Returns the value of an internal flag in the GA library whose value can
 *     be set using the ga.set_debug() subroutine.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_117get_debug, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_debug, __pyx_t_6) < 0) __PYX_ERR(0, 2064, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2073
 *     return GA_Get_debug()
 * 
 * def gop(X, op):             # <<<<<<<<<<<<<<
 *     """Global operation.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_119gop, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2073, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gop, __pyx_t_6) < 0) __PYX_ERR(0, 2073, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2119
 *     return X_nd
 * 
 * def gop_add(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "+")
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_121gop_add, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gop_add, __pyx_t_6) < 0) __PYX_ERR(0, 2119, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2122
 *     return gop(X, "+")
 * 
 * def gop_multiply(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "*")
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_123gop_multiply, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gop_multiply, __pyx_t_6) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2125
 *     return gop(X, "*")
 * 
 * def gop_max(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "max")
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_125gop_max, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gop_max, __pyx_t_6) < 0) __PYX_ERR(0, 2125, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2128
 *     return gop(X, "max")
 * 
 * def gop_min(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "min")
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_127gop_min, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gop_min, __pyx_t_6) < 0) __PYX_ERR(0, 2128, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2131
 *     return gop(X, "min")
 * 
 * def gop_absmax(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "absmax")
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_129gop_absmax, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gop_absmax, __pyx_t_6) < 0) __PYX_ERR(0, 2131, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2134
 *     return gop(X, "absmax")
 * 
 * def gop_absmin(X):             # <<<<<<<<<<<<<<
 *     return gop(X, "absmin")
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_131gop_absmin, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gop_absmin, __pyx_t_6) < 0) __PYX_ERR(0, 2134, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2137
 *     return gop(X, "absmin")
 * 
 * def has_ghosts(int g_a):             # <<<<<<<<<<<<<<
 *     """Determines whether any dimension of the given array has ghost cells.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_133has_ghosts, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_has_ghosts, __pyx_t_6) < 0) __PYX_ERR(0, 2137, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2153
 *     return False
 * 
 * def init_fence():             # <<<<<<<<<<<<<<
 *     """Initializes tracing of completion status of data movement operations.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_135init_fence, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_init_fence, __pyx_t_6) < 0) __PYX_ERR(0, 2153, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2161
 *     GA_Init_fence()
 * 
 * def initialize():             # <<<<<<<<<<<<<<
 *     """Allocates and initializes internal data structures in Global Arrays.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_137initialize, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_initialize, __pyx_t_6) < 0) __PYX_ERR(0, 2161, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2174
 *     _initialized = True
 * 
 * def initialize_ltd(size_t limit):             # <<<<<<<<<<<<<<
 *     """Allocates and initializes internal data structures and sets limit for
 *     memory used in global arrays.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_139initialize_ltd, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_initialize_ltd, __pyx_t_6) < 0) __PYX_ERR(0, 2174, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2193
 *     _initialized = True
 * 
 * def initialized():             # <<<<<<<<<<<<<<
 *     """Returns whether ga has been initialized."""
 *     return _initialized
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_141initialized, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_initialized, __pyx_t_6) < 0) __PYX_ERR(0, 2193, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2210
 *     return dims
 * 
 * def inquire_memory():             # <<<<<<<<<<<<<<
 *     """Returns amount of memory (in bytes) used in the allocated global arrays
 *     on the calling processor.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_147inquire_memory, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_inquire_memory, __pyx_t_6) < 0) __PYX_ERR(0, 2210, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2219
 *     return GA_Inquire_memory()
 * 
 * def inquire_name(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns the name of an array represented by the handle g_a.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_149inquire_name, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_inquire_name, __pyx_t_6) < 0) __PYX_ERR(0, 2219, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2237
 *     return gtype
 * 
 * def is_mirrored(int g_a):             # <<<<<<<<<<<<<<
 *     """Checks whether the array is mirrored.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_153is_mirrored, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_mirrored, __pyx_t_6) < 0) __PYX_ERR(0, 2237, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2249
 *     return False
 * 
 * def llt_solve(int g_a, int g_b):             # <<<<<<<<<<<<<<
 *     """Solves a system of linear equations
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_155llt_solve, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_llt_solve, __pyx_t_6) < 0) __PYX_ERR(0, 2249, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2271
 *     return GA_Llt_solve(g_a, g_b)
 * 
 * def locate(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Return the GA compute process id that 'owns' the data.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_157locate, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_locate, __pyx_t_6) < 0) __PYX_ERR(0, 2271, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2289
 *     return NGA_Locate64(g_a, <int64_t*>subscript_nd.data)
 * 
 * def locate_nnodes(int g_a, lo, hi):             # <<<<<<<<<<<<<<
 *     """Return the number of process which own the specified patch.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_159locate_nnodes, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_locate_nnodes, __pyx_t_6) < 0) __PYX_ERR(0, 2289, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2300
 *     return NGA_Locate_nnodes64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 * def locate_region(int g_a, lo, hi):             # <<<<<<<<<<<<<<
 *     """Return the list of the GA processes id that 'own' the data.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_161locate_region, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_locate_region, __pyx_t_6) < 0) __PYX_ERR(0, 2300, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2337
 *     return map_reshape,procs
 * 
 * def lock(int mutex):             # <<<<<<<<<<<<<<
 *     """Locks a mutex object identified by the mutex number.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_163lock, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_lock, __pyx_t_6) < 0) __PYX_ERR(0, 2337, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2346
 *     GA_Lock(mutex)
 * 
 * def lu_solve(int g_a, int g_b, bint trans=False):             # <<<<<<<<<<<<<<
 *     """Solve the system of linear equations op(A)X = B based on the LU
 *     factorization.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_165lu_solve, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_lu_solve, __pyx_t_6) < 0) __PYX_ERR(0, 2346, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2374
 *     GA_Lu_solve(ctrans, g_a, g_b)
 * 
 * def mask_sync(bint first, bint last):             # <<<<<<<<<<<<<<
 *     """This subroutine can be used to remove synchronization calls from around
 *     collective operations.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_167mask_sync, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_mask_sync, __pyx_t_6) < 0) __PYX_ERR(0, 2374, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2394
 *     GA_Mask_sync(first,last)
 * 
 * def matmul_patch(bint transa, bint transb, alpha, beta,             # <<<<<<<<<<<<<<
 *         int g_a, alo, ahi,
 *         int g_b, blo, bhi,
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_169matmul_patch, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_matmul_patch, __pyx_t_6) < 0) __PYX_ERR(0, 2394, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2452
 *             g_c, <int64_t*>clo_nd.data, <int64_t*>chi_nd.data)
 * 
 * def median(int g_a, int g_b, int g_c, int g_m,             # <<<<<<<<<<<<<<
 *         alo=None, ahi=None, blo=None, bhi=None,
 *         clo=None, chi=None, mlo=None, mhi=None):
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_171median, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_median, __pyx_t_6) < 0) __PYX_ERR(0, 2452, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2509
 *                 g_m, <int64_t*>mlo_nd.data, <int64_t*>mhi_nd.data)
 * 
 * def memory_avail():             # <<<<<<<<<<<<<<
 *     """Returns amount of memory (in bytes) left for allocation of new global
 *     arrays on the calling processor.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_173memory_avail, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_memory_avail, __pyx_t_6) < 0) __PYX_ERR(0, 2509, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2526
 *     return GA_Memory_avail()
 * 
 * def memory_limited():             # <<<<<<<<<<<<<<
 *     """Indicates if limit is set on memory usage in Global Arrays on the
 *     calling processor.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_175memory_limited, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_memory_limited, __pyx_t_6) < 0) __PYX_ERR(0, 2526, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2539
 *     return False
 * 
 * def merge_distr_patch(int g_a, alo, ahi, int g_b, blo, bhi):             # <<<<<<<<<<<<<<
 *     """This function merges all copies of a patch of a mirrored array (g_a)
 *     into a patch in a distributed array (g_b).
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_177merge_distr_patch, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_merge_distr_patch, __pyx_t_6) < 0) __PYX_ERR(0, 2539, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2568
 *             g_b, <int64_t*>blo_nd.data, <int64_t*>bhi_nd.data)
 * 
 * def merge_mirrored(int g_a):             # <<<<<<<<<<<<<<
 *     """This subroutine merges mirrored arrays by adding the contents of each
 *     array across nodes.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_179merge_mirrored, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_merge_mirrored, __pyx_t_6) < 0) __PYX_ERR(0, 2568, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2585
 *     GA_Merge_mirrored(g_a)
 * 
 * def nbacc(int g_a, buffer, lo=None, hi=None, alpha=None):             # <<<<<<<<<<<<<<
 *     """Non-blocking version of ga.acc.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_181nbacc, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_nbacc, __pyx_t_6) < 0) __PYX_ERR(0, 2585, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2618
 *     return _acc_common(g_a, buffer, lo, hi, alpha, True)
 * 
 * def nbget(int g_a, lo=None, hi=None, np.ndarray buffer=None):             # <<<<<<<<<<<<<<
 *     """Non-blocking version of the blocking ga.get operation.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_183nbget, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_nbget, __pyx_t_6) < 0) __PYX_ERR(0, 2618, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2648
 *     return _get_common(g_a, lo, hi, buffer, True)
 * 
 * def nblock(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns the number of partitions of each array dimension for g_a.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_185nblock, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_nblock, __pyx_t_6) < 0) __PYX_ERR(0, 2648, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2664
 *     return nblock_nd
 * 
 * def nbput(int g_a, buffer, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Non-blocking version of the blocking put operation.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_187nbput, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_nbput, __pyx_t_6) < 0) __PYX_ERR(0, 2664, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2691
 *     return _put_common(g_a, buffer, lo, hi, True, False)
 * 
 * def nbwait(ga_nbhdl_t nbhandle):             # <<<<<<<<<<<<<<
 *     """This function completes a non-blocking one-sided operation locally.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_189nbwait, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_nbwait, __pyx_t_6) < 0) __PYX_ERR(0, 2691, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2709
 *     NGA_NbWait(&nbhandle)
 * 
 * def ndim(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns the number of dimensions in array represented by the handle g_a.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_191ndim, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ndim, __pyx_t_6) < 0) __PYX_ERR(0, 2709, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2723
 *     return GA_Ndim(g_a)
 * 
 * def nnodes():             # <<<<<<<<<<<<<<
 *     """Returns the number of the GA compute (user) processes.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_193nnodes, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_nnodes, __pyx_t_6) < 0) __PYX_ERR(0, 2723, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2733
 *     return GA_Nnodes()
 * 
 * def nodeid():             # <<<<<<<<<<<<<<
 *     """Returns the GA process id (0, ..., ga.nnodes()-1) of the requesting
 *     compute process.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_195nodeid, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_nodeid, __pyx_t_6) < 0) __PYX_ERR(0, 2733, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2744
 *     return GA_Nodeid()
 * 
 * def norm1(int g_a):             # <<<<<<<<<<<<<<
 *     """Computes the 1-norm of the matrix or vector g_a.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_197norm1, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_norm1, __pyx_t_6) < 0) __PYX_ERR(0, 2744, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2760
 *     return nm
 * 
 * def norm_infinity(int g_a):             # <<<<<<<<<<<<<<
 *     """Computes the 1-norm of the matrix or vector g_a.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_199norm_infinity, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2760, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_norm_infinity, __pyx_t_6) < 0) __PYX_ERR(0, 2760, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2776
 *     return nm
 * 
 * def enum(int g_a, lo=None, hi=None, start=None, inc=None):             # <<<<<<<<<<<<<<
 *     """This subroutine enumerates the values of an array between elements lo
 *     and hi starting with the value istart and incrementing each subsequent
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_201enum, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_enum, __pyx_t_6) < 0) __PYX_ERR(0, 2776, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2834
 *     GA_Patch_enum64(g_a, c_lo, c_hi, vstart, vinc)
 * 
 * def pack(int g_src, int g_dst, int g_msk, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """The pack subroutine is designed to compress the values in the source
 *     vector g_src into a smaller destination array g_dst based on the values
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_203pack, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pack, __pyx_t_6) < 0) __PYX_ERR(0, 2834, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2872
 *     return icount
 * 
 * def periodic_acc(int g_a, buffer, lo=None, hi=None, alpha=None):             # <<<<<<<<<<<<<<
 *     """Periodic version of ga.acc.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_205periodic_acc, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_periodic_acc, __pyx_t_6) < 0) __PYX_ERR(0, 2872, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2903
 *     _acc_common(g_a, buffer, lo, hi, alpha, False, True)
 * 
 * def periodic_get(int g_a, lo=None, hi=None, np.ndarray buffer=None):             # <<<<<<<<<<<<<<
 *     """Periodic version of ga.get.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_207periodic_get, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_periodic_get, __pyx_t_6) < 0) __PYX_ERR(0, 2903, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2932
 *     return _get_common(g_a, lo, hi, buffer, False, True)
 * 
 * def periodic_put(int g_a, buffer, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Periodic version of ga.put.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_209periodic_put, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_periodic_put, __pyx_t_6) < 0) __PYX_ERR(0, 2932, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2959
 *     _put_common(g_a, buffer, lo, hi, False, True)
 * 
 * def pgroup_absolute_id(int pgroup, int pid):             # <<<<<<<<<<<<<<
 *     """TODO"""
 *     return GA_Pgroup_absolute_id(pgroup, pid)
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_211pgroup_absolute_id, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgroup_absolute_id, __pyx_t_6) < 0) __PYX_ERR(0, 2959, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2963
 *     return GA_Pgroup_absolute_id(pgroup, pid)
 * 
 * def pgroup_brdcst(int pgroup, buffer, int root=0):             # <<<<<<<<<<<<<<
 *     """Broadcast from process root to all other processes in the same group.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_213pgroup_brdcst, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2963, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgroup_brdcst, __pyx_t_6) < 0) __PYX_ERR(0, 2963, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":2993
 *     return buffer_nd
 * 
 * def pgroup_create(list):             # <<<<<<<<<<<<<<
 *     """Creates a processor group.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_215pgroup_create, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgroup_create, __pyx_t_6) < 0) __PYX_ERR(0, 2993, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3010
 *     return GA_Pgroup_create(<int*>list_nd.data, len(list_nd))
 * 
 * def pgroup_destroy(int pgroup):             # <<<<<<<<<<<<<<
 *     """Frees up a processor group handle.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_217pgroup_destroy, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgroup_destroy, __pyx_t_6) < 0) __PYX_ERR(0, 3010, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3022
 *     return True
 * 
 * def pgroup_get_default():             # <<<<<<<<<<<<<<
 *     """Returns a handle to the default processor group.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_219pgroup_get_default, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3022, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgroup_get_default, __pyx_t_6) < 0) __PYX_ERR(0, 3022, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3033
 *     return GA_Pgroup_get_default()
 * 
 * def pgroup_get_mirror():             # <<<<<<<<<<<<<<
 *     """Returns a handle to the mirrored processor group.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_221pgroup_get_mirror, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3033, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgroup_get_mirror, __pyx_t_6) < 0) __PYX_ERR(0, 3033, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3044
 *     return GA_Pgroup_get_mirror()
 * 
 * def pgroup_get_world():             # <<<<<<<<<<<<<<
 *     """Returns a handle to the world processor group.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_223pgroup_get_world, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgroup_get_world, __pyx_t_6) < 0) __PYX_ERR(0, 3044, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3055
 *     return GA_Pgroup_get_world()
 * 
 * def pgroup_gop(int pgroup, X, op):             # <<<<<<<<<<<<<<
 *     """Global operation.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_225pgroup_gop, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgroup_gop, __pyx_t_6) < 0) __PYX_ERR(0, 3055, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3096
 *     return X_nd
 * 
 * def pgroup_gop_add(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "+")
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_227pgroup_gop_add, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3096, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgroup_gop_add, __pyx_t_6) < 0) __PYX_ERR(0, 3096, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3099
 *     return pgroup_gop(pgroup, X, "+")
 * 
 * def pgroup_gop_multiply(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "*")
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_229pgroup_gop_multiply, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3099, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgroup_gop_multiply, __pyx_t_6) < 0) __PYX_ERR(0, 3099, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3102
 *     return pgroup_gop(pgroup, X, "*")
 * 
 * def pgroup_gop_max(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "max")
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_231pgroup_gop_max, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgroup_gop_max, __pyx_t_6) < 0) __PYX_ERR(0, 3102, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3105
 *     return pgroup_gop(pgroup, X, "max")
 * 
 * def pgroup_gop_min(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "min")
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_233pgroup_gop_min, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgroup_gop_min, __pyx_t_6) < 0) __PYX_ERR(0, 3105, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3108
 *     return pgroup_gop(pgroup, X, "min")
 * 
 * def pgroup_gop_absmax(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "absmax")
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_235pgroup_gop_absmax, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgroup_gop_absmax, __pyx_t_6) < 0) __PYX_ERR(0, 3108, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3111
 *     return pgroup_gop(pgroup, X, "absmax")
 * 
 * def pgroup_gop_absmin(int pgroup, X):             # <<<<<<<<<<<<<<
 *     return pgroup_gop(pgroup, X, "absmin")
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_237pgroup_gop_absmin, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgroup_gop_absmin, __pyx_t_6) < 0) __PYX_ERR(0, 3111, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3114
 *     return pgroup_gop(pgroup, X, "absmin")
 * 
 * def pgroup_nnodes(int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Returns the number of processors contained in the group specified by
 *     pgroup.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_239pgroup_nnodes, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgroup_nnodes, __pyx_t_6) < 0) __PYX_ERR(0, 3114, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3129
 *     return GA_Pgroup_nnodes(pgroup)
 * 
 * def pgroup_nodeid(int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Returns the relative index of the processor in the processor group
 *     specified by pgroup.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_241pgroup_nodeid, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgroup_nodeid, __pyx_t_6) < 0) __PYX_ERR(0, 3129, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3147
 *     return GA_Pgroup_nodeid(pgroup)
 * 
 * def pgroup_set_default(int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Resets the default processor group on a collection of processors.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_243pgroup_set_default, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgroup_set_default, __pyx_t_6) < 0) __PYX_ERR(0, 3147, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3170
 *     GA_Pgroup_set_default(pgroup)
 * 
 * def pgroup_split(int pgroup, int num_group):             # <<<<<<<<<<<<<<
 *     """TODO"""
 *     return GA_Pgroup_split(pgroup, num_group)
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_245pgroup_split, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgroup_split, __pyx_t_6) < 0) __PYX_ERR(0, 3170, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3174
 *     return GA_Pgroup_split(pgroup, num_group)
 * 
 * def pgroup_split_irreg(int pgroup, int color):             # <<<<<<<<<<<<<<
 *     """TODO"""
 *     return GA_Pgroup_split_irreg(pgroup, color)
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_247pgroup_split_irreg, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgroup_split_irreg, __pyx_t_6) < 0) __PYX_ERR(0, 3174, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3178
 *     return GA_Pgroup_split_irreg(pgroup, color)
 * 
 * def pgroup_sync(int pgroup=-1):             # <<<<<<<<<<<<<<
 *     """Executes a synchronization group across the processors in the processor
 *     group specified by pgroup.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_249pgroup_sync, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pgroup_sync, __pyx_t_6) < 0) __PYX_ERR(0, 3178, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3192
 *     GA_Pgroup_sync(pgroup)
 * 
 * def print_distribution(int g_a):             # <<<<<<<<<<<<<<
 *     """Prints the array distribution.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_251print_distribution, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_print_distribution, __pyx_t_6) < 0) __PYX_ERR(0, 3192, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3200
 *     GA_Print_distribution(g_a)
 * 
 * def print_file(int g_a, file):             # <<<<<<<<<<<<<<
 *     """Prints an entire array to a file.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_253print_file, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_print_file, __pyx_t_6) < 0) __PYX_ERR(0, 3200, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3215
 *     raise NotImplementedError
 * 
 * def print_patch(int g_a, lo=None, hi=None, bint pretty=True):             # <<<<<<<<<<<<<<
 *     """Prints a patch of g_a array to the standard output.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_255print_patch, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_print_patch, __pyx_t_6) < 0) __PYX_ERR(0, 3215, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3231
 *     NGA_Print_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, apretty)
 * 
 * def print_stats():             # <<<<<<<<<<<<<<
 *     """This non-collective (MIMD) operation prints information about:
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_257print_stats, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_print_stats, __pyx_t_6) < 0) __PYX_ERR(0, 3231, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3248
 *     GA_Print_stats()
 * 
 * def print_stdout(int g_a):             # <<<<<<<<<<<<<<
 *     """Prints an entire array to the standard output."""
 *     GA_Print(g_a)
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_259print_stdout, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_print_stdout, __pyx_t_6) < 0) __PYX_ERR(0, 3248, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3252
 *     GA_Print(g_a)
 * 
 * def proc_topology(int g_a, int proc):             # <<<<<<<<<<<<<<
 *     """Based on the distribution of an array associated with handle g_a,
 *     determines coordinates of the specified processor in the virtual processor
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_261proc_topology, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_proc_topology, __pyx_t_6) < 0) __PYX_ERR(0, 3252, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3269
 *     return coord
 * 
 * def put(int g_a, buffer, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Copies data from local array buffer to the global array section.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_263put, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_put, __pyx_t_6) < 0) __PYX_ERR(0, 3269, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3377
 *                 <void*>buffer_nd.data, <int64_t*>ld_nd.data)
 * 
 * def randomize(int g_a, val=None):             # <<<<<<<<<<<<<<
 *     """Fill array with random values in [0,val)."""
 *     cdef int gtype=inquire_type(g_a)
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_265randomize, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_randomize, __pyx_t_6) < 0) __PYX_ERR(0, 3377, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3397
 *     GA_Randomize(g_a, vval)
 * 
 * def read_inc(int g_a, subscript, long inc=1):             # <<<<<<<<<<<<<<
 *     """Atomically read and increment an element in an integer array.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_267read_inc, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_inc, __pyx_t_6) < 0) __PYX_ERR(0, 3397, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3415
 *     return NGA_Read_inc64(g_a, <int64_t*>subscript_nd.data, inc)
 * 
 * def register_dtype(dtype):             # <<<<<<<<<<<<<<
 *     """Creates a new data type based on the given dtype.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_269register_dtype, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_register_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 3415, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3429
 *     return gatype
 * 
 * def register_type(size_t bytes):             # <<<<<<<<<<<<<<
 *     """Creates a new data type of size bytes.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_271register_type, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_register_type, __pyx_t_6) < 0) __PYX_ERR(0, 3429, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3439
 *     return NGA_Register_type(bytes)
 * 
 * def recip(int g_a, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Take element-wise reciprocal of the array or patch.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_273recip, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_recip, __pyx_t_6) < 0) __PYX_ERR(0, 3439, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3452
 *         GA_Recip_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 * def release(int g_a, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Releases access to a global array when the data was read only.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_275release, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_release, __pyx_t_6) < 0) __PYX_ERR(0, 3452, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3468
 *     _release_common(g_a, lo, hi, False)
 * 
 * def release_block(int g_a, int index):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of data specified by the integer index
 *     when data was accessed as read only.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_277release_block, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_release_block, __pyx_t_6) < 0) __PYX_ERR(0, 3468, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3478
 *     NGA_Release_block(g_a, index)
 * 
 * def release_block_grid(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of data specified by the subscript array
 *     when data was accessed as read only.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_279release_block_grid, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_release_block_grid, __pyx_t_6) < 0) __PYX_ERR(0, 3478, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3492
 *     NGA_Release_block_grid(g_a, <int*>subscript_nd.data)
 * 
 * def release_block_segment(int g_a, int proc):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of locally held data for a block-cyclic
 *     array, when data was accessed as read-only.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_281release_block_segment, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_release_block_segment, __pyx_t_6) < 0) __PYX_ERR(0, 3492, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3530
 *         NGA_Release64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 * def release_ghost_element(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Releases access to the locally held data for an array with ghost
 *     elements, when data was accessed as read-only.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_283release_ghost_element, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_release_ghost_element, __pyx_t_6) < 0) __PYX_ERR(0, 3530, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3541
 *     NGA_Release_ghost_element64(g_a, <int64_t*>subscript_nd.data)
 * 
 * def release_ghosts(int g_a):             # <<<<<<<<<<<<<<
 *     """Releases access to the locally held block of data containing ghost
 *     elements, when data was accessed as read-only.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_285release_ghosts, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_release_ghosts, __pyx_t_6) < 0) __PYX_ERR(0, 3541, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3550
 *     NGA_Release_ghosts(g_a)
 * 
 * def release_update(int g_a, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Releases access to the data.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_287release_update, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_release_update, __pyx_t_6) < 0) __PYX_ERR(0, 3550, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3561
 *     _release_common(g_a, lo, hi, True)
 * 
 * def release_update_block(int g_a, int index):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of data specified by the integer index
 *     when data was accessed in read-write mode.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_289release_update_block, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_release_update_block, __pyx_t_6) < 0) __PYX_ERR(0, 3561, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3573
 *     NGA_Release_update_block(g_a, index)
 * 
 * def release_update_block_grid(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of data specified by the subscript array
 *     when data was accessed in read-write mode.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_291release_update_block_grid, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_release_update_block_grid, __pyx_t_6) < 0) __PYX_ERR(0, 3573, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3587
 *     NGA_Release_update_block_grid(g_a, <int*>subscript_nd.data)
 * 
 * def release_update_block_segment(int g_a, int proc):             # <<<<<<<<<<<<<<
 *     """Releases access to the block of locally held data for a block-cyclic
 *     array, when data was accessed as read-only.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_293release_update_block_segment, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_release_update_block_segment, __pyx_t_6) < 0) __PYX_ERR(0, 3587, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3596
 *     NGA_Release_update_block_segment(g_a, proc)
 * 
 * def release_update_ghost_element(int g_a, subscript):             # <<<<<<<<<<<<<<
 *     """Releases access to the locally held data for an array with ghost
 *     elements, when data was accessed in read-write mode.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_295release_update_ghost_element, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_release_update_ghost_element, __pyx_t_6) < 0) __PYX_ERR(0, 3596, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3608
 *     pass
 * 
 * def release_update_ghosts(int g_a):             # <<<<<<<<<<<<<<
 *     """Releases access to the locally held block of data containing ghost
 *     elements, when data was accessed in read-write mode.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_297release_update_ghosts, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_release_update_ghosts, __pyx_t_6) < 0) __PYX_ERR(0, 3608, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3617
 *     NGA_Release_update_ghosts(g_a)
 * 
 * def scale(int g_a, value, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Scales an array by the constant s.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_299scale, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3617, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_scale, __pyx_t_6) < 0) __PYX_ERR(0, 3617, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3648
 *                 g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data, vvalue)
 * 
 * def scale_rows(int g_a, int g_v):             # <<<<<<<<<<<<<<
 *     """Scales the rows of this matrix g_a using the vector g_v.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_301scale_rows, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_scale_rows, __pyx_t_6) < 0) __PYX_ERR(0, 3648, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3656
 *     GA_Scale_rows(g_a, g_v)
 * 
 * def scale_cols(int g_a, int g_v):             # <<<<<<<<<<<<<<
 *     """Scales the columns of this matrix g_a using the vector g_v.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_303scale_cols, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_scale_cols, __pyx_t_6) < 0) __PYX_ERR(0, 3656, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3664
 *     GA_Scale_cols(g_a, g_v)
 * 
 * def scan_add(int g_src, int g_dst, int g_msk, lo=None, hi=None,             # <<<<<<<<<<<<<<
 *         bint excl=False):
 *     """Adds successive elements in a source vector g_src and put the results
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_305scan_add, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_scan_add, __pyx_t_6) < 0) __PYX_ERR(0, 3664, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3715
 *     GA_Scan_add64(g_src, g_dst, g_msk, c_lo, c_hi, c_excl)
 * 
 * def scan_copy(int g_src, int g_dst, int g_msk, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """This subroutine does a segmented scan-copy of values in the source
 *     array g_src into a destination array g_dst with segments defined by
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_307scan_copy, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_scan_copy, __pyx_t_6) < 0) __PYX_ERR(0, 3715, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3741
 *     GA_Scan_copy64(g_src, g_dst, g_msk, c_lo, c_hi)
 * 
 * def scatter(int g_a, values, subsarray):             # <<<<<<<<<<<<<<
 *     """Scatters array elements from a global array into a local array.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_309scatter, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_scatter, __pyx_t_6) < 0) __PYX_ERR(0, 3741, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3798
 *         raise ValueError("how did this happen?")
 * 
 * def scatter_acc(int g_a, values, subsarray, alpha=None):             # <<<<<<<<<<<<<<
 *     """Scatters array elements from a global array into a local array.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_311scatter_acc, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_scatter_acc, __pyx_t_6) < 0) __PYX_ERR(0, 3798, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3874
 *         raise ValueError("how did this happen?")
 * 
 * def select_elem(int g_a, op):             # <<<<<<<<<<<<<<
 *     """Returns the value and index for an element that is selected by the
 *     specified operator in a global array corresponding to g_a handle.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_313select_elem, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_select_elem, __pyx_t_6) < 0) __PYX_ERR(0, 3874, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3921
 *         raise TypeError("type of g_a not recognized")
 * 
 * def select_elem_min(int g_a):             # <<<<<<<<<<<<<<
 *     """Equivalent to ga.select_elem(g_a, "min")."""
 *     return select_elem(g_a, "min")
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_315select_elem_min, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3921, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_select_elem_min, __pyx_t_6) < 0) __PYX_ERR(0, 3921, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3925
 *     return select_elem(g_a, "min")
 * 
 * def select_elem_max(int g_a):             # <<<<<<<<<<<<<<
 *     """Equivalent to ga.select_elem(g_a, "max")."""
 *     return select_elem(g_a, "max")
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_317select_elem_max, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3925, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_select_elem_max, __pyx_t_6) < 0) __PYX_ERR(0, 3925, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3929
 *     return select_elem(g_a, "max")
 * 
 * def set_array_name(int g_a, name):             # <<<<<<<<<<<<<<
 *     """Assigns a unique character string name to a global array handle that
 *     was obtained using the GA_Create_handle function.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_319set_array_name, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_array_name, __pyx_t_6) < 0) __PYX_ERR(0, 3929, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3938
 *     GA_Set_array_name(g_a, b(name))
 * 
 * def set_block_cyclic(int g_a, dims):             # <<<<<<<<<<<<<<
 *     """Creates a global array with a simple block-cyclic data distribution.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_321set_block_cyclic, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_block_cyclic, __pyx_t_6) < 0) __PYX_ERR(0, 3938, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3961
 *     GA_Set_block_cyclic(g_a, <int*>dims_nd.data)
 * 
 * def set_block_cyclic_proc_grid(int g_a, block, proc_grid):             # <<<<<<<<<<<<<<
 *     """Creates a global array with a SCALAPACK-type block cyclic data
 *     distribution.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_323set_block_cyclic_proc_grid, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3961, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_block_cyclic_proc_grid, __pyx_t_6) < 0) __PYX_ERR(0, 3961, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":3990
 *             <int*>proc_grid_nd.data)
 * 
 * def set_chunk(int g_a, chunk):             # <<<<<<<<<<<<<<
 *     """This function is used to set the chunk array for a global array handle
 *     that was obtained using the GA_Create_handle function. The chunk array is
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_325set_chunk, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_chunk, __pyx_t_6) < 0) __PYX_ERR(0, 3990, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4003
 *     GA_Set_chunk64(g_a, <int64_t*>chunk_nd.data)
 * 
 * def set_data(int g_a, dims, int type):             # <<<<<<<<<<<<<<
 *     """Sets the array dimension, the coordinate dimensions, and the data type
 *     assigned to a global array handle obtained using the ga.create_handle
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_327set_data, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4003, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_data, __pyx_t_6) < 0) __PYX_ERR(0, 4003, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4015
 *     GA_Set_data64(g_a, len(dims_nd), <int64_t*>dims_nd.data, type)
 * 
 * def set_debug(bint debug):             # <<<<<<<<<<<<<<
 *     """Sets an internal flag in the GA library to either True or False.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_329set_debug, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_debug, __pyx_t_6) < 0) __PYX_ERR(0, 4015, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4029
 *     GA_Set_debug(debug)
 * 
 * def set_diagonal(int g_a, int g_v):             # <<<<<<<<<<<<<<
 *     """Sets the diagonal elements of this matrix g_a with the elements of the
 *     vector g_v.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_331set_diagonal, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4029, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_diagonal, __pyx_t_6) < 0) __PYX_ERR(0, 4029, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4038
 *     GA_Set_diagonal(g_a, g_v)
 * 
 * def set_ghosts(int g_a, width):             # <<<<<<<<<<<<<<
 *     """Sets the ghost cell widths for a global array handle that was obtained
 *     using the ga.create_handle function.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_333set_ghosts, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4038, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_ghosts, __pyx_t_6) < 0) __PYX_ERR(0, 4038, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4053
 *     GA_Set_ghosts64(g_a, <int64_t*>width_nd.data)
 * 
 * def set_irreg_distr(int g_a, mapc, nblock):             # <<<<<<<<<<<<<<
 *     """Partitions the array data among the individual processors for a global
 *     array handle obtained using the ga.create_handle function.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_335set_irreg_distr, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4053, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_irreg_distr, __pyx_t_6) < 0) __PYX_ERR(0, 4053, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4086
 *     GA_Set_irreg_distr64(g_a, <int64_t*>mapc_nd.data, <int64_t*>nblock_nd.data)
 * 
 * def set_memory_limit(size_t limit):             # <<<<<<<<<<<<<<
 *     """Sets the amount of memory to be used (in bytes) per process.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_337set_memory_limit, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_memory_limit, __pyx_t_6) < 0) __PYX_ERR(0, 4086, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4098
 *     GA_Set_memory_limit(limit)
 * 
 * def set_pgroup(int g_a, int pgroup):             # <<<<<<<<<<<<<<
 *     """Sets the processor configuration assigned to a global array handle that
 *     was obtained using the ga.create_handle function.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_339set_pgroup, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_pgroup, __pyx_t_6) < 0) __PYX_ERR(0, 4098, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4112
 *     GA_Set_pgroup(g_a, pgroup)
 * 
 * def set_restricted(int g_a, list):             # <<<<<<<<<<<<<<
 *     """Restrict data in the global array g_a to only the processors listed in
 *     the array list.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_341set_restricted, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_restricted, __pyx_t_6) < 0) __PYX_ERR(0, 4112, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4132
 *     GA_Set_restricted(g_a, <int*>list_nd.data, len(list_nd))
 * 
 * def set_restricted_range(int g_a, int lo_proc, int hi_proc):             # <<<<<<<<<<<<<<
 *     """Restrict data in the global array to the given range of processors.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_343set_restricted_range, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_restricted_range, __pyx_t_6) < 0) __PYX_ERR(0, 4132, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4146
 *     GA_Set_restricted_range(g_a, lo_proc, hi_proc)
 * 
 * def shift_diagoal(int g_a, value=None):             # <<<<<<<<<<<<<<
 *     """Adds this constant to the diagonal elements of the matrix.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_345shift_diagoal, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_shift_diagoal, __pyx_t_6) < 0) __PYX_ERR(0, 4146, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4170
 *     GA_Shift_diagonal(g_a, vvalue)
 * 
 * def solve(int g_a, int g_b):             # <<<<<<<<<<<<<<
 *     """Solves a system of linear equations A * X = B.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_347solve, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_solve, __pyx_t_6) < 0) __PYX_ERR(0, 4170, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4186
 *     return GA_Solve(g_a, g_b)
 * 
 * def spd_invert(int g_a):             # <<<<<<<<<<<<<<
 *     """Compute the inverse of a double precision using the Cholesky
 *     factorization of a NxN double precision symmetric positive definite matrix
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_349spd_invert, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_spd_invert, __pyx_t_6) < 0) __PYX_ERR(0, 4186, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4199
 *     return GA_Spd_invert(g_a)
 * 
 * def step_max(int g_a, int g_b, alo=None, ahi=None, blo=None, bhi=None):             # <<<<<<<<<<<<<<
 *     """Calculates the largest multiple of a vector g_b that can be added to
 *     this vector g_a while keeping each element of this vector non-negative.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_351step_max, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_step_max, __pyx_t_6) < 0) __PYX_ERR(0, 4199, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4219
 *     return step
 * 
 * def strided_acc(int g_a, buffer, lo=None, hi=None, skip=None, alpha=None):             # <<<<<<<<<<<<<<
 *     """Strided version of ga.acc.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_353strided_acc, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_strided_acc, __pyx_t_6) < 0) __PYX_ERR(0, 4219, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4250
 *     _acc_common(g_a, buffer, lo, hi, alpha, False, False, skip)
 * 
 * def strided_get(int g_a, lo=None, hi=None, skip=None, np.ndarray buffer=None):             # <<<<<<<<<<<<<<
 *     """Strided version of ga.get.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_355strided_get, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_strided_get, __pyx_t_6) < 0) __PYX_ERR(0, 4250, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4278
 *     return _get_common(g_a, lo, hi, buffer, False, False, skip)
 * 
 * def strided_put(int g_a, buffer, lo=None, hi=None, skip=None):             # <<<<<<<<<<<<<<
 *     """Strided version of ga.put.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_357strided_put, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_strided_put, __pyx_t_6) < 0) __PYX_ERR(0, 4278, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4304
 *     _put_common(g_a, buffer, lo, hi, False, False, skip)
 * 
 * def summarize(bint verbose):             # <<<<<<<<<<<<<<
 *     """Prints info about allocated arrays."""
 *     GA_Summarize(verbose)
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_359summarize, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_summarize, __pyx_t_6) < 0) __PYX_ERR(0, 4304, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4308
 *     GA_Summarize(verbose)
 * 
 * def symmetrize(int g_a):             # <<<<<<<<<<<<<<
 *     """Symmetrizes matrix A represented with handle g_a: A:= .5 * (A+A').
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_361symmetrize, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_symmetrize, __pyx_t_6) < 0) __PYX_ERR(0, 4308, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4316
 *     GA_Symmetrize(g_a)
 * 
 * def sync():             # <<<<<<<<<<<<<<
 *     """Synchronize processes (a barrier) and ensure that all GA operations
 *     completed.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_363sync, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sync, __pyx_t_6) < 0) __PYX_ERR(0, 4316, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4325
 *     GA_Sync()
 * 
 * def terminate():             # <<<<<<<<<<<<<<
 *     """Delete all active arrays and destroy internal data structures.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_365terminate, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_terminate, __pyx_t_6) < 0) __PYX_ERR(0, 4325, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4335
 *     GA_Terminate()
 * 
 * def total_blocks(int g_a):             # <<<<<<<<<<<<<<
 *     """Returns the total number of blocks contained in a global
 *     array with a block-cyclic data distribution.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_367total_blocks, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_total_blocks, __pyx_t_6) < 0) __PYX_ERR(0, 4335, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4344
 *     return GA_Total_blocks(g_a)
 * 
 * def transpose(int g_a, int g_b):             # <<<<<<<<<<<<<<
 *     """Transposes a matrix: B = A', where A and B are represented by handles
 *     g_a and g_b.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_369transpose, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_transpose, __pyx_t_6) < 0) __PYX_ERR(0, 4344, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4353
 *     GA_Transpose(g_a, g_b)
 * 
 * def unlock(int mutex):             # <<<<<<<<<<<<<<
 *     """Unlocks a mutex object identified by the mutex number. It is a fatal
 *     error for a process to attempt to unlock a mutex which has not been locked
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_371unlock, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_unlock, __pyx_t_6) < 0) __PYX_ERR(0, 4353, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4359
 *     GA_Unlock(mutex)
 * 
 * def unpack(int g_src, int g_dst, int g_msk, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Expands the values in the source vector into a larger destination vector.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_373unpack, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_unpack, __pyx_t_6) < 0) __PYX_ERR(0, 4359, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4400
 *     return icount
 * 
 * def update_ghosts(int g_a):             # <<<<<<<<<<<<<<
 *     """This call updates the ghost cell regions on each processor with the
 *     corresponding neighbor data from other processors.
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_375update_ghosts, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_update_ghosts, __pyx_t_6) < 0) __PYX_ERR(0, 4400, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4416
 *     GA_Update_ghosts(g_a)
 * 
 * def update_ghost_dir(int g_a, int dimension, int dir, int flag):             # <<<<<<<<<<<<<<
 *     """This function can be used to update the ghost cells along individual
 *     directions. It is designed for algorithms that can overlap updates with
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_377update_ghost_dir, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_update_ghost_dir, __pyx_t_6) < 0) __PYX_ERR(0, 4416, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4445
 *     NGA_Update_ghost_dir(g_a, dimension, dir, flag)
 * 
 * def uses_ma():             # <<<<<<<<<<<<<<
 *     """TODO"""
 *     if GA_Uses_ma() == 1:
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_379uses_ma, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_uses_ma, __pyx_t_6) < 0) __PYX_ERR(0, 4445, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4451
 *     return False
 * 
 * def wtime():             # <<<<<<<<<<<<<<
 *     """This function return a wall (or elapsed) time on the calling processor.
 *     Returns time in seconds representing elapsed wall-clock time since an
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_381wtime, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_wtime, __pyx_t_6) < 0) __PYX_ERR(0, 4451, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4468
 *     return GA_Wtime()
 * 
 * def zero(int g_a, lo=None, hi=None):             # <<<<<<<<<<<<<<
 *     """Set all the elements in the array or patch to zero."""
 *     cdef np.ndarray[np.int64_t, ndim=1] lo_nd, hi_nd
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_383zero, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_zero, __pyx_t_6) < 0) __PYX_ERR(0, 4468, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4477
 *         NGA_Zero_patch64(g_a, <int64_t*>lo_nd.data, <int64_t*>hi_nd.data)
 * 
 * def zero_diagonal(int g_a):             # <<<<<<<<<<<<<<
 *     """Sets the diagonal elements of this matrix g_a with zeros.
 * 
 */
  __pyx_t_6 = PyCFunction_NewEx(&__pyx_mdef_9miniga4py_2ga_385zero_diagonal, NULL, __pyx_n_s_miniga4py_ga); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_zero_diagonal, __pyx_t_6) < 0) __PYX_ERR(0, 4477, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "miniga4py/ga.pyx":4485
 *     GA_Zero_diagonal(g_a)
 * 
 * initialize()             # <<<<<<<<<<<<<<
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_initialize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "miniga4py/ga.pyx":1
 * #cython: embedsignature=True             # <<<<<<<<<<<<<<
 * """The Global Arrays (GA) Python interface.
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_kp_u_gop_line_2073, __pyx_kp_u_Global_operation_X_1_N_is_a_vect) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_kp_u_pgroup_gop_line_3055, __pyx_kp_u_Global_operation_X_1_N_is_a_vect_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_5) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "../../../../../usr/local/lib/python3.6/dist-packages/Cython/Includes/numpy/__init__.pxd":1008
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init miniga4py.ga", 0, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init miniga4py.ga");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

/* PyCFunctionFastCall */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs);
    }
}
#endif

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
#include "frameobject.h"
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = f->f_localsplus;
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallMethO */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallOneArg */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* GetModuleGlobalName */
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    if (likely(result)) {
        Py_INCREF(result);
    } else if (unlikely(PyErr_Occurred())) {
        result = NULL;
    } else {
#else
    result = PyDict_GetItem(__pyx_d, name);
    if (likely(result)) {
        Py_INCREF(result);
    } else {
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

/* GetItemInt */
    static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

/* PyErrFetchRestore */
    #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* RaiseException */
    #if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* ExtTypeTest */
    static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* IsLittleEndian */
    static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
{
  union {
    uint32_t u32;
    uint8_t u8[4];
  } S;
  S.u32 = 0x01020304;
  return S.u8[0] == 4;
}

/* BufferFormatCheck */
    static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type) {
  stack[0].field = &ctx->root;
  stack[0].parent_offset = 0;
  ctx->root.type = type;
  ctx->root.name = "buffer dtype";
  ctx->root.offset = 0;
  ctx->head = stack;
  ctx->head->field = &ctx->root;
  ctx->fmt_offset = 0;
  ctx->head->parent_offset = 0;
  ctx->new_packmode = '@';
  ctx->enc_packmode = '@';
  ctx->new_count = 1;
  ctx->enc_count = 0;
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  ctx->is_valid_array = 0;
  ctx->struct_alignment = 0;
  while (type->typegroup == 'S') {
    ++ctx->head;
    ctx->head->field = type->fields;
    ctx->head->parent_offset = 0;
    type = type->fields->type;
  }
}
static int __Pyx_BufFmt_ParseNumber(const char** ts) {
    int count;
    const char* t = *ts;
    if (*t < '0' || *t > '9') {
      return -1;
    } else {
        count = *t++ - '0';
        while (*t >= '0' && *t < '9') {
            count *= 10;
            count += *t++ - '0';
        }
    }
    *ts = t;
    return count;
}
static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
    int number = __Pyx_BufFmt_ParseNumber(ts);
    if (number == -1)
        PyErr_Format(PyExc_ValueError,\
                     "Does not understand character buffer dtype format string ('%c')", **ts);
    return number;
}
static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  PyErr_Format(PyExc_ValueError,
               "Unexpected format string character: '%c'", ch);
}
static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  switch (ch) {
    case 'c': return "'char'";
    case 'b': return "'signed char'";
    case 'B': return "'unsigned char'";
    case 'h': return "'short'";
    case 'H': return "'unsigned short'";
    case 'i': return "'int'";
    case 'I': return "'unsigned int'";
    case 'l': return "'long'";
    case 'L': return "'unsigned long'";
    case 'q': return "'long long'";
    case 'Q': return "'unsigned long long'";
    case 'f': return (is_complex ? "'complex float'" : "'float'");
    case 'd': return (is_complex ? "'complex double'" : "'double'");
    case 'g': return (is_complex ? "'complex long double'" : "'long double'");
    case 'T': return "a struct";
    case 'O': return "Python object";
    case 'P': return "a pointer";
    case 's': case 'p': return "a string";
    case 0: return "end";
    default: return "unparseable format string";
  }
}
static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return 2;
    case 'i': case 'I': case 'l': case 'L': return 4;
    case 'q': case 'Q': return 8;
    case 'f': return (is_complex ? 8 : 4);
    case 'd': return (is_complex ? 16 : 8);
    case 'g': {
      PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
      return 0;
    }
    case 'O': case 'P': return sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  switch (ch) {
    case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(short);
    case 'i': case 'I': return sizeof(int);
    case 'l': case 'L': return sizeof(long);
    #ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
    #endif
    case 'f': return sizeof(float) * (is_complex ? 2 : 1);
    case 'd': return sizeof(double) * (is_complex ? 2 : 1);
    case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
    case 'O': case 'P': return sizeof(void*);
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
typedef struct { char c; short x; } __Pyx_st_short;
typedef struct { char c; int x; } __Pyx_st_int;
typedef struct { char c; long x; } __Pyx_st_long;
typedef struct { char c; float x; } __Pyx_st_float;
typedef struct { char c; double x; } __Pyx_st_double;
typedef struct { char c; long double x; } __Pyx_st_longdouble;
typedef struct { char c; void *x; } __Pyx_st_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
/* These are for computing the padding at the end of the struct to align
   on the first member of the struct. This will probably the same as above,
   but we don't have any guarantees.
 */
typedef struct { short x; char c; } __Pyx_pad_short;
typedef struct { int x; char c; } __Pyx_pad_int;
typedef struct { long x; char c; } __Pyx_pad_long;
typedef struct { float x; char c; } __Pyx_pad_float;
typedef struct { double x; char c; } __Pyx_pad_double;
typedef struct { long double x; char c; } __Pyx_pad_longdouble;
typedef struct { void *x; char c; } __Pyx_pad_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  switch (ch) {
    case 'c':
        return 'H';
    case 'b': case 'h': case 'i':
    case 'l': case 'q': case 's': case 'p':
        return 'I';
    case 'B': case 'H': case 'I': case 'L': case 'Q':
        return 'U';
    case 'f': case 'd': case 'g':
        return (is_complex ? 'C' : 'R');
    case 'O':
        return 'O';
    case 'P':
        return 'P';
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
    const char* expected;
    const char* quote;
    if (ctx->head == NULL) {
      expected = "end";
      quote = "";
    } else {
      expected = ctx->head->field->type->name;
      quote = "'";
    }
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected %s%s%s but got %s",
                 quote, expected, quote,
                 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  } else {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_StructField* parent = (ctx->head - 1)->field;
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
                 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
                 parent->type->name, field->name);
  }
}
static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  char group;
  size_t size, offset, arraysize = 1;
  if (ctx->enc_type == 0) return 0;
  if (ctx->head->field->type->arraysize[0]) {
    int i, ndim = 0;
    if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
        ctx->is_valid_array = ctx->head->field->type->ndim == 1;
        ndim = 1;
        if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
            PyErr_Format(PyExc_ValueError,
                         "Expected a dimension of size %zu, got %zu",
                         ctx->head->field->type->arraysize[0], ctx->enc_count);
            return -1;
        }
    }
    if (!ctx->is_valid_array) {
      PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
                   ctx->head->field->type->ndim, ndim);
      return -1;
    }
    for (i = 0; i < ctx->head->field->type->ndim; i++) {
      arraysize *= ctx->head->field->type->arraysize[i];
    }
    ctx->is_valid_array = 0;
    ctx->enc_count = 1;
  }
  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  do {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_TypeInfo* type = field->type;
    if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
    } else {
      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
    }
    if (ctx->enc_packmode == '@') {
      size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
      size_t align_mod_offset;
      if (align_at == 0) return -1;
      align_mod_offset = ctx->fmt_offset % align_at;
      if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
      if (ctx->struct_alignment == 0)
          ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
                                                                 ctx->is_complex);
    }
    if (type->size != size || type->typegroup != group) {
      if (type->typegroup == 'C' && type->fields != NULL) {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        ++ctx->head;
        ctx->head->field = type->fields;
        ctx->head->parent_offset = parent_offset;
        continue;
      }
      if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
      } else {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
      }
    }
    offset = ctx->head->parent_offset + field->offset;
    if (ctx->fmt_offset != offset) {
      PyErr_Format(PyExc_ValueError,
                   "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
                   (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
      return -1;
    }
    ctx->fmt_offset += size;
    if (arraysize)
      ctx->fmt_offset += (arraysize - 1) * size;
    --ctx->enc_count;
    while (1) {
      if (field == &ctx->root) {
        ctx->head = NULL;
        if (ctx->enc_count != 0) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
        }
        break;
      }
      ctx->head->field = ++field;
      if (field->type == NULL) {
        --ctx->head;
        field = ctx->head->field;
        continue;
      } else if (field->type->typegroup == 'S') {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        if (field->type->fields->type == NULL) continue;
        field = field->type->fields;
        ++ctx->head;
        ctx->head->field = field;
        ctx->head->parent_offset = parent_offset;
        break;
      } else {
        break;
      }
    }
  } while (ctx->enc_count);
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  return 0;
}
static PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
{
    const char *ts = *tsp;
    int i = 0, number;
    int ndim = ctx->head->field->type->ndim;
;
    ++ts;
    if (ctx->new_count != 1) {
        PyErr_SetString(PyExc_ValueError,
                        "Cannot handle repeated arrays in format string");
        return NULL;
    }
    if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
    while (*ts && *ts != ')') {
        switch (*ts) {
            case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
            default:  break;
        }
        number = __Pyx_BufFmt_ExpectNumber(&ts);
        if (number == -1) return NULL;
        if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
            return PyErr_Format(PyExc_ValueError,
                        "Expected a dimension of size %zu, got %d",
                        ctx->head->field->type->arraysize[i], number);
        if (*ts != ',' && *ts != ')')
            return PyErr_Format(PyExc_ValueError,
                                "Expected a comma in format string, got '%c'", *ts);
        if (*ts == ',') ts++;
        i++;
    }
    if (i != ndim)
        return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
                            ctx->head->field->type->ndim, i);
    if (!*ts) {
        PyErr_SetString(PyExc_ValueError,
                        "Unexpected end of format string, expected ')'");
        return NULL;
    }
    ctx->is_valid_array = 1;
    ctx->new_count = 1;
    *tsp = ++ts;
    return Py_None;
}
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  int got_Z = 0;
  while (1) {
    switch(*ts) {
      case 0:
        if (ctx->enc_type != 0 && ctx->head == NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        if (ctx->head != NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        return ts;
      case ' ':
      case '\r':
      case '\n':
        ++ts;
        break;
      case '<':
        if (!__Pyx_Is_Little_Endian()) {
          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '>':
      case '!':
        if (__Pyx_Is_Little_Endian()) {
          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '=':
      case '@':
      case '^':
        ctx->new_packmode = *ts++;
        break;
      case 'T':
        {
          const char* ts_after_sub;
          size_t i, struct_count = ctx->new_count;
          size_t struct_alignment = ctx->struct_alignment;
          ctx->new_count = 1;
          ++ts;
          if (*ts != '{') {
            PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
            return NULL;
          }
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_type = 0;
          ctx->enc_count = 0;
          ctx->struct_alignment = 0;
          ++ts;
          ts_after_sub = ts;
          for (i = 0; i != struct_count; ++i) {
            ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
            if (!ts_after_sub) return NULL;
          }
          ts = ts_after_sub;
          if (struct_alignment) ctx->struct_alignment = struct_alignment;
        }
        break;
      case '}':
        {
          size_t alignment = ctx->struct_alignment;
          ++ts;
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_type = 0;
          if (alignment && ctx->fmt_offset % alignment) {
            ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
          }
        }
        return ts;
      case 'x':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->fmt_offset += ctx->new_count;
        ctx->new_count = 1;
        ctx->enc_count = 0;
        ctx->enc_type = 0;
        ctx->enc_packmode = ctx->new_packmode;
        ++ts;
        break;
      case 'Z':
        got_Z = 1;
        ++ts;
        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
          return NULL;
        }
        CYTHON_FALLTHROUGH;
      case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
      case 'l': case 'L': case 'q': case 'Q':
      case 'f': case 'd': case 'g':
      case 'O': case 'p':
        if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
            ctx->enc_packmode == ctx->new_packmode) {
          ctx->enc_count += ctx->new_count;
          ctx->new_count = 1;
          got_Z = 0;
          ++ts;
          break;
        }
        CYTHON_FALLTHROUGH;
      case 's':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->enc_count = ctx->new_count;
        ctx->enc_packmode = ctx->new_packmode;
        ctx->enc_type = *ts;
        ctx->is_complex = got_Z;
        ++ts;
        ctx->new_count = 1;
        got_Z = 0;
        break;
      case ':':
        ++ts;
        while(*ts != ':') ++ts;
        ++ts;
        break;
      case '(':
        if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
        break;
      default:
        {
          int number = __Pyx_BufFmt_ExpectNumber(&ts);
          if (number == -1) return NULL;
          ctx->new_count = (size_t)number;
        }
    }
  }
}

/* BufferGetAndValidate */
      static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
  if (unlikely(info->buf == NULL)) return;
  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
  __Pyx_ReleaseBuffer(info);
}
static void __Pyx_ZeroBuffer(Py_buffer* buf) {
  buf->buf = NULL;
  buf->obj = NULL;
  buf->strides = __Pyx_zeros;
  buf->shape = __Pyx_zeros;
  buf->suboffsets = __Pyx_minusones;
}
static int __Pyx__GetBufferAndValidate(
        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
{
  buf->buf = NULL;
  if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
    __Pyx_ZeroBuffer(buf);
    return -1;
  }
  if (unlikely(buf->ndim != nd)) {
    PyErr_Format(PyExc_ValueError,
                 "Buffer has wrong number of dimensions (expected %d, got %d)",
                 nd, buf->ndim);
    goto fail;
  }
  if (!cast) {
    __Pyx_BufFmt_Context ctx;
    __Pyx_BufFmt_Init(&ctx, stack, dtype);
    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
  }
  if (unlikely((unsigned)buf->itemsize != dtype->size)) {
    PyErr_Format(PyExc_ValueError,
      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
    goto fail;
  }
  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
  return 0;
fail:;
  __Pyx_SafeReleaseBuffer(buf);
  return -1;
}

/* BufferFallbackError */
      static void __Pyx_RaiseBufferFallbackError(void) {
  PyErr_SetString(PyExc_ValueError,
     "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
}

/* SaveResetException */
      #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if PY_VERSION_HEX >= 0x030700A2
    *type = tstate->exc_state.exc_type;
    *value = tstate->exc_state.exc_value;
    *tb = tstate->exc_state.exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if PY_VERSION_HEX >= 0x030700A2
    tmp_type = tstate->exc_state.exc_type;
    tmp_value = tstate->exc_state.exc_value;
    tmp_tb = tstate->exc_state.exc_traceback;
    tstate->exc_state.exc_type = type;
    tstate->exc_state.exc_value = value;
    tstate->exc_state.exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* PyErrExceptionMatches */
      #if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    if (unlikely(PyTuple_Check(err)))
        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* GetException */
      #if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
#endif
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if PY_VERSION_HEX >= 0x030700A2
    tmp_type = tstate->exc_state.exc_type;
    tmp_value = tstate->exc_state.exc_value;
    tmp_tb = tstate->exc_state.exc_traceback;
    tstate->exc_state.exc_type = local_type;
    tstate->exc_state.exc_value = local_value;
    tstate->exc_state.exc_traceback = local_tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

/* WriteUnraisableException */
        static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback, CYTHON_UNUSED int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
#ifdef _MSC_VER
    else state = (PyGILState_STATE)-1;
#endif
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

/* RaiseArgTupleInvalid */
        static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* RaiseDoubleKeywords */
        static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

/* ParseKeywords */
        static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

/* RaiseTooManyValuesToUnpack */
        static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* RaiseNeedMoreValuesToUnpack */
        static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* IterFinish */
        static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_FAST_THREAD_STATE
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

/* UnpackItemEndCheck */
        static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

/* PyIntBinop */
        #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* ObjectGetItem */
        #if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
    PyObject *runerr;
    Py_ssize_t key_value;
    PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
    if (unlikely(!(m && m->sq_item))) {
        PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
        return NULL;
    }
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
    PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
    if (likely(m && m->mp_subscript)) {
        return m->mp_subscript(obj, key);
    }
    return __Pyx_PyObject_GetIndex(obj, key);
}
#endif

/* BufferIndexError */
        static void __Pyx_RaiseBufferIndexError(int axis) {
  PyErr_Format(PyExc_IndexError,
     "Out of bounds on buffer access (axis %d)", axis);
}

/* DictGetItem */
        #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            PyObject* args = PyTuple_Pack(1, key);
            if (likely(args))
                PyErr_SetObject(PyExc_KeyError, args);
            Py_XDECREF(args);
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#endif

/* PyObjectCallNoArg */
        #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || __Pyx_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

/* ArgTypeTest */
          static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (exact) {
        #if PY_MAJOR_VERSION == 2
        if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

/* None */
          static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
    Py_ssize_t q = a / b;
    Py_ssize_t r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

/* Import */
          static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* SetItemInt */
          static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (!j) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
                                               CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
        if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
            PyObject* old = PyList_GET_ITEM(o, n);
            Py_INCREF(v);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
            return 1;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_ass_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return -1;
                    PyErr_Clear();
                }
            }
            return m->sq_ass_item(o, i, v);
        }
    }
#else
#if CYTHON_COMPILING_IN_PYPY
    if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) {
#else
    if (is_list || PySequence_Check(o)) {
#endif
        return PySequence_SetItem(o, i, v);
    }
#endif
    return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
}

/* RaiseNoneIterError */
            static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* CLineInTraceback */
            #ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
      use_cline = __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback);
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (PyObject_Not(use_cline) != 0) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
            static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

/* AddTraceback */
            #include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

/* Declarations */
            #if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return ::std::complex< float >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return x + y*(__pyx_t_float_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      __pyx_t_float_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

/* Arithmetic */
            #if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    #if 1
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        if (b.imag == 0) {
            return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else if (fabsf(b.real) >= fabsf(b.imag)) {
            if (b.real == 0 && b.imag == 0) {
                return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
            } else {
                float r = b.imag / b.real;
                float s = 1.0 / (b.real + b.imag * r);
                return __pyx_t_float_complex_from_parts(
                    (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
            }
        } else {
            float r = b.real / b.imag;
            float s = 1.0 / (b.imag + b.real * r);
            return __pyx_t_float_complex_from_parts(
                (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
        }
    }
    #else
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        if (b.imag == 0) {
            return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else {
            float denom = b.real * b.real + b.imag * b.imag;
            return __pyx_t_float_complex_from_parts(
                (a.real * b.real + a.imag * b.imag) / denom,
                (a.imag * b.real - a.real * b.imag) / denom);
        }
    }
    #endif
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrtf(z.real*z.real + z.imag*z.imag);
          #else
            return hypotf(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
            __pyx_t_float_complex z;
            float r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    float denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        z = __Pyx_c_prod_float(a, a);
                        return __Pyx_c_prod_float(a, a);
                    case 3:
                        z = __Pyx_c_prod_float(a, a);
                        return __Pyx_c_prod_float(z, a);
                    case 4:
                        z = __Pyx_c_prod_float(a, a);
                        return __Pyx_c_prod_float(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                } else if (b.imag == 0) {
                    z.real = powf(a.real, b.real);
                    z.imag = 0;
                    return z;
                } else if (a.real > 0) {
                    r = a.real;
                    theta = 0;
                } else {
                    r = -a.real;
                    theta = atan2f(0, -1);
                }
            } else {
                r = __Pyx_c_abs_float(a);
                theta = atan2f(a.imag, a.real);
            }
            lnr = logf(r);
            z_r = expf(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cosf(z_theta);
            z.imag = z_r * sinf(z_theta);
            return z;
        }
    #endif
#endif

/* Declarations */
            #if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return ::std::complex< double >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return x + y*(__pyx_t_double_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      __pyx_t_double_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

/* Arithmetic */
            #if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    #if 1
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        if (b.imag == 0) {
            return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else if (fabs(b.real) >= fabs(b.imag)) {
            if (b.real == 0 && b.imag == 0) {
                return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
            } else {
                double r = b.imag / b.real;
                double s = 1.0 / (b.real + b.imag * r);
                return __pyx_t_double_complex_from_parts(
                    (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
            }
        } else {
            double r = b.real / b.imag;
            double s = 1.0 / (b.imag + b.real * r);
            return __pyx_t_double_complex_from_parts(
                (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
        }
    }
    #else
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        if (b.imag == 0) {
            return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else {
            double denom = b.real * b.real + b.imag * b.imag;
            return __pyx_t_double_complex_from_parts(
                (a.real * b.real + a.imag * b.imag) / denom,
                (a.imag * b.real - a.real * b.imag) / denom);
        }
    }
    #endif
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrt(z.real*z.real + z.imag*z.imag);
          #else
            return hypot(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
            __pyx_t_double_complex z;
            double r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    double denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        z = __Pyx_c_prod_double(a, a);
                        return __Pyx_c_prod_double(a, a);
                    case 3:
                        z = __Pyx_c_prod_double(a, a);
                        return __Pyx_c_prod_double(z, a);
                    case 4:
                        z = __Pyx_c_prod_double(a, a);
                        return __Pyx_c_prod_double(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                } else if (b.imag == 0) {
                    z.real = pow(a.real, b.real);
                    z.imag = 0;
                    return z;
                } else if (a.real > 0) {
                    r = a.real;
                    theta = 0;
                } else {
                    r = -a.real;
                    theta = atan2(0, -1);
                }
            } else {
                r = __Pyx_c_abs_double(a);
                theta = atan2(a.imag, a.real);
            }
            lnr = log(r);
            z_r = exp(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cos(z_theta);
            z.imag = z_r * sin(z_theta);
            return z;
        }
    #endif
#endif

#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
    if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
        if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
    PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
    return -1;
}
static void __Pyx_ReleaseBuffer(Py_buffer *view) {
    PyObject *obj = view->obj;
    if (!obj) return;
    if (PyObject_CheckBuffer(obj)) {
        PyBuffer_Release(view);
        return;
    }
    if ((0)) {}
        else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view);
    view->obj = NULL;
    Py_DECREF(obj);
}
#endif


            /* CIntFromPyVerify */
            #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntToPy */
            static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) -1, const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
            static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) -1, const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* FromPy */
            static __pyx_t_float_complex __Pyx_PyComplex_As___pyx_t_float_complex(PyObject* o) {
    Py_complex cval;
#if !CYTHON_COMPILING_IN_PYPY
    if (PyComplex_CheckExact(o))
        cval = ((PyComplexObject *)o)->cval;
    else
#endif
        cval = PyComplex_AsCComplex(o);
    return __pyx_t_float_complex_from_parts(
               (float)cval.real,
               (float)cval.imag);
}

/* FromPy */
            static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject* o) {
    Py_complex cval;
#if !CYTHON_COMPILING_IN_PYPY
    if (PyComplex_CheckExact(o))
        cval = ((PyComplexObject *)o)->cval;
    else
#endif
        cval = PyComplex_AsCComplex(o);
    return __pyx_t_double_complex_from_parts(
               (double)cval.real,
               (double)cval.imag);
}

/* CIntToPy */
            static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
    const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(Py_intptr_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(Py_intptr_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
            static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Integer(Integer value) {
    const Integer neg_one = (Integer) -1, const_zero = (Integer) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(Integer) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(Integer) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(Integer) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(Integer) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(Integer) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(Integer),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
            static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int64(npy_int64 value) {
    const npy_int64 neg_one = (npy_int64) -1, const_zero = (npy_int64) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(npy_int64) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(npy_int64) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(npy_int64) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(npy_int64) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(npy_int64) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(npy_int64),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
            static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PY_LONG_LONG(PY_LONG_LONG value) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG) -1, const_zero = (PY_LONG_LONG) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(PY_LONG_LONG) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PY_LONG_LONG) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(PY_LONG_LONG) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(PY_LONG_LONG),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
            static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value) {
    const int64_t neg_one = (int64_t) -1, const_zero = (int64_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int64_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int64_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int64_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int64_t),
                                     little, !is_unsigned);
    }
}

static PyObject* __pyx_convert__to_py_SingleComplex(SingleComplex s) {
              PyObject* res;
              PyObject* member;
              res = __Pyx_PyDict_NewPresized(2); if (unlikely(!res)) return NULL;
              member = PyFloat_FromDouble(s.real); if (unlikely(!member)) goto bad;
              if (unlikely(PyDict_SetItem(res, __pyx_n_s_real, member) < 0)) goto bad;
              Py_DECREF(member);
              member = PyFloat_FromDouble(s.imag); if (unlikely(!member)) goto bad;
              if (unlikely(PyDict_SetItem(res, __pyx_n_s_imag, member) < 0)) goto bad;
              Py_DECREF(member);
              return res;
              bad:
              Py_XDECREF(member);
              Py_DECREF(res);
              return NULL;
            }
            static PyObject* __pyx_convert__to_py_DoubleComplex(DoubleComplex s) {
              PyObject* res;
              PyObject* member;
              res = __Pyx_PyDict_NewPresized(2); if (unlikely(!res)) return NULL;
              member = PyFloat_FromDouble(s.real); if (unlikely(!member)) goto bad;
              if (unlikely(PyDict_SetItem(res, __pyx_n_s_real, member) < 0)) goto bad;
              Py_DECREF(member);
              member = PyFloat_FromDouble(s.imag); if (unlikely(!member)) goto bad;
              if (unlikely(PyDict_SetItem(res, __pyx_n_s_imag, member) < 0)) goto bad;
              Py_DECREF(member);
              return res;
              bad:
              Py_XDECREF(member);
              Py_DECREF(res);
              return NULL;
            }
            /* CIntToPy */
            static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
    const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum NPY_TYPES) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
            static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) -1, const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* CIntFromPy */
            static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *x) {
    const int64_t neg_one = (int64_t) -1, const_zero = (int64_t) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int64_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int64_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int64_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int64_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int64_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(int64_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) >= 2 * PyLong_SHIFT) {
                            return (int64_t) (((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int64_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) >= 3 * PyLong_SHIFT) {
                            return (int64_t) (((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int64_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) >= 4 * PyLong_SHIFT) {
                            return (int64_t) (((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int64_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int64_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int64_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int64_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int64_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int64_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
                            return (int64_t) (((int64_t)-1)*(((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int64_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
                            return (int64_t) ((((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
                            return (int64_t) (((int64_t)-1)*(((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int64_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
                            return (int64_t) ((((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT) {
                            return (int64_t) (((int64_t)-1)*(((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int64_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int64_t) - 1 > 4 * PyLong_SHIFT) {
                            return (int64_t) ((((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int64_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int64_t val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int64_t) -1;
        }
    } else {
        int64_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int64_t) -1;
        val = __Pyx_PyInt_As_int64_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int64_t");
    return (int64_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int64_t");
    return (int64_t) -1;
}

/* CIntFromPy */
            static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(size_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (size_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
                            return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
                            return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
                            return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (size_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(size_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(size_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(size_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            size_t val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (size_t) -1;
        }
    } else {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to size_t");
    return (size_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to size_t");
    return (size_t) -1;
}

/* CIntFromPy */
            static CYTHON_INLINE Integer __Pyx_PyInt_As_Integer(PyObject *x) {
    const Integer neg_one = (Integer) -1, const_zero = (Integer) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(Integer) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(Integer, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (Integer) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (Integer) 0;
                case  1: __PYX_VERIFY_RETURN_INT(Integer, digit, digits[0])
                case 2:
                    if (8 * sizeof(Integer) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Integer, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Integer) >= 2 * PyLong_SHIFT) {
                            return (Integer) (((((Integer)digits[1]) << PyLong_SHIFT) | (Integer)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(Integer) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Integer, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Integer) >= 3 * PyLong_SHIFT) {
                            return (Integer) (((((((Integer)digits[2]) << PyLong_SHIFT) | (Integer)digits[1]) << PyLong_SHIFT) | (Integer)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(Integer) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Integer, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Integer) >= 4 * PyLong_SHIFT) {
                            return (Integer) (((((((((Integer)digits[3]) << PyLong_SHIFT) | (Integer)digits[2]) << PyLong_SHIFT) | (Integer)digits[1]) << PyLong_SHIFT) | (Integer)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (Integer) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(Integer) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(Integer, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(Integer) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(Integer, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (Integer) 0;
                case -1: __PYX_VERIFY_RETURN_INT(Integer, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(Integer,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(Integer) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Integer, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Integer) - 1 > 2 * PyLong_SHIFT) {
                            return (Integer) (((Integer)-1)*(((((Integer)digits[1]) << PyLong_SHIFT) | (Integer)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(Integer) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Integer, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Integer) - 1 > 2 * PyLong_SHIFT) {
                            return (Integer) ((((((Integer)digits[1]) << PyLong_SHIFT) | (Integer)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(Integer) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Integer, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Integer) - 1 > 3 * PyLong_SHIFT) {
                            return (Integer) (((Integer)-1)*(((((((Integer)digits[2]) << PyLong_SHIFT) | (Integer)digits[1]) << PyLong_SHIFT) | (Integer)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(Integer) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Integer, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Integer) - 1 > 3 * PyLong_SHIFT) {
                            return (Integer) ((((((((Integer)digits[2]) << PyLong_SHIFT) | (Integer)digits[1]) << PyLong_SHIFT) | (Integer)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(Integer) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Integer, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Integer) - 1 > 4 * PyLong_SHIFT) {
                            return (Integer) (((Integer)-1)*(((((((((Integer)digits[3]) << PyLong_SHIFT) | (Integer)digits[2]) << PyLong_SHIFT) | (Integer)digits[1]) << PyLong_SHIFT) | (Integer)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(Integer) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(Integer, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(Integer) - 1 > 4 * PyLong_SHIFT) {
                            return (Integer) ((((((((((Integer)digits[3]) << PyLong_SHIFT) | (Integer)digits[2]) << PyLong_SHIFT) | (Integer)digits[1]) << PyLong_SHIFT) | (Integer)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(Integer) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(Integer, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(Integer) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(Integer, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            Integer val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (Integer) -1;
        }
    } else {
        Integer val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (Integer) -1;
        val = __Pyx_PyInt_As_Integer(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to Integer");
    return (Integer) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to Integer");
    return (Integer) -1;
}

/* CIntFromPy */
            static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) -1, const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* CIntFromPy */
            static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG) -1, const_zero = (PY_LONG_LONG) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(PY_LONG_LONG) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (PY_LONG_LONG) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (PY_LONG_LONG) 0;
                case  1: __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, digit, digits[0])
                case 2:
                    if (8 * sizeof(PY_LONG_LONG) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) >= 2 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) (((((PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PY_LONG_LONG) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) >= 3 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) (((((((PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PY_LONG_LONG) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) >= 4 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) (((((((((PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (PY_LONG_LONG) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(PY_LONG_LONG) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (PY_LONG_LONG) 0;
                case -1: __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(PY_LONG_LONG,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(PY_LONG_LONG) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) (((PY_LONG_LONG)-1)*(((((PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(PY_LONG_LONG) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) ((((((PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) (((PY_LONG_LONG)-1)*(((((((PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PY_LONG_LONG) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) ((((((((PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) (((PY_LONG_LONG)-1)*(((((((((PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PY_LONG_LONG) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) ((((((((((PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(PY_LONG_LONG) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            PY_LONG_LONG val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (PY_LONG_LONG) -1;
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (PY_LONG_LONG) -1;
        val = __Pyx_PyInt_As_PY_LONG_LONG(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to PY_LONG_LONG");
    return (PY_LONG_LONG) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to PY_LONG_LONG");
    return (PY_LONG_LONG) -1;
}

/* FastTypeChecks */
            #if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* CheckBinaryVersion */
            static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

/* ModuleImport */
            #ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

/* TypeImport */
            #ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    size_t size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    py_name = __Pyx_PyIdentifier_FromString(class_name);
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (!strict && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd",
            module_name, class_name, basicsize, size);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    else if ((size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
            module_name, class_name, basicsize, size);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

/* InitStrings */
            static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        if (PyObject_Hash(*t->p) == -1)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    char* defenc_c;
    PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
    if (!defenc) return NULL;
    defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    {
        char* end = defenc_c + PyBytes_GET_SIZE(defenc);
        char* c;
        for (c = defenc_c; c < end; c++) {
            if ((unsigned char) (*c) >= 128) {
                PyUnicode_AsASCIIString(o);
                return NULL;
            }
        }
    }
#endif
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(x);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
