/* Generated by Cython 0.29.20 */

#ifndef __PYX_HAVE_API__pygpu__gpuarray
#define __PYX_HAVE_API__pygpu__gpuarray
#ifdef __MINGW64__
#define MS_WIN64
#endif
#include "Python.h"
#include "gpuarray.h"

static PyTypeObject *__pyx_ptype_5pygpu_8gpuarray_GpuContext = 0;
#define PyGpuContextType (*__pyx_ptype_5pygpu_8gpuarray_GpuContext)
static PyTypeObject *__pyx_ptype_5pygpu_8gpuarray_GpuArray = 0;
#define PyGpuArrayType (*__pyx_ptype_5pygpu_8gpuarray_GpuArray)
static PyTypeObject *__pyx_ptype_5pygpu_8gpuarray_GpuKernel = 0;
#define PyGpuKernelType (*__pyx_ptype_5pygpu_8gpuarray_GpuKernel)

static PyArray_Descr *(*__pyx_api_f_5pygpu_8gpuarray_typecode_to_dtype)(int) = 0;
#define typecode_to_dtype __pyx_api_f_5pygpu_8gpuarray_typecode_to_dtype
static int (*__pyx_api_f_5pygpu_8gpuarray_get_typecode)(PyObject *) = 0;
#define get_typecode __pyx_api_f_5pygpu_8gpuarray_get_typecode
static struct PyGpuContextObject *(*__pyx_api_f_5pygpu_8gpuarray_pygpu_default_context)(void) = 0;
#define pygpu_default_context __pyx_api_f_5pygpu_8gpuarray_pygpu_default_context
static int (*__pyx_api_f_5pygpu_8gpuarray_pygpu_GpuArray_Check)(PyObject *) = 0;
#define pygpu_GpuArray_Check __pyx_api_f_5pygpu_8gpuarray_pygpu_GpuArray_Check
static struct PyGpuContextObject *(*__pyx_api_f_5pygpu_8gpuarray_pygpu_init)(PyObject *, gpucontext_props *) = 0;
#define pygpu_init __pyx_api_f_5pygpu_8gpuarray_pygpu_init
static struct PyGpuArrayObject *(*__pyx_api_f_5pygpu_8gpuarray_pygpu_zeros)(unsigned int, size_t const *, int, ga_order, struct PyGpuContextObject *, PyObject *) = 0;
#define pygpu_zeros __pyx_api_f_5pygpu_8gpuarray_pygpu_zeros
static struct PyGpuArrayObject *(*__pyx_api_f_5pygpu_8gpuarray_pygpu_empty)(unsigned int, size_t const *, int, ga_order, struct PyGpuContextObject *, PyObject *) = 0;
#define pygpu_empty __pyx_api_f_5pygpu_8gpuarray_pygpu_empty
static struct PyGpuArrayObject *(*__pyx_api_f_5pygpu_8gpuarray_pygpu_fromgpudata)(gpudata *, size_t, int, unsigned int, size_t const *, Py_ssize_t const *, struct PyGpuContextObject *, int, PyObject *, PyObject *) = 0;
#define pygpu_fromgpudata __pyx_api_f_5pygpu_8gpuarray_pygpu_fromgpudata
static struct PyGpuArrayObject *(*__pyx_api_f_5pygpu_8gpuarray_pygpu_copy)(struct PyGpuArrayObject *, ga_order) = 0;
#define pygpu_copy __pyx_api_f_5pygpu_8gpuarray_pygpu_copy
static int (*__pyx_api_f_5pygpu_8gpuarray_pygpu_move)(struct PyGpuArrayObject *, struct PyGpuArrayObject *) = 0;
#define pygpu_move __pyx_api_f_5pygpu_8gpuarray_pygpu_move
static struct PyGpuArrayObject *(*__pyx_api_f_5pygpu_8gpuarray_pygpu_view)(struct PyGpuArrayObject *, PyObject *) = 0;
#define pygpu_view __pyx_api_f_5pygpu_8gpuarray_pygpu_view
static int (*__pyx_api_f_5pygpu_8gpuarray_pygpu_sync)(struct PyGpuArrayObject *) = 0;
#define pygpu_sync __pyx_api_f_5pygpu_8gpuarray_pygpu_sync
static struct PyGpuArrayObject *(*__pyx_api_f_5pygpu_8gpuarray_pygpu_empty_like)(struct PyGpuArrayObject *, ga_order, int) = 0;
#define pygpu_empty_like __pyx_api_f_5pygpu_8gpuarray_pygpu_empty_like
static PyArrayObject *(*__pyx_api_f_5pygpu_8gpuarray_pygpu_as_ndarray)(struct PyGpuArrayObject *) = 0;
#define pygpu_as_ndarray __pyx_api_f_5pygpu_8gpuarray_pygpu_as_ndarray
static struct PyGpuArrayObject *(*__pyx_api_f_5pygpu_8gpuarray_pygpu_index)(struct PyGpuArrayObject *, Py_ssize_t const *, Py_ssize_t const *, Py_ssize_t const *) = 0;
#define pygpu_index __pyx_api_f_5pygpu_8gpuarray_pygpu_index
static struct PyGpuArrayObject *(*__pyx_api_f_5pygpu_8gpuarray_pygpu_reshape)(struct PyGpuArrayObject *, unsigned int, size_t const *, ga_order, int, int) = 0;
#define pygpu_reshape __pyx_api_f_5pygpu_8gpuarray_pygpu_reshape
static struct PyGpuArrayObject *(*__pyx_api_f_5pygpu_8gpuarray_pygpu_transpose)(struct PyGpuArrayObject *, unsigned int const *) = 0;
#define pygpu_transpose __pyx_api_f_5pygpu_8gpuarray_pygpu_transpose
static int (*__pyx_api_f_5pygpu_8gpuarray_pygpu_transfer)(struct PyGpuArrayObject *, struct PyGpuArrayObject *) = 0;
#define pygpu_transfer __pyx_api_f_5pygpu_8gpuarray_pygpu_transfer
static struct PyGpuArrayObject *(*__pyx_api_f_5pygpu_8gpuarray_pygpu_concatenate)(GpuArray const **, size_t, unsigned int, int, PyObject *, struct PyGpuContextObject *) = 0;
#define pygpu_concatenate __pyx_api_f_5pygpu_8gpuarray_pygpu_concatenate
#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

#ifndef __PYX_HAVE_RT_ImportFunction
#define __PYX_HAVE_RT_ImportFunction
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, funcname);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C function %.200s",
                PyModule_GetName(module), funcname);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    tmp.p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, desc);
        goto bad;
    }
    tmp.p = PyCObject_AsVoidPtr(cobj);}
#endif
    *f = tmp.fp;
    if (!(*f))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

#ifndef __PYX_HAVE_RT_ImportType_proto
#define __PYX_HAVE_RT_ImportType_proto
enum __Pyx_ImportType_CheckSize {
   __Pyx_ImportType_CheckSize_Error = 0,
   __Pyx_ImportType_CheckSize_Warn = 1,
   __Pyx_ImportType_CheckSize_Ignore = 2
};
static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
#endif

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
    size_t size, enum __Pyx_ImportType_CheckSize check_size)
{
    PyObject *result = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    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 ((size_t)basicsize < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif


static int import_pygpu__gpuarray(void) {
  PyObject *module = 0;
  module = PyImport_ImportModule("pygpu.gpuarray");
  if (!module) goto bad;
  if (__Pyx_ImportFunction(module, "typecode_to_dtype", (void (**)(void))&__pyx_api_f_5pygpu_8gpuarray_typecode_to_dtype, "PyArray_Descr *(int)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "get_typecode", (void (**)(void))&__pyx_api_f_5pygpu_8gpuarray_get_typecode, "int (PyObject *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "pygpu_default_context", (void (**)(void))&__pyx_api_f_5pygpu_8gpuarray_pygpu_default_context, "struct PyGpuContextObject *(void)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "pygpu_GpuArray_Check", (void (**)(void))&__pyx_api_f_5pygpu_8gpuarray_pygpu_GpuArray_Check, "int (PyObject *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "pygpu_init", (void (**)(void))&__pyx_api_f_5pygpu_8gpuarray_pygpu_init, "struct PyGpuContextObject *(PyObject *, gpucontext_props *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "pygpu_zeros", (void (**)(void))&__pyx_api_f_5pygpu_8gpuarray_pygpu_zeros, "struct PyGpuArrayObject *(unsigned int, size_t const *, int, ga_order, struct PyGpuContextObject *, PyObject *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "pygpu_empty", (void (**)(void))&__pyx_api_f_5pygpu_8gpuarray_pygpu_empty, "struct PyGpuArrayObject *(unsigned int, size_t const *, int, ga_order, struct PyGpuContextObject *, PyObject *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "pygpu_fromgpudata", (void (**)(void))&__pyx_api_f_5pygpu_8gpuarray_pygpu_fromgpudata, "struct PyGpuArrayObject *(gpudata *, size_t, int, unsigned int, size_t const *, Py_ssize_t const *, struct PyGpuContextObject *, int, PyObject *, PyObject *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "pygpu_copy", (void (**)(void))&__pyx_api_f_5pygpu_8gpuarray_pygpu_copy, "struct PyGpuArrayObject *(struct PyGpuArrayObject *, ga_order)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "pygpu_move", (void (**)(void))&__pyx_api_f_5pygpu_8gpuarray_pygpu_move, "int (struct PyGpuArrayObject *, struct PyGpuArrayObject *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "pygpu_view", (void (**)(void))&__pyx_api_f_5pygpu_8gpuarray_pygpu_view, "struct PyGpuArrayObject *(struct PyGpuArrayObject *, PyObject *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "pygpu_sync", (void (**)(void))&__pyx_api_f_5pygpu_8gpuarray_pygpu_sync, "int (struct PyGpuArrayObject *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "pygpu_empty_like", (void (**)(void))&__pyx_api_f_5pygpu_8gpuarray_pygpu_empty_like, "struct PyGpuArrayObject *(struct PyGpuArrayObject *, ga_order, int)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "pygpu_as_ndarray", (void (**)(void))&__pyx_api_f_5pygpu_8gpuarray_pygpu_as_ndarray, "PyArrayObject *(struct PyGpuArrayObject *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "pygpu_index", (void (**)(void))&__pyx_api_f_5pygpu_8gpuarray_pygpu_index, "struct PyGpuArrayObject *(struct PyGpuArrayObject *, Py_ssize_t const *, Py_ssize_t const *, Py_ssize_t const *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "pygpu_reshape", (void (**)(void))&__pyx_api_f_5pygpu_8gpuarray_pygpu_reshape, "struct PyGpuArrayObject *(struct PyGpuArrayObject *, unsigned int, size_t const *, ga_order, int, int)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "pygpu_transpose", (void (**)(void))&__pyx_api_f_5pygpu_8gpuarray_pygpu_transpose, "struct PyGpuArrayObject *(struct PyGpuArrayObject *, unsigned int const *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "pygpu_transfer", (void (**)(void))&__pyx_api_f_5pygpu_8gpuarray_pygpu_transfer, "int (struct PyGpuArrayObject *, struct PyGpuArrayObject *)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "pygpu_concatenate", (void (**)(void))&__pyx_api_f_5pygpu_8gpuarray_pygpu_concatenate, "struct PyGpuArrayObject *(GpuArray const **, size_t, unsigned int, int, PyObject *, struct PyGpuContextObject *)") < 0) goto bad;
  __pyx_ptype_5pygpu_8gpuarray_GpuContext = __Pyx_ImportType(module, "pygpu.gpuarray", "GpuContext", sizeof(struct PyGpuContextObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pygpu_8gpuarray_GpuContext) goto bad;
  __pyx_ptype_5pygpu_8gpuarray_GpuArray = __Pyx_ImportType(module, "pygpu.gpuarray", "GpuArray", sizeof(struct PyGpuArrayObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pygpu_8gpuarray_GpuArray) goto bad;
  __pyx_ptype_5pygpu_8gpuarray_GpuKernel = __Pyx_ImportType(module, "pygpu.gpuarray", "GpuKernel", sizeof(struct PyGpuKernelObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5pygpu_8gpuarray_GpuKernel) goto bad;
  Py_DECREF(module); module = 0;
  return 0;
  bad:
  Py_XDECREF(module);
  return -1;
}

#endif /* !__PYX_HAVE_API__pygpu__gpuarray */
