/* Generated by Cython 0.22 */

#define PY_SSIZE_T_CLEAN
#ifndef CYTHON_USE_PYLONG_INTERNALS
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 0
#else
#include "pyconfig.h"
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 1
#else
#define CYTHON_USE_PYLONG_INTERNALS 0
#endif
#endif
#endif
#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 < 0x03020000)
    #error Cython requires Python 2.6+ or Python 3.2+.
#else
#define CYTHON_ABI "0_22"
#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
#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_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#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
#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#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_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)
#else
  #define CYTHON_PEP393_ENABLED 0
  #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_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]))
#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)
  #define __Pyx_PyFrozenSet_Size(s)         PyObject_Size(s)
#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))
  #define __Pyx_PyFrozenSet_Size(s)         PySet_Size(s)
#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
  #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
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#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) : PyInstanceMethod_New(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#ifndef CYTHON_INLINE
  #if 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
#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
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
   a quiet NaN. */
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#define __Pyx_void_to_None(void_result) (void_result, Py_INCREF(Py_None), Py_None)
#ifdef __cplusplus
template<typename T>
void __Pyx_call_destructor(T* x) {
    x->~T();
}
template<typename T>
class __Pyx_FakeReference {
  public:
    __Pyx_FakeReference() : ptr(NULL) { }
    __Pyx_FakeReference(T& ref) : ptr(&ref) { }
    T *operator->() { return ptr; }
    operator T&() { return *ptr; }
  private:
    T *ptr;
};
#endif


#if PY_MAJOR_VERSION >= 3
  #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

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

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__pyzoltan__core__carray
#define __PYX_HAVE_API__pyzoltan__core__carray
#include "string.h"
#include "stdio.h"
#include "stdlib.h"
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#include "stdint.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#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
typedef struct {PyObject **p; 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_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)))  )
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE 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_PyObject_AsSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((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)
#if PY_MAJOR_VERSION < 3
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);
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
#endif
#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_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_COMPILING_IN_CPYTHON
#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 && __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 PyObject *__pyx_m;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;

#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[] = {
  "pyzoltan/core/carray.pyx",
  "pyzoltan/core/carray.pxd",
  "__init__.pxd",
  "type.pxd",
};

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":726
 * # 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;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":727
 * 
 * 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;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":728
 * 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;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":729
 * 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;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":733
 * #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;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":734
 * 
 * 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;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":735
 * 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;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":736
 * 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;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":740
 * #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;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":741
 * 
 * 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;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":750
 * # 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;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":751
 * # 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;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":752
 * 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;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":754
 * 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;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":755
 * 
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 */
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":756
 * 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;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":758
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uintp      uintp_t
 * 
 */
typedef npy_intp __pyx_t_5numpy_intp_t;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":759
 * 
 * ctypedef npy_intp       intp_t
 * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_double     float_t
 */
typedef npy_uintp __pyx_t_5numpy_uintp_t;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":761
 * 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;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":762
 * 
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longdouble longdouble_t
 * 
 */
typedef npy_double __pyx_t_5numpy_double_t;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":763
 * 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;
#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

#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


/*--- Type declarations ---*/
struct __pyx_obj_8pyzoltan_4core_6carray_BaseArrayIter;
struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray;
struct __pyx_obj_8pyzoltan_4core_6carray_IntArray;
struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray;
struct __pyx_obj_8pyzoltan_4core_6carray_LongArray;
struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray;
struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":765
 * 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;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":766
 * 
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
 * ctypedef npy_clongdouble clongdouble_t
 * 
 */
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":767
 * 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;

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":769
 * 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_8pyzoltan_4core_6carray_9BaseArray_remove;
struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_copy_subset;
struct __pyx_opt_args_8pyzoltan_4core_6carray_8IntArray_remove;
struct __pyx_opt_args_8pyzoltan_4core_6carray_9UIntArray_remove;
struct __pyx_opt_args_8pyzoltan_4core_6carray_9LongArray_remove;
struct __pyx_opt_args_8pyzoltan_4core_6carray_10FloatArray_remove;
struct __pyx_opt_args_8pyzoltan_4core_6carray_11DoubleArray_remove;
struct __pyx_opt_args_8pyzoltan_4core_6carray_8IntArray_copy_subset;
struct __pyx_opt_args_8pyzoltan_4core_6carray_9UIntArray_copy_subset;
struct __pyx_opt_args_8pyzoltan_4core_6carray_9LongArray_copy_subset;
struct __pyx_opt_args_8pyzoltan_4core_6carray_10FloatArray_copy_subset;
struct __pyx_opt_args_8pyzoltan_4core_6carray_11DoubleArray_copy_subset;

/* "pyzoltan/core/carray.pxd":43
 *     cpdef set_data(self, np.ndarray)
 *     cpdef squeeze(self)
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=*)             # <<<<<<<<<<<<<<
 *     cpdef extend(self, np.ndarray in_array)
 *     cpdef reset(self)
 */
struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_remove {
  int __pyx_n;
  int input_sorted;
};

/* "pyzoltan/core/carray.pxd":50
 *     cpdef str get_c_type(self)
 *     cpdef copy_values(self, LongArray indices, BaseArray dest)
 *     cpdef copy_subset(self, BaseArray source, long start_index=*, long end_index=*)             # <<<<<<<<<<<<<<
 *     cpdef update_min_max(self)
 * 
 */
struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_copy_subset {
  int __pyx_n;
  long start_index;
  long end_index;
};

/* "pyzoltan/core/carray.pxd":78
 *     cpdef set_view(self, IntArray, long start, long end)
 *     cpdef squeeze(self)
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=*)             # <<<<<<<<<<<<<<
 *     cpdef extend(self, np.ndarray in_array)
 *     cpdef reset(self)
 */
struct __pyx_opt_args_8pyzoltan_4core_6carray_8IntArray_remove {
  int __pyx_n;
  int input_sorted;
};

/* "pyzoltan/core/carray.pxd":108
 *     cpdef set_view(self, UIntArray, long start, long end)
 *     cpdef squeeze(self)
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=*)             # <<<<<<<<<<<<<<
 *     cpdef extend(self, np.ndarray in_array)
 *     cpdef reset(self)
 */
struct __pyx_opt_args_8pyzoltan_4core_6carray_9UIntArray_remove {
  int __pyx_n;
  int input_sorted;
};

/* "pyzoltan/core/carray.pxd":138
 *     cpdef set_view(self, LongArray, long start, long end)
 *     cpdef squeeze(self)
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=*)             # <<<<<<<<<<<<<<
 *     cpdef extend(self, np.ndarray in_array)
 *     cpdef reset(self)
 */
struct __pyx_opt_args_8pyzoltan_4core_6carray_9LongArray_remove {
  int __pyx_n;
  int input_sorted;
};

/* "pyzoltan/core/carray.pxd":168
 *     cpdef set_view(self, FloatArray, long start, long end)
 *     cpdef squeeze(self)
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=*)             # <<<<<<<<<<<<<<
 *     cpdef extend(self, np.ndarray in_array)
 *     cpdef reset(self)
 */
struct __pyx_opt_args_8pyzoltan_4core_6carray_10FloatArray_remove {
  int __pyx_n;
  int input_sorted;
};

/* "pyzoltan/core/carray.pxd":198
 *     cpdef set_view(self, DoubleArray, long start, long end)
 *     cpdef squeeze(self)
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=*)             # <<<<<<<<<<<<<<
 *     cpdef extend(self, np.ndarray in_array)
 *     cpdef reset(self)
 */
struct __pyx_opt_args_8pyzoltan_4core_6carray_11DoubleArray_remove {
  int __pyx_n;
  int input_sorted;
};

/* "pyzoltan/core/carray.pyx":649
 *             dest_array.data[i] = self.data[indices.data[i]]
 * 
 *     cpdef copy_subset(self, BaseArray source, long start_index=-1,             # <<<<<<<<<<<<<<
 *                       long end_index=-1):
 *         """Copy a subset of values from src to self.
 */
struct __pyx_opt_args_8pyzoltan_4core_6carray_8IntArray_copy_subset {
  int __pyx_n;
  long start_index;
  long end_index;
};

/* "pyzoltan/core/carray.pyx":1114
 *             dest_array.data[i] = self.data[indices.data[i]]
 * 
 *     cpdef copy_subset(self, BaseArray source, long start_index=-1,             # <<<<<<<<<<<<<<
 *                       long end_index=-1):
 *         """Copy a subset of values from src to self.
 */
struct __pyx_opt_args_8pyzoltan_4core_6carray_9UIntArray_copy_subset {
  int __pyx_n;
  long start_index;
  long end_index;
};

/* "pyzoltan/core/carray.pyx":1579
 *             dest_array.data[i] = self.data[indices.data[i]]
 * 
 *     cpdef copy_subset(self, BaseArray source, long start_index=-1,             # <<<<<<<<<<<<<<
 *                       long end_index=-1):
 *         """Copy a subset of values from src to self.
 */
struct __pyx_opt_args_8pyzoltan_4core_6carray_9LongArray_copy_subset {
  int __pyx_n;
  long start_index;
  long end_index;
};

/* "pyzoltan/core/carray.pyx":2044
 *             dest_array.data[i] = self.data[indices.data[i]]
 * 
 *     cpdef copy_subset(self, BaseArray source, long start_index=-1,             # <<<<<<<<<<<<<<
 *                       long end_index=-1):
 *         """Copy a subset of values from src to self.
 */
struct __pyx_opt_args_8pyzoltan_4core_6carray_10FloatArray_copy_subset {
  int __pyx_n;
  long start_index;
  long end_index;
};

/* "pyzoltan/core/carray.pyx":2509
 *             dest_array.data[i] = self.data[indices.data[i]]
 * 
 *     cpdef copy_subset(self, BaseArray source, long start_index=-1,             # <<<<<<<<<<<<<<
 *                       long end_index=-1):
 *         """Copy a subset of values from src to self.
 */
struct __pyx_opt_args_8pyzoltan_4core_6carray_11DoubleArray_copy_subset {
  int __pyx_n;
  long start_index;
  long end_index;
};

/* "pyzoltan/core/carray.pxd":23
 * cdef class LongArray(BaseArray)
 * 
 * cdef class BaseArrayIter:             # <<<<<<<<<<<<<<
 *     cdef BaseArray arr
 *     cdef long i
 */
struct __pyx_obj_8pyzoltan_4core_6carray_BaseArrayIter {
  PyObject_HEAD
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *arr;
  long i;
};


/* "pyzoltan/core/carray.pxd":20
 * 
 * # forward declaration
 * cdef class BaseArray             # <<<<<<<<<<<<<<
 * cdef class LongArray(BaseArray)
 * 
 */
struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray {
  PyObject_HEAD
  struct __pyx_vtabstruct_8pyzoltan_4core_6carray_BaseArray *__pyx_vtab;
  long length;
  long alloc;
  PyArrayObject *_npy_array;
};


/* "pyzoltan/core/carray.pxd":56
 * # `IntArray` class.
 * # ###########################################################################
 * cdef class IntArray(BaseArray):             # <<<<<<<<<<<<<<
 *     """This class defines a managed array of ints. """
 *     cdef int *data
 */
struct __pyx_obj_8pyzoltan_4core_6carray_IntArray {
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray __pyx_base;
  int *data;
  int *_old_data;
  int minimum;
  int maximum;
  struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *_parent;
};


/* "pyzoltan/core/carray.pxd":86
 * # `UIntArray` class.
 * # ###########################################################################
 * cdef class UIntArray(BaseArray):             # <<<<<<<<<<<<<<
 *     """This class defines a managed array of unsigned ints. """
 *     cdef unsigned int *data
 */
struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray {
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray __pyx_base;
  unsigned int *data;
  unsigned int *_old_data;
  unsigned int minimum;
  unsigned int maximum;
  struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *_parent;
};


/* "pyzoltan/core/carray.pxd":21
 * # forward declaration
 * cdef class BaseArray
 * cdef class LongArray(BaseArray)             # <<<<<<<<<<<<<<
 * 
 * cdef class BaseArrayIter:
 */
struct __pyx_obj_8pyzoltan_4core_6carray_LongArray {
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray __pyx_base;
  long *data;
  long *_old_data;
  long minimum;
  long maximum;
  struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *_parent;
};


/* "pyzoltan/core/carray.pxd":146
 * # `FloatArray` class.
 * # ###########################################################################
 * cdef class FloatArray(BaseArray):             # <<<<<<<<<<<<<<
 *     """This class defines a managed array of floats. """
 *     cdef float *data
 */
struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray {
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray __pyx_base;
  float *data;
  float *_old_data;
  float minimum;
  float maximum;
  struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *_parent;
};


/* "pyzoltan/core/carray.pxd":176
 * # `DoubleArray` class.
 * # ###########################################################################
 * cdef class DoubleArray(BaseArray):             # <<<<<<<<<<<<<<
 *     """This class defines a managed array of doubles. """
 *     cdef double *data
 */
struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray {
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray __pyx_base;
  double *data;
  double *_old_data;
  double minimum;
  double maximum;
  struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *_parent;
};



/* "pyzoltan/core/carray.pyx":140
 * 
 * 
 * cdef class BaseArray:             # <<<<<<<<<<<<<<
 *     """Base class for managed C-arrays.
 *     """
 */

struct __pyx_vtabstruct_8pyzoltan_4core_6carray_BaseArray {
  void (*c_align_array)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *);
  void (*c_reserve)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long);
  void (*c_reset)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *);
  void (*c_resize)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long);
  void (*c_squeeze)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *);
  PyObject *(*reserve)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long, int __pyx_skip_dispatch);
  PyObject *(*resize)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long, int __pyx_skip_dispatch);
  PyArrayObject *(*get_npy_array)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch);
  PyObject *(*set_data)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, PyArrayObject *, int __pyx_skip_dispatch);
  PyObject *(*squeeze)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch);
  PyObject *(*remove)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_remove *__pyx_optional_args);
  PyObject *(*extend)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, PyArrayObject *, int __pyx_skip_dispatch);
  PyObject *(*reset)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch);
  PyObject *(*align_array)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, int __pyx_skip_dispatch);
  PyObject *(*get_c_type)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch);
  PyObject *(*copy_values)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch);
  PyObject *(*copy_subset)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_copy_subset *__pyx_optional_args);
  PyObject *(*update_min_max)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_8pyzoltan_4core_6carray_BaseArray *__pyx_vtabptr_8pyzoltan_4core_6carray_BaseArray;


/* "pyzoltan/core/carray.pyx":1205
 * # `LongArray` class.
 * # ###########################################################################
 * cdef class LongArray(BaseArray):             # <<<<<<<<<<<<<<
 *     """Represents an array of `longs`
 * 
 */

struct __pyx_vtabstruct_8pyzoltan_4core_6carray_LongArray {
  struct __pyx_vtabstruct_8pyzoltan_4core_6carray_BaseArray __pyx_base;
  PyObject *(*_setup_npy_array)(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *);
  void (*c_append)(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, long);
  void (*c_set_view)(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, long *, long);
  long *(*get_data_ptr)(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *);
  long (*get)(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, long, int __pyx_skip_dispatch);
  PyObject *(*set)(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, long, long, int __pyx_skip_dispatch);
  PyObject *(*append)(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, long, int __pyx_skip_dispatch);
  PyObject *(*set_view)(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, long, long, int __pyx_skip_dispatch);
  long (*index)(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, long, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_8pyzoltan_4core_6carray_LongArray *__pyx_vtabptr_8pyzoltan_4core_6carray_LongArray;


/* "pyzoltan/core/carray.pyx":275
 * # `IntArray` class.
 * # ###########################################################################
 * cdef class IntArray(BaseArray):             # <<<<<<<<<<<<<<
 *     """Represents an array of `ints`
 * 
 */

struct __pyx_vtabstruct_8pyzoltan_4core_6carray_IntArray {
  struct __pyx_vtabstruct_8pyzoltan_4core_6carray_BaseArray __pyx_base;
  PyObject *(*_setup_npy_array)(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *);
  void (*c_append)(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *, int);
  void (*c_set_view)(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *, int *, long);
  int *(*get_data_ptr)(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *);
  int (*get)(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *, long, int __pyx_skip_dispatch);
  PyObject *(*set)(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *, long, int, int __pyx_skip_dispatch);
  PyObject *(*append)(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *, int, int __pyx_skip_dispatch);
  PyObject *(*set_view)(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *, struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *, long, long, int __pyx_skip_dispatch);
  long (*index)(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *, int, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_8pyzoltan_4core_6carray_IntArray *__pyx_vtabptr_8pyzoltan_4core_6carray_IntArray;


/* "pyzoltan/core/carray.pyx":740
 * # `UIntArray` class.
 * # ###########################################################################
 * cdef class UIntArray(BaseArray):             # <<<<<<<<<<<<<<
 *     """Represents an array of `unsigned ints`
 * 
 */

struct __pyx_vtabstruct_8pyzoltan_4core_6carray_UIntArray {
  struct __pyx_vtabstruct_8pyzoltan_4core_6carray_BaseArray __pyx_base;
  PyObject *(*_setup_npy_array)(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *);
  void (*c_append)(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *, unsigned int);
  void (*c_set_view)(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *, unsigned int *, long);
  unsigned int *(*get_data_ptr)(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *);
  unsigned int (*get)(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *, long, int __pyx_skip_dispatch);
  PyObject *(*set)(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *, long, unsigned int, int __pyx_skip_dispatch);
  PyObject *(*append)(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *, unsigned int, int __pyx_skip_dispatch);
  PyObject *(*set_view)(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *, struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *, long, long, int __pyx_skip_dispatch);
  long (*index)(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *, unsigned int, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_8pyzoltan_4core_6carray_UIntArray *__pyx_vtabptr_8pyzoltan_4core_6carray_UIntArray;


/* "pyzoltan/core/carray.pyx":1670
 * # `FloatArray` class.
 * # ###########################################################################
 * cdef class FloatArray(BaseArray):             # <<<<<<<<<<<<<<
 *     """Represents an array of `floats`
 * 
 */

struct __pyx_vtabstruct_8pyzoltan_4core_6carray_FloatArray {
  struct __pyx_vtabstruct_8pyzoltan_4core_6carray_BaseArray __pyx_base;
  PyObject *(*_setup_npy_array)(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *);
  void (*c_append)(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *, float);
  void (*c_set_view)(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *, float *, long);
  float *(*get_data_ptr)(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *);
  float (*get)(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *, long, int __pyx_skip_dispatch);
  PyObject *(*set)(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *, long, float, int __pyx_skip_dispatch);
  PyObject *(*append)(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *, float, int __pyx_skip_dispatch);
  PyObject *(*set_view)(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *, struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *, long, long, int __pyx_skip_dispatch);
  long (*index)(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *, float, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_8pyzoltan_4core_6carray_FloatArray *__pyx_vtabptr_8pyzoltan_4core_6carray_FloatArray;


/* "pyzoltan/core/carray.pyx":2135
 * # `DoubleArray` class.
 * # ###########################################################################
 * cdef class DoubleArray(BaseArray):             # <<<<<<<<<<<<<<
 *     """Represents an array of `doubles`
 * 
 */

struct __pyx_vtabstruct_8pyzoltan_4core_6carray_DoubleArray {
  struct __pyx_vtabstruct_8pyzoltan_4core_6carray_BaseArray __pyx_base;
  PyObject *(*_setup_npy_array)(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *);
  void (*c_append)(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *, double);
  void (*c_set_view)(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *, double *, long);
  double *(*get_data_ptr)(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *);
  double (*get)(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *, long, int __pyx_skip_dispatch);
  PyObject *(*set)(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *, long, double, int __pyx_skip_dispatch);
  PyObject *(*append)(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *, double, int __pyx_skip_dispatch);
  PyObject *(*set_view)(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *, struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *, long, long, int __pyx_skip_dispatch);
  long (*index)(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *, double, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_8pyzoltan_4core_6carray_DoubleArray *__pyx_vtabptr_8pyzoltan_4core_6carray_DoubleArray;

/* --- Runtime support code (head) --- */
#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)

#if CYTHON_COMPILING_IN_CPYTHON
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);
}
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

static PyObject *__Pyx_GetBuiltinName(PyObject *name);

static CYTHON_INLINE long __Pyx_mod_long(long, long); /* proto */

#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */

#define UNARY_NEG_WOULD_OVERFLOW(x)            (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);

static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback);

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);

static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

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

#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

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

#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

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

#define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound) \
    __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)
static CYTHON_INLINE int __Pyx_PyObject_SetSlice(
        PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact);

#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 CYTHON_INLINE 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);

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);

#if PY_MAJOR_VERSION >= 3
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;
}
#else
    #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#endif

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

static int __Pyx_SetVtable(PyObject *dict, void *vtable);

typedef struct {
    int code_line;
    PyCodeObject* code_object;
} __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);

static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value);

#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(_WIN32) || defined(__clang__)) && defined(__cplusplus) && CYTHON_CCOMPLEX
    #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

static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);

#if CYTHON_CCOMPLEX
    #define __Pyx_c_eqf(a, b)   ((a)==(b))
    #define __Pyx_c_sumf(a, b)  ((a)+(b))
    #define __Pyx_c_difff(a, b) ((a)-(b))
    #define __Pyx_c_prodf(a, b) ((a)*(b))
    #define __Pyx_c_quotf(a, b) ((a)/(b))
    #define __Pyx_c_negf(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zerof(z) ((z)==(float)0)
    #define __Pyx_c_conjf(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_absf(z)     (::std::abs(z))
        #define __Pyx_c_powf(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zerof(z) ((z)==0)
    #define __Pyx_c_conjf(z)    (conjf(z))
    #if 1
        #define __Pyx_c_absf(z)     (cabsf(z))
        #define __Pyx_c_powf(a, b)  (cpowf(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex);
    static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex);
    #if 1
        static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex);
    #endif
#endif

static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);

#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq(a, b)   ((a)==(b))
    #define __Pyx_c_sum(a, b)  ((a)+(b))
    #define __Pyx_c_diff(a, b) ((a)-(b))
    #define __Pyx_c_prod(a, b) ((a)*(b))
    #define __Pyx_c_quot(a, b) ((a)/(b))
    #define __Pyx_c_neg(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero(z) ((z)==(double)0)
    #define __Pyx_c_conj(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs(z)     (::std::abs(z))
        #define __Pyx_c_pow(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero(z) ((z)==0)
    #define __Pyx_c_conj(z)    (conj(z))
    #if 1
        #define __Pyx_c_abs(z)     (cabs(z))
        #define __Pyx_c_pow(a, b)  (cpow(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex);
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex);
    #endif
#endif

static int __Pyx_check_binary_version(void);

static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);

#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

static PyObject *__Pyx_ImportModule(const char *name);

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

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);

static void __pyx_f_8pyzoltan_4core_6carray_9BaseArray_c_align_array(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_new_indices); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_9BaseArray_c_reserve(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, CYTHON_UNUSED long __pyx_v_size); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_9BaseArray_c_reset(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_9BaseArray_c_resize(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, CYTHON_UNUSED long __pyx_v_size); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_9BaseArray_c_squeeze(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_get_c_type(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_reserve(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, CYTHON_UNUSED long __pyx_v_size, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_resize(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, CYTHON_UNUSED long __pyx_v_size, int __pyx_skip_dispatch); /* proto*/
static PyArrayObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_get_npy_array(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_set_data(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, PyArrayObject *__pyx_v_nparr, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_squeeze(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_remove(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, CYTHON_UNUSED PyArrayObject *__pyx_v_index_list, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_remove *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_extend(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, CYTHON_UNUSED PyArrayObject *__pyx_v_in_array, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_align_array(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_new_indices, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_reset(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_copy_values(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_copy_subset(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_copy_subset *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_update_min_max(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static long __pyx_f_8pyzoltan_4core_6carray_8IntArray_index(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int __pyx_v_value, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray__setup_npy_array(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_8IntArray_c_align_array(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_new_indices); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_8IntArray_c_append(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int __pyx_v_value); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_8IntArray_c_reserve(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_size); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_8IntArray_c_reset(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_8IntArray_c_resize(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_size); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_8IntArray_c_set_view(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int *__pyx_v_array, long __pyx_v_length); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_8IntArray_c_squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_get_c_type(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static int *__pyx_f_8pyzoltan_4core_6carray_8IntArray_get_data_ptr(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self); /* proto*/
static int __pyx_f_8pyzoltan_4core_6carray_8IntArray_get(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_idx, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_set(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_idx, int __pyx_v_value, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_append(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int __pyx_v_value, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_reserve(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_size, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_reset(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_resize(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_size, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_set_view(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_parent, long __pyx_v_start, long __pyx_v_end, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_remove(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_8IntArray_remove *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_extend(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_8IntArray_copy_subset *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static long __pyx_f_8pyzoltan_4core_6carray_9UIntArray_index(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, unsigned int __pyx_v_value, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray__setup_npy_array(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_align_array(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_new_indices); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_append(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, unsigned int __pyx_v_value); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_reserve(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_size); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_reset(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_resize(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_size); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_set_view(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, unsigned int *__pyx_v_array, long __pyx_v_length); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_get_c_type(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static unsigned int *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_get_data_ptr(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self); /* proto*/
static unsigned int __pyx_f_8pyzoltan_4core_6carray_9UIntArray_get(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_idx, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_set(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_idx, unsigned int __pyx_v_value, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_append(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, unsigned int __pyx_v_value, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_reserve(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_size, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_reset(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_resize(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_size, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_set_view(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_parent, long __pyx_v_start, long __pyx_v_end, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_remove(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9UIntArray_remove *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_extend(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9UIntArray_copy_subset *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static long __pyx_f_8pyzoltan_4core_6carray_9LongArray_index(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_value, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray__setup_npy_array(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_9LongArray_c_align_array(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_new_indices); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_9LongArray_c_append(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_value); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_9LongArray_c_reserve(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_size); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_9LongArray_c_reset(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_9LongArray_c_resize(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_size); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_9LongArray_c_set_view(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long *__pyx_v_array, long __pyx_v_length); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_9LongArray_c_squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_get_c_type(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static long *__pyx_f_8pyzoltan_4core_6carray_9LongArray_get_data_ptr(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self); /* proto*/
static long __pyx_f_8pyzoltan_4core_6carray_9LongArray_get(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_idx, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_set(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_idx, long __pyx_v_value, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_append(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_value, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_reserve(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_size, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_reset(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_resize(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_size, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_set_view(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_parent, long __pyx_v_start, long __pyx_v_end, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_remove(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9LongArray_remove *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_extend(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9LongArray_copy_subset *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static long __pyx_f_8pyzoltan_4core_6carray_10FloatArray_index(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, float __pyx_v_value, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray__setup_npy_array(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_align_array(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_new_indices); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_append(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, float __pyx_v_value); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_reserve(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_size); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_reset(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_resize(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_size); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_set_view(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, float *__pyx_v_array, long __pyx_v_length); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_get_c_type(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static float *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_get_data_ptr(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self); /* proto*/
static float __pyx_f_8pyzoltan_4core_6carray_10FloatArray_get(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_idx, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_set(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_idx, float __pyx_v_value, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_append(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, float __pyx_v_value, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_reserve(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_size, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_reset(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_resize(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_size, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_set_view(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_parent, long __pyx_v_start, long __pyx_v_end, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_remove(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_10FloatArray_remove *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_extend(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_10FloatArray_copy_subset *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static long __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_index(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, double __pyx_v_value, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray__setup_npy_array(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_align_array(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_new_indices); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_append(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, double __pyx_v_value); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_reserve(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_size); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_reset(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_resize(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_size); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_set_view(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, double *__pyx_v_array, long __pyx_v_length); /* proto*/
static void __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_get_c_type(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static double *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_get_data_ptr(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self); /* proto*/
static double __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_get(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_idx, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_set(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_idx, double __pyx_v_value, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_append(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, double __pyx_v_value, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_reserve(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_size, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_reset(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_resize(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_size, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_set_view(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_parent, long __pyx_v_start, long __pyx_v_end, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_remove(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_11DoubleArray_remove *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_extend(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_11DoubleArray_copy_subset *__pyx_optional_args); /* proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/

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

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

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

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

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

/* Module declarations from '__builtin__' */

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

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

/* 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*/

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

/* Module declarations from 'pyzoltan.core.carray' */
static PyTypeObject *__pyx_ptype_8pyzoltan_4core_6carray_BaseArray = 0;
static PyTypeObject *__pyx_ptype_8pyzoltan_4core_6carray_LongArray = 0;
static PyTypeObject *__pyx_ptype_8pyzoltan_4core_6carray_BaseArrayIter = 0;
static PyTypeObject *__pyx_ptype_8pyzoltan_4core_6carray_IntArray = 0;
static PyTypeObject *__pyx_ptype_8pyzoltan_4core_6carray_UIntArray = 0;
static PyTypeObject *__pyx_ptype_8pyzoltan_4core_6carray_FloatArray = 0;
static PyTypeObject *__pyx_ptype_8pyzoltan_4core_6carray_DoubleArray = 0;
static CYTHON_INLINE long __pyx_f_8pyzoltan_4core_6carray_aligned(long, int); /*proto*/
static void *__pyx_f_8pyzoltan_4core_6carray_aligned_malloc(size_t); /*proto*/
static void *__pyx_f_8pyzoltan_4core_6carray_aligned_realloc(void *, size_t, size_t); /*proto*/
static void __pyx_f_8pyzoltan_4core_6carray_aligned_free(void *); /*proto*/
static long __pyx_f_8pyzoltan_4core_6carray_py_aligned(long, int, int __pyx_skip_dispatch); /*proto*/
static void *__pyx_f_8pyzoltan_4core_6carray__aligned_malloc(size_t); /*proto*/
static void *__pyx_f_8pyzoltan_4core_6carray__aligned_realloc(void *, size_t, size_t); /*proto*/
static void *__pyx_f_8pyzoltan_4core_6carray__deref_base(void *); /*proto*/
#define __Pyx_MODULE_NAME "pyzoltan.core.carray"
int __pyx_module_is_main_pyzoltan__core__carray = 0;

/* Implementation of 'pyzoltan.core.carray' */
static PyObject *__pyx_builtin_MemoryError;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_StopIteration;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_py_aligned(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_n, int __pyx_v_item_size); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_get_c_type(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_2reserve(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, long __pyx_v_size); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_4resize(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, long __pyx_v_size); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_6get_npy_array(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_8set_data(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, PyArrayObject *__pyx_v_nparr); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_10squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_12remove(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_v_input_sorted); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_14extend(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_16align_array(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_new_indices); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_18reset(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_20copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_22copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, long __pyx_v_start_index, long __pyx_v_end_index); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_24update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_26__len__(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_28__iter__(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_6length___get__(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_6length_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_5alloc___get__(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_5alloc_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_13BaseArrayIter___init__(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArrayIter *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_arr); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_13BaseArrayIter_2__next__(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArrayIter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_13BaseArrayIter_4__iter__(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArrayIter *__pyx_v_self); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_8IntArray___cinit__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_n); /* proto */
static void __pyx_pf_8pyzoltan_4core_6carray_8IntArray_2__dealloc__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_4__getitem__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_idx); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_8IntArray_6__setitem__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_idx, int __pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_8index(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int __pyx_v_value); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_8IntArray_10__contains__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int __pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_12__reduce__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_14__setstate__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_16get_c_type(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_18get(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_idx); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_20set(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_idx, int __pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_22append(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int __pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_24reserve(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_size); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_26reset(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_28resize(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_size); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_30set_view(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_parent, long __pyx_v_start, long __pyx_v_end); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_32squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_34remove(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_v_input_sorted); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_36extend(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_38copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_40copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, long __pyx_v_start_index, long __pyx_v_end_index); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_42update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_7minimum___get__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_8IntArray_7minimum_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_7maximum___get__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_8IntArray_7maximum_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_9UIntArray___cinit__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_n); /* proto */
static void __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_2__dealloc__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_4__getitem__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_idx); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_6__setitem__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_idx, unsigned int __pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_8index(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, unsigned int __pyx_v_value); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_10__contains__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, unsigned int __pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_12__reduce__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_14__setstate__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_16get_c_type(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_18get(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_idx); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_20set(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_idx, unsigned int __pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_22append(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, unsigned int __pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_24reserve(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_size); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_26reset(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_28resize(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_size); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_30set_view(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_parent, long __pyx_v_start, long __pyx_v_end); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_32squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_34remove(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_v_input_sorted); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_36extend(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_38copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_40copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, long __pyx_v_start_index, long __pyx_v_end_index); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_42update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_7minimum___get__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_7minimum_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_7maximum___get__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_7maximum_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_9LongArray___cinit__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_n); /* proto */
static void __pyx_pf_8pyzoltan_4core_6carray_9LongArray_2__dealloc__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_4__getitem__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_idx); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_9LongArray_6__setitem__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_idx, long __pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_8index(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_value); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_9LongArray_10__contains__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_12__reduce__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_14__setstate__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_16get_c_type(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_18get(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_idx); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_20set(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_idx, long __pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_22append(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_24reserve(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_size); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_26reset(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_28resize(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_size); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_30set_view(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_parent, long __pyx_v_start, long __pyx_v_end); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_32squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_34remove(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_v_input_sorted); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_36extend(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_38copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_40copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, long __pyx_v_start_index, long __pyx_v_end_index); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_42update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_7minimum___get__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_9LongArray_7minimum_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_7maximum___get__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_9LongArray_7maximum_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_10FloatArray___cinit__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_n); /* proto */
static void __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_2__dealloc__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_4__getitem__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_idx); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_6__setitem__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_idx, float __pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_8index(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, float __pyx_v_value); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_10__contains__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, float __pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_12__reduce__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_14__setstate__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_16get_c_type(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_18get(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_idx); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_20set(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_idx, float __pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_22append(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, float __pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_24reserve(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_size); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_26reset(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_28resize(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_size); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_30set_view(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_parent, long __pyx_v_start, long __pyx_v_end); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_32squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_34remove(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_v_input_sorted); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_36extend(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_38copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_40copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, long __pyx_v_start_index, long __pyx_v_end_index); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_42update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_7minimum___get__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_7minimum_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_7maximum___get__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_7maximum_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray___cinit__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_n); /* proto */
static void __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_2__dealloc__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_4__getitem__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_idx); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_6__setitem__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_idx, double __pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_8index(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, double __pyx_v_value); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_10__contains__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, double __pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_12__reduce__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_14__setstate__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_16get_c_type(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_18get(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_idx); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_20set(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_idx, double __pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_22append(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, double __pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_24reserve(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_size); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_26reset(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_28resize(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_size); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_30set_view(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_parent, long __pyx_v_start, long __pyx_v_end); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_32squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_34remove(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_v_input_sorted); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_36extend(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_38copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_40copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, long __pyx_v_start_index, long __pyx_v_end_index); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_42update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_7minimum___get__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_7minimum_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_7maximum___get__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self); /* proto */
static int __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_7maximum_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, PyObject *__pyx_v_value); /* 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_tp_new_8pyzoltan_4core_6carray_BaseArray(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8pyzoltan_4core_6carray_LongArray(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8pyzoltan_4core_6carray_BaseArrayIter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8pyzoltan_4core_6carray_IntArray(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8pyzoltan_4core_6carray_UIntArray(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8pyzoltan_4core_6carray_FloatArray(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8pyzoltan_4core_6carray_DoubleArray(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static char __pyx_k_B[] = "B";
static char __pyx_k_H[] = "H";
static char __pyx_k_I[] = "I";
static char __pyx_k_L[] = "L";
static char __pyx_k_O[] = "O";
static char __pyx_k_Q[] = "Q";
static char __pyx_k_b[] = "b";
static char __pyx_k_d[] = "d";
static char __pyx_k_f[] = "f";
static char __pyx_k_g[] = "g";
static char __pyx_k_h[] = "h";
static char __pyx_k_i[] = "i";
static char __pyx_k_l[] = "l";
static char __pyx_k_n[] = "n";
static char __pyx_k_q[] = "q";
static char __pyx_k_Zd[] = "Zd";
static char __pyx_k_Zf[] = "Zf";
static char __pyx_k_Zg[] = "Zg";
static char __pyx_k_np[] = "np";
static char __pyx_k_arr[] = "arr";
static char __pyx_k_end[] = "end";
static char __pyx_k_get[] = "get";
static char __pyx_k_idx[] = "idx";
static char __pyx_k_int[] = "int";
static char __pyx_k_set[] = "set";
static char __pyx_k_data[] = "data";
static char __pyx_k_dest[] = "dest";
static char __pyx_k_long[] = "long";
static char __pyx_k_main[] = "__main__";
static char __pyx_k_size[] = "size";
static char __pyx_k_sort[] = "sort";
static char __pyx_k_test[] = "__test__";
static char __pyx_k_error[] = "error";
static char __pyx_k_float[] = "float";
static char __pyx_k_index[] = "index";
static char __pyx_k_numpy[] = "numpy";
static char __pyx_k_range[] = "range";
static char __pyx_k_reset[] = "reset";
static char __pyx_k_start[] = "start";
static char __pyx_k_value[] = "value";
static char __pyx_k_append[] = "append";
static char __pyx_k_double[] = "double";
static char __pyx_k_extend[] = "extend";
static char __pyx_k_import[] = "__import__";
static char __pyx_k_logger[] = "logger";
static char __pyx_k_parent[] = "parent";
static char __pyx_k_remove[] = "remove";
static char __pyx_k_resize[] = "resize";
static char __pyx_k_source[] = "source";
static char __pyx_k_indices[] = "indices";
static char __pyx_k_logging[] = "logging";
static char __pyx_k_reserve[] = "reserve";
static char __pyx_k_squeeze[] = "squeeze";
static char __pyx_k_set_data[] = "set_data";
static char __pyx_k_set_view[] = "set_view";
static char __pyx_k_end_index[] = "end_index";
static char __pyx_k_getLogger[] = "getLogger";
static char __pyx_k_item_size[] = "item_size";
static char __pyx_k_ValueError[] = "ValueError";
static char __pyx_k_alloc_long[] = "alloc: 'long'";
static char __pyx_k_get_c_type[] = "get_c_type";
static char __pyx_k_index_list[] = "index_list";
static char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static char __pyx_k_MemoryError[] = "MemoryError";
static char __pyx_k_align_array[] = "align_array";
static char __pyx_k_copy_subset[] = "copy_subset";
static char __pyx_k_copy_values[] = "copy_values";
static char __pyx_k_length_long[] = "length: 'long'";
static char __pyx_k_maximum_int[] = "maximum: 'int'";
static char __pyx_k_minimum_int[] = "minimum: 'int'";
static char __pyx_k_start_index[] = "start_index";
static char __pyx_k_RuntimeError[] = "RuntimeError";
static char __pyx_k_input_sorted[] = "input_sorted";
static char __pyx_k_maximum_long[] = "maximum: 'long'";
static char __pyx_k_minimum_long[] = "minimum: 'long'";
static char __pyx_k_unsigned_int[] = "unsigned int";
static char __pyx_k_StopIteration[] = "StopIteration";
static char __pyx_k_get_npy_array[] = "get_npy_array";
static char __pyx_k_maximum_float[] = "maximum: 'float'";
static char __pyx_k_minimum_float[] = "minimum: 'float'";
static char __pyx_k_maximum_double[] = "maximum: 'double'";
static char __pyx_k_minimum_double[] = "minimum: 'double'";
static char __pyx_k_update_min_max[] = "update_min_max";
static char __pyx_k_BaseArray_reset[] = "BaseArray::reset";
static char __pyx_k_BaseArray_extend[] = "BaseArray::extend";
static char __pyx_k_BaseArray_remove[] = "BaseArray::remove";
static char __pyx_k_BaseArray_resize[] = "BaseArray::resize";
static char __pyx_k_BaseArray_reserve[] = "BaseArray::reserve";
static char __pyx_k_BaseArray_squeeze[] = "BaseArray::squeeze";
static char __pyx_k_NotImplementedError[] = "NotImplementedError";
static char __pyx_k_array_size_mismatch[] = "array size mismatch";
static char __pyx_k_BaseArray_get_c_type[] = "BaseArray::get_c_type";
static char __pyx_k_maximum_unsigned_int[] = "maximum: 'unsigned int'";
static char __pyx_k_minimum_unsigned_int[] = "minimum: 'unsigned int'";
static char __pyx_k_BaseArray_copy_subset[] = "BaseArray::copy_subset";
static char __pyx_k_BaseArray_copy_values[] = "BaseArray::copy_values";
static char __pyx_k_Unequal_array_lengths[] = "Unequal array lengths";
static char __pyx_k_BaseArray_update_min_max[] = "BaseArray::update_min_max";
static char __pyx_k_start_index_d_end_index_d[] = "start_index : %d, end_index : %d";
static char __pyx_k_Not_enough_values_in_source[] = "Not enough values in source";
static char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
static char __pyx_k_Passed_pointer_is_not_aligned[] = "Passed pointer is not aligned.";
static char __pyx_k_Cannot_squeeze_array_which_is_a[] = "Cannot squeeze array which is a view.";
static char __pyx_k_Implementation_of_resizeable_ar[] = "\nImplementation of resizeable arrays of different types in Cython.\n\nAll arrays provide for the following operations:\n\n - access by indexing.\n - access through get/set function.\n - appending values at the end of the array.\n - reserving space for future appends.\n - access to internal data through a numpy array.\n\n\nEach array also provides an interface to its data through a numpy array.\nThis is done through the ``get_npy_array`` function. The returned numpy\narray can be used just like any other numpy array but for the following\nrestrictions:\n\n - the array may not be resized.\n - references of this array should not be kept.\n - slices of this array may not be made.\n\nThe numpy array may however be copied and used in any manner.\n";
static char __pyx_k_Source_length_should_be_same_as[] = "Source length should be same as dest length";
static char __pyx_k_start_index_beyond_array_length[] = "start_index beyond array length";
static char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
static char __pyx_k_Cannot_extend_array_which_is_a_v[] = "Cannot extend array which is a view.";
static char __pyx_k_Cannot_reize_array_which_is_a_vi[] = "Cannot reize array which is a view.";
static char __pyx_k_Cannot_remove_elements_from_view[] = "Cannot remove elements from view array.";
static char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
static char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
static char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
static char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
static PyObject *__pyx_kp_s_BaseArray_copy_subset;
static PyObject *__pyx_kp_s_BaseArray_copy_values;
static PyObject *__pyx_kp_s_BaseArray_extend;
static PyObject *__pyx_kp_s_BaseArray_get_c_type;
static PyObject *__pyx_kp_s_BaseArray_remove;
static PyObject *__pyx_kp_s_BaseArray_reserve;
static PyObject *__pyx_kp_s_BaseArray_reset;
static PyObject *__pyx_kp_s_BaseArray_resize;
static PyObject *__pyx_kp_s_BaseArray_squeeze;
static PyObject *__pyx_kp_s_BaseArray_update_min_max;
static PyObject *__pyx_kp_s_Cannot_extend_array_which_is_a_v;
static PyObject *__pyx_kp_s_Cannot_reize_array_which_is_a_vi;
static PyObject *__pyx_kp_s_Cannot_remove_elements_from_view;
static PyObject *__pyx_kp_s_Cannot_squeeze_array_which_is_a;
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
static PyObject *__pyx_n_s_MemoryError;
static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
static PyObject *__pyx_n_s_NotImplementedError;
static PyObject *__pyx_kp_s_Not_enough_values_in_source;
static PyObject *__pyx_kp_s_Passed_pointer_is_not_aligned;
static PyObject *__pyx_n_s_RuntimeError;
static PyObject *__pyx_kp_s_Source_length_should_be_same_as;
static PyObject *__pyx_n_s_StopIteration;
static PyObject *__pyx_kp_s_Unequal_array_lengths;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_align_array;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_arr;
static PyObject *__pyx_kp_s_array_size_mismatch;
static PyObject *__pyx_n_s_copy_subset;
static PyObject *__pyx_n_s_copy_values;
static PyObject *__pyx_n_s_data;
static PyObject *__pyx_n_s_dest;
static PyObject *__pyx_n_s_double;
static PyObject *__pyx_n_s_end;
static PyObject *__pyx_n_s_end_index;
static PyObject *__pyx_n_s_error;
static PyObject *__pyx_n_s_extend;
static PyObject *__pyx_n_s_float;
static PyObject *__pyx_n_s_get;
static PyObject *__pyx_n_s_getLogger;
static PyObject *__pyx_n_s_get_c_type;
static PyObject *__pyx_n_s_get_npy_array;
static PyObject *__pyx_n_s_idx;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_index;
static PyObject *__pyx_n_s_index_list;
static PyObject *__pyx_n_s_indices;
static PyObject *__pyx_n_s_input_sorted;
static PyObject *__pyx_n_s_int;
static PyObject *__pyx_n_s_item_size;
static PyObject *__pyx_n_s_logger;
static PyObject *__pyx_n_s_logging;
static PyObject *__pyx_n_s_long;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_n;
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_np;
static PyObject *__pyx_n_s_numpy;
static PyObject *__pyx_n_s_parent;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_remove;
static PyObject *__pyx_n_s_reserve;
static PyObject *__pyx_n_s_reset;
static PyObject *__pyx_n_s_resize;
static PyObject *__pyx_n_s_set;
static PyObject *__pyx_n_s_set_data;
static PyObject *__pyx_n_s_set_view;
static PyObject *__pyx_n_s_size;
static PyObject *__pyx_n_s_sort;
static PyObject *__pyx_n_s_source;
static PyObject *__pyx_n_s_squeeze;
static PyObject *__pyx_n_s_start;
static PyObject *__pyx_n_s_start_index;
static PyObject *__pyx_kp_s_start_index_beyond_array_length;
static PyObject *__pyx_kp_s_start_index_d_end_index_d;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
static PyObject *__pyx_kp_s_unsigned_int;
static PyObject *__pyx_n_s_update_min_max;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
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__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;

/* "pyzoltan/core/carray.pyx":70
 * import_array()
 * 
 * cdef inline long aligned(long n, int item_size) nogil:             # <<<<<<<<<<<<<<
 *     """Align `n` items each having size (in bytes) `item_size` to
 *     64 bytes and return the appropriate number of items that would
 */

static CYTHON_INLINE long __pyx_f_8pyzoltan_4core_6carray_aligned(long __pyx_v_n, int __pyx_v_item_size) {
  long __pyx_r;
  int __pyx_t_1;
  long __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "pyzoltan/core/carray.pyx":75
 *     be aligned to 64 bytes.
 *     """
 *     if n*item_size%64 == 0:             # <<<<<<<<<<<<<<
 *         return n
 *     else:
 */
  __pyx_t_1 = ((__Pyx_mod_long((__pyx_v_n * __pyx_v_item_size), 64) == 0) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":76
 *     """
 *     if n*item_size%64 == 0:
 *         return n             # <<<<<<<<<<<<<<
 *     else:
 *         if 64%item_size == 0:
 */
    __pyx_r = __pyx_v_n;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "pyzoltan/core/carray.pyx":78
 *         return n
 *     else:
 *         if 64%item_size == 0:             # <<<<<<<<<<<<<<
 *             return (n*item_size/64 + 1)*64/item_size
 *         else:
 */
    if (unlikely(__pyx_v_item_size == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = ((__Pyx_mod_long(64, __pyx_v_item_size) == 0) != 0);
    if (__pyx_t_1) {

      /* "pyzoltan/core/carray.pyx":79
 *     else:
 *         if 64%item_size == 0:
 *             return (n*item_size/64 + 1)*64/item_size             # <<<<<<<<<<<<<<
 *         else:
 *             return (n*item_size/64 + 1)*64
 */
      __pyx_t_2 = ((__Pyx_div_long((__pyx_v_n * __pyx_v_item_size), 64) + 1) * 64);
      if (unlikely(__pyx_v_item_size == 0)) {
        #ifdef WITH_THREAD
        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
        #endif
        PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
        #ifdef WITH_THREAD
        PyGILState_Release(__pyx_gilstate_save);
        #endif
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      else if (sizeof(long) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_item_size == (int)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_2))) {
        #ifdef WITH_THREAD
        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
        #endif
        PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
        #ifdef WITH_THREAD
        PyGILState_Release(__pyx_gilstate_save);
        #endif
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_r = __Pyx_div_long(__pyx_t_2, __pyx_v_item_size);
      goto __pyx_L0;
    }
    /*else*/ {

      /* "pyzoltan/core/carray.pyx":81
 *             return (n*item_size/64 + 1)*64/item_size
 *         else:
 *             return (n*item_size/64 + 1)*64             # <<<<<<<<<<<<<<
 * 
 * cpdef long py_aligned(long n, int item_size):
 */
      __pyx_r = ((__Pyx_div_long((__pyx_v_n * __pyx_v_item_size), 64) + 1) * 64);
      goto __pyx_L0;
    }
  }

  /* "pyzoltan/core/carray.pyx":70
 * import_array()
 * 
 * cdef inline long aligned(long n, int item_size) nogil:             # <<<<<<<<<<<<<<
 *     """Align `n` items each having size (in bytes) `item_size` to
 *     64 bytes and return the appropriate number of items that would
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pyzoltan.core.carray.aligned", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":83
 *             return (n*item_size/64 + 1)*64
 * 
 * cpdef long py_aligned(long n, int item_size):             # <<<<<<<<<<<<<<
 *     """Align `n` items each having size (in bytes) `item_size` to
 *     64 bits and return the appropriate number of items that would
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_1py_aligned(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static long __pyx_f_8pyzoltan_4core_6carray_py_aligned(long __pyx_v_n, int __pyx_v_item_size, CYTHON_UNUSED int __pyx_skip_dispatch) {
  long __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("py_aligned", 0);

  /* "pyzoltan/core/carray.pyx":88
 *     be aligned to 64 bytes.
 *     """
 *     return aligned(n, item_size)             # <<<<<<<<<<<<<<
 * 
 * cdef void* _aligned_malloc(size_t bytes) nogil:
 */
  __pyx_r = __pyx_f_8pyzoltan_4core_6carray_aligned(__pyx_v_n, __pyx_v_item_size);
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":83
 *             return (n*item_size/64 + 1)*64
 * 
 * cpdef long py_aligned(long n, int item_size):             # <<<<<<<<<<<<<<
 *     """Align `n` items each having size (in bytes) `item_size` to
 *     64 bits and return the appropriate number of items that would
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_1py_aligned(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_py_aligned[] = "py_aligned(long n, int item_size) -> long\nAlign `n` items each having size (in bytes) `item_size` to\n    64 bits and return the appropriate number of items that would\n    be aligned to 64 bytes.\n    ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_1py_aligned(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  int __pyx_v_item_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("py_aligned (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_item_size,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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_item_size)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("py_aligned", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "py_aligned") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __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_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_item_size = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_item_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("py_aligned", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.py_aligned", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_py_aligned(__pyx_self, __pyx_v_n, __pyx_v_item_size);

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_py_aligned(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_n, int __pyx_v_item_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("py_aligned", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_f_8pyzoltan_4core_6carray_py_aligned(__pyx_v_n, __pyx_v_item_size, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.py_aligned", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":90
 *     return aligned(n, item_size)
 * 
 * cdef void* _aligned_malloc(size_t bytes) nogil:             # <<<<<<<<<<<<<<
 *     """Allocates block of memory starting on a cache line.
 * 
 */

static void *__pyx_f_8pyzoltan_4core_6carray__aligned_malloc(size_t __pyx_v_bytes) {
  size_t __pyx_v_cache_size;
  char *__pyx_v_base;
  char *__pyx_v_result;
  void *__pyx_r;

  /* "pyzoltan/core/carray.pyx":96
 *     http://www.drdobbs.com/parallel/understanding-and-avoiding-memory-issues/212400410
 *     """
 *     cdef size_t cache_size = 64             # <<<<<<<<<<<<<<
 *     cdef char* base = <char*>malloc(cache_size + bytes)
 * 
 */
  __pyx_v_cache_size = 64;

  /* "pyzoltan/core/carray.pyx":97
 *     """
 *     cdef size_t cache_size = 64
 *     cdef char* base = <char*>malloc(cache_size + bytes)             # <<<<<<<<<<<<<<
 * 
 *     # Round pointer up to next line
 */
  __pyx_v_base = ((char *)malloc((__pyx_v_cache_size + __pyx_v_bytes)));

  /* "pyzoltan/core/carray.pyx":100
 * 
 *     # Round pointer up to next line
 *     cdef char* result = <char*>(<uintptr_t>(base+cache_size)&-(cache_size))             # <<<<<<<<<<<<<<
 * 
 *     # Record where block actually starts.
 */
  __pyx_v_result = ((char *)(((uintptr_t)(__pyx_v_base + __pyx_v_cache_size)) & (-__pyx_v_cache_size)));

  /* "pyzoltan/core/carray.pyx":103
 * 
 *     # Record where block actually starts.
 *     (<char**>result)[-1] = base             # <<<<<<<<<<<<<<
 * 
 *     return <void*>result
 */
  (((char **)__pyx_v_result)[-1]) = __pyx_v_base;

  /* "pyzoltan/core/carray.pyx":105
 *     (<char**>result)[-1] = base
 * 
 *     return <void*>result             # <<<<<<<<<<<<<<
 * 
 * cdef void* _aligned_realloc(void *existing, size_t bytes, size_t old_size) nogil:
 */
  __pyx_r = ((void *)__pyx_v_result);
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":90
 *     return aligned(n, item_size)
 * 
 * cdef void* _aligned_malloc(size_t bytes) nogil:             # <<<<<<<<<<<<<<
 *     """Allocates block of memory starting on a cache line.
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":107
 *     return <void*>result
 * 
 * cdef void* _aligned_realloc(void *existing, size_t bytes, size_t old_size) nogil:             # <<<<<<<<<<<<<<
 *     """Allocates block of memory starting on a cache line.
 * 
 */

static void *__pyx_f_8pyzoltan_4core_6carray__aligned_realloc(void *__pyx_v_existing, size_t __pyx_v_bytes, size_t __pyx_v_old_size) {
  void *__pyx_v_result;
  void *__pyx_r;

  /* "pyzoltan/core/carray.pyx":111
 * 
 *     """
 *     cdef void* result = _aligned_malloc(bytes)             # <<<<<<<<<<<<<<
 * 
 *     # Copy everything from the old to the new and free the old.
 */
  __pyx_v_result = __pyx_f_8pyzoltan_4core_6carray__aligned_malloc(__pyx_v_bytes);

  /* "pyzoltan/core/carray.pyx":114
 * 
 *     # Copy everything from the old to the new and free the old.
 *     memcpy(<void*>result, <void*>existing, old_size)             # <<<<<<<<<<<<<<
 *     aligned_free(<void*>existing)
 * 
 */
  memcpy(((void *)__pyx_v_result), ((void *)__pyx_v_existing), __pyx_v_old_size);

  /* "pyzoltan/core/carray.pyx":115
 *     # Copy everything from the old to the new and free the old.
 *     memcpy(<void*>result, <void*>existing, old_size)
 *     aligned_free(<void*>existing)             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
  __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_existing));

  /* "pyzoltan/core/carray.pyx":117
 *     aligned_free(<void*>existing)
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef void* _deref_base(void* ptr) nogil:
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":107
 *     return <void*>result
 * 
 * cdef void* _aligned_realloc(void *existing, size_t bytes, size_t old_size) nogil:             # <<<<<<<<<<<<<<
 *     """Allocates block of memory starting on a cache line.
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":119
 *     return result
 * 
 * cdef void* _deref_base(void* ptr) nogil:             # <<<<<<<<<<<<<<
 *     cdef size_t cache_size = 64
 *     # Recover where block actually starts
 */

static void *__pyx_f_8pyzoltan_4core_6carray__deref_base(void *__pyx_v_ptr) {
  size_t __pyx_v_cache_size;
  char *__pyx_v_base;
  void *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save;
  #endif
  __Pyx_RefNannySetupContext("_deref_base", 1);
  /*try:*/ {

    /* "pyzoltan/core/carray.pyx":120
 * 
 * cdef void* _deref_base(void* ptr) nogil:
 *     cdef size_t cache_size = 64             # <<<<<<<<<<<<<<
 *     # Recover where block actually starts
 *     cdef char* base = (<char**>ptr)[-1]
 */
    __pyx_v_cache_size = 64;

    /* "pyzoltan/core/carray.pyx":122
 *     cdef size_t cache_size = 64
 *     # Recover where block actually starts
 *     cdef char* base = (<char**>ptr)[-1]             # <<<<<<<<<<<<<<
 *     if <void*>(<uintptr_t>(base+cache_size)&-(cache_size)) != ptr:
 *         with gil:
 */
    __pyx_v_base = (((char **)__pyx_v_ptr)[-1]);

    /* "pyzoltan/core/carray.pyx":123
 *     # Recover where block actually starts
 *     cdef char* base = (<char**>ptr)[-1]
 *     if <void*>(<uintptr_t>(base+cache_size)&-(cache_size)) != ptr:             # <<<<<<<<<<<<<<
 *         with gil:
 *             raise MemoryError("Passed pointer is not aligned.")
 */
    __pyx_t_1 = ((((void *)(((uintptr_t)(__pyx_v_base + __pyx_v_cache_size)) & (-__pyx_v_cache_size))) != __pyx_v_ptr) != 0);
    if (__pyx_t_1) {

      /* "pyzoltan/core/carray.pyx":124
 *     cdef char* base = (<char**>ptr)[-1]
 *     if <void*>(<uintptr_t>(base+cache_size)&-(cache_size)) != ptr:
 *         with gil:             # <<<<<<<<<<<<<<
 *             raise MemoryError("Passed pointer is not aligned.")
 *     return <void*>base
 */
      {
          #ifdef WITH_THREAD
          PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
          #endif
          /*try:*/ {

            /* "pyzoltan/core/carray.pyx":125
 *     if <void*>(<uintptr_t>(base+cache_size)&-(cache_size)) != ptr:
 *         with gil:
 *             raise MemoryError("Passed pointer is not aligned.")             # <<<<<<<<<<<<<<
 *     return <void*>base
 * 
 */
            __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_Raise(__pyx_t_2, 0, 0, 0);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          }

          /* "pyzoltan/core/carray.pyx":124
 *     cdef char* base = (<char**>ptr)[-1]
 *     if <void*>(<uintptr_t>(base+cache_size)&-(cache_size)) != ptr:
 *         with gil:             # <<<<<<<<<<<<<<
 *             raise MemoryError("Passed pointer is not aligned.")
 *     return <void*>base
 */
          /*finally:*/ {
            __pyx_L8_error: {
              #ifdef WITH_THREAD
              PyGILState_Release(__pyx_gilstate_save);
              #endif
              goto __pyx_L4_error;
            }
          }
      }
    }

    /* "pyzoltan/core/carray.pyx":126
 *         with gil:
 *             raise MemoryError("Passed pointer is not aligned.")
 *     return <void*>base             # <<<<<<<<<<<<<<
 * 
 * cdef void* aligned_malloc(size_t bytes) nogil:
 */
    __pyx_r = ((void *)__pyx_v_base);
    goto __pyx_L3_return;
  }

  /* "pyzoltan/core/carray.pyx":120
 * 
 * cdef void* _deref_base(void* ptr) nogil:
 *     cdef size_t cache_size = 64             # <<<<<<<<<<<<<<
 *     # Recover where block actually starts
 *     cdef char* base = (<char**>ptr)[-1]
 */
  /*finally:*/ {
    __pyx_L3_return: {
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L0;
    }
    __pyx_L4_error: {
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L1_error;
    }
  }

  /* "pyzoltan/core/carray.pyx":119
 *     return result
 * 
 * cdef void* _deref_base(void* ptr) nogil:             # <<<<<<<<<<<<<<
 *     cdef size_t cache_size = 64
 *     # Recover where block actually starts
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("pyzoltan.core.carray._deref_base", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":128
 *     return <void*>base
 * 
 * cdef void* aligned_malloc(size_t bytes) nogil:             # <<<<<<<<<<<<<<
 *     return _aligned_malloc(bytes)
 * 
 */

static void *__pyx_f_8pyzoltan_4core_6carray_aligned_malloc(size_t __pyx_v_bytes) {
  void *__pyx_r;

  /* "pyzoltan/core/carray.pyx":129
 * 
 * cdef void* aligned_malloc(size_t bytes) nogil:
 *     return _aligned_malloc(bytes)             # <<<<<<<<<<<<<<
 * 
 * cdef void* aligned_realloc(void* p, size_t bytes, size_t old_size) nogil:
 */
  __pyx_r = __pyx_f_8pyzoltan_4core_6carray__aligned_malloc(__pyx_v_bytes);
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":128
 *     return <void*>base
 * 
 * cdef void* aligned_malloc(size_t bytes) nogil:             # <<<<<<<<<<<<<<
 *     return _aligned_malloc(bytes)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":131
 *     return _aligned_malloc(bytes)
 * 
 * cdef void* aligned_realloc(void* p, size_t bytes, size_t old_size) nogil:             # <<<<<<<<<<<<<<
 *     return _aligned_realloc(p, bytes, old_size)
 * 
 */

static void *__pyx_f_8pyzoltan_4core_6carray_aligned_realloc(void *__pyx_v_p, size_t __pyx_v_bytes, size_t __pyx_v_old_size) {
  void *__pyx_r;

  /* "pyzoltan/core/carray.pyx":132
 * 
 * cdef void* aligned_realloc(void* p, size_t bytes, size_t old_size) nogil:
 *     return _aligned_realloc(p, bytes, old_size)             # <<<<<<<<<<<<<<
 * 
 * cdef void aligned_free(void* p) nogil:
 */
  __pyx_r = __pyx_f_8pyzoltan_4core_6carray__aligned_realloc(__pyx_v_p, __pyx_v_bytes, __pyx_v_old_size);
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":131
 *     return _aligned_malloc(bytes)
 * 
 * cdef void* aligned_realloc(void* p, size_t bytes, size_t old_size) nogil:             # <<<<<<<<<<<<<<
 *     return _aligned_realloc(p, bytes, old_size)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":134
 *     return _aligned_realloc(p, bytes, old_size)
 * 
 * cdef void aligned_free(void* p) nogil:             # <<<<<<<<<<<<<<
 *     """Free block allocated by alligned_malloc.
 *     """
 */

static void __pyx_f_8pyzoltan_4core_6carray_aligned_free(void *__pyx_v_p) {

  /* "pyzoltan/core/carray.pyx":137
 *     """Free block allocated by alligned_malloc.
 *     """
 *     free(<void*>_deref_base(p))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  free(((void *)__pyx_f_8pyzoltan_4core_6carray__deref_base(__pyx_v_p)));

  /* "pyzoltan/core/carray.pyx":134
 *     return _aligned_realloc(p, bytes, old_size)
 * 
 * cdef void aligned_free(void* p) nogil:             # <<<<<<<<<<<<<<
 *     """Free block allocated by alligned_malloc.
 *     """
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":145
 * 
 * 
 *     cdef void c_align_array(self, LongArray new_indices) nogil:             # <<<<<<<<<<<<<<
 *         """Rearrange the array contents according to the new indices.
 *         """
 */

static void __pyx_f_8pyzoltan_4core_6carray_9BaseArray_c_align_array(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_new_indices) {

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":150
 *         pass
 * 
 *     cdef void c_reserve(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

static void __pyx_f_8pyzoltan_4core_6carray_9BaseArray_c_reserve(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, CYTHON_UNUSED long __pyx_v_size) {

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":153
 *         pass
 * 
 *     cdef void c_reset(self) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         self.length = 0
 */

static void __pyx_f_8pyzoltan_4core_6carray_9BaseArray_c_reset(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self) {
  PyArrayObject *__pyx_v_arr;
  long __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":154
 * 
 *     cdef void c_reset(self) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         self.length = 0
 *         arr.dimensions[0] = self.length
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->_npy_array);

  /* "pyzoltan/core/carray.pyx":155
 *     cdef void c_reset(self) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         self.length = 0             # <<<<<<<<<<<<<<
 *         arr.dimensions[0] = self.length
 * 
 */
  __pyx_v_self->length = 0;

  /* "pyzoltan/core/carray.pyx":156
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         self.length = 0
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_resize(self, long size) nogil:
 */
  __pyx_t_1 = __pyx_v_self->length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":153
 *         pass
 * 
 *     cdef void c_reset(self) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         self.length = 0
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":158
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_resize(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

static void __pyx_f_8pyzoltan_4core_6carray_9BaseArray_c_resize(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, CYTHON_UNUSED long __pyx_v_size) {

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":161
 *         pass
 * 
 *     cdef void c_squeeze(self) nogil:             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

static void __pyx_f_8pyzoltan_4core_6carray_9BaseArray_c_squeeze(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self) {

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":165
 * 
 * 
 *     cpdef str get_c_type(self):             # <<<<<<<<<<<<<<
 *         """Return the c data type of this array.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_1get_c_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_get_c_type(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, int __pyx_skip_dispatch) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_c_type", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_c_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_1get_c_type)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":168
 *         """Return the c data type of this array.
 *         """
 *         raise NotImplementedError, 'BaseArray::get_c_type'             # <<<<<<<<<<<<<<
 * 
 *     cpdef reserve(self, long size):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_kp_s_BaseArray_get_c_type, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pyzoltan/core/carray.pyx":165
 * 
 * 
 *     cpdef str get_c_type(self):             # <<<<<<<<<<<<<<
 *         """Return the c data type of this 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("pyzoltan.core.carray.BaseArray.get_c_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_1get_c_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_get_c_type[] = "BaseArray.get_c_type(self) -> str\nReturn the c data type of this array.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_1get_c_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_c_type (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_get_c_type(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_get_c_type(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_c_type", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9BaseArray_get_c_type(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.BaseArray.get_c_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":170
 *         raise NotImplementedError, 'BaseArray::get_c_type'
 * 
 *     cpdef reserve(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes the internal data to required size.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_3reserve(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_reserve(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, CYTHON_UNUSED long __pyx_v_size, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reserve", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reserve); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_3reserve)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __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;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":173
 *         """Resizes the internal data to required size.
 *         """
 *         raise NotImplementedError, 'BaseArray::reserve'             # <<<<<<<<<<<<<<
 * 
 *     cpdef resize(self, long size):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_kp_s_BaseArray_reserve, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pyzoltan/core/carray.pyx":170
 *         raise NotImplementedError, 'BaseArray::get_c_type'
 * 
 *     cpdef reserve(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes the internal data to required size.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.BaseArray.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_3reserve(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_2reserve[] = "BaseArray.reserve(self, long size)\nResizes the internal data to required size.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_3reserve(PyObject *__pyx_v_self, PyObject *__pyx_arg_size) {
  long __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reserve (wrapper)", 0);
  assert(__pyx_arg_size); {
    __pyx_v_size = __Pyx_PyInt_As_long(__pyx_arg_size); if (unlikely((__pyx_v_size == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.BaseArray.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_2reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), ((long)__pyx_v_size));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_2reserve(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, long __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reserve", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9BaseArray_reserve(__pyx_v_self, __pyx_v_size, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.BaseArray.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":175
 *         raise NotImplementedError, 'BaseArray::reserve'
 * 
 *     cpdef resize(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes the array to the new size.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_5resize(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_resize(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, CYTHON_UNUSED long __pyx_v_size, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resize", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_resize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_5resize)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __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;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":178
 *         """Resizes the array to the new size.
 *         """
 *         raise NotImplementedError, 'BaseArray::resize'             # <<<<<<<<<<<<<<
 * 
 *     cpdef np.ndarray get_npy_array(self):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_kp_s_BaseArray_resize, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pyzoltan/core/carray.pyx":175
 *         raise NotImplementedError, 'BaseArray::reserve'
 * 
 *     cpdef resize(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes the array to the new size.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.BaseArray.resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_5resize(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_4resize[] = "BaseArray.resize(self, long size)\nResizes the array to the new size.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_5resize(PyObject *__pyx_v_self, PyObject *__pyx_arg_size) {
  long __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resize (wrapper)", 0);
  assert(__pyx_arg_size); {
    __pyx_v_size = __Pyx_PyInt_As_long(__pyx_arg_size); if (unlikely((__pyx_v_size == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.BaseArray.resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_4resize(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), ((long)__pyx_v_size));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_4resize(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, long __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9BaseArray_resize(__pyx_v_self, __pyx_v_size, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.BaseArray.resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":180
 *         raise NotImplementedError, 'BaseArray::resize'
 * 
 *     cpdef np.ndarray get_npy_array(self):             # <<<<<<<<<<<<<<
 *         """Returns a numpy array of the data: do not keep its reference.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_7get_npy_array(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyArrayObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_get_npy_array(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, int __pyx_skip_dispatch) {
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_npy_array", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_npy_array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_7get_npy_array)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((PyArrayObject *)__pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":183
 *         """Returns a numpy array of the data: do not keep its reference.
 *         """
 *         return self._npy_array             # <<<<<<<<<<<<<<
 * 
 *     cpdef set_data(self, np.ndarray nparr):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_npy_array));
  __pyx_r = __pyx_v_self->_npy_array;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":180
 *         raise NotImplementedError, 'BaseArray::resize'
 * 
 *     cpdef np.ndarray get_npy_array(self):             # <<<<<<<<<<<<<<
 *         """Returns a numpy array of the data: do not keep its reference.
 *         """
 */

  /* 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("pyzoltan.core.carray.BaseArray.get_npy_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_7get_npy_array(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_6get_npy_array[] = "BaseArray.get_npy_array(self) -> ndarray\nReturns a numpy array of the data: do not keep its reference.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_7get_npy_array(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_npy_array (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_6get_npy_array(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_6get_npy_array(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_npy_array", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8pyzoltan_4core_6carray_9BaseArray_get_npy_array(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.BaseArray.get_npy_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":185
 *         return self._npy_array
 * 
 *     cpdef set_data(self, np.ndarray nparr):             # <<<<<<<<<<<<<<
 *         """Set data from the given numpy array.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_9set_data(PyObject *__pyx_v_self, PyObject *__pyx_v_nparr); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_set_data(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, PyArrayObject *__pyx_v_nparr, int __pyx_skip_dispatch) {
  PyArrayObject *__pyx_v_sarr;
  PyArrayObject *__pyx_v_darr;
  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;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_data", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_9set_data)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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, ((PyObject *)__pyx_v_nparr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_v_nparr));
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, ((PyObject *)__pyx_v_nparr));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_nparr));
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":194
 * 
 *         """
 *         cdef PyArrayObject* sarr = <PyArrayObject*>nparr             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* darr = <PyArrayObject*>self._npy_array
 * 
 */
  __pyx_v_sarr = ((PyArrayObject *)__pyx_v_nparr);

  /* "pyzoltan/core/carray.pyx":195
 *         """
 *         cdef PyArrayObject* sarr = <PyArrayObject*>nparr
 *         cdef PyArrayObject* darr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 * 
 *         if sarr.data == darr.data:
 */
  __pyx_v_darr = ((PyArrayObject *)__pyx_v_self->_npy_array);

  /* "pyzoltan/core/carray.pyx":197
 *         cdef PyArrayObject* darr = <PyArrayObject*>self._npy_array
 * 
 *         if sarr.data == darr.data:             # <<<<<<<<<<<<<<
 *             return
 *         elif sarr.dimensions[0] <= darr.dimensions[0]:
 */
  __pyx_t_6 = ((__pyx_v_sarr->data == __pyx_v_darr->data) != 0);
  if (__pyx_t_6) {

    /* "pyzoltan/core/carray.pyx":198
 * 
 *         if sarr.data == darr.data:
 *             return             # <<<<<<<<<<<<<<
 *         elif sarr.dimensions[0] <= darr.dimensions[0]:
 *             self._npy_array[:sarr.dimensions[0]] = nparr
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "pyzoltan/core/carray.pyx":199
 *         if sarr.data == darr.data:
 *             return
 *         elif sarr.dimensions[0] <= darr.dimensions[0]:             # <<<<<<<<<<<<<<
 *             self._npy_array[:sarr.dimensions[0]] = nparr
 *         else:
 */
  __pyx_t_6 = (((__pyx_v_sarr->dimensions[0]) <= (__pyx_v_darr->dimensions[0])) != 0);
  if (__pyx_t_6) {

    /* "pyzoltan/core/carray.pyx":200
 *             return
 *         elif sarr.dimensions[0] <= darr.dimensions[0]:
 *             self._npy_array[:sarr.dimensions[0]] = nparr             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError, 'array size mismatch'
 */
    if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_self->_npy_array), ((PyObject *)__pyx_v_nparr), 0, (__pyx_v_sarr->dimensions[0]), NULL, NULL, NULL, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pyzoltan/core/carray.pyx":202
 *             self._npy_array[:sarr.dimensions[0]] = nparr
 *         else:
 *             raise ValueError, 'array size mismatch'             # <<<<<<<<<<<<<<
 * 
 *     cpdef squeeze(self):
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_array_size_mismatch, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":185
 *         return self._npy_array
 * 
 *     cpdef set_data(self, np.ndarray nparr):             # <<<<<<<<<<<<<<
 *         """Set data from the given numpy array.
 * 
 */

  /* 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("pyzoltan.core.carray.BaseArray.set_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_9set_data(PyObject *__pyx_v_self, PyObject *__pyx_v_nparr); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_8set_data[] = "BaseArray.set_data(self, ndarray nparr)\nSet data from the given numpy array.\n\n        If the numpy array is a reference to the numpy array maintained\n        internally by this class, nothing is done.\n        Otherwise, if the size of nparr matches this array, values are\n        copied into the array maintained.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_9set_data(PyObject *__pyx_v_self, PyObject *__pyx_v_nparr) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_data (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nparr), __pyx_ptype_5numpy_ndarray, 1, "nparr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_8set_data(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), ((PyArrayObject *)__pyx_v_nparr));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_8set_data(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, PyArrayObject *__pyx_v_nparr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_data", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9BaseArray_set_data(__pyx_v_self, __pyx_v_nparr, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.BaseArray.set_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":204
 *             raise ValueError, 'array size mismatch'
 * 
 *     cpdef squeeze(self):             # <<<<<<<<<<<<<<
 *         """Release any unused memory.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_11squeeze(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_squeeze(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, int __pyx_skip_dispatch) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("squeeze", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_squeeze); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_11squeeze)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":207
 *         """Release any unused memory.
 *         """
 *         raise NotImplementedError, 'BaseArray::squeeze'             # <<<<<<<<<<<<<<
 * 
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=0):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_kp_s_BaseArray_squeeze, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pyzoltan/core/carray.pyx":204
 *             raise ValueError, 'array size mismatch'
 * 
 *     cpdef squeeze(self):             # <<<<<<<<<<<<<<
 *         """Release any unused memory.
 *         """
 */

  /* 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("pyzoltan.core.carray.BaseArray.squeeze", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_11squeeze(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_10squeeze[] = "BaseArray.squeeze(self)\nRelease any unused memory.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_11squeeze(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("squeeze (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_10squeeze(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_10squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("squeeze", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9BaseArray_squeeze(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.BaseArray.squeeze", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":209
 *         raise NotImplementedError, 'BaseArray::squeeze'
 * 
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=0):             # <<<<<<<<<<<<<<
 *         """Remove the particles with indices in index_list.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_13remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_remove(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, CYTHON_UNUSED PyArrayObject *__pyx_v_index_list, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_remove *__pyx_optional_args) {
  int __pyx_v_input_sorted = ((int)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;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_input_sorted = __pyx_optional_args->input_sorted;
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_13remove)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_input_sorted); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_6 = 1;
        }
      }
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_index_list));
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_index_list));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_index_list));
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":212
 *         """Remove the particles with indices in index_list.
 *         """
 *         raise NotImplementedError, 'BaseArray::remove'             # <<<<<<<<<<<<<<
 * 
 *     cpdef extend(self, np.ndarray in_array):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_kp_s_BaseArray_remove, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pyzoltan/core/carray.pyx":209
 *         raise NotImplementedError, 'BaseArray::squeeze'
 * 
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=0):             # <<<<<<<<<<<<<<
 *         """Remove the particles with indices in index_list.
 *         """
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyzoltan.core.carray.BaseArray.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_13remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_12remove[] = "BaseArray.remove(self, ndarray index_list, bool input_sorted=0)\nRemove the particles with indices in index_list.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_13remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_index_list = 0;
  int __pyx_v_input_sorted;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index_list,&__pyx_n_s_input_sorted,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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index_list)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_input_sorted);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "remove") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_index_list = ((PyArrayObject *)values[0]);
    if (values[1]) {
      __pyx_v_input_sorted = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_input_sorted == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_input_sorted = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("remove", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.BaseArray.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index_list), __pyx_ptype_5numpy_ndarray, 1, "index_list", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_12remove(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_index_list, __pyx_v_input_sorted);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_12remove(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_v_input_sorted) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_remove __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.input_sorted = __pyx_v_input_sorted;
  __pyx_t_1 = __pyx_vtabptr_8pyzoltan_4core_6carray_BaseArray->remove(__pyx_v_self, __pyx_v_index_list, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.BaseArray.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":214
 *         raise NotImplementedError, 'BaseArray::remove'
 * 
 *     cpdef extend(self, np.ndarray in_array):             # <<<<<<<<<<<<<<
 *         """Extend the array with data from in_array.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_15extend(PyObject *__pyx_v_self, PyObject *__pyx_v_in_array); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_extend(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, CYTHON_UNUSED PyArrayObject *__pyx_v_in_array, int __pyx_skip_dispatch) {
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_15extend)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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, ((PyObject *)__pyx_v_in_array)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_v_in_array));
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, ((PyObject *)__pyx_v_in_array));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_in_array));
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":217
 *         """Extend the array with data from in_array.
 *         """
 *         raise NotImplementedError, 'BaseArray::extend'             # <<<<<<<<<<<<<<
 * 
 *     cpdef align_array(self, LongArray new_indices):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_kp_s_BaseArray_extend, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pyzoltan/core/carray.pyx":214
 *         raise NotImplementedError, 'BaseArray::remove'
 * 
 *     cpdef extend(self, np.ndarray in_array):             # <<<<<<<<<<<<<<
 *         """Extend the array with data from in_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_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pyzoltan.core.carray.BaseArray.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_15extend(PyObject *__pyx_v_self, PyObject *__pyx_v_in_array); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_14extend[] = "BaseArray.extend(self, ndarray in_array)\nExtend the array with data from in_array.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_15extend(PyObject *__pyx_v_self, PyObject *__pyx_v_in_array) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("extend (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_array), __pyx_ptype_5numpy_ndarray, 1, "in_array", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_14extend(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), ((PyArrayObject *)__pyx_v_in_array));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_14extend(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9BaseArray_extend(__pyx_v_self, __pyx_v_in_array, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.BaseArray.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":219
 *         raise NotImplementedError, 'BaseArray::extend'
 * 
 *     cpdef align_array(self, LongArray new_indices):             # <<<<<<<<<<<<<<
 *         """Rearrange the array contents according to the new indices.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_17align_array(PyObject *__pyx_v_self, PyObject *__pyx_v_new_indices); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_align_array(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_new_indices, int __pyx_skip_dispatch) {
  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;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("align_array", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_align_array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_17align_array)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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, ((PyObject *)__pyx_v_new_indices)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_v_new_indices));
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, ((PyObject *)__pyx_v_new_indices));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_new_indices));
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":222
 *         """Rearrange the array contents according to the new indices.
 *         """
 *         if new_indices.length != self.length:             # <<<<<<<<<<<<<<
 *             raise ValueError, 'Unequal array lengths'
 *         self.c_align_array(new_indices)
 */
  __pyx_t_6 = ((__pyx_v_new_indices->__pyx_base.length != __pyx_v_self->length) != 0);
  if (__pyx_t_6) {

    /* "pyzoltan/core/carray.pyx":223
 *         """
 *         if new_indices.length != self.length:
 *             raise ValueError, 'Unequal array lengths'             # <<<<<<<<<<<<<<
 *         self.c_align_array(new_indices)
 * 
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Unequal_array_lengths, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":224
 *         if new_indices.length != self.length:
 *             raise ValueError, 'Unequal array lengths'
 *         self.c_align_array(new_indices)             # <<<<<<<<<<<<<<
 * 
 *     cpdef reset(self):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self->__pyx_vtab)->c_align_array(__pyx_v_self, __pyx_v_new_indices);

  /* "pyzoltan/core/carray.pyx":219
 *         raise NotImplementedError, 'BaseArray::extend'
 * 
 *     cpdef align_array(self, LongArray new_indices):             # <<<<<<<<<<<<<<
 *         """Rearrange the array contents according to the new indices.
 *         """
 */

  /* 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("pyzoltan.core.carray.BaseArray.align_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_17align_array(PyObject *__pyx_v_self, PyObject *__pyx_v_new_indices); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_16align_array[] = "BaseArray.align_array(self, LongArray new_indices)\nRearrange the array contents according to the new indices.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_17align_array(PyObject *__pyx_v_self, PyObject *__pyx_v_new_indices) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("align_array (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_new_indices), __pyx_ptype_8pyzoltan_4core_6carray_LongArray, 1, "new_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_16align_array(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), ((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_new_indices));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_16align_array(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_new_indices) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("align_array", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9BaseArray_align_array(__pyx_v_self, __pyx_v_new_indices, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.BaseArray.align_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":226
 *         self.c_align_array(new_indices)
 * 
 *     cpdef reset(self):             # <<<<<<<<<<<<<<
 *         """Reset the length of the array to 0.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_19reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_reset(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, int __pyx_skip_dispatch) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reset", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_19reset)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":229
 *         """Reset the length of the array to 0.
 *         """
 *         raise NotImplementedError, 'BaseArray::reset'             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy_values(self, LongArray indices, BaseArray dest):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_kp_s_BaseArray_reset, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pyzoltan/core/carray.pyx":226
 *         self.c_align_array(new_indices)
 * 
 *     cpdef reset(self):             # <<<<<<<<<<<<<<
 *         """Reset the length of the array to 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("pyzoltan.core.carray.BaseArray.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_19reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_18reset[] = "BaseArray.reset(self)\nReset the length of the array to 0.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_19reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_18reset(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_18reset(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reset", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9BaseArray_reset(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.BaseArray.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":231
 *         raise NotImplementedError, 'BaseArray::reset'
 * 
 *     cpdef copy_values(self, LongArray indices, BaseArray dest):             # <<<<<<<<<<<<<<
 *         """Copy values of indexed particles from self to dest.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_21copy_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_copy_values(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest, int __pyx_skip_dispatch) {
  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;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_values", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy_values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_21copy_values)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && 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);
          __pyx_t_5 = 1;
        }
      }
      __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_4) {
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_indices));
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, ((PyObject *)__pyx_v_indices));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_indices));
      __Pyx_INCREF(((PyObject *)__pyx_v_dest));
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_dest));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_dest));
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":234
 *         """Copy values of indexed particles from self to dest.
 *         """
 *         raise NotImplementedError, 'BaseArray::copy_values'             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy_subset(self, BaseArray source,
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_kp_s_BaseArray_copy_values, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pyzoltan/core/carray.pyx":231
 *         raise NotImplementedError, 'BaseArray::reset'
 * 
 *     cpdef copy_values(self, LongArray indices, BaseArray dest):             # <<<<<<<<<<<<<<
 *         """Copy values of indexed particles from self to dest.
 *         """
 */

  /* 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("pyzoltan.core.carray.BaseArray.copy_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_21copy_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_20copy_values[] = "BaseArray.copy_values(self, LongArray indices, BaseArray dest)\nCopy values of indexed particles from self to dest.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_21copy_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices = 0;
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_values (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,&__pyx_n_s_dest,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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indices)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dest)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("copy_values", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy_values") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __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_indices = ((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)values[0]);
    __pyx_v_dest = ((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy_values", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.BaseArray.copy_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_8pyzoltan_4core_6carray_LongArray, 1, "indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dest), __pyx_ptype_8pyzoltan_4core_6carray_BaseArray, 1, "dest", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_20copy_values(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_indices, __pyx_v_dest);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_20copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_values", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9BaseArray_copy_values(__pyx_v_self, __pyx_v_indices, __pyx_v_dest, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.BaseArray.copy_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":236
 *         raise NotImplementedError, 'BaseArray::copy_values'
 * 
 *     cpdef copy_subset(self, BaseArray source,             # <<<<<<<<<<<<<<
 *                       long start_index=-1, long end_index=-1):
 *         """Copy subset of values from source to self.
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_23copy_subset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_copy_subset(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_copy_subset *__pyx_optional_args) {
  long __pyx_v_start_index = ((long)-1);
  long __pyx_v_end_index = ((long)-1);
  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;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_subset", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_start_index = __pyx_optional_args->start_index;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_end_index = __pyx_optional_args->end_index;
      }
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy_subset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_23copy_subset)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_start_index); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_end_index); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_source));
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, ((PyObject *)__pyx_v_source));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_source));
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":240
 *         """Copy subset of values from source to self.
 *         """
 *         raise NotImplementedError, 'BaseArray::copy_subset'             # <<<<<<<<<<<<<<
 * 
 *     cpdef update_min_max(self):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_kp_s_BaseArray_copy_subset, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pyzoltan/core/carray.pyx":236
 *         raise NotImplementedError, 'BaseArray::copy_values'
 * 
 *     cpdef copy_subset(self, BaseArray source,             # <<<<<<<<<<<<<<
 *                       long start_index=-1, long end_index=-1):
 *         """Copy subset of values from source to self.
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyzoltan.core.carray.BaseArray.copy_subset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_23copy_subset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_22copy_subset[] = "BaseArray.copy_subset(self, BaseArray source, long start_index=-1, long end_index=-1)\nCopy subset of values from source to self.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_23copy_subset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source = 0;
  long __pyx_v_start_index;
  long __pyx_v_end_index;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_subset (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_start_index,&__pyx_n_s_end_index,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_source)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start_index);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end_index);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy_subset") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_source = ((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)values[0]);
    if (values[1]) {
      __pyx_v_start_index = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_start_index == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_start_index = ((long)-1);
    }
    if (values[2]) {
      __pyx_v_end_index = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_end_index == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_end_index = ((long)-1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy_subset", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.BaseArray.copy_subset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_source), __pyx_ptype_8pyzoltan_4core_6carray_BaseArray, 1, "source", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_22copy_subset(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_source, __pyx_v_start_index, __pyx_v_end_index);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_22copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, long __pyx_v_start_index, long __pyx_v_end_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_copy_subset __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_subset", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.start_index = __pyx_v_start_index;
  __pyx_t_2.end_index = __pyx_v_end_index;
  __pyx_t_1 = __pyx_vtabptr_8pyzoltan_4core_6carray_BaseArray->copy_subset(__pyx_v_self, __pyx_v_source, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.BaseArray.copy_subset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":242
 *         raise NotImplementedError, 'BaseArray::copy_subset'
 * 
 *     cpdef update_min_max(self):             # <<<<<<<<<<<<<<
 *         """Update the min and max values of the array.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_25update_min_max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9BaseArray_update_min_max(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, int __pyx_skip_dispatch) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update_min_max", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_update_min_max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_25update_min_max)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":245
 *         """Update the min and max values of the array.
 *         """
 *         raise NotImplementedError, 'BaseArray::update_min_max'             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_kp_s_BaseArray_update_min_max, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pyzoltan/core/carray.pyx":242
 *         raise NotImplementedError, 'BaseArray::copy_subset'
 * 
 *     cpdef update_min_max(self):             # <<<<<<<<<<<<<<
 *         """Update the min and max values of the 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("pyzoltan.core.carray.BaseArray.update_min_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_25update_min_max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_24update_min_max[] = "BaseArray.update_min_max(self)\nUpdate the min and max values of the array.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_25update_min_max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_min_max (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_24update_min_max(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_24update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update_min_max", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9BaseArray_update_min_max(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.BaseArray.update_min_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":247
 *         raise NotImplementedError, 'BaseArray::update_min_max'
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.length
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_27__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_27__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_26__len__(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

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

static Py_ssize_t __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_26__len__(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "pyzoltan/core/carray.pyx":248
 * 
 *     def __len__(self):
 *         return self.length             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_r = __pyx_v_self->length;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":247
 *         raise NotImplementedError, 'BaseArray::update_min_max'
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.length
 * 
 */

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

/* "pyzoltan/core/carray.pyx":250
 *         return self.length
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """ Support the iteration protocol"""
 *         return BaseArrayIter(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_29__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_28__iter__[] = " Support the iteration protocol";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_8pyzoltan_4core_6carray_9BaseArray_28__iter__;
#endif
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_29__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_28__iter__(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_28__iter__(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "pyzoltan/core/carray.pyx":252
 *     def __iter__(self):
 *         """ Support the iteration protocol"""
 *         return BaseArrayIter(self)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8pyzoltan_4core_6carray_BaseArrayIter)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __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;

  /* "pyzoltan/core/carray.pyx":250
 *         return self.length
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """ Support the iteration protocol"""
 *         return BaseArrayIter(self)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyzoltan.core.carray.BaseArray.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pxd":29
 * cdef class BaseArray:
 *     """Base class for managed C-arrays."""
 *     cdef public long length, alloc             # <<<<<<<<<<<<<<
 *     cdef np.ndarray _npy_array
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_6length_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_6length_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_6length___get__(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_6length___get__(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.BaseArray.length.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_6length_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_6length_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_6length_2__set__(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_6length_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_As_long(__pyx_v_value); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->length = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.BaseArray.length.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_5alloc_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_5alloc_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_5alloc___get__(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9BaseArray_5alloc___get__(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->alloc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.BaseArray.alloc.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_5alloc_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_5alloc_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_5alloc_2__set__(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_9BaseArray_5alloc_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_As_long(__pyx_v_value); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->alloc = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.BaseArray.alloc.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":257
 * cdef class BaseArrayIter:
 *     """ Iteration object to support iteration over BaseArray. """
 *     def __init__(self, BaseArray arr):             # <<<<<<<<<<<<<<
 *         self.arr = arr
 *         self.i = -1
 */

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_13BaseArrayIter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8pyzoltan_4core_6carray_13BaseArrayIter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_arr = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_arr,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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_arr = ((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.BaseArrayIter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_8pyzoltan_4core_6carray_BaseArray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_13BaseArrayIter___init__(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArrayIter *)__pyx_v_self), __pyx_v_arr);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8pyzoltan_4core_6carray_13BaseArrayIter___init__(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArrayIter *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_arr) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pyzoltan/core/carray.pyx":258
 *     """ Iteration object to support iteration over BaseArray. """
 *     def __init__(self, BaseArray arr):
 *         self.arr = arr             # <<<<<<<<<<<<<<
 *         self.i = -1
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_arr));
  __Pyx_GOTREF(__pyx_v_self->arr);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->arr));
  __pyx_v_self->arr = __pyx_v_arr;

  /* "pyzoltan/core/carray.pyx":259
 *     def __init__(self, BaseArray arr):
 *         self.arr = arr
 *         self.i = -1             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __pyx_v_self->i = -1;

  /* "pyzoltan/core/carray.pyx":257
 * cdef class BaseArrayIter:
 *     """ Iteration object to support iteration over BaseArray. """
 *     def __init__(self, BaseArray arr):             # <<<<<<<<<<<<<<
 *         self.arr = arr
 *         self.i = -1
 */

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

/* "pyzoltan/core/carray.pyx":261
 *         self.i = -1
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         self.i = self.i+1
 *         if self.i < self.arr.length:
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_13BaseArrayIter_3__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_13BaseArrayIter_3__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_13BaseArrayIter_2__next__(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArrayIter *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_13BaseArrayIter_2__next__(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArrayIter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "pyzoltan/core/carray.pyx":262
 * 
 *     def __next__(self):
 *         self.i = self.i+1             # <<<<<<<<<<<<<<
 *         if self.i < self.arr.length:
 *             return self.arr[self.i]
 */
  __pyx_v_self->i = (__pyx_v_self->i + 1);

  /* "pyzoltan/core/carray.pyx":263
 *     def __next__(self):
 *         self.i = self.i+1
 *         if self.i < self.arr.length:             # <<<<<<<<<<<<<<
 *             return self.arr[self.i]
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->i < __pyx_v_self->arr->length) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":264
 *         self.i = self.i+1
 *         if self.i < self.arr.length:
 *             return self.arr[self.i]             # <<<<<<<<<<<<<<
 *         else:
 *             raise StopIteration
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->arr), __pyx_v_self->i, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "pyzoltan/core/carray.pyx":266
 *             return self.arr[self.i]
 *         else:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":261
 *         self.i = -1
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         self.i = self.i+1
 *         if self.i < self.arr.length:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyzoltan.core.carray.BaseArrayIter.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":268
 *             raise StopIteration
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_13BaseArrayIter_5__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_13BaseArrayIter_5__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_13BaseArrayIter_4__iter__(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArrayIter *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_13BaseArrayIter_4__iter__(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArrayIter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "pyzoltan/core/carray.pyx":269
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":268
 *             raise StopIteration
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "pyzoltan/core/carray.pyx":317
 *     #cdef np.ndarray _npy_array
 * 
 *     def __cinit__(self, long n=0):             # <<<<<<<<<<<<<<
 *         """Constructor for the class.
 *         """
 */

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_8IntArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8pyzoltan_4core_6carray_8IntArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,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);
        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 = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray___cinit__(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self), __pyx_v_n);

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

static int __pyx_pf_8pyzoltan_4core_6carray_8IntArray___cinit__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_n) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "pyzoltan/core/carray.pyx":320
 *         """Constructor for the class.
 *         """
 *         self.length = n             # <<<<<<<<<<<<<<
 *         self._parent = None
 *         self._old_data = NULL
 */
  __pyx_v_self->__pyx_base.length = __pyx_v_n;

  /* "pyzoltan/core/carray.pyx":321
 *         """
 *         self.length = n
 *         self._parent = None             # <<<<<<<<<<<<<<
 *         self._old_data = NULL
 *         if n == 0:
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_parent);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_parent));
  __pyx_v_self->_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)Py_None);

  /* "pyzoltan/core/carray.pyx":322
 *         self.length = n
 *         self._parent = None
 *         self._old_data = NULL             # <<<<<<<<<<<<<<
 *         if n == 0:
 *             n = 16
 */
  __pyx_v_self->_old_data = NULL;

  /* "pyzoltan/core/carray.pyx":323
 *         self._parent = None
 *         self._old_data = NULL
 *         if n == 0:             # <<<<<<<<<<<<<<
 *             n = 16
 *         self.alloc = n
 */
  __pyx_t_1 = ((__pyx_v_n == 0) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":324
 *         self._old_data = NULL
 *         if n == 0:
 *             n = 16             # <<<<<<<<<<<<<<
 *         self.alloc = n
 *         self.data = <int*>aligned_malloc(n*sizeof(int))
 */
    __pyx_v_n = 16;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":325
 *         if n == 0:
 *             n = 16
 *         self.alloc = n             # <<<<<<<<<<<<<<
 *         self.data = <int*>aligned_malloc(n*sizeof(int))
 * 
 */
  __pyx_v_self->__pyx_base.alloc = __pyx_v_n;

  /* "pyzoltan/core/carray.pyx":326
 *             n = 16
 *         self.alloc = n
 *         self.data = <int*>aligned_malloc(n*sizeof(int))             # <<<<<<<<<<<<<<
 * 
 *         self._setup_npy_array()
 */
  __pyx_v_self->data = ((int *)__pyx_f_8pyzoltan_4core_6carray_aligned_malloc((__pyx_v_n * (sizeof(int)))));

  /* "pyzoltan/core/carray.pyx":328
 *         self.data = <int*>aligned_malloc(n*sizeof(int))
 * 
 *         self._setup_npy_array()             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->_setup_npy_array(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyzoltan/core/carray.pyx":317
 *     #cdef np.ndarray _npy_array
 * 
 *     def __cinit__(self, long n=0):             # <<<<<<<<<<<<<<
 *         """Constructor for the class.
 *         """
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":330
 *         self._setup_npy_array()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         """Frees the array.
 *         """
 */

/* Python wrapper */
static void __pyx_pw_8pyzoltan_4core_6carray_8IntArray_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_8pyzoltan_4core_6carray_8IntArray_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_8pyzoltan_4core_6carray_8IntArray_2__dealloc__(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self));

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

static void __pyx_pf_8pyzoltan_4core_6carray_8IntArray_2__dealloc__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "pyzoltan/core/carray.pyx":333
 *         """Frees the array.
 *         """
 *         if self._old_data == NULL:             # <<<<<<<<<<<<<<
 *             aligned_free(<void*>self.data)
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->_old_data == NULL) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":334
 *         """
 *         if self._old_data == NULL:
 *             aligned_free(<void*>self.data)             # <<<<<<<<<<<<<<
 *         else:
 *             aligned_free(<void*>self._old_data)
 */
    __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_self->data));
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pyzoltan/core/carray.pyx":336
 *             aligned_free(<void*>self.data)
 *         else:
 *             aligned_free(<void*>self._old_data)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, long idx):
 */
    __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_self->_old_data));
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":330
 *         self._setup_npy_array()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         """Frees the array.
 *         """
 */

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

/* "pyzoltan/core/carray.pyx":338
 *             aligned_free(<void*>self._old_data)
 * 
 *     def __getitem__(self, long idx):             # <<<<<<<<<<<<<<
 *         """Get item at position idx.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_8IntArray_4__getitem__[] = "Get item at position idx.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_8pyzoltan_4core_6carray_8IntArray_4__getitem__;
#endif
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx) {
  long __pyx_v_idx;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  assert(__pyx_arg_idx); {
    __pyx_v_idx = __Pyx_PyInt_As_long(__pyx_arg_idx); if (unlikely((__pyx_v_idx == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_4__getitem__(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self), ((long)__pyx_v_idx));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_4__getitem__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_idx) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "pyzoltan/core/carray.pyx":341
 *         """Get item at position idx.
 *         """
 *         return self.data[idx]             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, long idx, int value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_self->data[__pyx_v_idx])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":338
 *             aligned_free(<void*>self._old_data)
 * 
 *     def __getitem__(self, long idx):             # <<<<<<<<<<<<<<
 *         """Get item at position idx.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":343
 *         return self.data[idx]
 * 
 *     def __setitem__(self, long idx, int value):             # <<<<<<<<<<<<<<
 *         """Set location idx to value.
 *         """
 */

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_8IntArray_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx, PyObject *__pyx_arg_value); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_8IntArray_6__setitem__[] = "Set location idx to value.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_8pyzoltan_4core_6carray_8IntArray_6__setitem__;
#endif
static int __pyx_pw_8pyzoltan_4core_6carray_8IntArray_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx, PyObject *__pyx_arg_value) {
  long __pyx_v_idx;
  int __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  assert(__pyx_arg_idx); {
    __pyx_v_idx = __Pyx_PyInt_As_long(__pyx_arg_idx); if (unlikely((__pyx_v_idx == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  assert(__pyx_arg_value); {
    __pyx_v_value = __Pyx_PyInt_As_int(__pyx_arg_value); if (unlikely((__pyx_v_value == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_6__setitem__(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self), ((long)__pyx_v_idx), ((int)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_8IntArray_6__setitem__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_idx, int __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "pyzoltan/core/carray.pyx":346
 *         """Set location idx to value.
 *         """
 *         self.data[idx] = value             # <<<<<<<<<<<<<<
 * 
 *     cpdef long index(self, int value):
 */
  (__pyx_v_self->data[__pyx_v_idx]) = __pyx_v_value;

  /* "pyzoltan/core/carray.pyx":343
 *         return self.data[idx]
 * 
 *     def __setitem__(self, long idx, int value):             # <<<<<<<<<<<<<<
 *         """Set location idx to value.
 *         """
 */

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

/* "pyzoltan/core/carray.pyx":348
 *         self.data[idx] = value
 * 
 *     cpdef long index(self, int value):             # <<<<<<<<<<<<<<
 *         """Returns the index at which value is in self, else -1.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_9index(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static long __pyx_f_8pyzoltan_4core_6carray_8IntArray_index(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int __pyx_v_value, int __pyx_skip_dispatch) {
  long __pyx_v_i;
  long __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 = NULL;
  PyObject *__pyx_t_6 = NULL;
  long __pyx_t_7;
  long __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("index", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_9index)) {
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __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;
      __pyx_t_7 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_7;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":352
 *         """
 *         cdef long i
 *         for i in range(self.length):             # <<<<<<<<<<<<<<
 *             if self.data[i] == value:
 *                 return i
 */
  __pyx_t_7 = __pyx_v_self->__pyx_base.length;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pyzoltan/core/carray.pyx":353
 *         cdef long i
 *         for i in range(self.length):
 *             if self.data[i] == value:             # <<<<<<<<<<<<<<
 *                 return i
 *         return -1
 */
    __pyx_t_9 = (((__pyx_v_self->data[__pyx_v_i]) == __pyx_v_value) != 0);
    if (__pyx_t_9) {

      /* "pyzoltan/core/carray.pyx":354
 *         for i in range(self.length):
 *             if self.data[i] == value:
 *                 return i             # <<<<<<<<<<<<<<
 *         return -1
 * 
 */
      __pyx_r = __pyx_v_i;
      goto __pyx_L0;
    }
  }

  /* "pyzoltan/core/carray.pyx":355
 *             if self.data[i] == value:
 *                 return i
 *         return -1             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, int value):
 */
  __pyx_r = -1;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":348
 *         self.data[idx] = value
 * 
 *     cpdef long index(self, int value):             # <<<<<<<<<<<<<<
 *         """Returns the index at which value is in self, else -1.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("pyzoltan.core.carray.IntArray.index", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_9index(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_8IntArray_8index[] = "IntArray.index(self, int value) -> long\nReturns the index at which value is in self, else -1.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_9index(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  int __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("index (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __Pyx_PyInt_As_int(__pyx_arg_value); if (unlikely((__pyx_v_value == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_8index(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self), ((int)__pyx_v_value));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_8index(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int __pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("index", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_f_8pyzoltan_4core_6carray_8IntArray_index(__pyx_v_self, __pyx_v_value, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.IntArray.index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":357
 *         return -1
 * 
 *     def __contains__(self, int value):             # <<<<<<<<<<<<<<
 *         """Returns True if value is in self.
 *         """
 */

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_8IntArray_11__contains__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_8IntArray_10__contains__[] = "Returns True if value is in self.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_8pyzoltan_4core_6carray_8IntArray_10__contains__;
#endif
static int __pyx_pw_8pyzoltan_4core_6carray_8IntArray_11__contains__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  int __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __Pyx_PyInt_As_int(__pyx_arg_value); if (unlikely((__pyx_v_value == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_10__contains__(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self), ((int)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_8IntArray_10__contains__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "pyzoltan/core/carray.pyx":360
 *         """Returns True if value is in self.
 *         """
 *         return (self.index(value) >= 0)             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */
  __pyx_r = (((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->index(__pyx_v_self, __pyx_v_value, 0) >= 0);
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":357
 *         return -1
 * 
 *     def __contains__(self, int value):             # <<<<<<<<<<<<<<
 *         """Returns True if value is in self.
 *         """
 */

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

/* "pyzoltan/core/carray.pyx":362
 *         return (self.index(value) >= 0)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         """Implemented to facilitate pickling.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_13__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_8IntArray_12__reduce__[] = "IntArray.__reduce__(self)\nImplemented to facilitate pickling.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_13__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_12__reduce__(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_12__reduce__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self) {
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce__", 0);

  /* "pyzoltan/core/carray.pyx":365
 *         """Implemented to facilitate pickling.
 *         """
 *         d = {}             # <<<<<<<<<<<<<<
 *         d['data'] = self.get_npy_array()
 * 
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_d = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":366
 *         """
 *         d = {}
 *         d['data'] = self.get_npy_array()             # <<<<<<<<<<<<<<
 * 
 *         return (IntArray, (), d)
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_npy_array(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyDict_SetItem(__pyx_v_d, __pyx_n_s_data, __pyx_t_1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":368
 *         d['data'] = self.get_npy_array()
 * 
 *         return (IntArray, (), d)             # <<<<<<<<<<<<<<
 * 
 *     def __setstate__(self, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_8pyzoltan_4core_6carray_IntArray)));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_8pyzoltan_4core_6carray_IntArray)));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_8pyzoltan_4core_6carray_IntArray)));
  __Pyx_INCREF(__pyx_empty_tuple);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_empty_tuple);
  __Pyx_GIVEREF(__pyx_empty_tuple);
  __Pyx_INCREF(__pyx_v_d);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_d);
  __Pyx_GIVEREF(__pyx_v_d);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":362
 *         return (self.index(value) >= 0)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         """Implemented to facilitate pickling.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":370
 *         return (IntArray, (), d)
 * 
 *     def __setstate__(self, d):             # <<<<<<<<<<<<<<
 *         """Load the carray from the dictionary d.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_15__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_d); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_8IntArray_14__setstate__[] = "IntArray.__setstate__(self, d)\nLoad the carray from the dictionary d.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_15__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_14__setstate__(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self), ((PyObject *)__pyx_v_d));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_14__setstate__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, PyObject *__pyx_v_d) {
  PyArrayObject *__pyx_v_arr = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  long __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate__", 0);

  /* "pyzoltan/core/carray.pyx":373
 *         """Load the carray from the dictionary d.
 *         """
 *         cdef np.ndarray arr = d['data']             # <<<<<<<<<<<<<<
 *         self.resize(arr.size)
 *         self.set_data(arr)
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_s_data); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_arr = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":374
 *         """
 *         cdef np.ndarray arr = d['data']
 *         self.resize(arr.size)             # <<<<<<<<<<<<<<
 *         self.set_data(arr)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_arr), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.resize(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":375
 *         cdef np.ndarray arr = d['data']
 *         self.resize(arr.size)
 *         self.set_data(arr)             # <<<<<<<<<<<<<<
 * 
 *     cdef _setup_npy_array(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_data(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_arr, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":370
 *         return (IntArray, (), d)
 * 
 *     def __setstate__(self, d):             # <<<<<<<<<<<<<<
 *         """Load the carray from the dictionary d.
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_arr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":377
 *         self.set_data(arr)
 * 
 *     cdef _setup_npy_array(self):             # <<<<<<<<<<<<<<
 *         """Create the numpy array.
 *         """
 */

static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray__setup_npy_array(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self) {
  int __pyx_v_nd;
  npy_intp __pyx_v_dims;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setup_npy_array", 0);

  /* "pyzoltan/core/carray.pyx":380
 *         """Create the numpy array.
 *         """
 *         cdef int nd = 1             # <<<<<<<<<<<<<<
 *         cdef np.npy_intp dims = self.length
 * 
 */
  __pyx_v_nd = 1;

  /* "pyzoltan/core/carray.pyx":381
 *         """
 *         cdef int nd = 1
 *         cdef np.npy_intp dims = self.length             # <<<<<<<<<<<<<<
 * 
 *         self._npy_array = PyArray_SimpleNewFromData(
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  __pyx_v_dims = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":383
 *         cdef np.npy_intp dims = self.length
 * 
 *         self._npy_array = PyArray_SimpleNewFromData(             # <<<<<<<<<<<<<<
 *             nd, &dims, NPY_INT, self.data
 *         )
 */
  __pyx_t_2 = ((PyObject *)PyArray_SimpleNewFromData(__pyx_v_nd, (&__pyx_v_dims), NPY_INT, __pyx_v_self->data)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base._npy_array);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base._npy_array));
  __pyx_v_self->__pyx_base._npy_array = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyzoltan/core/carray.pyx":377
 *         self.set_data(arr)
 * 
 *     cdef _setup_npy_array(self):             # <<<<<<<<<<<<<<
 *         """Create the numpy array.
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray._setup_npy_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":388
 * 
 * 
 *     cdef void c_align_array(self, LongArray new_indices) nogil:             # <<<<<<<<<<<<<<
 *         """Rearrange the array contents according to the new indices.
 *         """
 */

static void __pyx_f_8pyzoltan_4core_6carray_8IntArray_c_align_array(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_new_indices) {
  long __pyx_v_i;
  long __pyx_v_length;
  long __pyx_v_n_bytes;
  int *__pyx_v_temp;
  long __pyx_t_1;
  long __pyx_t_2;
  int __pyx_t_3;

  /* "pyzoltan/core/carray.pyx":393
 * 
 *         cdef long i
 *         cdef long length = self.length             # <<<<<<<<<<<<<<
 *         cdef long n_bytes
 *         cdef int *temp
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  __pyx_v_length = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":397
 *         cdef int *temp
 * 
 *         n_bytes = sizeof(int)*length             # <<<<<<<<<<<<<<
 *         temp = <int*>aligned_malloc(n_bytes)
 * 
 */
  __pyx_v_n_bytes = ((sizeof(int)) * __pyx_v_length);

  /* "pyzoltan/core/carray.pyx":398
 * 
 *         n_bytes = sizeof(int)*length
 *         temp = <int*>aligned_malloc(n_bytes)             # <<<<<<<<<<<<<<
 * 
 *         memcpy(<void*>temp, <void*>self.data, n_bytes)
 */
  __pyx_v_temp = ((int *)__pyx_f_8pyzoltan_4core_6carray_aligned_malloc(__pyx_v_n_bytes));

  /* "pyzoltan/core/carray.pyx":400
 *         temp = <int*>aligned_malloc(n_bytes)
 * 
 *         memcpy(<void*>temp, <void*>self.data, n_bytes)             # <<<<<<<<<<<<<<
 * 
 *         # copy the data from the resized portion to the actual positions.
 */
  memcpy(((void *)__pyx_v_temp), ((void *)__pyx_v_self->data), __pyx_v_n_bytes);

  /* "pyzoltan/core/carray.pyx":403
 * 
 *         # copy the data from the resized portion to the actual positions.
 *         for i in range(length):             # <<<<<<<<<<<<<<
 *             if i != new_indices.data[i]:
 *                 self.data[i] = temp[new_indices.data[i]]
 */
  __pyx_t_1 = __pyx_v_length;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "pyzoltan/core/carray.pyx":404
 *         # copy the data from the resized portion to the actual positions.
 *         for i in range(length):
 *             if i != new_indices.data[i]:             # <<<<<<<<<<<<<<
 *                 self.data[i] = temp[new_indices.data[i]]
 * 
 */
    __pyx_t_3 = ((__pyx_v_i != (__pyx_v_new_indices->data[__pyx_v_i])) != 0);
    if (__pyx_t_3) {

      /* "pyzoltan/core/carray.pyx":405
 *         for i in range(length):
 *             if i != new_indices.data[i]:
 *                 self.data[i] = temp[new_indices.data[i]]             # <<<<<<<<<<<<<<
 * 
 *         aligned_free(<void*>temp)
 */
      (__pyx_v_self->data[__pyx_v_i]) = (__pyx_v_temp[(__pyx_v_new_indices->data[__pyx_v_i])]);
      goto __pyx_L5;
    }
    __pyx_L5:;
  }

  /* "pyzoltan/core/carray.pyx":407
 *                 self.data[i] = temp[new_indices.data[i]]
 * 
 *         aligned_free(<void*>temp)             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_append(self, int value) nogil:
 */
  __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_temp));

  /* "pyzoltan/core/carray.pyx":388
 * 
 * 
 *     cdef void c_align_array(self, LongArray new_indices) nogil:             # <<<<<<<<<<<<<<
 *         """Rearrange the array contents according to the new indices.
 *         """
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":409
 *         aligned_free(<void*>temp)
 * 
 *     cdef void c_append(self, int value) nogil:             # <<<<<<<<<<<<<<
 *         cdef long l = self.length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 */

static void __pyx_f_8pyzoltan_4core_6carray_8IntArray_c_append(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int __pyx_v_value) {
  long __pyx_v_l;
  PyArrayObject *__pyx_v_arr;
  long __pyx_t_1;
  int __pyx_t_2;

  /* "pyzoltan/core/carray.pyx":410
 * 
 *     cdef void c_append(self, int value) nogil:
 *         cdef long l = self.length             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  __pyx_v_l = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":411
 *     cdef void c_append(self, int value) nogil:
 *         cdef long l = self.length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 * 
 *         if l >= self.alloc:
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":413
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 *         if l >= self.alloc:             # <<<<<<<<<<<<<<
 *             self.c_reserve(l*2)
 *         self.data[l] = value
 */
  __pyx_t_2 = ((__pyx_v_l >= __pyx_v_self->__pyx_base.alloc) != 0);
  if (__pyx_t_2) {

    /* "pyzoltan/core/carray.pyx":414
 * 
 *         if l >= self.alloc:
 *             self.c_reserve(l*2)             # <<<<<<<<<<<<<<
 *         self.data[l] = value
 *         self.length += 1
 */
    ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), (__pyx_v_l * 2));
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":415
 *         if l >= self.alloc:
 *             self.c_reserve(l*2)
 *         self.data[l] = value             # <<<<<<<<<<<<<<
 *         self.length += 1
 * 
 */
  (__pyx_v_self->data[__pyx_v_l]) = __pyx_v_value;

  /* "pyzoltan/core/carray.pyx":416
 *             self.c_reserve(l*2)
 *         self.data[l] = value
 *         self.length += 1             # <<<<<<<<<<<<<<
 * 
 *         # update the numpy arrays length
 */
  __pyx_v_self->__pyx_base.length = (__pyx_v_self->__pyx_base.length + 1);

  /* "pyzoltan/core/carray.pyx":419
 * 
 *         # update the numpy arrays length
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_reserve(self, long size) nogil:
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":409
 *         aligned_free(<void*>temp)
 * 
 *     cdef void c_append(self, int value) nogil:             # <<<<<<<<<<<<<<
 *         cdef long l = self.length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":421
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_reserve(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 */

static void __pyx_f_8pyzoltan_4core_6carray_8IntArray_c_reserve(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_size) {
  PyArrayObject *__pyx_v_arr;
  void *__pyx_v_data;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("c_reserve", 0);
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  /*try:*/ {

    /* "pyzoltan/core/carray.pyx":422
 * 
 *     cdef void c_reserve(self, long size) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         cdef void* data = NULL
 *         if size > self.alloc:
 */
    __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

    /* "pyzoltan/core/carray.pyx":423
 *     cdef void c_reserve(self, long size) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL             # <<<<<<<<<<<<<<
 *         if size > self.alloc:
 *             data = <int*>aligned_realloc(
 */
    __pyx_v_data = NULL;

    /* "pyzoltan/core/carray.pyx":424
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 *         if size > self.alloc:             # <<<<<<<<<<<<<<
 *             data = <int*>aligned_realloc(
 *                 self.data, size*sizeof(int),
 */
    __pyx_t_1 = ((__pyx_v_size > __pyx_v_self->__pyx_base.alloc) != 0);
    if (__pyx_t_1) {

      /* "pyzoltan/core/carray.pyx":425
 *         cdef void* data = NULL
 *         if size > self.alloc:
 *             data = <int*>aligned_realloc(             # <<<<<<<<<<<<<<
 *                 self.data, size*sizeof(int),
 *                 self.alloc*sizeof(int)
 */
      __pyx_v_data = ((int *)__pyx_f_8pyzoltan_4core_6carray_aligned_realloc(__pyx_v_self->data, (__pyx_v_size * (sizeof(int))), (__pyx_v_self->__pyx_base.alloc * (sizeof(int)))));

      /* "pyzoltan/core/carray.pyx":430
 *             )
 * 
 *             if data == NULL:             # <<<<<<<<<<<<<<
 *                 aligned_free(<void*>self.data)
 *                 with gil:
 */
      __pyx_t_1 = ((__pyx_v_data == NULL) != 0);
      if (__pyx_t_1) {

        /* "pyzoltan/core/carray.pyx":431
 * 
 *             if data == NULL:
 *                 aligned_free(<void*>self.data)             # <<<<<<<<<<<<<<
 *                 with gil:
 *                     raise MemoryError
 */
        __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_self->data));

        /* "pyzoltan/core/carray.pyx":432
 *             if data == NULL:
 *                 aligned_free(<void*>self.data)
 *                 with gil:             # <<<<<<<<<<<<<<
 *                     raise MemoryError
 * 
 */
        {
            #ifdef WITH_THREAD
            PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
            #endif
            /*try:*/ {

              /* "pyzoltan/core/carray.pyx":433
 *                 aligned_free(<void*>self.data)
 *                 with gil:
 *                     raise MemoryError             # <<<<<<<<<<<<<<
 * 
 *             self.data = <int*>data
 */
              PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
            }

            /* "pyzoltan/core/carray.pyx":432
 *             if data == NULL:
 *                 aligned_free(<void*>self.data)
 *                 with gil:             # <<<<<<<<<<<<<<
 *                     raise MemoryError
 * 
 */
            /*finally:*/ {
              __pyx_L9_error: {
                #ifdef WITH_THREAD
                PyGILState_Release(__pyx_gilstate_save);
                #endif
                goto __pyx_L4_error;
              }
            }
        }
      }

      /* "pyzoltan/core/carray.pyx":435
 *                     raise MemoryError
 * 
 *             self.data = <int*>data             # <<<<<<<<<<<<<<
 *             self.alloc = size
 *             arr.data = <char *>self.data
 */
      __pyx_v_self->data = ((int *)__pyx_v_data);

      /* "pyzoltan/core/carray.pyx":436
 * 
 *             self.data = <int*>data
 *             self.alloc = size             # <<<<<<<<<<<<<<
 *             arr.data = <char *>self.data
 * 
 */
      __pyx_v_self->__pyx_base.alloc = __pyx_v_size;

      /* "pyzoltan/core/carray.pyx":437
 *             self.data = <int*>data
 *             self.alloc = size
 *             arr.data = <char *>self.data             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_reset(self) nogil:
 */
      __pyx_v_arr->data = ((char *)__pyx_v_self->data);
      goto __pyx_L6;
    }
    __pyx_L6:;
  }

  /* "pyzoltan/core/carray.pyx":422
 * 
 *     cdef void c_reserve(self, long size) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         cdef void* data = NULL
 *         if size > self.alloc:
 */
  /*finally:*/ {
    /*normal exit:*/{
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L5;
    }
    __pyx_L4_error: {
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "pyzoltan/core/carray.pyx":421
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_reserve(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pyzoltan.core.carray.IntArray.c_reserve", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "pyzoltan/core/carray.pyx":439
 *             arr.data = <char *>self.data
 * 
 *     cdef void c_reset(self) nogil:             # <<<<<<<<<<<<<<
 *         BaseArray.c_reset(self)
 *         if self._old_data != NULL:
 */

static void __pyx_f_8pyzoltan_4core_6carray_8IntArray_c_reset(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self) {
  int __pyx_t_1;
  int *__pyx_t_2;

  /* "pyzoltan/core/carray.pyx":440
 * 
 *     cdef void c_reset(self) nogil:
 *         BaseArray.c_reset(self)             # <<<<<<<<<<<<<<
 *         if self._old_data != NULL:
 *             self.data = self._old_data
 */
  __pyx_f_8pyzoltan_4core_6carray_9BaseArray_c_reset(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

  /* "pyzoltan/core/carray.pyx":441
 *     cdef void c_reset(self) nogil:
 *         BaseArray.c_reset(self)
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             self.data = self._old_data
 *             self._old_data = NULL
 */
  __pyx_t_1 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":442
 *         BaseArray.c_reset(self)
 *         if self._old_data != NULL:
 *             self.data = self._old_data             # <<<<<<<<<<<<<<
 *             self._old_data = NULL
 *             self._npy_array.data = <char *>self.data
 */
    __pyx_t_2 = __pyx_v_self->_old_data;
    __pyx_v_self->data = __pyx_t_2;

    /* "pyzoltan/core/carray.pyx":443
 *         if self._old_data != NULL:
 *             self.data = self._old_data
 *             self._old_data = NULL             # <<<<<<<<<<<<<<
 *             self._npy_array.data = <char *>self.data
 * 
 */
    __pyx_v_self->_old_data = NULL;

    /* "pyzoltan/core/carray.pyx":444
 *             self.data = self._old_data
 *             self._old_data = NULL
 *             self._npy_array.data = <char *>self.data             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_resize(self, long size) nogil:
 */
    __pyx_v_self->__pyx_base._npy_array->data = ((char *)__pyx_v_self->data);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":439
 *             arr.data = <char *>self.data
 * 
 *     cdef void c_reset(self) nogil:             # <<<<<<<<<<<<<<
 *         BaseArray.c_reset(self)
 *         if self._old_data != NULL:
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":446
 *             self._npy_array.data = <char *>self.data
 * 
 *     cdef void c_resize(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 */

static void __pyx_f_8pyzoltan_4core_6carray_8IntArray_c_resize(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_size) {
  PyArrayObject *__pyx_v_arr;
  long __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":447
 * 
 *     cdef void c_resize(self, long size) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 * 
 *         # reserve memory
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":450
 * 
 *         # reserve memory
 *         self.c_reserve(size)             # <<<<<<<<<<<<<<
 * 
 *         # update the lengths
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_size);

  /* "pyzoltan/core/carray.pyx":453
 * 
 *         # update the lengths
 *         self.length = size             # <<<<<<<<<<<<<<
 *         arr.dimensions[0] = self.length
 * 
 */
  __pyx_v_self->__pyx_base.length = __pyx_v_size;

  /* "pyzoltan/core/carray.pyx":454
 *         # update the lengths
 *         self.length = size
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_set_view(self, int *array, long length) nogil:
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":446
 *             self._npy_array.data = <char *>self.data
 * 
 *     cdef void c_resize(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":456
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_set_view(self, int *array, long length) nogil:             # <<<<<<<<<<<<<<
 *         """Create a view of a given raw data pointer with given length.
 *         """
 */

static void __pyx_f_8pyzoltan_4core_6carray_8IntArray_c_set_view(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int *__pyx_v_array, long __pyx_v_length) {
  PyArrayObject *__pyx_v_arr;
  int __pyx_t_1;
  int *__pyx_t_2;
  long __pyx_t_3;

  /* "pyzoltan/core/carray.pyx":459
 *         """Create a view of a given raw data pointer with given length.
 *         """
 *         if self._old_data == NULL:             # <<<<<<<<<<<<<<
 *             self._old_data = self.data
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->_old_data == NULL) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":460
 *         """
 *         if self._old_data == NULL:
 *             self._old_data = self.data             # <<<<<<<<<<<<<<
 * 
 *         self.data = array
 */
    __pyx_t_2 = __pyx_v_self->data;
    __pyx_v_self->_old_data = __pyx_t_2;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":462
 *             self._old_data = self.data
 * 
 *         self.data = array             # <<<<<<<<<<<<<<
 *         self.length = length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 */
  __pyx_v_self->data = __pyx_v_array;

  /* "pyzoltan/core/carray.pyx":463
 * 
 *         self.data = array
 *         self.length = length             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data
 */
  __pyx_v_self->__pyx_base.length = __pyx_v_length;

  /* "pyzoltan/core/carray.pyx":464
 *         self.data = array
 *         self.length = length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         arr.data = <char *>self.data
 *         arr.dimensions[0] = self.length
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":465
 *         self.length = length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data             # <<<<<<<<<<<<<<
 *         arr.dimensions[0] = self.length
 * 
 */
  __pyx_v_arr->data = ((char *)__pyx_v_self->data);

  /* "pyzoltan/core/carray.pyx":466
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_squeeze(self) nogil:
 */
  __pyx_t_3 = __pyx_v_self->__pyx_base.length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_3;

  /* "pyzoltan/core/carray.pyx":456
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_set_view(self, int *array, long length) nogil:             # <<<<<<<<<<<<<<
 *         """Create a view of a given raw data pointer with given length.
 *         """
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":468
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_squeeze(self) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 */

static void __pyx_f_8pyzoltan_4core_6carray_8IntArray_c_squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self) {
  PyArrayObject *__pyx_v_arr;
  void *__pyx_v_data;
  size_t __pyx_v_size;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  long __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("c_squeeze", 0);
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  /*try:*/ {

    /* "pyzoltan/core/carray.pyx":469
 * 
 *     cdef void c_squeeze(self) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         cdef void* data = NULL
 *         cdef size_t size = max(self.length, 16)
 */
    __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

    /* "pyzoltan/core/carray.pyx":470
 *     cdef void c_squeeze(self) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL             # <<<<<<<<<<<<<<
 *         cdef size_t size = max(self.length, 16)
 *         data = <int*>aligned_realloc(
 */
    __pyx_v_data = NULL;

    /* "pyzoltan/core/carray.pyx":471
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 *         cdef size_t size = max(self.length, 16)             # <<<<<<<<<<<<<<
 *         data = <int*>aligned_realloc(
 *             self.data, size*sizeof(int),
 */
    __pyx_t_1 = 16;
    __pyx_t_2 = __pyx_v_self->__pyx_base.length;
    if (((__pyx_t_1 > __pyx_t_2) != 0)) {
      __pyx_t_3 = __pyx_t_1;
    } else {
      __pyx_t_3 = __pyx_t_2;
    }
    __pyx_v_size = __pyx_t_3;

    /* "pyzoltan/core/carray.pyx":472
 *         cdef void* data = NULL
 *         cdef size_t size = max(self.length, 16)
 *         data = <int*>aligned_realloc(             # <<<<<<<<<<<<<<
 *             self.data, size*sizeof(int),
 *             self.alloc*sizeof(int)
 */
    __pyx_v_data = ((int *)__pyx_f_8pyzoltan_4core_6carray_aligned_realloc(__pyx_v_self->data, (__pyx_v_size * (sizeof(int))), (__pyx_v_self->__pyx_base.alloc * (sizeof(int)))));

    /* "pyzoltan/core/carray.pyx":477
 *         )
 * 
 *         if data == NULL:             # <<<<<<<<<<<<<<
 *             # free original data
 *             aligned_free(<void*>self.data)
 */
    __pyx_t_4 = ((__pyx_v_data == NULL) != 0);
    if (__pyx_t_4) {

      /* "pyzoltan/core/carray.pyx":479
 *         if data == NULL:
 *             # free original data
 *             aligned_free(<void*>self.data)             # <<<<<<<<<<<<<<
 *             with gil:
 *                 raise MemoryError
 */
      __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_self->data));

      /* "pyzoltan/core/carray.pyx":480
 *             # free original data
 *             aligned_free(<void*>self.data)
 *             with gil:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 * 
 */
      {
          #ifdef WITH_THREAD
          PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
          #endif
          /*try:*/ {

            /* "pyzoltan/core/carray.pyx":481
 *             aligned_free(<void*>self.data)
 *             with gil:
 *                 raise MemoryError             # <<<<<<<<<<<<<<
 * 
 *         self.data = <int*>data
 */
            PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          }

          /* "pyzoltan/core/carray.pyx":480
 *             # free original data
 *             aligned_free(<void*>self.data)
 *             with gil:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 * 
 */
          /*finally:*/ {
            __pyx_L8_error: {
              #ifdef WITH_THREAD
              PyGILState_Release(__pyx_gilstate_save);
              #endif
              goto __pyx_L4_error;
            }
          }
      }
    }

    /* "pyzoltan/core/carray.pyx":483
 *                 raise MemoryError
 * 
 *         self.data = <int*>data             # <<<<<<<<<<<<<<
 *         self.alloc = size
 *         arr.data = <char *>self.data
 */
    __pyx_v_self->data = ((int *)__pyx_v_data);

    /* "pyzoltan/core/carray.pyx":484
 * 
 *         self.data = <int*>data
 *         self.alloc = size             # <<<<<<<<<<<<<<
 *         arr.data = <char *>self.data
 * 
 */
    __pyx_v_self->__pyx_base.alloc = __pyx_v_size;

    /* "pyzoltan/core/carray.pyx":485
 *         self.data = <int*>data
 *         self.alloc = size
 *         arr.data = <char *>self.data             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_arr->data = ((char *)__pyx_v_self->data);
  }

  /* "pyzoltan/core/carray.pyx":469
 * 
 *     cdef void c_squeeze(self) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         cdef void* data = NULL
 *         cdef size_t size = max(self.length, 16)
 */
  /*finally:*/ {
    /*normal exit:*/{
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L5;
    }
    __pyx_L4_error: {
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "pyzoltan/core/carray.pyx":468
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_squeeze(self) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pyzoltan.core.carray.IntArray.c_squeeze", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "pyzoltan/core/carray.pyx":488
 * 
 * 
 *     cpdef str get_c_type(self):             # <<<<<<<<<<<<<<
 *         """Return the c data type for this array as a string.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_17get_c_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_get_c_type(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int __pyx_skip_dispatch) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_c_type", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_c_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_17get_c_type)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":491
 *         """Return the c data type for this array as a string.
 *         """
 *         return 'int'             # <<<<<<<<<<<<<<
 * 
 *     cdef int* get_data_ptr(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_n_s_int);
  __pyx_r = __pyx_n_s_int;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":488
 * 
 * 
 *     cpdef str get_c_type(self):             # <<<<<<<<<<<<<<
 *         """Return the c data type for this array as a string.
 *         """
 */

  /* 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("pyzoltan.core.carray.IntArray.get_c_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_17get_c_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_8IntArray_16get_c_type[] = "IntArray.get_c_type(self) -> str\nReturn the c data type for this array as a string.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_17get_c_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_c_type (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_16get_c_type(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_16get_c_type(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_c_type", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_8IntArray_get_c_type(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.IntArray.get_c_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":493
 *         return 'int'
 * 
 *     cdef int* get_data_ptr(self):             # <<<<<<<<<<<<<<
 *         """Return the internal data pointer.
 *         """
 */

static int *__pyx_f_8pyzoltan_4core_6carray_8IntArray_get_data_ptr(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self) {
  int *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_data_ptr", 0);

  /* "pyzoltan/core/carray.pyx":496
 *         """Return the internal data pointer.
 *         """
 *         return self.data             # <<<<<<<<<<<<<<
 * 
 *     cpdef int get(self, long idx):
 */
  __pyx_r = __pyx_v_self->data;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":493
 *         return 'int'
 * 
 *     cdef int* get_data_ptr(self):             # <<<<<<<<<<<<<<
 *         """Return the internal data pointer.
 *         """
 */

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

/* "pyzoltan/core/carray.pyx":498
 *         return self.data
 * 
 *     cpdef int get(self, long idx):             # <<<<<<<<<<<<<<
 *         """Gets value stored at position `idx`.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_19get(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx); /*proto*/
static int __pyx_f_8pyzoltan_4core_6carray_8IntArray_get(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_idx, int __pyx_skip_dispatch) {
  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 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_19get)) {
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_idx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __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;
      __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_7;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":501
 *         """Gets value stored at position `idx`.
 *         """
 *         return self.data[idx]             # <<<<<<<<<<<<<<
 * 
 *     cpdef set(self, long idx, int value):
 */
  __pyx_r = (__pyx_v_self->data[__pyx_v_idx]);
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":498
 *         return self.data
 * 
 *     cpdef int get(self, long idx):             # <<<<<<<<<<<<<<
 *         """Gets value stored at position `idx`.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("pyzoltan.core.carray.IntArray.get", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_19get(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_8IntArray_18get[] = "IntArray.get(self, long idx) -> int\nGets value stored at position `idx`.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_19get(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx) {
  long __pyx_v_idx;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  assert(__pyx_arg_idx); {
    __pyx_v_idx = __Pyx_PyInt_As_long(__pyx_arg_idx); if (unlikely((__pyx_v_idx == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_18get(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self), ((long)__pyx_v_idx));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_18get(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_idx) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_8pyzoltan_4core_6carray_8IntArray_get(__pyx_v_self, __pyx_v_idx, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.IntArray.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":503
 *         return self.data[idx]
 * 
 *     cpdef set(self, long idx, int value):             # <<<<<<<<<<<<<<
 *         """Sets location `idx` to `value`.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_21set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_set(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_idx, int __pyx_v_value, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_21set)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_idx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      }
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":506
 *         """Sets location `idx` to `value`.
 *         """
 *         self.data[idx] = value             # <<<<<<<<<<<<<<
 * 
 *     cpdef append(self, int value):
 */
  (__pyx_v_self->data[__pyx_v_idx]) = __pyx_v_value;

  /* "pyzoltan/core/carray.pyx":503
 *         return self.data[idx]
 * 
 *     cpdef set(self, long idx, int value):             # <<<<<<<<<<<<<<
 *         """Sets location `idx` to `value`.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_21set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_8IntArray_20set[] = "IntArray.set(self, long idx, int value)\nSets location `idx` to `value`.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_21set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_idx;
  int __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idx,&__pyx_n_s_value,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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_idx)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __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_idx = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_idx == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_value = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_value == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_20set(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self), __pyx_v_idx, __pyx_v_value);

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_20set(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_idx, int __pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_8IntArray_set(__pyx_v_self, __pyx_v_idx, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.IntArray.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":508
 *         self.data[idx] = value
 * 
 *     cpdef append(self, int value):             # <<<<<<<<<<<<<<
 *         """Appends `value` to the end of the array.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_23append(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_append(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int __pyx_v_value, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_append); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_23append)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __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;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":511
 *         """Appends `value` to the end of the array.
 *         """
 *         self.c_append(value)             # <<<<<<<<<<<<<<
 * 
 *     cpdef reserve(self, long size):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->c_append(__pyx_v_self, __pyx_v_value);

  /* "pyzoltan/core/carray.pyx":508
 *         self.data[idx] = value
 * 
 *     cpdef append(self, int value):             # <<<<<<<<<<<<<<
 *         """Appends `value` to the end of the array.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_23append(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_8IntArray_22append[] = "IntArray.append(self, int value)\nAppends `value` to the end of the array.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_23append(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  int __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __Pyx_PyInt_As_int(__pyx_arg_value); if (unlikely((__pyx_v_value == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_22append(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self), ((int)__pyx_v_value));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_22append(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int __pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_8IntArray_append(__pyx_v_self, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.IntArray.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":513
 *         self.c_append(value)
 * 
 *     cpdef reserve(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes the internal data to ``size*sizeof(int)`` bytes.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_25reserve(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_reserve(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_size, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reserve", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reserve); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_25reserve)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __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;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":516
 *         """Resizes the internal data to ``size*sizeof(int)`` bytes.
 *         """
 *         self.c_reserve(size)             # <<<<<<<<<<<<<<
 * 
 *     cpdef reset(self):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_size);

  /* "pyzoltan/core/carray.pyx":513
 *         self.c_append(value)
 * 
 *     cpdef reserve(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes the internal data to ``size*sizeof(int)`` bytes.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_25reserve(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_8IntArray_24reserve[] = "IntArray.reserve(self, long size)\nResizes the internal data to ``size*sizeof(int)`` bytes.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_25reserve(PyObject *__pyx_v_self, PyObject *__pyx_arg_size) {
  long __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reserve (wrapper)", 0);
  assert(__pyx_arg_size); {
    __pyx_v_size = __Pyx_PyInt_As_long(__pyx_arg_size); if (unlikely((__pyx_v_size == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_24reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self), ((long)__pyx_v_size));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_24reserve(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reserve", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_8IntArray_reserve(__pyx_v_self, __pyx_v_size, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.IntArray.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":518
 *         self.c_reserve(size)
 * 
 *     cpdef reset(self):             # <<<<<<<<<<<<<<
 *         """Reset the length of the array to 0.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_27reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_reset(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int __pyx_skip_dispatch) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reset", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_27reset)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":521
 *         """Reset the length of the array to 0.
 *         """
 *         self.c_reset()             # <<<<<<<<<<<<<<
 *         if self._old_data != NULL:
 *             self._parent = None
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_reset(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

  /* "pyzoltan/core/carray.pyx":522
 *         """
 *         self.c_reset()
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             self._parent = None
 * 
 */
  __pyx_t_5 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_5) {

    /* "pyzoltan/core/carray.pyx":523
 *         self.c_reset()
 *         if self._old_data != NULL:
 *             self._parent = None             # <<<<<<<<<<<<<<
 * 
 *     cpdef resize(self, long size):
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_parent);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_parent));
    __pyx_v_self->_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)Py_None);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":518
 *         self.c_reserve(size)
 * 
 *     cpdef reset(self):             # <<<<<<<<<<<<<<
 *         """Reset the length of the array to 0.
 *         """
 */

  /* 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("pyzoltan.core.carray.IntArray.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_27reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_8IntArray_26reset[] = "IntArray.reset(self)\nReset the length of the array to 0.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_27reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_26reset(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_26reset(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reset", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_8IntArray_reset(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.IntArray.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":525
 *             self._parent = None
 * 
 *     cpdef resize(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes internal data to ``size*sizeof(int)`` bytes
 *         and sets the length to the new size.
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_29resize(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_resize(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_size, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resize", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_resize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_29resize)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __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;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":530
 * 
 *         """
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             raise RuntimeError('Cannot reize array which is a view.')
 * 
 */
  __pyx_t_7 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_7) {

    /* "pyzoltan/core/carray.pyx":531
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot reize array which is a view.')             # <<<<<<<<<<<<<<
 * 
 *         self.c_resize(size)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":533
 *             raise RuntimeError('Cannot reize array which is a view.')
 * 
 *         self.c_resize(size)             # <<<<<<<<<<<<<<
 * 
 *     cpdef set_view(self, IntArray parent, long start, long end):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_resize(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_size);

  /* "pyzoltan/core/carray.pyx":525
 *             self._parent = None
 * 
 *     cpdef resize(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes internal data to ``size*sizeof(int)`` bytes
 *         and sets the length to the new size.
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_29resize(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_8IntArray_28resize[] = "IntArray.resize(self, long size)\nResizes internal data to ``size*sizeof(int)`` bytes\n        and sets the length to the new size.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_29resize(PyObject *__pyx_v_self, PyObject *__pyx_arg_size) {
  long __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resize (wrapper)", 0);
  assert(__pyx_arg_size); {
    __pyx_v_size = __Pyx_PyInt_As_long(__pyx_arg_size); if (unlikely((__pyx_v_size == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_28resize(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self), ((long)__pyx_v_size));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_28resize(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, long __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_8IntArray_resize(__pyx_v_self, __pyx_v_size, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.IntArray.resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":535
 *         self.c_resize(size)
 * 
 *     cpdef set_view(self, IntArray parent, long start, long end):             # <<<<<<<<<<<<<<
 *         """Create a view of a given a `parent` array from start to end.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_31set_view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_set_view(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_parent, long __pyx_v_start, long __pyx_v_end, int __pyx_skip_dispatch) {
  PyArrayObject *__pyx_v_arr;
  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;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  int *__pyx_t_11;
  long __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_view", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_view); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_31set_view)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_parent));
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, ((PyObject *)__pyx_v_parent));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_parent));
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":552
 * 
 *         """
 *         if self._parent is None:             # <<<<<<<<<<<<<<
 *             self._old_data = self.data
 *         self._parent = parent
 */
  __pyx_t_9 = (((PyObject *)__pyx_v_self->_parent) == Py_None);
  __pyx_t_10 = (__pyx_t_9 != 0);
  if (__pyx_t_10) {

    /* "pyzoltan/core/carray.pyx":553
 *         """
 *         if self._parent is None:
 *             self._old_data = self.data             # <<<<<<<<<<<<<<
 *         self._parent = parent
 *         self.data = parent.data + start
 */
    __pyx_t_11 = __pyx_v_self->data;
    __pyx_v_self->_old_data = __pyx_t_11;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":554
 *         if self._parent is None:
 *             self._old_data = self.data
 *         self._parent = parent             # <<<<<<<<<<<<<<
 *         self.data = parent.data + start
 *         self.length = end - start
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_parent));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_parent));
  __Pyx_GOTREF(__pyx_v_self->_parent);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_parent));
  __pyx_v_self->_parent = __pyx_v_parent;

  /* "pyzoltan/core/carray.pyx":555
 *             self._old_data = self.data
 *         self._parent = parent
 *         self.data = parent.data + start             # <<<<<<<<<<<<<<
 *         self.length = end - start
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 */
  __pyx_v_self->data = (__pyx_v_parent->data + __pyx_v_start);

  /* "pyzoltan/core/carray.pyx":556
 *         self._parent = parent
 *         self.data = parent.data + start
 *         self.length = end - start             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data
 */
  __pyx_v_self->__pyx_base.length = (__pyx_v_end - __pyx_v_start);

  /* "pyzoltan/core/carray.pyx":557
 *         self.data = parent.data + start
 *         self.length = end - start
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         arr.data = <char *>self.data
 *         arr.dimensions[0] = self.length
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":558
 *         self.length = end - start
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data             # <<<<<<<<<<<<<<
 *         arr.dimensions[0] = self.length
 * 
 */
  __pyx_v_arr->data = ((char *)__pyx_v_self->data);

  /* "pyzoltan/core/carray.pyx":559
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cpdef squeeze(self):
 */
  __pyx_t_12 = __pyx_v_self->__pyx_base.length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_12;

  /* "pyzoltan/core/carray.pyx":535
 *         self.c_resize(size)
 * 
 *     cpdef set_view(self, IntArray parent, long start, long end):             # <<<<<<<<<<<<<<
 *         """Create a view of a given a `parent` array from start to end.
 * 
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.set_view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_31set_view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_8IntArray_30set_view[] = "IntArray.set_view(self, IntArray parent, long start, long end)\nCreate a view of a given a `parent` array from start to end.\n\n        Note that this excludes the end index.\n\n        Parameters\n        ----------\n\n        parent : IntArray\n            The parent array of which this is a view.\n        start : long\n            The starting index to start the view from.\n        end : long\n            The ending index to end the view at, excludes the end\n            itself.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_31set_view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_parent = 0;
  long __pyx_v_start;
  long __pyx_v_end;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parent,&__pyx_n_s_start,&__pyx_n_s_end,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parent)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_view", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_view", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_view") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __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_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)values[0]);
    __pyx_v_start = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_start == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_end = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_end == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_view", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.set_view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_8pyzoltan_4core_6carray_IntArray, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_30set_view(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self), __pyx_v_parent, __pyx_v_start, __pyx_v_end);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_30set_view(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_parent, long __pyx_v_start, long __pyx_v_end) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_view", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_8IntArray_set_view(__pyx_v_self, __pyx_v_parent, __pyx_v_start, __pyx_v_end, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.IntArray.set_view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":561
 *         arr.dimensions[0] = self.length
 * 
 *     cpdef squeeze(self):             # <<<<<<<<<<<<<<
 *         """Release any unused memory.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_33squeeze(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int __pyx_skip_dispatch) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("squeeze", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_squeeze); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_33squeeze)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":564
 *         """Release any unused memory.
 *         """
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             raise RuntimeError('Cannot squeeze array which is a view.')
 * 
 */
  __pyx_t_5 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_5) {

    /* "pyzoltan/core/carray.pyx":565
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot squeeze array which is a view.')             # <<<<<<<<<<<<<<
 * 
 *         self.c_squeeze()
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":567
 *             raise RuntimeError('Cannot squeeze array which is a view.')
 * 
 *         self.c_squeeze()             # <<<<<<<<<<<<<<
 * 
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=0):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_squeeze(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

  /* "pyzoltan/core/carray.pyx":561
 *         arr.dimensions[0] = self.length
 * 
 *     cpdef squeeze(self):             # <<<<<<<<<<<<<<
 *         """Release any unused memory.
 *         """
 */

  /* 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("pyzoltan.core.carray.IntArray.squeeze", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_33squeeze(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_8IntArray_32squeeze[] = "IntArray.squeeze(self)\nRelease any unused memory.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_33squeeze(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("squeeze (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_32squeeze(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_32squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("squeeze", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_8IntArray_squeeze(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.IntArray.squeeze", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":569
 *         self.c_squeeze()
 * 
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=0):             # <<<<<<<<<<<<<<
 *         """Remove the particles with indices in index_list.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_35remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_remove(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_8IntArray_remove *__pyx_optional_args) {
  int __pyx_v_input_sorted = ((int)0);
  long __pyx_v_i;
  long __pyx_v_inlength;
  PyArrayObject *__pyx_v_sorted_indices = 0;
  long __pyx_v_id;
  PyArrayObject *__pyx_v_arr;
  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;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  long __pyx_t_9;
  long __pyx_t_10;
  long __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_input_sorted = __pyx_optional_args->input_sorted;
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_35remove)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_input_sorted); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_6 = 1;
        }
      }
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_index_list));
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_index_list));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_index_list));
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":590
 * 
 *         """
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             raise RuntimeError('Cannot remove elements from view array.')
 *         cdef long i
 */
  __pyx_t_8 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_8) {

    /* "pyzoltan/core/carray.pyx":591
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot remove elements from view array.')             # <<<<<<<<<<<<<<
 *         cdef long i
 *         cdef long inlength = index_list.size
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":593
 *             raise RuntimeError('Cannot remove elements from view array.')
 *         cdef long i
 *         cdef long inlength = index_list.size             # <<<<<<<<<<<<<<
 *         cdef np.ndarray sorted_indices
 *         cdef long id
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_index_list), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_inlength = __pyx_t_9;

  /* "pyzoltan/core/carray.pyx":596
 *         cdef np.ndarray sorted_indices
 *         cdef long id
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 * 
 *         if inlength > self.length:
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":598
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 *         if inlength > self.length:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_8 = ((__pyx_v_inlength > __pyx_v_self->__pyx_base.length) != 0);
  if (__pyx_t_8) {

    /* "pyzoltan/core/carray.pyx":599
 * 
 *         if inlength > self.length:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if input_sorted != 1:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "pyzoltan/core/carray.pyx":601
 *             return
 * 
 *         if input_sorted != 1:             # <<<<<<<<<<<<<<
 *             sorted_indices = np.sort(index_list)
 *         else:
 */
  __pyx_t_8 = ((__pyx_v_input_sorted != 1) != 0);
  if (__pyx_t_8) {

    /* "pyzoltan/core/carray.pyx":602
 * 
 *         if input_sorted != 1:
 *             sorted_indices = np.sort(index_list)             # <<<<<<<<<<<<<<
 *         else:
 *             sorted_indices = index_list
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sort); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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, ((PyObject *)__pyx_v_index_list)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(((PyObject *)__pyx_v_index_list));
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, ((PyObject *)__pyx_v_index_list));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_index_list));
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_sorted_indices = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pyzoltan/core/carray.pyx":604
 *             sorted_indices = np.sort(index_list)
 *         else:
 *             sorted_indices = index_list             # <<<<<<<<<<<<<<
 * 
 *         for i in range(inlength):
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_index_list));
    __pyx_v_sorted_indices = __pyx_v_index_list;
  }
  __pyx_L5:;

  /* "pyzoltan/core/carray.pyx":606
 *             sorted_indices = index_list
 * 
 *         for i in range(inlength):             # <<<<<<<<<<<<<<
 *             id = sorted_indices[inlength-(i+1)]
 *             if id < self.length:
 */
  __pyx_t_9 = __pyx_v_inlength;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_i = __pyx_t_10;

    /* "pyzoltan/core/carray.pyx":607
 * 
 *         for i in range(inlength):
 *             id = sorted_indices[inlength-(i+1)]             # <<<<<<<<<<<<<<
 *             if id < self.length:
 *                 self.data[id] = self.data[self.length-1]
 */
    __pyx_t_11 = (__pyx_v_inlength - (__pyx_v_i + 1));
    __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_sorted_indices), __pyx_t_11, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_11 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_id = __pyx_t_11;

    /* "pyzoltan/core/carray.pyx":608
 *         for i in range(inlength):
 *             id = sorted_indices[inlength-(i+1)]
 *             if id < self.length:             # <<<<<<<<<<<<<<
 *                 self.data[id] = self.data[self.length-1]
 *                 self.length = self.length - 1
 */
    __pyx_t_8 = ((__pyx_v_id < __pyx_v_self->__pyx_base.length) != 0);
    if (__pyx_t_8) {

      /* "pyzoltan/core/carray.pyx":609
 *             id = sorted_indices[inlength-(i+1)]
 *             if id < self.length:
 *                 self.data[id] = self.data[self.length-1]             # <<<<<<<<<<<<<<
 *                 self.length = self.length - 1
 *                 arr.dimensions[0] = self.length
 */
      (__pyx_v_self->data[__pyx_v_id]) = (__pyx_v_self->data[(__pyx_v_self->__pyx_base.length - 1)]);

      /* "pyzoltan/core/carray.pyx":610
 *             if id < self.length:
 *                 self.data[id] = self.data[self.length-1]
 *                 self.length = self.length - 1             # <<<<<<<<<<<<<<
 *                 arr.dimensions[0] = self.length
 * 
 */
      __pyx_v_self->__pyx_base.length = (__pyx_v_self->__pyx_base.length - 1);

      /* "pyzoltan/core/carray.pyx":611
 *                 self.data[id] = self.data[self.length-1]
 *                 self.length = self.length - 1
 *                 arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cpdef extend(self, np.ndarray in_array):
 */
      __pyx_t_11 = __pyx_v_self->__pyx_base.length;
      (__pyx_v_arr->dimensions[0]) = __pyx_t_11;
      goto __pyx_L8;
    }
    __pyx_L8:;
  }

  /* "pyzoltan/core/carray.pyx":569
 *         self.c_squeeze()
 * 
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=0):             # <<<<<<<<<<<<<<
 *         """Remove the particles with indices in index_list.
 * 
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sorted_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_35remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_8IntArray_34remove[] = "IntArray.remove(self, ndarray index_list, bool input_sorted=0)\nRemove the particles with indices in index_list.\n\n        Parameters\n        ----------\n\n        index_list : ndarray\n            a list of indices which should be removed.\n        input_sorted : bool\n            indicates if the input is sorted in ascending order.  if\n            not, the array will be sorted internally.\n\n        Notes\n        -----\n\n         If the input indices are not sorted, sort them in ascending order.\n         Starting with the last element in the index list, start replacing the\n         element at the said index with the last element in the data and update\n         the length of the array.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_35remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_index_list = 0;
  int __pyx_v_input_sorted;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index_list,&__pyx_n_s_input_sorted,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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index_list)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_input_sorted);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "remove") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_index_list = ((PyArrayObject *)values[0]);
    if (values[1]) {
      __pyx_v_input_sorted = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_input_sorted == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_input_sorted = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("remove", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index_list), __pyx_ptype_5numpy_ndarray, 1, "index_list", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_34remove(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self), __pyx_v_index_list, __pyx_v_input_sorted);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_34remove(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_v_input_sorted) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_remove __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.input_sorted = __pyx_v_input_sorted;
  __pyx_t_1 = __pyx_vtabptr_8pyzoltan_4core_6carray_IntArray->__pyx_base.remove(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_index_list, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.IntArray.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":613
 *                 arr.dimensions[0] = self.length
 * 
 *     cpdef extend(self, np.ndarray in_array):             # <<<<<<<<<<<<<<
 *         """Extend the array with data from in_array.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_37extend(PyObject *__pyx_v_self, PyObject *__pyx_v_in_array); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_extend(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array, int __pyx_skip_dispatch) {
  long __pyx_v_len;
  long __pyx_v_i;
  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;
  int __pyx_t_6;
  long __pyx_t_7;
  long __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_37extend)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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, ((PyObject *)__pyx_v_in_array)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_v_in_array));
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, ((PyObject *)__pyx_v_in_array));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_in_array));
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":629
 * 
 *         """
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             raise RuntimeError('Cannot extend array which is a view.')
 *         cdef long len = in_array.size
 */
  __pyx_t_6 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_6) {

    /* "pyzoltan/core/carray.pyx":630
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot extend array which is a view.')             # <<<<<<<<<<<<<<
 *         cdef long len = in_array.size
 *         cdef long i
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":631
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot extend array which is a view.')
 *         cdef long len = in_array.size             # <<<<<<<<<<<<<<
 *         cdef long i
 *         for i in range(len):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_in_array), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_len = __pyx_t_7;

  /* "pyzoltan/core/carray.pyx":633
 *         cdef long len = in_array.size
 *         cdef long i
 *         for i in range(len):             # <<<<<<<<<<<<<<
 *             self.append(in_array[i])
 * 
 */
  __pyx_t_7 = __pyx_v_len;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pyzoltan/core/carray.pyx":634
 *         cdef long i
 *         for i in range(len):
 *             self.append(in_array[i])             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy_values(self, LongArray indices, BaseArray dest):
 */
    __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_in_array), __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->append(__pyx_v_self, __pyx_t_9, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":613
 *                 arr.dimensions[0] = self.length
 * 
 *     cpdef extend(self, np.ndarray in_array):             # <<<<<<<<<<<<<<
 *         """Extend the array with data from in_array.
 * 
 */

  /* 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("pyzoltan.core.carray.IntArray.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_37extend(PyObject *__pyx_v_self, PyObject *__pyx_v_in_array); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_8IntArray_36extend[] = "IntArray.extend(self, ndarray in_array)\nExtend the array with data from in_array.\n\n        Parameters\n        ----------\n\n        in_array : ndarray\n            a numpy array with data to be added to the current array.\n\n        Notes\n        -----\n\n         - accessing the in_array using the indexing operation seems to be\n           costly. Look at the annotated cython html file.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_37extend(PyObject *__pyx_v_self, PyObject *__pyx_v_in_array) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("extend (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_array), __pyx_ptype_5numpy_ndarray, 1, "in_array", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_36extend(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self), ((PyArrayObject *)__pyx_v_in_array));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_36extend(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_8IntArray_extend(__pyx_v_self, __pyx_v_in_array, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.IntArray.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":636
 *             self.append(in_array[i])
 * 
 *     cpdef copy_values(self, LongArray indices, BaseArray dest):             # <<<<<<<<<<<<<<
 *         """Copies values of indices in indices from self to `dest`.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_39copy_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest, int __pyx_skip_dispatch) {
  struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_dest_array = 0;
  long __pyx_v_i;
  long __pyx_v_num_values;
  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;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  long __pyx_t_7;
  long __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_values", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy_values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_39copy_values)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && 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);
          __pyx_t_5 = 1;
        }
      }
      __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_4) {
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_indices));
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, ((PyObject *)__pyx_v_indices));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_indices));
      __Pyx_INCREF(((PyObject *)__pyx_v_dest));
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_dest));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_dest));
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":642
 *         i.e. atleast as long as indices.
 *         """
 *         cdef IntArray dest_array = <IntArray>dest             # <<<<<<<<<<<<<<
 *         cdef long i, num_values
 *         num_values = indices.length
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_dest);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_dest_array = ((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":644
 *         cdef IntArray dest_array = <IntArray>dest
 *         cdef long i, num_values
 *         num_values = indices.length             # <<<<<<<<<<<<<<
 * 
 *         for i in range(num_values):
 */
  __pyx_t_7 = __pyx_v_indices->__pyx_base.length;
  __pyx_v_num_values = __pyx_t_7;

  /* "pyzoltan/core/carray.pyx":646
 *         num_values = indices.length
 * 
 *         for i in range(num_values):             # <<<<<<<<<<<<<<
 *             dest_array.data[i] = self.data[indices.data[i]]
 * 
 */
  __pyx_t_7 = __pyx_v_num_values;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pyzoltan/core/carray.pyx":647
 * 
 *         for i in range(num_values):
 *             dest_array.data[i] = self.data[indices.data[i]]             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy_subset(self, BaseArray source, long start_index=-1,
 */
    (__pyx_v_dest_array->data[__pyx_v_i]) = (__pyx_v_self->data[(__pyx_v_indices->data[__pyx_v_i])]);
  }

  /* "pyzoltan/core/carray.pyx":636
 *             self.append(in_array[i])
 * 
 *     cpdef copy_values(self, LongArray indices, BaseArray dest):             # <<<<<<<<<<<<<<
 *         """Copies values of indices in indices from self to `dest`.
 * 
 */

  /* 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_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.copy_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dest_array);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_39copy_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_8IntArray_38copy_values[] = "IntArray.copy_values(self, LongArray indices, BaseArray dest)\nCopies values of indices in indices from self to `dest`.\n\n        No size check if performed, we assume the dest to of proper size\n        i.e. atleast as long as indices.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_39copy_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices = 0;
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_values (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,&__pyx_n_s_dest,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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indices)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dest)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("copy_values", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy_values") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __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_indices = ((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)values[0]);
    __pyx_v_dest = ((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy_values", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.copy_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_8pyzoltan_4core_6carray_LongArray, 1, "indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dest), __pyx_ptype_8pyzoltan_4core_6carray_BaseArray, 1, "dest", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_38copy_values(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self), __pyx_v_indices, __pyx_v_dest);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_38copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_values", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_8IntArray_copy_values(__pyx_v_self, __pyx_v_indices, __pyx_v_dest, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.IntArray.copy_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":649
 *             dest_array.data[i] = self.data[indices.data[i]]
 * 
 *     cpdef copy_subset(self, BaseArray source, long start_index=-1,             # <<<<<<<<<<<<<<
 *                       long end_index=-1):
 *         """Copy a subset of values from src to self.
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_41copy_subset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_8IntArray_copy_subset *__pyx_optional_args) {
  long __pyx_v_start_index = ((long)-1);
  long __pyx_v_end_index = ((long)-1);
  long __pyx_v_si;
  long __pyx_v_ei;
  long __pyx_v_s_length;
  long __pyx_v_d_length;
  long __pyx_v_i;
  long __pyx_v_j;
  struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_src = 0;
  PyObject *__pyx_v_msg = 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;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  long __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  long __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_subset", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_start_index = __pyx_optional_args->start_index;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_end_index = __pyx_optional_args->end_index;
      }
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy_subset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_41copy_subset)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_start_index); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_end_index); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_source));
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, ((PyObject *)__pyx_v_source));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_source));
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":664
 *         """
 *         cdef long si, ei, s_length, d_length, i, j
 *         cdef IntArray src = <IntArray>source             # <<<<<<<<<<<<<<
 *         s_length = src.length
 *         d_length = self.length
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_source);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_src = ((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":665
 *         cdef long si, ei, s_length, d_length, i, j
 *         cdef IntArray src = <IntArray>source
 *         s_length = src.length             # <<<<<<<<<<<<<<
 *         d_length = self.length
 * 
 */
  __pyx_t_9 = __pyx_v_src->__pyx_base.length;
  __pyx_v_s_length = __pyx_t_9;

  /* "pyzoltan/core/carray.pyx":666
 *         cdef IntArray src = <IntArray>source
 *         s_length = src.length
 *         d_length = self.length             # <<<<<<<<<<<<<<
 * 
 *         if end_index < 0:
 */
  __pyx_t_9 = __pyx_v_self->__pyx_base.length;
  __pyx_v_d_length = __pyx_t_9;

  /* "pyzoltan/core/carray.pyx":668
 *         d_length = self.length
 * 
 *         if end_index < 0:             # <<<<<<<<<<<<<<
 *             if start_index < 0:
 *                 if s_length != d_length:
 */
  __pyx_t_10 = ((__pyx_v_end_index < 0) != 0);
  if (__pyx_t_10) {

    /* "pyzoltan/core/carray.pyx":669
 * 
 *         if end_index < 0:
 *             if start_index < 0:             # <<<<<<<<<<<<<<
 *                 if s_length != d_length:
 *                     msg = 'Source length should be same as dest length'
 */
    __pyx_t_10 = ((__pyx_v_start_index < 0) != 0);
    if (__pyx_t_10) {

      /* "pyzoltan/core/carray.pyx":670
 *         if end_index < 0:
 *             if start_index < 0:
 *                 if s_length != d_length:             # <<<<<<<<<<<<<<
 *                     msg = 'Source length should be same as dest length'
 *                     logger.error(msg)
 */
      __pyx_t_10 = ((__pyx_v_s_length != __pyx_v_d_length) != 0);
      if (__pyx_t_10) {

        /* "pyzoltan/core/carray.pyx":671
 *             if start_index < 0:
 *                 if s_length != d_length:
 *                     msg = 'Source length should be same as dest length'             # <<<<<<<<<<<<<<
 *                     logger.error(msg)
 *                     raise ValueError, msg
 */
        __Pyx_INCREF(__pyx_kp_s_Source_length_should_be_same_as);
        __pyx_v_msg = __pyx_kp_s_Source_length_should_be_same_as;

        /* "pyzoltan/core/carray.pyx":672
 *                 if s_length != d_length:
 *                     msg = 'Source length should be same as dest length'
 *                     logger.error(msg)             # <<<<<<<<<<<<<<
 *                     raise ValueError, msg
 *                 si = 0
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        if (!__pyx_t_2) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "pyzoltan/core/carray.pyx":673
 *                     msg = 'Source length should be same as dest length'
 *                     logger.error(msg)
 *                     raise ValueError, msg             # <<<<<<<<<<<<<<
 *                 si = 0
 *                 ei = self.length
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "pyzoltan/core/carray.pyx":674
 *                     logger.error(msg)
 *                     raise ValueError, msg
 *                 si = 0             # <<<<<<<<<<<<<<
 *                 ei = self.length
 *             else:
 */
      __pyx_v_si = 0;

      /* "pyzoltan/core/carray.pyx":675
 *                     raise ValueError, msg
 *                 si = 0
 *                 ei = self.length             # <<<<<<<<<<<<<<
 *             else:
 *                 # meaning we copy from the specified start index to the end of
 */
      __pyx_t_9 = __pyx_v_self->__pyx_base.length;
      __pyx_v_ei = __pyx_t_9;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "pyzoltan/core/carray.pyx":679
 *                 # meaning we copy from the specified start index to the end of
 *                 # self. make sure the sizes are consistent.
 *                 si = start_index             # <<<<<<<<<<<<<<
 *                 ei = d_length
 * 
 */
      __pyx_v_si = __pyx_v_start_index;

      /* "pyzoltan/core/carray.pyx":680
 *                 # self. make sure the sizes are consistent.
 *                 si = start_index
 *                 ei = d_length             # <<<<<<<<<<<<<<
 * 
 *                 if start_index > (d_length-1):
 */
      __pyx_v_ei = __pyx_v_d_length;

      /* "pyzoltan/core/carray.pyx":682
 *                 ei = d_length
 * 
 *                 if start_index > (d_length-1):             # <<<<<<<<<<<<<<
 *                     msg = 'start_index beyond array length'
 *                     logger.error(msg)
 */
      __pyx_t_10 = ((__pyx_v_start_index > (__pyx_v_d_length - 1)) != 0);
      if (__pyx_t_10) {

        /* "pyzoltan/core/carray.pyx":683
 * 
 *                 if start_index > (d_length-1):
 *                     msg = 'start_index beyond array length'             # <<<<<<<<<<<<<<
 *                     logger.error(msg)
 *                     raise ValueError, msg
 */
        __Pyx_INCREF(__pyx_kp_s_start_index_beyond_array_length);
        __pyx_v_msg = __pyx_kp_s_start_index_beyond_array_length;

        /* "pyzoltan/core/carray.pyx":684
 *                 if start_index > (d_length-1):
 *                     msg = 'start_index beyond array length'
 *                     logger.error(msg)             # <<<<<<<<<<<<<<
 *                     raise ValueError, msg
 * 
 */
        __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        if (!__pyx_t_5) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "pyzoltan/core/carray.pyx":685
 *                     msg = 'start_index beyond array length'
 *                     logger.error(msg)
 *                     raise ValueError, msg             # <<<<<<<<<<<<<<
 * 
 *                 if (ei - si) > s_length:
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "pyzoltan/core/carray.pyx":687
 *                     raise ValueError, msg
 * 
 *                 if (ei - si) > s_length:             # <<<<<<<<<<<<<<
 *                     msg = 'Not enough values in source'
 *                     logger.error(msg)
 */
      __pyx_t_10 = (((__pyx_v_ei - __pyx_v_si) > __pyx_v_s_length) != 0);
      if (__pyx_t_10) {

        /* "pyzoltan/core/carray.pyx":688
 * 
 *                 if (ei - si) > s_length:
 *                     msg = 'Not enough values in source'             # <<<<<<<<<<<<<<
 *                     logger.error(msg)
 *                     raise ValueError, msg
 */
        __Pyx_INCREF(__pyx_kp_s_Not_enough_values_in_source);
        __pyx_v_msg = __pyx_kp_s_Not_enough_values_in_source;

        /* "pyzoltan/core/carray.pyx":689
 *                 if (ei - si) > s_length:
 *                     msg = 'Not enough values in source'
 *                     logger.error(msg)             # <<<<<<<<<<<<<<
 *                     raise ValueError, msg
 *         else:
 */
        __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        if (!__pyx_t_8) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __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;

        /* "pyzoltan/core/carray.pyx":690
 *                     msg = 'Not enough values in source'
 *                     logger.error(msg)
 *                     raise ValueError, msg             # <<<<<<<<<<<<<<
 *         else:
 *             if start_index < 0:
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pyzoltan/core/carray.pyx":692
 *                     raise ValueError, msg
 *         else:
 *             if start_index < 0:             # <<<<<<<<<<<<<<
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                           end_index)
 */
    __pyx_t_10 = ((__pyx_v_start_index < 0) != 0);
    if (__pyx_t_10) {

      /* "pyzoltan/core/carray.pyx":693
 *         else:
 *             if start_index < 0:
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,             # <<<<<<<<<<<<<<
 *                                                           end_index)
 *                 logger.error(msg)
 */
      __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_start_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);

      /* "pyzoltan/core/carray.pyx":694
 *             if start_index < 0:
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                           end_index)             # <<<<<<<<<<<<<<
 *                 logger.error(msg)
 *                 raise ValueError, msg
 */
      __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_end_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);

      /* "pyzoltan/core/carray.pyx":693
 *         else:
 *             if start_index < 0:
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,             # <<<<<<<<<<<<<<
 *                                                           end_index)
 *                 logger.error(msg)
 */
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_1 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_start_index_d_end_index_d, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_msg = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "pyzoltan/core/carray.pyx":695
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                           end_index)
 *                 logger.error(msg)             # <<<<<<<<<<<<<<
 *                 raise ValueError, msg
 *             else:
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_v_msg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_msg);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_msg);
        __Pyx_GIVEREF(__pyx_v_msg);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pyzoltan/core/carray.pyx":696
 *                                                           end_index)
 *                 logger.error(msg)
 *                 raise ValueError, msg             # <<<<<<<<<<<<<<
 *             else:
 *                 if (start_index > (d_length-1) or end_index > d_length or
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    /*else*/ {

      /* "pyzoltan/core/carray.pyx":698
 *                 raise ValueError, msg
 *             else:
 *                 if (start_index > (d_length-1) or end_index > d_length or             # <<<<<<<<<<<<<<
 *                     start_index > end_index):
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,
 */
      __pyx_t_11 = ((__pyx_v_start_index > (__pyx_v_d_length - 1)) != 0);
      if (!__pyx_t_11) {
      } else {
        __pyx_t_10 = __pyx_t_11;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_11 = ((__pyx_v_end_index > __pyx_v_d_length) != 0);
      if (!__pyx_t_11) {
      } else {
        __pyx_t_10 = __pyx_t_11;
        goto __pyx_L10_bool_binop_done;
      }

      /* "pyzoltan/core/carray.pyx":699
 *             else:
 *                 if (start_index > (d_length-1) or end_index > d_length or
 *                     start_index > end_index):             # <<<<<<<<<<<<<<
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                               end_index)
 */
      __pyx_t_11 = ((__pyx_v_start_index > __pyx_v_end_index) != 0);
      __pyx_t_10 = __pyx_t_11;
      __pyx_L10_bool_binop_done:;
      if (__pyx_t_10) {

        /* "pyzoltan/core/carray.pyx":700
 *                 if (start_index > (d_length-1) or end_index > d_length or
 *                     start_index > end_index):
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,             # <<<<<<<<<<<<<<
 *                                                               end_index)
 *                     logger.error(msg)
 */
        __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_start_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);

        /* "pyzoltan/core/carray.pyx":701
 *                     start_index > end_index):
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                               end_index)             # <<<<<<<<<<<<<<
 *                     logger.error(msg)
 *                     raise ValueError, msg
 */
        __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_end_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);

        /* "pyzoltan/core/carray.pyx":700
 *                 if (start_index > (d_length-1) or end_index > d_length or
 *                     start_index > end_index):
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,             # <<<<<<<<<<<<<<
 *                                                               end_index)
 *                     logger.error(msg)
 */
        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_2 = 0;
        __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_start_index_d_end_index_d, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_v_msg = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "pyzoltan/core/carray.pyx":702
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                               end_index)
 *                     logger.error(msg)             # <<<<<<<<<<<<<<
 *                     raise ValueError, msg
 * 
 */
        __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        if (!__pyx_t_8) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __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;

        /* "pyzoltan/core/carray.pyx":703
 *                                                               end_index)
 *                     logger.error(msg)
 *                     raise ValueError, msg             # <<<<<<<<<<<<<<
 * 
 *                 si = start_index
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "pyzoltan/core/carray.pyx":705
 *                     raise ValueError, msg
 * 
 *                 si = start_index             # <<<<<<<<<<<<<<
 *                 ei = end_index
 * 
 */
      __pyx_v_si = __pyx_v_start_index;

      /* "pyzoltan/core/carray.pyx":706
 * 
 *                 si = start_index
 *                 ei = end_index             # <<<<<<<<<<<<<<
 * 
 *         # we have valid start and end indices now. can start copying now.
 */
      __pyx_v_ei = __pyx_v_end_index;
    }
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":709
 * 
 *         # we have valid start and end indices now. can start copying now.
 *         j = 0             # <<<<<<<<<<<<<<
 *         for i in range(si, ei):
 *             self.data[i] = src.data[j]
 */
  __pyx_v_j = 0;

  /* "pyzoltan/core/carray.pyx":710
 *         # we have valid start and end indices now. can start copying now.
 *         j = 0
 *         for i in range(si, ei):             # <<<<<<<<<<<<<<
 *             self.data[i] = src.data[j]
 *             j += 1
 */
  __pyx_t_9 = __pyx_v_ei;
  for (__pyx_t_12 = __pyx_v_si; __pyx_t_12 < __pyx_t_9; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "pyzoltan/core/carray.pyx":711
 *         j = 0
 *         for i in range(si, ei):
 *             self.data[i] = src.data[j]             # <<<<<<<<<<<<<<
 *             j += 1
 * 
 */
    (__pyx_v_self->data[__pyx_v_i]) = (__pyx_v_src->data[__pyx_v_j]);

    /* "pyzoltan/core/carray.pyx":712
 *         for i in range(si, ei):
 *             self.data[i] = src.data[j]
 *             j += 1             # <<<<<<<<<<<<<<
 * 
 *     cpdef update_min_max(self):
 */
    __pyx_v_j = (__pyx_v_j + 1);
  }

  /* "pyzoltan/core/carray.pyx":649
 *             dest_array.data[i] = self.data[indices.data[i]]
 * 
 *     cpdef copy_subset(self, BaseArray source, long start_index=-1,             # <<<<<<<<<<<<<<
 *                       long end_index=-1):
 *         """Copy a subset of values from src to self.
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.copy_subset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_src);
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_41copy_subset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_8IntArray_40copy_subset[] = "IntArray.copy_subset(self, BaseArray source, long start_index=-1, long end_index=-1)\nCopy a subset of values from src to self.\n\n        Parameters\n        ----------\n\n        start_index : long\n            the first index in dest that corresponds to the 0th\n            index in source\n\n        end_index : long\n            the first index in dest from start_index that is not copied\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_41copy_subset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source = 0;
  long __pyx_v_start_index;
  long __pyx_v_end_index;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_subset (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_start_index,&__pyx_n_s_end_index,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_source)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start_index);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end_index);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy_subset") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_source = ((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)values[0]);
    if (values[1]) {
      __pyx_v_start_index = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_start_index == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_start_index = ((long)-1);
    }
    if (values[2]) {
      __pyx_v_end_index = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_end_index == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_end_index = ((long)-1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy_subset", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.copy_subset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_source), __pyx_ptype_8pyzoltan_4core_6carray_BaseArray, 1, "source", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_40copy_subset(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self), __pyx_v_source, __pyx_v_start_index, __pyx_v_end_index);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_40copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, long __pyx_v_start_index, long __pyx_v_end_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_copy_subset __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_subset", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.start_index = __pyx_v_start_index;
  __pyx_t_2.end_index = __pyx_v_end_index;
  __pyx_t_1 = __pyx_vtabptr_8pyzoltan_4core_6carray_IntArray->__pyx_base.copy_subset(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_source, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.IntArray.copy_subset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":714
 *             j += 1
 * 
 *     cpdef update_min_max(self):             # <<<<<<<<<<<<<<
 *         """Updates the min and max values of the array.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_43update_min_max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_8IntArray_update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, int __pyx_skip_dispatch) {
  long __pyx_v_i;
  int __pyx_v_min_val;
  int __pyx_v_max_val;
  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;
  long __pyx_t_6;
  long __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update_min_max", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_update_min_max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_43update_min_max)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":717
 *         """Updates the min and max values of the array.
 *         """
 *         cdef long i = 0             # <<<<<<<<<<<<<<
 *         cdef int min_val, max_val
 * 
 */
  __pyx_v_i = 0;

  /* "pyzoltan/core/carray.pyx":720
 *         cdef int min_val, max_val
 * 
 *         if self.length == 0:             # <<<<<<<<<<<<<<
 *             self.minimum = <int>0
 *             self.maximum = <int>0
 */
  __pyx_t_5 = ((__pyx_v_self->__pyx_base.length == 0) != 0);
  if (__pyx_t_5) {

    /* "pyzoltan/core/carray.pyx":721
 * 
 *         if self.length == 0:
 *             self.minimum = <int>0             # <<<<<<<<<<<<<<
 *             self.maximum = <int>0
 *             return
 */
    __pyx_v_self->minimum = ((int)0);

    /* "pyzoltan/core/carray.pyx":722
 *         if self.length == 0:
 *             self.minimum = <int>0
 *             self.maximum = <int>0             # <<<<<<<<<<<<<<
 *             return
 * 
 */
    __pyx_v_self->maximum = ((int)0);

    /* "pyzoltan/core/carray.pyx":723
 *             self.minimum = <int>0
 *             self.maximum = <int>0
 *             return             # <<<<<<<<<<<<<<
 * 
 *         min_val = self.data[0]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "pyzoltan/core/carray.pyx":725
 *             return
 * 
 *         min_val = self.data[0]             # <<<<<<<<<<<<<<
 *         max_val = self.data[0]
 * 
 */
  __pyx_v_min_val = (__pyx_v_self->data[0]);

  /* "pyzoltan/core/carray.pyx":726
 * 
 *         min_val = self.data[0]
 *         max_val = self.data[0]             # <<<<<<<<<<<<<<
 * 
 *         for i in range(self.length):
 */
  __pyx_v_max_val = (__pyx_v_self->data[0]);

  /* "pyzoltan/core/carray.pyx":728
 *         max_val = self.data[0]
 * 
 *         for i in range(self.length):             # <<<<<<<<<<<<<<
 *             if min_val > self.data[i]:
 *                 min_val = self.data[i]
 */
  __pyx_t_6 = __pyx_v_self->__pyx_base.length;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "pyzoltan/core/carray.pyx":729
 * 
 *         for i in range(self.length):
 *             if min_val > self.data[i]:             # <<<<<<<<<<<<<<
 *                 min_val = self.data[i]
 *             if max_val < self.data[i]:
 */
    __pyx_t_5 = ((__pyx_v_min_val > (__pyx_v_self->data[__pyx_v_i])) != 0);
    if (__pyx_t_5) {

      /* "pyzoltan/core/carray.pyx":730
 *         for i in range(self.length):
 *             if min_val > self.data[i]:
 *                 min_val = self.data[i]             # <<<<<<<<<<<<<<
 *             if max_val < self.data[i]:
 *                 max_val = self.data[i]
 */
      __pyx_v_min_val = (__pyx_v_self->data[__pyx_v_i]);
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pyzoltan/core/carray.pyx":731
 *             if min_val > self.data[i]:
 *                 min_val = self.data[i]
 *             if max_val < self.data[i]:             # <<<<<<<<<<<<<<
 *                 max_val = self.data[i]
 * 
 */
    __pyx_t_5 = ((__pyx_v_max_val < (__pyx_v_self->data[__pyx_v_i])) != 0);
    if (__pyx_t_5) {

      /* "pyzoltan/core/carray.pyx":732
 *                 min_val = self.data[i]
 *             if max_val < self.data[i]:
 *                 max_val = self.data[i]             # <<<<<<<<<<<<<<
 * 
 *         self.minimum = min_val
 */
      __pyx_v_max_val = (__pyx_v_self->data[__pyx_v_i]);
      goto __pyx_L7;
    }
    __pyx_L7:;
  }

  /* "pyzoltan/core/carray.pyx":734
 *                 max_val = self.data[i]
 * 
 *         self.minimum = min_val             # <<<<<<<<<<<<<<
 *         self.maximum = max_val
 * 
 */
  __pyx_v_self->minimum = __pyx_v_min_val;

  /* "pyzoltan/core/carray.pyx":735
 * 
 *         self.minimum = min_val
 *         self.maximum = max_val             # <<<<<<<<<<<<<<
 * 
 * # ###########################################################################
 */
  __pyx_v_self->maximum = __pyx_v_max_val;

  /* "pyzoltan/core/carray.pyx":714
 *             j += 1
 * 
 *     cpdef update_min_max(self):             # <<<<<<<<<<<<<<
 *         """Updates the min and max values of the array.
 *         """
 */

  /* 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("pyzoltan.core.carray.IntArray.update_min_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_43update_min_max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_8IntArray_42update_min_max[] = "IntArray.update_min_max(self)\nUpdates the min and max values of the array.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_43update_min_max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_min_max (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_42update_min_max(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_42update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update_min_max", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_8IntArray_update_min_max(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.IntArray.update_min_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pxd":60
 *     cdef int *data
 *     cdef int *_old_data
 *     cdef public int minimum, maximum             # <<<<<<<<<<<<<<
 *     cdef IntArray _parent
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_7minimum_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_7minimum_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_7minimum___get__(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_7minimum___get__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->minimum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.IntArray.minimum.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_8IntArray_7minimum_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8pyzoltan_4core_6carray_8IntArray_7minimum_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_7minimum_2__set__(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_8IntArray_7minimum_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->minimum = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.minimum.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_7maximum_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_8IntArray_7maximum_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_7maximum___get__(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_8IntArray_7maximum___get__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->maximum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.IntArray.maximum.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_8IntArray_7maximum_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8pyzoltan_4core_6carray_8IntArray_7maximum_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_8IntArray_7maximum_2__set__(((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_8IntArray_7maximum_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->maximum = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.IntArray.maximum.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":782
 *     #cdef np.ndarray _npy_array
 * 
 *     def __cinit__(self, long n=0):             # <<<<<<<<<<<<<<
 *         """Constructor for the class.
 *         """
 */

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_9UIntArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8pyzoltan_4core_6carray_9UIntArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,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);
        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 = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray___cinit__(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self), __pyx_v_n);

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

static int __pyx_pf_8pyzoltan_4core_6carray_9UIntArray___cinit__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_n) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "pyzoltan/core/carray.pyx":785
 *         """Constructor for the class.
 *         """
 *         self.length = n             # <<<<<<<<<<<<<<
 *         self._parent = None
 *         self._old_data = NULL
 */
  __pyx_v_self->__pyx_base.length = __pyx_v_n;

  /* "pyzoltan/core/carray.pyx":786
 *         """
 *         self.length = n
 *         self._parent = None             # <<<<<<<<<<<<<<
 *         self._old_data = NULL
 *         if n == 0:
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_parent);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_parent));
  __pyx_v_self->_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)Py_None);

  /* "pyzoltan/core/carray.pyx":787
 *         self.length = n
 *         self._parent = None
 *         self._old_data = NULL             # <<<<<<<<<<<<<<
 *         if n == 0:
 *             n = 16
 */
  __pyx_v_self->_old_data = NULL;

  /* "pyzoltan/core/carray.pyx":788
 *         self._parent = None
 *         self._old_data = NULL
 *         if n == 0:             # <<<<<<<<<<<<<<
 *             n = 16
 *         self.alloc = n
 */
  __pyx_t_1 = ((__pyx_v_n == 0) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":789
 *         self._old_data = NULL
 *         if n == 0:
 *             n = 16             # <<<<<<<<<<<<<<
 *         self.alloc = n
 *         self.data = <unsigned int*>aligned_malloc(n*sizeof(unsigned int))
 */
    __pyx_v_n = 16;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":790
 *         if n == 0:
 *             n = 16
 *         self.alloc = n             # <<<<<<<<<<<<<<
 *         self.data = <unsigned int*>aligned_malloc(n*sizeof(unsigned int))
 * 
 */
  __pyx_v_self->__pyx_base.alloc = __pyx_v_n;

  /* "pyzoltan/core/carray.pyx":791
 *             n = 16
 *         self.alloc = n
 *         self.data = <unsigned int*>aligned_malloc(n*sizeof(unsigned int))             # <<<<<<<<<<<<<<
 * 
 *         self._setup_npy_array()
 */
  __pyx_v_self->data = ((unsigned int *)__pyx_f_8pyzoltan_4core_6carray_aligned_malloc((__pyx_v_n * (sizeof(unsigned int)))));

  /* "pyzoltan/core/carray.pyx":793
 *         self.data = <unsigned int*>aligned_malloc(n*sizeof(unsigned int))
 * 
 *         self._setup_npy_array()             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->_setup_npy_array(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyzoltan/core/carray.pyx":782
 *     #cdef np.ndarray _npy_array
 * 
 *     def __cinit__(self, long n=0):             # <<<<<<<<<<<<<<
 *         """Constructor for the class.
 *         """
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":795
 *         self._setup_npy_array()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         """Frees the array.
 *         """
 */

/* Python wrapper */
static void __pyx_pw_8pyzoltan_4core_6carray_9UIntArray_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_8pyzoltan_4core_6carray_9UIntArray_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_2__dealloc__(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self));

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

static void __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_2__dealloc__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "pyzoltan/core/carray.pyx":798
 *         """Frees the array.
 *         """
 *         if self._old_data == NULL:             # <<<<<<<<<<<<<<
 *             aligned_free(<void*>self.data)
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->_old_data == NULL) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":799
 *         """
 *         if self._old_data == NULL:
 *             aligned_free(<void*>self.data)             # <<<<<<<<<<<<<<
 *         else:
 *             aligned_free(<void*>self._old_data)
 */
    __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_self->data));
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pyzoltan/core/carray.pyx":801
 *             aligned_free(<void*>self.data)
 *         else:
 *             aligned_free(<void*>self._old_data)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, long idx):
 */
    __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_self->_old_data));
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":795
 *         self._setup_npy_array()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         """Frees the array.
 *         """
 */

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

/* "pyzoltan/core/carray.pyx":803
 *             aligned_free(<void*>self._old_data)
 * 
 *     def __getitem__(self, long idx):             # <<<<<<<<<<<<<<
 *         """Get item at position idx.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_4__getitem__[] = "Get item at position idx.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_8pyzoltan_4core_6carray_9UIntArray_4__getitem__;
#endif
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx) {
  long __pyx_v_idx;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  assert(__pyx_arg_idx); {
    __pyx_v_idx = __Pyx_PyInt_As_long(__pyx_arg_idx); if (unlikely((__pyx_v_idx == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_4__getitem__(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self), ((long)__pyx_v_idx));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_4__getitem__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_idx) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "pyzoltan/core/carray.pyx":806
 *         """Get item at position idx.
 *         """
 *         return self.data[idx]             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, long idx, unsigned int value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int((__pyx_v_self->data[__pyx_v_idx])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":803
 *             aligned_free(<void*>self._old_data)
 * 
 *     def __getitem__(self, long idx):             # <<<<<<<<<<<<<<
 *         """Get item at position idx.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":808
 *         return self.data[idx]
 * 
 *     def __setitem__(self, long idx, unsigned int value):             # <<<<<<<<<<<<<<
 *         """Set location idx to value.
 *         """
 */

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_9UIntArray_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx, PyObject *__pyx_arg_value); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_6__setitem__[] = "Set location idx to value.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_8pyzoltan_4core_6carray_9UIntArray_6__setitem__;
#endif
static int __pyx_pw_8pyzoltan_4core_6carray_9UIntArray_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx, PyObject *__pyx_arg_value) {
  long __pyx_v_idx;
  unsigned int __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  assert(__pyx_arg_idx); {
    __pyx_v_idx = __Pyx_PyInt_As_long(__pyx_arg_idx); if (unlikely((__pyx_v_idx == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  assert(__pyx_arg_value); {
    __pyx_v_value = __Pyx_PyInt_As_unsigned_int(__pyx_arg_value); if (unlikely((__pyx_v_value == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_6__setitem__(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self), ((long)__pyx_v_idx), ((unsigned int)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_6__setitem__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_idx, unsigned int __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "pyzoltan/core/carray.pyx":811
 *         """Set location idx to value.
 *         """
 *         self.data[idx] = value             # <<<<<<<<<<<<<<
 * 
 *     cpdef long index(self, unsigned int value):
 */
  (__pyx_v_self->data[__pyx_v_idx]) = __pyx_v_value;

  /* "pyzoltan/core/carray.pyx":808
 *         return self.data[idx]
 * 
 *     def __setitem__(self, long idx, unsigned int value):             # <<<<<<<<<<<<<<
 *         """Set location idx to value.
 *         """
 */

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

/* "pyzoltan/core/carray.pyx":813
 *         self.data[idx] = value
 * 
 *     cpdef long index(self, unsigned int value):             # <<<<<<<<<<<<<<
 *         """Returns the index at which value is in self, else -1.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_9index(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static long __pyx_f_8pyzoltan_4core_6carray_9UIntArray_index(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, unsigned int __pyx_v_value, int __pyx_skip_dispatch) {
  long __pyx_v_i;
  long __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 = NULL;
  PyObject *__pyx_t_6 = NULL;
  long __pyx_t_7;
  long __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("index", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_9index)) {
      __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __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;
      __pyx_t_7 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_7;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":817
 *         """
 *         cdef long i
 *         for i in range(self.length):             # <<<<<<<<<<<<<<
 *             if self.data[i] == value:
 *                 return i
 */
  __pyx_t_7 = __pyx_v_self->__pyx_base.length;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pyzoltan/core/carray.pyx":818
 *         cdef long i
 *         for i in range(self.length):
 *             if self.data[i] == value:             # <<<<<<<<<<<<<<
 *                 return i
 *         return -1
 */
    __pyx_t_9 = (((__pyx_v_self->data[__pyx_v_i]) == __pyx_v_value) != 0);
    if (__pyx_t_9) {

      /* "pyzoltan/core/carray.pyx":819
 *         for i in range(self.length):
 *             if self.data[i] == value:
 *                 return i             # <<<<<<<<<<<<<<
 *         return -1
 * 
 */
      __pyx_r = __pyx_v_i;
      goto __pyx_L0;
    }
  }

  /* "pyzoltan/core/carray.pyx":820
 *             if self.data[i] == value:
 *                 return i
 *         return -1             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, unsigned int value):
 */
  __pyx_r = -1;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":813
 *         self.data[idx] = value
 * 
 *     cpdef long index(self, unsigned int value):             # <<<<<<<<<<<<<<
 *         """Returns the index at which value is in self, else -1.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("pyzoltan.core.carray.UIntArray.index", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_9index(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_8index[] = "UIntArray.index(self, unsigned int value) -> long\nReturns the index at which value is in self, else -1.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_9index(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  unsigned int __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("index (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __Pyx_PyInt_As_unsigned_int(__pyx_arg_value); if (unlikely((__pyx_v_value == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_8index(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self), ((unsigned int)__pyx_v_value));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_8index(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, unsigned int __pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("index", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_f_8pyzoltan_4core_6carray_9UIntArray_index(__pyx_v_self, __pyx_v_value, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.UIntArray.index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":822
 *         return -1
 * 
 *     def __contains__(self, unsigned int value):             # <<<<<<<<<<<<<<
 *         """Returns True if value is in self.
 *         """
 */

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_9UIntArray_11__contains__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_10__contains__[] = "Returns True if value is in self.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_8pyzoltan_4core_6carray_9UIntArray_10__contains__;
#endif
static int __pyx_pw_8pyzoltan_4core_6carray_9UIntArray_11__contains__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  unsigned int __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __Pyx_PyInt_As_unsigned_int(__pyx_arg_value); if (unlikely((__pyx_v_value == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_10__contains__(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self), ((unsigned int)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_10__contains__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, unsigned int __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "pyzoltan/core/carray.pyx":825
 *         """Returns True if value is in self.
 *         """
 *         return (self.index(value) >= 0)             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */
  __pyx_r = (((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->index(__pyx_v_self, __pyx_v_value, 0) >= 0);
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":822
 *         return -1
 * 
 *     def __contains__(self, unsigned int value):             # <<<<<<<<<<<<<<
 *         """Returns True if value is in self.
 *         """
 */

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

/* "pyzoltan/core/carray.pyx":827
 *         return (self.index(value) >= 0)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         """Implemented to facilitate pickling.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_13__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_12__reduce__[] = "UIntArray.__reduce__(self)\nImplemented to facilitate pickling.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_13__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_12__reduce__(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_12__reduce__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self) {
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce__", 0);

  /* "pyzoltan/core/carray.pyx":830
 *         """Implemented to facilitate pickling.
 *         """
 *         d = {}             # <<<<<<<<<<<<<<
 *         d['data'] = self.get_npy_array()
 * 
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_d = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":831
 *         """
 *         d = {}
 *         d['data'] = self.get_npy_array()             # <<<<<<<<<<<<<<
 * 
 *         return (UIntArray, (), d)
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_npy_array(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyDict_SetItem(__pyx_v_d, __pyx_n_s_data, __pyx_t_1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":833
 *         d['data'] = self.get_npy_array()
 * 
 *         return (UIntArray, (), d)             # <<<<<<<<<<<<<<
 * 
 *     def __setstate__(self, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_8pyzoltan_4core_6carray_UIntArray)));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_8pyzoltan_4core_6carray_UIntArray)));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_8pyzoltan_4core_6carray_UIntArray)));
  __Pyx_INCREF(__pyx_empty_tuple);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_empty_tuple);
  __Pyx_GIVEREF(__pyx_empty_tuple);
  __Pyx_INCREF(__pyx_v_d);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_d);
  __Pyx_GIVEREF(__pyx_v_d);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":827
 *         return (self.index(value) >= 0)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         """Implemented to facilitate pickling.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":835
 *         return (UIntArray, (), d)
 * 
 *     def __setstate__(self, d):             # <<<<<<<<<<<<<<
 *         """Load the carray from the dictionary d.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_15__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_d); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_14__setstate__[] = "UIntArray.__setstate__(self, d)\nLoad the carray from the dictionary d.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_15__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_14__setstate__(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self), ((PyObject *)__pyx_v_d));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_14__setstate__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, PyObject *__pyx_v_d) {
  PyArrayObject *__pyx_v_arr = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  long __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate__", 0);

  /* "pyzoltan/core/carray.pyx":838
 *         """Load the carray from the dictionary d.
 *         """
 *         cdef np.ndarray arr = d['data']             # <<<<<<<<<<<<<<
 *         self.resize(arr.size)
 *         self.set_data(arr)
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_s_data); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_arr = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":839
 *         """
 *         cdef np.ndarray arr = d['data']
 *         self.resize(arr.size)             # <<<<<<<<<<<<<<
 *         self.set_data(arr)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_arr), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.resize(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":840
 *         cdef np.ndarray arr = d['data']
 *         self.resize(arr.size)
 *         self.set_data(arr)             # <<<<<<<<<<<<<<
 * 
 *     cdef _setup_npy_array(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_data(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_arr, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":835
 *         return (UIntArray, (), d)
 * 
 *     def __setstate__(self, d):             # <<<<<<<<<<<<<<
 *         """Load the carray from the dictionary d.
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_arr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":842
 *         self.set_data(arr)
 * 
 *     cdef _setup_npy_array(self):             # <<<<<<<<<<<<<<
 *         """Create the numpy array.
 *         """
 */

static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray__setup_npy_array(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self) {
  int __pyx_v_nd;
  npy_intp __pyx_v_dims;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setup_npy_array", 0);

  /* "pyzoltan/core/carray.pyx":845
 *         """Create the numpy array.
 *         """
 *         cdef int nd = 1             # <<<<<<<<<<<<<<
 *         cdef np.npy_intp dims = self.length
 * 
 */
  __pyx_v_nd = 1;

  /* "pyzoltan/core/carray.pyx":846
 *         """
 *         cdef int nd = 1
 *         cdef np.npy_intp dims = self.length             # <<<<<<<<<<<<<<
 * 
 *         self._npy_array = PyArray_SimpleNewFromData(
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  __pyx_v_dims = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":848
 *         cdef np.npy_intp dims = self.length
 * 
 *         self._npy_array = PyArray_SimpleNewFromData(             # <<<<<<<<<<<<<<
 *             nd, &dims, NPY_UINT, self.data
 *         )
 */
  __pyx_t_2 = ((PyObject *)PyArray_SimpleNewFromData(__pyx_v_nd, (&__pyx_v_dims), NPY_UINT, __pyx_v_self->data)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base._npy_array);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base._npy_array));
  __pyx_v_self->__pyx_base._npy_array = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyzoltan/core/carray.pyx":842
 *         self.set_data(arr)
 * 
 *     cdef _setup_npy_array(self):             # <<<<<<<<<<<<<<
 *         """Create the numpy array.
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray._setup_npy_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":853
 * 
 * 
 *     cdef void c_align_array(self, LongArray new_indices) nogil:             # <<<<<<<<<<<<<<
 *         """Rearrange the array contents according to the new indices.
 *         """
 */

static void __pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_align_array(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_new_indices) {
  long __pyx_v_i;
  long __pyx_v_length;
  long __pyx_v_n_bytes;
  unsigned int *__pyx_v_temp;
  long __pyx_t_1;
  long __pyx_t_2;
  int __pyx_t_3;

  /* "pyzoltan/core/carray.pyx":858
 * 
 *         cdef long i
 *         cdef long length = self.length             # <<<<<<<<<<<<<<
 *         cdef long n_bytes
 *         cdef unsigned int *temp
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  __pyx_v_length = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":862
 *         cdef unsigned int *temp
 * 
 *         n_bytes = sizeof(unsigned int)*length             # <<<<<<<<<<<<<<
 *         temp = <unsigned int*>aligned_malloc(n_bytes)
 * 
 */
  __pyx_v_n_bytes = ((sizeof(unsigned int)) * __pyx_v_length);

  /* "pyzoltan/core/carray.pyx":863
 * 
 *         n_bytes = sizeof(unsigned int)*length
 *         temp = <unsigned int*>aligned_malloc(n_bytes)             # <<<<<<<<<<<<<<
 * 
 *         memcpy(<void*>temp, <void*>self.data, n_bytes)
 */
  __pyx_v_temp = ((unsigned int *)__pyx_f_8pyzoltan_4core_6carray_aligned_malloc(__pyx_v_n_bytes));

  /* "pyzoltan/core/carray.pyx":865
 *         temp = <unsigned int*>aligned_malloc(n_bytes)
 * 
 *         memcpy(<void*>temp, <void*>self.data, n_bytes)             # <<<<<<<<<<<<<<
 * 
 *         # copy the data from the resized portion to the actual positions.
 */
  memcpy(((void *)__pyx_v_temp), ((void *)__pyx_v_self->data), __pyx_v_n_bytes);

  /* "pyzoltan/core/carray.pyx":868
 * 
 *         # copy the data from the resized portion to the actual positions.
 *         for i in range(length):             # <<<<<<<<<<<<<<
 *             if i != new_indices.data[i]:
 *                 self.data[i] = temp[new_indices.data[i]]
 */
  __pyx_t_1 = __pyx_v_length;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "pyzoltan/core/carray.pyx":869
 *         # copy the data from the resized portion to the actual positions.
 *         for i in range(length):
 *             if i != new_indices.data[i]:             # <<<<<<<<<<<<<<
 *                 self.data[i] = temp[new_indices.data[i]]
 * 
 */
    __pyx_t_3 = ((__pyx_v_i != (__pyx_v_new_indices->data[__pyx_v_i])) != 0);
    if (__pyx_t_3) {

      /* "pyzoltan/core/carray.pyx":870
 *         for i in range(length):
 *             if i != new_indices.data[i]:
 *                 self.data[i] = temp[new_indices.data[i]]             # <<<<<<<<<<<<<<
 * 
 *         aligned_free(<void*>temp)
 */
      (__pyx_v_self->data[__pyx_v_i]) = (__pyx_v_temp[(__pyx_v_new_indices->data[__pyx_v_i])]);
      goto __pyx_L5;
    }
    __pyx_L5:;
  }

  /* "pyzoltan/core/carray.pyx":872
 *                 self.data[i] = temp[new_indices.data[i]]
 * 
 *         aligned_free(<void*>temp)             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_append(self, unsigned int value) nogil:
 */
  __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_temp));

  /* "pyzoltan/core/carray.pyx":853
 * 
 * 
 *     cdef void c_align_array(self, LongArray new_indices) nogil:             # <<<<<<<<<<<<<<
 *         """Rearrange the array contents according to the new indices.
 *         """
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":874
 *         aligned_free(<void*>temp)
 * 
 *     cdef void c_append(self, unsigned int value) nogil:             # <<<<<<<<<<<<<<
 *         cdef long l = self.length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 */

static void __pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_append(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, unsigned int __pyx_v_value) {
  long __pyx_v_l;
  PyArrayObject *__pyx_v_arr;
  long __pyx_t_1;
  int __pyx_t_2;

  /* "pyzoltan/core/carray.pyx":875
 * 
 *     cdef void c_append(self, unsigned int value) nogil:
 *         cdef long l = self.length             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  __pyx_v_l = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":876
 *     cdef void c_append(self, unsigned int value) nogil:
 *         cdef long l = self.length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 * 
 *         if l >= self.alloc:
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":878
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 *         if l >= self.alloc:             # <<<<<<<<<<<<<<
 *             self.c_reserve(l*2)
 *         self.data[l] = value
 */
  __pyx_t_2 = ((__pyx_v_l >= __pyx_v_self->__pyx_base.alloc) != 0);
  if (__pyx_t_2) {

    /* "pyzoltan/core/carray.pyx":879
 * 
 *         if l >= self.alloc:
 *             self.c_reserve(l*2)             # <<<<<<<<<<<<<<
 *         self.data[l] = value
 *         self.length += 1
 */
    ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), (__pyx_v_l * 2));
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":880
 *         if l >= self.alloc:
 *             self.c_reserve(l*2)
 *         self.data[l] = value             # <<<<<<<<<<<<<<
 *         self.length += 1
 * 
 */
  (__pyx_v_self->data[__pyx_v_l]) = __pyx_v_value;

  /* "pyzoltan/core/carray.pyx":881
 *             self.c_reserve(l*2)
 *         self.data[l] = value
 *         self.length += 1             # <<<<<<<<<<<<<<
 * 
 *         # update the numpy arrays length
 */
  __pyx_v_self->__pyx_base.length = (__pyx_v_self->__pyx_base.length + 1);

  /* "pyzoltan/core/carray.pyx":884
 * 
 *         # update the numpy arrays length
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_reserve(self, long size) nogil:
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":874
 *         aligned_free(<void*>temp)
 * 
 *     cdef void c_append(self, unsigned int value) nogil:             # <<<<<<<<<<<<<<
 *         cdef long l = self.length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":886
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_reserve(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 */

static void __pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_reserve(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_size) {
  PyArrayObject *__pyx_v_arr;
  void *__pyx_v_data;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("c_reserve", 0);
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  /*try:*/ {

    /* "pyzoltan/core/carray.pyx":887
 * 
 *     cdef void c_reserve(self, long size) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         cdef void* data = NULL
 *         if size > self.alloc:
 */
    __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

    /* "pyzoltan/core/carray.pyx":888
 *     cdef void c_reserve(self, long size) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL             # <<<<<<<<<<<<<<
 *         if size > self.alloc:
 *             data = <unsigned int*>aligned_realloc(
 */
    __pyx_v_data = NULL;

    /* "pyzoltan/core/carray.pyx":889
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 *         if size > self.alloc:             # <<<<<<<<<<<<<<
 *             data = <unsigned int*>aligned_realloc(
 *                 self.data, size*sizeof(unsigned int),
 */
    __pyx_t_1 = ((__pyx_v_size > __pyx_v_self->__pyx_base.alloc) != 0);
    if (__pyx_t_1) {

      /* "pyzoltan/core/carray.pyx":890
 *         cdef void* data = NULL
 *         if size > self.alloc:
 *             data = <unsigned int*>aligned_realloc(             # <<<<<<<<<<<<<<
 *                 self.data, size*sizeof(unsigned int),
 *                 self.alloc*sizeof(unsigned int)
 */
      __pyx_v_data = ((unsigned int *)__pyx_f_8pyzoltan_4core_6carray_aligned_realloc(__pyx_v_self->data, (__pyx_v_size * (sizeof(unsigned int))), (__pyx_v_self->__pyx_base.alloc * (sizeof(unsigned int)))));

      /* "pyzoltan/core/carray.pyx":895
 *             )
 * 
 *             if data == NULL:             # <<<<<<<<<<<<<<
 *                 aligned_free(<void*>self.data)
 *                 with gil:
 */
      __pyx_t_1 = ((__pyx_v_data == NULL) != 0);
      if (__pyx_t_1) {

        /* "pyzoltan/core/carray.pyx":896
 * 
 *             if data == NULL:
 *                 aligned_free(<void*>self.data)             # <<<<<<<<<<<<<<
 *                 with gil:
 *                     raise MemoryError
 */
        __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_self->data));

        /* "pyzoltan/core/carray.pyx":897
 *             if data == NULL:
 *                 aligned_free(<void*>self.data)
 *                 with gil:             # <<<<<<<<<<<<<<
 *                     raise MemoryError
 * 
 */
        {
            #ifdef WITH_THREAD
            PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
            #endif
            /*try:*/ {

              /* "pyzoltan/core/carray.pyx":898
 *                 aligned_free(<void*>self.data)
 *                 with gil:
 *                     raise MemoryError             # <<<<<<<<<<<<<<
 * 
 *             self.data = <unsigned int*>data
 */
              PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
            }

            /* "pyzoltan/core/carray.pyx":897
 *             if data == NULL:
 *                 aligned_free(<void*>self.data)
 *                 with gil:             # <<<<<<<<<<<<<<
 *                     raise MemoryError
 * 
 */
            /*finally:*/ {
              __pyx_L9_error: {
                #ifdef WITH_THREAD
                PyGILState_Release(__pyx_gilstate_save);
                #endif
                goto __pyx_L4_error;
              }
            }
        }
      }

      /* "pyzoltan/core/carray.pyx":900
 *                     raise MemoryError
 * 
 *             self.data = <unsigned int*>data             # <<<<<<<<<<<<<<
 *             self.alloc = size
 *             arr.data = <char *>self.data
 */
      __pyx_v_self->data = ((unsigned int *)__pyx_v_data);

      /* "pyzoltan/core/carray.pyx":901
 * 
 *             self.data = <unsigned int*>data
 *             self.alloc = size             # <<<<<<<<<<<<<<
 *             arr.data = <char *>self.data
 * 
 */
      __pyx_v_self->__pyx_base.alloc = __pyx_v_size;

      /* "pyzoltan/core/carray.pyx":902
 *             self.data = <unsigned int*>data
 *             self.alloc = size
 *             arr.data = <char *>self.data             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_reset(self) nogil:
 */
      __pyx_v_arr->data = ((char *)__pyx_v_self->data);
      goto __pyx_L6;
    }
    __pyx_L6:;
  }

  /* "pyzoltan/core/carray.pyx":887
 * 
 *     cdef void c_reserve(self, long size) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         cdef void* data = NULL
 *         if size > self.alloc:
 */
  /*finally:*/ {
    /*normal exit:*/{
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L5;
    }
    __pyx_L4_error: {
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "pyzoltan/core/carray.pyx":886
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_reserve(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pyzoltan.core.carray.UIntArray.c_reserve", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "pyzoltan/core/carray.pyx":904
 *             arr.data = <char *>self.data
 * 
 *     cdef void c_reset(self) nogil:             # <<<<<<<<<<<<<<
 *         BaseArray.c_reset(self)
 *         if self._old_data != NULL:
 */

static void __pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_reset(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self) {
  int __pyx_t_1;
  unsigned int *__pyx_t_2;

  /* "pyzoltan/core/carray.pyx":905
 * 
 *     cdef void c_reset(self) nogil:
 *         BaseArray.c_reset(self)             # <<<<<<<<<<<<<<
 *         if self._old_data != NULL:
 *             self.data = self._old_data
 */
  __pyx_f_8pyzoltan_4core_6carray_9BaseArray_c_reset(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

  /* "pyzoltan/core/carray.pyx":906
 *     cdef void c_reset(self) nogil:
 *         BaseArray.c_reset(self)
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             self.data = self._old_data
 *             self._old_data = NULL
 */
  __pyx_t_1 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":907
 *         BaseArray.c_reset(self)
 *         if self._old_data != NULL:
 *             self.data = self._old_data             # <<<<<<<<<<<<<<
 *             self._old_data = NULL
 *             self._npy_array.data = <char *>self.data
 */
    __pyx_t_2 = __pyx_v_self->_old_data;
    __pyx_v_self->data = __pyx_t_2;

    /* "pyzoltan/core/carray.pyx":908
 *         if self._old_data != NULL:
 *             self.data = self._old_data
 *             self._old_data = NULL             # <<<<<<<<<<<<<<
 *             self._npy_array.data = <char *>self.data
 * 
 */
    __pyx_v_self->_old_data = NULL;

    /* "pyzoltan/core/carray.pyx":909
 *             self.data = self._old_data
 *             self._old_data = NULL
 *             self._npy_array.data = <char *>self.data             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_resize(self, long size) nogil:
 */
    __pyx_v_self->__pyx_base._npy_array->data = ((char *)__pyx_v_self->data);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":904
 *             arr.data = <char *>self.data
 * 
 *     cdef void c_reset(self) nogil:             # <<<<<<<<<<<<<<
 *         BaseArray.c_reset(self)
 *         if self._old_data != NULL:
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":911
 *             self._npy_array.data = <char *>self.data
 * 
 *     cdef void c_resize(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 */

static void __pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_resize(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_size) {
  PyArrayObject *__pyx_v_arr;
  long __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":912
 * 
 *     cdef void c_resize(self, long size) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 * 
 *         # reserve memory
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":915
 * 
 *         # reserve memory
 *         self.c_reserve(size)             # <<<<<<<<<<<<<<
 * 
 *         # update the lengths
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_size);

  /* "pyzoltan/core/carray.pyx":918
 * 
 *         # update the lengths
 *         self.length = size             # <<<<<<<<<<<<<<
 *         arr.dimensions[0] = self.length
 * 
 */
  __pyx_v_self->__pyx_base.length = __pyx_v_size;

  /* "pyzoltan/core/carray.pyx":919
 *         # update the lengths
 *         self.length = size
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_set_view(self, unsigned int *array, long length) nogil:
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":911
 *             self._npy_array.data = <char *>self.data
 * 
 *     cdef void c_resize(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":921
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_set_view(self, unsigned int *array, long length) nogil:             # <<<<<<<<<<<<<<
 *         """Create a view of a given raw data pointer with given length.
 *         """
 */

static void __pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_set_view(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, unsigned int *__pyx_v_array, long __pyx_v_length) {
  PyArrayObject *__pyx_v_arr;
  int __pyx_t_1;
  unsigned int *__pyx_t_2;
  long __pyx_t_3;

  /* "pyzoltan/core/carray.pyx":924
 *         """Create a view of a given raw data pointer with given length.
 *         """
 *         if self._old_data == NULL:             # <<<<<<<<<<<<<<
 *             self._old_data = self.data
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->_old_data == NULL) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":925
 *         """
 *         if self._old_data == NULL:
 *             self._old_data = self.data             # <<<<<<<<<<<<<<
 * 
 *         self.data = array
 */
    __pyx_t_2 = __pyx_v_self->data;
    __pyx_v_self->_old_data = __pyx_t_2;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":927
 *             self._old_data = self.data
 * 
 *         self.data = array             # <<<<<<<<<<<<<<
 *         self.length = length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 */
  __pyx_v_self->data = __pyx_v_array;

  /* "pyzoltan/core/carray.pyx":928
 * 
 *         self.data = array
 *         self.length = length             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data
 */
  __pyx_v_self->__pyx_base.length = __pyx_v_length;

  /* "pyzoltan/core/carray.pyx":929
 *         self.data = array
 *         self.length = length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         arr.data = <char *>self.data
 *         arr.dimensions[0] = self.length
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":930
 *         self.length = length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data             # <<<<<<<<<<<<<<
 *         arr.dimensions[0] = self.length
 * 
 */
  __pyx_v_arr->data = ((char *)__pyx_v_self->data);

  /* "pyzoltan/core/carray.pyx":931
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_squeeze(self) nogil:
 */
  __pyx_t_3 = __pyx_v_self->__pyx_base.length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_3;

  /* "pyzoltan/core/carray.pyx":921
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_set_view(self, unsigned int *array, long length) nogil:             # <<<<<<<<<<<<<<
 *         """Create a view of a given raw data pointer with given length.
 *         """
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":933
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_squeeze(self) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 */

static void __pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self) {
  PyArrayObject *__pyx_v_arr;
  void *__pyx_v_data;
  size_t __pyx_v_size;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  long __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("c_squeeze", 0);
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  /*try:*/ {

    /* "pyzoltan/core/carray.pyx":934
 * 
 *     cdef void c_squeeze(self) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         cdef void* data = NULL
 *         cdef size_t size = max(self.length, 16)
 */
    __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

    /* "pyzoltan/core/carray.pyx":935
 *     cdef void c_squeeze(self) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL             # <<<<<<<<<<<<<<
 *         cdef size_t size = max(self.length, 16)
 *         data = <unsigned int*>aligned_realloc(
 */
    __pyx_v_data = NULL;

    /* "pyzoltan/core/carray.pyx":936
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 *         cdef size_t size = max(self.length, 16)             # <<<<<<<<<<<<<<
 *         data = <unsigned int*>aligned_realloc(
 *             self.data, size*sizeof(unsigned int),
 */
    __pyx_t_1 = 16;
    __pyx_t_2 = __pyx_v_self->__pyx_base.length;
    if (((__pyx_t_1 > __pyx_t_2) != 0)) {
      __pyx_t_3 = __pyx_t_1;
    } else {
      __pyx_t_3 = __pyx_t_2;
    }
    __pyx_v_size = __pyx_t_3;

    /* "pyzoltan/core/carray.pyx":937
 *         cdef void* data = NULL
 *         cdef size_t size = max(self.length, 16)
 *         data = <unsigned int*>aligned_realloc(             # <<<<<<<<<<<<<<
 *             self.data, size*sizeof(unsigned int),
 *             self.alloc*sizeof(unsigned int)
 */
    __pyx_v_data = ((unsigned int *)__pyx_f_8pyzoltan_4core_6carray_aligned_realloc(__pyx_v_self->data, (__pyx_v_size * (sizeof(unsigned int))), (__pyx_v_self->__pyx_base.alloc * (sizeof(unsigned int)))));

    /* "pyzoltan/core/carray.pyx":942
 *         )
 * 
 *         if data == NULL:             # <<<<<<<<<<<<<<
 *             # free original data
 *             aligned_free(<void*>self.data)
 */
    __pyx_t_4 = ((__pyx_v_data == NULL) != 0);
    if (__pyx_t_4) {

      /* "pyzoltan/core/carray.pyx":944
 *         if data == NULL:
 *             # free original data
 *             aligned_free(<void*>self.data)             # <<<<<<<<<<<<<<
 *             with gil:
 *                 raise MemoryError
 */
      __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_self->data));

      /* "pyzoltan/core/carray.pyx":945
 *             # free original data
 *             aligned_free(<void*>self.data)
 *             with gil:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 * 
 */
      {
          #ifdef WITH_THREAD
          PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
          #endif
          /*try:*/ {

            /* "pyzoltan/core/carray.pyx":946
 *             aligned_free(<void*>self.data)
 *             with gil:
 *                 raise MemoryError             # <<<<<<<<<<<<<<
 * 
 *         self.data = <unsigned int*>data
 */
            PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          }

          /* "pyzoltan/core/carray.pyx":945
 *             # free original data
 *             aligned_free(<void*>self.data)
 *             with gil:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 * 
 */
          /*finally:*/ {
            __pyx_L8_error: {
              #ifdef WITH_THREAD
              PyGILState_Release(__pyx_gilstate_save);
              #endif
              goto __pyx_L4_error;
            }
          }
      }
    }

    /* "pyzoltan/core/carray.pyx":948
 *                 raise MemoryError
 * 
 *         self.data = <unsigned int*>data             # <<<<<<<<<<<<<<
 *         self.alloc = size
 *         arr.data = <char *>self.data
 */
    __pyx_v_self->data = ((unsigned int *)__pyx_v_data);

    /* "pyzoltan/core/carray.pyx":949
 * 
 *         self.data = <unsigned int*>data
 *         self.alloc = size             # <<<<<<<<<<<<<<
 *         arr.data = <char *>self.data
 * 
 */
    __pyx_v_self->__pyx_base.alloc = __pyx_v_size;

    /* "pyzoltan/core/carray.pyx":950
 *         self.data = <unsigned int*>data
 *         self.alloc = size
 *         arr.data = <char *>self.data             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_arr->data = ((char *)__pyx_v_self->data);
  }

  /* "pyzoltan/core/carray.pyx":934
 * 
 *     cdef void c_squeeze(self) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         cdef void* data = NULL
 *         cdef size_t size = max(self.length, 16)
 */
  /*finally:*/ {
    /*normal exit:*/{
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L5;
    }
    __pyx_L4_error: {
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "pyzoltan/core/carray.pyx":933
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_squeeze(self) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pyzoltan.core.carray.UIntArray.c_squeeze", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "pyzoltan/core/carray.pyx":953
 * 
 * 
 *     cpdef str get_c_type(self):             # <<<<<<<<<<<<<<
 *         """Return the c data type for this array as a string.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_17get_c_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_get_c_type(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, int __pyx_skip_dispatch) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_c_type", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_c_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_17get_c_type)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":956
 *         """Return the c data type for this array as a string.
 *         """
 *         return 'unsigned int'             # <<<<<<<<<<<<<<
 * 
 *     cdef unsigned int* get_data_ptr(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_kp_s_unsigned_int);
  __pyx_r = __pyx_kp_s_unsigned_int;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":953
 * 
 * 
 *     cpdef str get_c_type(self):             # <<<<<<<<<<<<<<
 *         """Return the c data type for this array as a string.
 *         """
 */

  /* 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("pyzoltan.core.carray.UIntArray.get_c_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_17get_c_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_16get_c_type[] = "UIntArray.get_c_type(self) -> str\nReturn the c data type for this array as a string.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_17get_c_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_c_type (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_16get_c_type(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_16get_c_type(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_c_type", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9UIntArray_get_c_type(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.UIntArray.get_c_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":958
 *         return 'unsigned int'
 * 
 *     cdef unsigned int* get_data_ptr(self):             # <<<<<<<<<<<<<<
 *         """Return the internal data pointer.
 *         """
 */

static unsigned int *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_get_data_ptr(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self) {
  unsigned int *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_data_ptr", 0);

  /* "pyzoltan/core/carray.pyx":961
 *         """Return the internal data pointer.
 *         """
 *         return self.data             # <<<<<<<<<<<<<<
 * 
 *     cpdef unsigned int get(self, long idx):
 */
  __pyx_r = __pyx_v_self->data;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":958
 *         return 'unsigned int'
 * 
 *     cdef unsigned int* get_data_ptr(self):             # <<<<<<<<<<<<<<
 *         """Return the internal data pointer.
 *         """
 */

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

/* "pyzoltan/core/carray.pyx":963
 *         return self.data
 * 
 *     cpdef unsigned int get(self, long idx):             # <<<<<<<<<<<<<<
 *         """Gets value stored at position `idx`.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_19get(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx); /*proto*/
static unsigned int __pyx_f_8pyzoltan_4core_6carray_9UIntArray_get(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_idx, int __pyx_skip_dispatch) {
  unsigned 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 = NULL;
  PyObject *__pyx_t_6 = NULL;
  unsigned int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_19get)) {
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_idx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __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;
      __pyx_t_7 = __Pyx_PyInt_As_unsigned_int(__pyx_t_2); if (unlikely((__pyx_t_7 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_7;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":966
 *         """Gets value stored at position `idx`.
 *         """
 *         return self.data[idx]             # <<<<<<<<<<<<<<
 * 
 *     cpdef set(self, long idx, unsigned int value):
 */
  __pyx_r = (__pyx_v_self->data[__pyx_v_idx]);
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":963
 *         return self.data
 * 
 *     cpdef unsigned int get(self, long idx):             # <<<<<<<<<<<<<<
 *         """Gets value stored at position `idx`.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("pyzoltan.core.carray.UIntArray.get", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_19get(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_18get[] = "UIntArray.get(self, long idx) -> unsigned int\nGets value stored at position `idx`.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_19get(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx) {
  long __pyx_v_idx;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  assert(__pyx_arg_idx); {
    __pyx_v_idx = __Pyx_PyInt_As_long(__pyx_arg_idx); if (unlikely((__pyx_v_idx == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_18get(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self), ((long)__pyx_v_idx));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_18get(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_idx) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_f_8pyzoltan_4core_6carray_9UIntArray_get(__pyx_v_self, __pyx_v_idx, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.UIntArray.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":968
 *         return self.data[idx]
 * 
 *     cpdef set(self, long idx, unsigned int value):             # <<<<<<<<<<<<<<
 *         """Sets location `idx` to `value`.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_21set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_set(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_idx, unsigned int __pyx_v_value, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_21set)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_idx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      }
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":971
 *         """Sets location `idx` to `value`.
 *         """
 *         self.data[idx] = value             # <<<<<<<<<<<<<<
 * 
 *     cpdef append(self, unsigned int value):
 */
  (__pyx_v_self->data[__pyx_v_idx]) = __pyx_v_value;

  /* "pyzoltan/core/carray.pyx":968
 *         return self.data[idx]
 * 
 *     cpdef set(self, long idx, unsigned int value):             # <<<<<<<<<<<<<<
 *         """Sets location `idx` to `value`.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_21set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_20set[] = "UIntArray.set(self, long idx, unsigned int value)\nSets location `idx` to `value`.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_21set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_idx;
  unsigned int __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idx,&__pyx_n_s_value,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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_idx)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __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_idx = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_idx == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_value = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_value == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_20set(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self), __pyx_v_idx, __pyx_v_value);

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_20set(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_idx, unsigned int __pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9UIntArray_set(__pyx_v_self, __pyx_v_idx, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.UIntArray.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":973
 *         self.data[idx] = value
 * 
 *     cpdef append(self, unsigned int value):             # <<<<<<<<<<<<<<
 *         """Appends `value` to the end of the array.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_23append(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_append(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, unsigned int __pyx_v_value, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_append); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_23append)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __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;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":976
 *         """Appends `value` to the end of the array.
 *         """
 *         self.c_append(value)             # <<<<<<<<<<<<<<
 * 
 *     cpdef reserve(self, long size):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->c_append(__pyx_v_self, __pyx_v_value);

  /* "pyzoltan/core/carray.pyx":973
 *         self.data[idx] = value
 * 
 *     cpdef append(self, unsigned int value):             # <<<<<<<<<<<<<<
 *         """Appends `value` to the end of the array.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_23append(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_22append[] = "UIntArray.append(self, unsigned int value)\nAppends `value` to the end of the array.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_23append(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  unsigned int __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __Pyx_PyInt_As_unsigned_int(__pyx_arg_value); if (unlikely((__pyx_v_value == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_22append(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self), ((unsigned int)__pyx_v_value));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_22append(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, unsigned int __pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9UIntArray_append(__pyx_v_self, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.UIntArray.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":978
 *         self.c_append(value)
 * 
 *     cpdef reserve(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes the internal data to ``size*sizeof(unsigned int)`` bytes.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_25reserve(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_reserve(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_size, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reserve", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reserve); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_25reserve)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __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;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":981
 *         """Resizes the internal data to ``size*sizeof(unsigned int)`` bytes.
 *         """
 *         self.c_reserve(size)             # <<<<<<<<<<<<<<
 * 
 *     cpdef reset(self):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_size);

  /* "pyzoltan/core/carray.pyx":978
 *         self.c_append(value)
 * 
 *     cpdef reserve(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes the internal data to ``size*sizeof(unsigned int)`` bytes.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_25reserve(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_24reserve[] = "UIntArray.reserve(self, long size)\nResizes the internal data to ``size*sizeof(unsigned int)`` bytes.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_25reserve(PyObject *__pyx_v_self, PyObject *__pyx_arg_size) {
  long __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reserve (wrapper)", 0);
  assert(__pyx_arg_size); {
    __pyx_v_size = __Pyx_PyInt_As_long(__pyx_arg_size); if (unlikely((__pyx_v_size == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_24reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self), ((long)__pyx_v_size));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_24reserve(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reserve", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9UIntArray_reserve(__pyx_v_self, __pyx_v_size, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.UIntArray.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":983
 *         self.c_reserve(size)
 * 
 *     cpdef reset(self):             # <<<<<<<<<<<<<<
 *         """Reset the length of the array to 0.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_27reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_reset(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, int __pyx_skip_dispatch) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reset", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_27reset)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":986
 *         """Reset the length of the array to 0.
 *         """
 *         self.c_reset()             # <<<<<<<<<<<<<<
 *         if self._old_data != NULL:
 *             self._parent = None
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_reset(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

  /* "pyzoltan/core/carray.pyx":987
 *         """
 *         self.c_reset()
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             self._parent = None
 * 
 */
  __pyx_t_5 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_5) {

    /* "pyzoltan/core/carray.pyx":988
 *         self.c_reset()
 *         if self._old_data != NULL:
 *             self._parent = None             # <<<<<<<<<<<<<<
 * 
 *     cpdef resize(self, long size):
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_parent);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_parent));
    __pyx_v_self->_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)Py_None);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":983
 *         self.c_reserve(size)
 * 
 *     cpdef reset(self):             # <<<<<<<<<<<<<<
 *         """Reset the length of the array to 0.
 *         """
 */

  /* 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("pyzoltan.core.carray.UIntArray.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_27reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_26reset[] = "UIntArray.reset(self)\nReset the length of the array to 0.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_27reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_26reset(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_26reset(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reset", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9UIntArray_reset(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.UIntArray.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":990
 *             self._parent = None
 * 
 *     cpdef resize(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes internal data to ``size*sizeof(unsigned int)`` bytes
 *         and sets the length to the new size.
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_29resize(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_resize(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_size, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resize", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_resize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_29resize)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __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;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":995
 * 
 *         """
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             raise RuntimeError('Cannot reize array which is a view.')
 * 
 */
  __pyx_t_7 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_7) {

    /* "pyzoltan/core/carray.pyx":996
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot reize array which is a view.')             # <<<<<<<<<<<<<<
 * 
 *         self.c_resize(size)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":998
 *             raise RuntimeError('Cannot reize array which is a view.')
 * 
 *         self.c_resize(size)             # <<<<<<<<<<<<<<
 * 
 *     cpdef set_view(self, UIntArray parent, long start, long end):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_resize(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_size);

  /* "pyzoltan/core/carray.pyx":990
 *             self._parent = None
 * 
 *     cpdef resize(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes internal data to ``size*sizeof(unsigned int)`` bytes
 *         and sets the length to the new size.
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_29resize(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_28resize[] = "UIntArray.resize(self, long size)\nResizes internal data to ``size*sizeof(unsigned int)`` bytes\n        and sets the length to the new size.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_29resize(PyObject *__pyx_v_self, PyObject *__pyx_arg_size) {
  long __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resize (wrapper)", 0);
  assert(__pyx_arg_size); {
    __pyx_v_size = __Pyx_PyInt_As_long(__pyx_arg_size); if (unlikely((__pyx_v_size == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_28resize(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self), ((long)__pyx_v_size));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_28resize(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, long __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9UIntArray_resize(__pyx_v_self, __pyx_v_size, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.UIntArray.resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1000
 *         self.c_resize(size)
 * 
 *     cpdef set_view(self, UIntArray parent, long start, long end):             # <<<<<<<<<<<<<<
 *         """Create a view of a given a `parent` array from start to end.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_31set_view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_set_view(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_parent, long __pyx_v_start, long __pyx_v_end, int __pyx_skip_dispatch) {
  PyArrayObject *__pyx_v_arr;
  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;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  unsigned int *__pyx_t_11;
  long __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_view", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_view); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_31set_view)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_parent));
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, ((PyObject *)__pyx_v_parent));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_parent));
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1017
 * 
 *         """
 *         if self._parent is None:             # <<<<<<<<<<<<<<
 *             self._old_data = self.data
 *         self._parent = parent
 */
  __pyx_t_9 = (((PyObject *)__pyx_v_self->_parent) == Py_None);
  __pyx_t_10 = (__pyx_t_9 != 0);
  if (__pyx_t_10) {

    /* "pyzoltan/core/carray.pyx":1018
 *         """
 *         if self._parent is None:
 *             self._old_data = self.data             # <<<<<<<<<<<<<<
 *         self._parent = parent
 *         self.data = parent.data + start
 */
    __pyx_t_11 = __pyx_v_self->data;
    __pyx_v_self->_old_data = __pyx_t_11;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":1019
 *         if self._parent is None:
 *             self._old_data = self.data
 *         self._parent = parent             # <<<<<<<<<<<<<<
 *         self.data = parent.data + start
 *         self.length = end - start
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_parent));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_parent));
  __Pyx_GOTREF(__pyx_v_self->_parent);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_parent));
  __pyx_v_self->_parent = __pyx_v_parent;

  /* "pyzoltan/core/carray.pyx":1020
 *             self._old_data = self.data
 *         self._parent = parent
 *         self.data = parent.data + start             # <<<<<<<<<<<<<<
 *         self.length = end - start
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 */
  __pyx_v_self->data = (__pyx_v_parent->data + __pyx_v_start);

  /* "pyzoltan/core/carray.pyx":1021
 *         self._parent = parent
 *         self.data = parent.data + start
 *         self.length = end - start             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data
 */
  __pyx_v_self->__pyx_base.length = (__pyx_v_end - __pyx_v_start);

  /* "pyzoltan/core/carray.pyx":1022
 *         self.data = parent.data + start
 *         self.length = end - start
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         arr.data = <char *>self.data
 *         arr.dimensions[0] = self.length
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":1023
 *         self.length = end - start
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data             # <<<<<<<<<<<<<<
 *         arr.dimensions[0] = self.length
 * 
 */
  __pyx_v_arr->data = ((char *)__pyx_v_self->data);

  /* "pyzoltan/core/carray.pyx":1024
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cpdef squeeze(self):
 */
  __pyx_t_12 = __pyx_v_self->__pyx_base.length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_12;

  /* "pyzoltan/core/carray.pyx":1000
 *         self.c_resize(size)
 * 
 *     cpdef set_view(self, UIntArray parent, long start, long end):             # <<<<<<<<<<<<<<
 *         """Create a view of a given a `parent` array from start to end.
 * 
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.set_view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_31set_view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_30set_view[] = "UIntArray.set_view(self, UIntArray parent, long start, long end)\nCreate a view of a given a `parent` array from start to end.\n\n        Note that this excludes the end index.\n\n        Parameters\n        ----------\n\n        parent : UIntArray\n            The parent array of which this is a view.\n        start : long\n            The starting index to start the view from.\n        end : long\n            The ending index to end the view at, excludes the end\n            itself.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_31set_view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_parent = 0;
  long __pyx_v_start;
  long __pyx_v_end;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parent,&__pyx_n_s_start,&__pyx_n_s_end,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parent)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_view", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_view", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_view") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __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_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)values[0]);
    __pyx_v_start = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_start == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_end = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_end == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_view", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.set_view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_8pyzoltan_4core_6carray_UIntArray, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_30set_view(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self), __pyx_v_parent, __pyx_v_start, __pyx_v_end);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_30set_view(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_parent, long __pyx_v_start, long __pyx_v_end) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_view", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9UIntArray_set_view(__pyx_v_self, __pyx_v_parent, __pyx_v_start, __pyx_v_end, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.UIntArray.set_view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1026
 *         arr.dimensions[0] = self.length
 * 
 *     cpdef squeeze(self):             # <<<<<<<<<<<<<<
 *         """Release any unused memory.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_33squeeze(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, int __pyx_skip_dispatch) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("squeeze", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_squeeze); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_33squeeze)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1029
 *         """Release any unused memory.
 *         """
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             raise RuntimeError('Cannot squeeze array which is a view.')
 * 
 */
  __pyx_t_5 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_5) {

    /* "pyzoltan/core/carray.pyx":1030
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot squeeze array which is a view.')             # <<<<<<<<<<<<<<
 * 
 *         self.c_squeeze()
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":1032
 *             raise RuntimeError('Cannot squeeze array which is a view.')
 * 
 *         self.c_squeeze()             # <<<<<<<<<<<<<<
 * 
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=0):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_squeeze(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

  /* "pyzoltan/core/carray.pyx":1026
 *         arr.dimensions[0] = self.length
 * 
 *     cpdef squeeze(self):             # <<<<<<<<<<<<<<
 *         """Release any unused memory.
 *         """
 */

  /* 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("pyzoltan.core.carray.UIntArray.squeeze", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_33squeeze(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_32squeeze[] = "UIntArray.squeeze(self)\nRelease any unused memory.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_33squeeze(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("squeeze (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_32squeeze(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_32squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("squeeze", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9UIntArray_squeeze(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.UIntArray.squeeze", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1034
 *         self.c_squeeze()
 * 
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=0):             # <<<<<<<<<<<<<<
 *         """Remove the particles with indices in index_list.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_35remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_remove(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9UIntArray_remove *__pyx_optional_args) {
  int __pyx_v_input_sorted = ((int)0);
  long __pyx_v_i;
  long __pyx_v_inlength;
  PyArrayObject *__pyx_v_sorted_indices = 0;
  long __pyx_v_id;
  PyArrayObject *__pyx_v_arr;
  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;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  long __pyx_t_9;
  long __pyx_t_10;
  long __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_input_sorted = __pyx_optional_args->input_sorted;
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_35remove)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_input_sorted); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_6 = 1;
        }
      }
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_index_list));
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_index_list));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_index_list));
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1055
 * 
 *         """
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             raise RuntimeError('Cannot remove elements from view array.')
 *         cdef long i
 */
  __pyx_t_8 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_8) {

    /* "pyzoltan/core/carray.pyx":1056
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot remove elements from view array.')             # <<<<<<<<<<<<<<
 *         cdef long i
 *         cdef long inlength = index_list.size
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":1058
 *             raise RuntimeError('Cannot remove elements from view array.')
 *         cdef long i
 *         cdef long inlength = index_list.size             # <<<<<<<<<<<<<<
 *         cdef np.ndarray sorted_indices
 *         cdef long id
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_index_list), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_inlength = __pyx_t_9;

  /* "pyzoltan/core/carray.pyx":1061
 *         cdef np.ndarray sorted_indices
 *         cdef long id
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 * 
 *         if inlength > self.length:
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":1063
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 *         if inlength > self.length:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_8 = ((__pyx_v_inlength > __pyx_v_self->__pyx_base.length) != 0);
  if (__pyx_t_8) {

    /* "pyzoltan/core/carray.pyx":1064
 * 
 *         if inlength > self.length:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if input_sorted != 1:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "pyzoltan/core/carray.pyx":1066
 *             return
 * 
 *         if input_sorted != 1:             # <<<<<<<<<<<<<<
 *             sorted_indices = np.sort(index_list)
 *         else:
 */
  __pyx_t_8 = ((__pyx_v_input_sorted != 1) != 0);
  if (__pyx_t_8) {

    /* "pyzoltan/core/carray.pyx":1067
 * 
 *         if input_sorted != 1:
 *             sorted_indices = np.sort(index_list)             # <<<<<<<<<<<<<<
 *         else:
 *             sorted_indices = index_list
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sort); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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, ((PyObject *)__pyx_v_index_list)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(((PyObject *)__pyx_v_index_list));
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, ((PyObject *)__pyx_v_index_list));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_index_list));
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_sorted_indices = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pyzoltan/core/carray.pyx":1069
 *             sorted_indices = np.sort(index_list)
 *         else:
 *             sorted_indices = index_list             # <<<<<<<<<<<<<<
 * 
 *         for i in range(inlength):
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_index_list));
    __pyx_v_sorted_indices = __pyx_v_index_list;
  }
  __pyx_L5:;

  /* "pyzoltan/core/carray.pyx":1071
 *             sorted_indices = index_list
 * 
 *         for i in range(inlength):             # <<<<<<<<<<<<<<
 *             id = sorted_indices[inlength-(i+1)]
 *             if id < self.length:
 */
  __pyx_t_9 = __pyx_v_inlength;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_i = __pyx_t_10;

    /* "pyzoltan/core/carray.pyx":1072
 * 
 *         for i in range(inlength):
 *             id = sorted_indices[inlength-(i+1)]             # <<<<<<<<<<<<<<
 *             if id < self.length:
 *                 self.data[id] = self.data[self.length-1]
 */
    __pyx_t_11 = (__pyx_v_inlength - (__pyx_v_i + 1));
    __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_sorted_indices), __pyx_t_11, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_11 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_id = __pyx_t_11;

    /* "pyzoltan/core/carray.pyx":1073
 *         for i in range(inlength):
 *             id = sorted_indices[inlength-(i+1)]
 *             if id < self.length:             # <<<<<<<<<<<<<<
 *                 self.data[id] = self.data[self.length-1]
 *                 self.length = self.length - 1
 */
    __pyx_t_8 = ((__pyx_v_id < __pyx_v_self->__pyx_base.length) != 0);
    if (__pyx_t_8) {

      /* "pyzoltan/core/carray.pyx":1074
 *             id = sorted_indices[inlength-(i+1)]
 *             if id < self.length:
 *                 self.data[id] = self.data[self.length-1]             # <<<<<<<<<<<<<<
 *                 self.length = self.length - 1
 *                 arr.dimensions[0] = self.length
 */
      (__pyx_v_self->data[__pyx_v_id]) = (__pyx_v_self->data[(__pyx_v_self->__pyx_base.length - 1)]);

      /* "pyzoltan/core/carray.pyx":1075
 *             if id < self.length:
 *                 self.data[id] = self.data[self.length-1]
 *                 self.length = self.length - 1             # <<<<<<<<<<<<<<
 *                 arr.dimensions[0] = self.length
 * 
 */
      __pyx_v_self->__pyx_base.length = (__pyx_v_self->__pyx_base.length - 1);

      /* "pyzoltan/core/carray.pyx":1076
 *                 self.data[id] = self.data[self.length-1]
 *                 self.length = self.length - 1
 *                 arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cpdef extend(self, np.ndarray in_array):
 */
      __pyx_t_11 = __pyx_v_self->__pyx_base.length;
      (__pyx_v_arr->dimensions[0]) = __pyx_t_11;
      goto __pyx_L8;
    }
    __pyx_L8:;
  }

  /* "pyzoltan/core/carray.pyx":1034
 *         self.c_squeeze()
 * 
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=0):             # <<<<<<<<<<<<<<
 *         """Remove the particles with indices in index_list.
 * 
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sorted_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_35remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_34remove[] = "UIntArray.remove(self, ndarray index_list, bool input_sorted=0)\nRemove the particles with indices in index_list.\n\n        Parameters\n        ----------\n\n        index_list : ndarray\n            a list of indices which should be removed.\n        input_sorted : bool\n            indicates if the input is sorted in ascending order.  if\n            not, the array will be sorted internally.\n\n        Notes\n        -----\n\n         If the input indices are not sorted, sort them in ascending order.\n         Starting with the last element in the index list, start replacing the\n         element at the said index with the last element in the data and update\n         the length of the array.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_35remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_index_list = 0;
  int __pyx_v_input_sorted;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index_list,&__pyx_n_s_input_sorted,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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index_list)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_input_sorted);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "remove") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_index_list = ((PyArrayObject *)values[0]);
    if (values[1]) {
      __pyx_v_input_sorted = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_input_sorted == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_input_sorted = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("remove", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index_list), __pyx_ptype_5numpy_ndarray, 1, "index_list", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_34remove(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self), __pyx_v_index_list, __pyx_v_input_sorted);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_34remove(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_v_input_sorted) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_remove __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.input_sorted = __pyx_v_input_sorted;
  __pyx_t_1 = __pyx_vtabptr_8pyzoltan_4core_6carray_UIntArray->__pyx_base.remove(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_index_list, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.UIntArray.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1078
 *                 arr.dimensions[0] = self.length
 * 
 *     cpdef extend(self, np.ndarray in_array):             # <<<<<<<<<<<<<<
 *         """Extend the array with data from in_array.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_37extend(PyObject *__pyx_v_self, PyObject *__pyx_v_in_array); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_extend(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array, int __pyx_skip_dispatch) {
  long __pyx_v_len;
  long __pyx_v_i;
  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;
  int __pyx_t_6;
  long __pyx_t_7;
  long __pyx_t_8;
  unsigned int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_37extend)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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, ((PyObject *)__pyx_v_in_array)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_v_in_array));
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, ((PyObject *)__pyx_v_in_array));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_in_array));
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1094
 * 
 *         """
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             raise RuntimeError('Cannot extend array which is a view.')
 *         cdef long len = in_array.size
 */
  __pyx_t_6 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_6) {

    /* "pyzoltan/core/carray.pyx":1095
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot extend array which is a view.')             # <<<<<<<<<<<<<<
 *         cdef long len = in_array.size
 *         cdef long i
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":1096
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot extend array which is a view.')
 *         cdef long len = in_array.size             # <<<<<<<<<<<<<<
 *         cdef long i
 *         for i in range(len):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_in_array), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_len = __pyx_t_7;

  /* "pyzoltan/core/carray.pyx":1098
 *         cdef long len = in_array.size
 *         cdef long i
 *         for i in range(len):             # <<<<<<<<<<<<<<
 *             self.append(in_array[i])
 * 
 */
  __pyx_t_7 = __pyx_v_len;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pyzoltan/core/carray.pyx":1099
 *         cdef long i
 *         for i in range(len):
 *             self.append(in_array[i])             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy_values(self, LongArray indices, BaseArray dest):
 */
    __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_in_array), __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyInt_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_9 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->append(__pyx_v_self, __pyx_t_9, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1078
 *                 arr.dimensions[0] = self.length
 * 
 *     cpdef extend(self, np.ndarray in_array):             # <<<<<<<<<<<<<<
 *         """Extend the array with data from in_array.
 * 
 */

  /* 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("pyzoltan.core.carray.UIntArray.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_37extend(PyObject *__pyx_v_self, PyObject *__pyx_v_in_array); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_36extend[] = "UIntArray.extend(self, ndarray in_array)\nExtend the array with data from in_array.\n\n        Parameters\n        ----------\n\n        in_array : ndarray\n            a numpy array with data to be added to the current array.\n\n        Notes\n        -----\n\n         - accessing the in_array using the indexing operation seems to be\n           costly. Look at the annotated cython html file.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_37extend(PyObject *__pyx_v_self, PyObject *__pyx_v_in_array) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("extend (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_array), __pyx_ptype_5numpy_ndarray, 1, "in_array", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_36extend(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self), ((PyArrayObject *)__pyx_v_in_array));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_36extend(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9UIntArray_extend(__pyx_v_self, __pyx_v_in_array, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.UIntArray.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1101
 *             self.append(in_array[i])
 * 
 *     cpdef copy_values(self, LongArray indices, BaseArray dest):             # <<<<<<<<<<<<<<
 *         """Copies values of indices in indices from self to `dest`.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_39copy_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest, int __pyx_skip_dispatch) {
  struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_dest_array = 0;
  long __pyx_v_i;
  long __pyx_v_num_values;
  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;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  long __pyx_t_7;
  long __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_values", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy_values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_39copy_values)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && 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);
          __pyx_t_5 = 1;
        }
      }
      __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_4) {
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_indices));
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, ((PyObject *)__pyx_v_indices));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_indices));
      __Pyx_INCREF(((PyObject *)__pyx_v_dest));
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_dest));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_dest));
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1107
 *         i.e. atleast as long as indices.
 *         """
 *         cdef UIntArray dest_array = <UIntArray>dest             # <<<<<<<<<<<<<<
 *         cdef long i, num_values
 *         num_values = indices.length
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_dest);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_dest_array = ((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":1109
 *         cdef UIntArray dest_array = <UIntArray>dest
 *         cdef long i, num_values
 *         num_values = indices.length             # <<<<<<<<<<<<<<
 * 
 *         for i in range(num_values):
 */
  __pyx_t_7 = __pyx_v_indices->__pyx_base.length;
  __pyx_v_num_values = __pyx_t_7;

  /* "pyzoltan/core/carray.pyx":1111
 *         num_values = indices.length
 * 
 *         for i in range(num_values):             # <<<<<<<<<<<<<<
 *             dest_array.data[i] = self.data[indices.data[i]]
 * 
 */
  __pyx_t_7 = __pyx_v_num_values;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pyzoltan/core/carray.pyx":1112
 * 
 *         for i in range(num_values):
 *             dest_array.data[i] = self.data[indices.data[i]]             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy_subset(self, BaseArray source, long start_index=-1,
 */
    (__pyx_v_dest_array->data[__pyx_v_i]) = (__pyx_v_self->data[(__pyx_v_indices->data[__pyx_v_i])]);
  }

  /* "pyzoltan/core/carray.pyx":1101
 *             self.append(in_array[i])
 * 
 *     cpdef copy_values(self, LongArray indices, BaseArray dest):             # <<<<<<<<<<<<<<
 *         """Copies values of indices in indices from self to `dest`.
 * 
 */

  /* 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_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.copy_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dest_array);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_39copy_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_38copy_values[] = "UIntArray.copy_values(self, LongArray indices, BaseArray dest)\nCopies values of indices in indices from self to `dest`.\n\n        No size check if performed, we assume the dest to of proper size\n        i.e. atleast as long as indices.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_39copy_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices = 0;
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_values (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,&__pyx_n_s_dest,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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indices)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dest)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("copy_values", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy_values") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __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_indices = ((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)values[0]);
    __pyx_v_dest = ((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy_values", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.copy_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_8pyzoltan_4core_6carray_LongArray, 1, "indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dest), __pyx_ptype_8pyzoltan_4core_6carray_BaseArray, 1, "dest", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_38copy_values(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self), __pyx_v_indices, __pyx_v_dest);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_38copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_values", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9UIntArray_copy_values(__pyx_v_self, __pyx_v_indices, __pyx_v_dest, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.UIntArray.copy_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1114
 *             dest_array.data[i] = self.data[indices.data[i]]
 * 
 *     cpdef copy_subset(self, BaseArray source, long start_index=-1,             # <<<<<<<<<<<<<<
 *                       long end_index=-1):
 *         """Copy a subset of values from src to self.
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_41copy_subset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9UIntArray_copy_subset *__pyx_optional_args) {
  long __pyx_v_start_index = ((long)-1);
  long __pyx_v_end_index = ((long)-1);
  long __pyx_v_si;
  long __pyx_v_ei;
  long __pyx_v_s_length;
  long __pyx_v_d_length;
  long __pyx_v_i;
  long __pyx_v_j;
  struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_src = 0;
  PyObject *__pyx_v_msg = 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;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  long __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  long __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_subset", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_start_index = __pyx_optional_args->start_index;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_end_index = __pyx_optional_args->end_index;
      }
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy_subset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_41copy_subset)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_start_index); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_end_index); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_source));
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, ((PyObject *)__pyx_v_source));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_source));
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1129
 *         """
 *         cdef long si, ei, s_length, d_length, i, j
 *         cdef UIntArray src = <UIntArray>source             # <<<<<<<<<<<<<<
 *         s_length = src.length
 *         d_length = self.length
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_source);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_src = ((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":1130
 *         cdef long si, ei, s_length, d_length, i, j
 *         cdef UIntArray src = <UIntArray>source
 *         s_length = src.length             # <<<<<<<<<<<<<<
 *         d_length = self.length
 * 
 */
  __pyx_t_9 = __pyx_v_src->__pyx_base.length;
  __pyx_v_s_length = __pyx_t_9;

  /* "pyzoltan/core/carray.pyx":1131
 *         cdef UIntArray src = <UIntArray>source
 *         s_length = src.length
 *         d_length = self.length             # <<<<<<<<<<<<<<
 * 
 *         if end_index < 0:
 */
  __pyx_t_9 = __pyx_v_self->__pyx_base.length;
  __pyx_v_d_length = __pyx_t_9;

  /* "pyzoltan/core/carray.pyx":1133
 *         d_length = self.length
 * 
 *         if end_index < 0:             # <<<<<<<<<<<<<<
 *             if start_index < 0:
 *                 if s_length != d_length:
 */
  __pyx_t_10 = ((__pyx_v_end_index < 0) != 0);
  if (__pyx_t_10) {

    /* "pyzoltan/core/carray.pyx":1134
 * 
 *         if end_index < 0:
 *             if start_index < 0:             # <<<<<<<<<<<<<<
 *                 if s_length != d_length:
 *                     msg = 'Source length should be same as dest length'
 */
    __pyx_t_10 = ((__pyx_v_start_index < 0) != 0);
    if (__pyx_t_10) {

      /* "pyzoltan/core/carray.pyx":1135
 *         if end_index < 0:
 *             if start_index < 0:
 *                 if s_length != d_length:             # <<<<<<<<<<<<<<
 *                     msg = 'Source length should be same as dest length'
 *                     logger.error(msg)
 */
      __pyx_t_10 = ((__pyx_v_s_length != __pyx_v_d_length) != 0);
      if (__pyx_t_10) {

        /* "pyzoltan/core/carray.pyx":1136
 *             if start_index < 0:
 *                 if s_length != d_length:
 *                     msg = 'Source length should be same as dest length'             # <<<<<<<<<<<<<<
 *                     logger.error(msg)
 *                     raise ValueError, msg
 */
        __Pyx_INCREF(__pyx_kp_s_Source_length_should_be_same_as);
        __pyx_v_msg = __pyx_kp_s_Source_length_should_be_same_as;

        /* "pyzoltan/core/carray.pyx":1137
 *                 if s_length != d_length:
 *                     msg = 'Source length should be same as dest length'
 *                     logger.error(msg)             # <<<<<<<<<<<<<<
 *                     raise ValueError, msg
 *                 si = 0
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        if (!__pyx_t_2) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "pyzoltan/core/carray.pyx":1138
 *                     msg = 'Source length should be same as dest length'
 *                     logger.error(msg)
 *                     raise ValueError, msg             # <<<<<<<<<<<<<<
 *                 si = 0
 *                 ei = self.length
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "pyzoltan/core/carray.pyx":1139
 *                     logger.error(msg)
 *                     raise ValueError, msg
 *                 si = 0             # <<<<<<<<<<<<<<
 *                 ei = self.length
 *             else:
 */
      __pyx_v_si = 0;

      /* "pyzoltan/core/carray.pyx":1140
 *                     raise ValueError, msg
 *                 si = 0
 *                 ei = self.length             # <<<<<<<<<<<<<<
 *             else:
 *                 # meaning we copy from the specified start index to the end of
 */
      __pyx_t_9 = __pyx_v_self->__pyx_base.length;
      __pyx_v_ei = __pyx_t_9;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "pyzoltan/core/carray.pyx":1144
 *                 # meaning we copy from the specified start index to the end of
 *                 # self. make sure the sizes are consistent.
 *                 si = start_index             # <<<<<<<<<<<<<<
 *                 ei = d_length
 * 
 */
      __pyx_v_si = __pyx_v_start_index;

      /* "pyzoltan/core/carray.pyx":1145
 *                 # self. make sure the sizes are consistent.
 *                 si = start_index
 *                 ei = d_length             # <<<<<<<<<<<<<<
 * 
 *                 if start_index > (d_length-1):
 */
      __pyx_v_ei = __pyx_v_d_length;

      /* "pyzoltan/core/carray.pyx":1147
 *                 ei = d_length
 * 
 *                 if start_index > (d_length-1):             # <<<<<<<<<<<<<<
 *                     msg = 'start_index beyond array length'
 *                     logger.error(msg)
 */
      __pyx_t_10 = ((__pyx_v_start_index > (__pyx_v_d_length - 1)) != 0);
      if (__pyx_t_10) {

        /* "pyzoltan/core/carray.pyx":1148
 * 
 *                 if start_index > (d_length-1):
 *                     msg = 'start_index beyond array length'             # <<<<<<<<<<<<<<
 *                     logger.error(msg)
 *                     raise ValueError, msg
 */
        __Pyx_INCREF(__pyx_kp_s_start_index_beyond_array_length);
        __pyx_v_msg = __pyx_kp_s_start_index_beyond_array_length;

        /* "pyzoltan/core/carray.pyx":1149
 *                 if start_index > (d_length-1):
 *                     msg = 'start_index beyond array length'
 *                     logger.error(msg)             # <<<<<<<<<<<<<<
 *                     raise ValueError, msg
 * 
 */
        __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        if (!__pyx_t_5) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "pyzoltan/core/carray.pyx":1150
 *                     msg = 'start_index beyond array length'
 *                     logger.error(msg)
 *                     raise ValueError, msg             # <<<<<<<<<<<<<<
 * 
 *                 if (ei - si) > s_length:
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "pyzoltan/core/carray.pyx":1152
 *                     raise ValueError, msg
 * 
 *                 if (ei - si) > s_length:             # <<<<<<<<<<<<<<
 *                     msg = 'Not enough values in source'
 *                     logger.error(msg)
 */
      __pyx_t_10 = (((__pyx_v_ei - __pyx_v_si) > __pyx_v_s_length) != 0);
      if (__pyx_t_10) {

        /* "pyzoltan/core/carray.pyx":1153
 * 
 *                 if (ei - si) > s_length:
 *                     msg = 'Not enough values in source'             # <<<<<<<<<<<<<<
 *                     logger.error(msg)
 *                     raise ValueError, msg
 */
        __Pyx_INCREF(__pyx_kp_s_Not_enough_values_in_source);
        __pyx_v_msg = __pyx_kp_s_Not_enough_values_in_source;

        /* "pyzoltan/core/carray.pyx":1154
 *                 if (ei - si) > s_length:
 *                     msg = 'Not enough values in source'
 *                     logger.error(msg)             # <<<<<<<<<<<<<<
 *                     raise ValueError, msg
 *         else:
 */
        __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        if (!__pyx_t_8) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __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;

        /* "pyzoltan/core/carray.pyx":1155
 *                     msg = 'Not enough values in source'
 *                     logger.error(msg)
 *                     raise ValueError, msg             # <<<<<<<<<<<<<<
 *         else:
 *             if start_index < 0:
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pyzoltan/core/carray.pyx":1157
 *                     raise ValueError, msg
 *         else:
 *             if start_index < 0:             # <<<<<<<<<<<<<<
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                           end_index)
 */
    __pyx_t_10 = ((__pyx_v_start_index < 0) != 0);
    if (__pyx_t_10) {

      /* "pyzoltan/core/carray.pyx":1158
 *         else:
 *             if start_index < 0:
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,             # <<<<<<<<<<<<<<
 *                                                           end_index)
 *                 logger.error(msg)
 */
      __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_start_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);

      /* "pyzoltan/core/carray.pyx":1159
 *             if start_index < 0:
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                           end_index)             # <<<<<<<<<<<<<<
 *                 logger.error(msg)
 *                 raise ValueError, msg
 */
      __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_end_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);

      /* "pyzoltan/core/carray.pyx":1158
 *         else:
 *             if start_index < 0:
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,             # <<<<<<<<<<<<<<
 *                                                           end_index)
 *                 logger.error(msg)
 */
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_1 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_start_index_d_end_index_d, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_msg = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "pyzoltan/core/carray.pyx":1160
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                           end_index)
 *                 logger.error(msg)             # <<<<<<<<<<<<<<
 *                 raise ValueError, msg
 *             else:
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_v_msg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_msg);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_msg);
        __Pyx_GIVEREF(__pyx_v_msg);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pyzoltan/core/carray.pyx":1161
 *                                                           end_index)
 *                 logger.error(msg)
 *                 raise ValueError, msg             # <<<<<<<<<<<<<<
 *             else:
 *                 if (start_index > (d_length-1) or end_index > d_length or
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    /*else*/ {

      /* "pyzoltan/core/carray.pyx":1163
 *                 raise ValueError, msg
 *             else:
 *                 if (start_index > (d_length-1) or end_index > d_length or             # <<<<<<<<<<<<<<
 *                     start_index > end_index):
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,
 */
      __pyx_t_11 = ((__pyx_v_start_index > (__pyx_v_d_length - 1)) != 0);
      if (!__pyx_t_11) {
      } else {
        __pyx_t_10 = __pyx_t_11;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_11 = ((__pyx_v_end_index > __pyx_v_d_length) != 0);
      if (!__pyx_t_11) {
      } else {
        __pyx_t_10 = __pyx_t_11;
        goto __pyx_L10_bool_binop_done;
      }

      /* "pyzoltan/core/carray.pyx":1164
 *             else:
 *                 if (start_index > (d_length-1) or end_index > d_length or
 *                     start_index > end_index):             # <<<<<<<<<<<<<<
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                               end_index)
 */
      __pyx_t_11 = ((__pyx_v_start_index > __pyx_v_end_index) != 0);
      __pyx_t_10 = __pyx_t_11;
      __pyx_L10_bool_binop_done:;
      if (__pyx_t_10) {

        /* "pyzoltan/core/carray.pyx":1165
 *                 if (start_index > (d_length-1) or end_index > d_length or
 *                     start_index > end_index):
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,             # <<<<<<<<<<<<<<
 *                                                               end_index)
 *                     logger.error(msg)
 */
        __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_start_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);

        /* "pyzoltan/core/carray.pyx":1166
 *                     start_index > end_index):
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                               end_index)             # <<<<<<<<<<<<<<
 *                     logger.error(msg)
 *                     raise ValueError, msg
 */
        __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_end_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);

        /* "pyzoltan/core/carray.pyx":1165
 *                 if (start_index > (d_length-1) or end_index > d_length or
 *                     start_index > end_index):
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,             # <<<<<<<<<<<<<<
 *                                                               end_index)
 *                     logger.error(msg)
 */
        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_2 = 0;
        __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_start_index_d_end_index_d, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_v_msg = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "pyzoltan/core/carray.pyx":1167
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                               end_index)
 *                     logger.error(msg)             # <<<<<<<<<<<<<<
 *                     raise ValueError, msg
 * 
 */
        __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        if (!__pyx_t_8) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __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;

        /* "pyzoltan/core/carray.pyx":1168
 *                                                               end_index)
 *                     logger.error(msg)
 *                     raise ValueError, msg             # <<<<<<<<<<<<<<
 * 
 *                 si = start_index
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "pyzoltan/core/carray.pyx":1170
 *                     raise ValueError, msg
 * 
 *                 si = start_index             # <<<<<<<<<<<<<<
 *                 ei = end_index
 * 
 */
      __pyx_v_si = __pyx_v_start_index;

      /* "pyzoltan/core/carray.pyx":1171
 * 
 *                 si = start_index
 *                 ei = end_index             # <<<<<<<<<<<<<<
 * 
 *         # we have valid start and end indices now. can start copying now.
 */
      __pyx_v_ei = __pyx_v_end_index;
    }
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":1174
 * 
 *         # we have valid start and end indices now. can start copying now.
 *         j = 0             # <<<<<<<<<<<<<<
 *         for i in range(si, ei):
 *             self.data[i] = src.data[j]
 */
  __pyx_v_j = 0;

  /* "pyzoltan/core/carray.pyx":1175
 *         # we have valid start and end indices now. can start copying now.
 *         j = 0
 *         for i in range(si, ei):             # <<<<<<<<<<<<<<
 *             self.data[i] = src.data[j]
 *             j += 1
 */
  __pyx_t_9 = __pyx_v_ei;
  for (__pyx_t_12 = __pyx_v_si; __pyx_t_12 < __pyx_t_9; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "pyzoltan/core/carray.pyx":1176
 *         j = 0
 *         for i in range(si, ei):
 *             self.data[i] = src.data[j]             # <<<<<<<<<<<<<<
 *             j += 1
 * 
 */
    (__pyx_v_self->data[__pyx_v_i]) = (__pyx_v_src->data[__pyx_v_j]);

    /* "pyzoltan/core/carray.pyx":1177
 *         for i in range(si, ei):
 *             self.data[i] = src.data[j]
 *             j += 1             # <<<<<<<<<<<<<<
 * 
 *     cpdef update_min_max(self):
 */
    __pyx_v_j = (__pyx_v_j + 1);
  }

  /* "pyzoltan/core/carray.pyx":1114
 *             dest_array.data[i] = self.data[indices.data[i]]
 * 
 *     cpdef copy_subset(self, BaseArray source, long start_index=-1,             # <<<<<<<<<<<<<<
 *                       long end_index=-1):
 *         """Copy a subset of values from src to self.
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.copy_subset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_src);
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_41copy_subset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_40copy_subset[] = "UIntArray.copy_subset(self, BaseArray source, long start_index=-1, long end_index=-1)\nCopy a subset of values from src to self.\n\n        Parameters\n        ----------\n\n        start_index : long\n            the first index in dest that corresponds to the 0th\n            index in source\n\n        end_index : long\n            the first index in dest from start_index that is not copied\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_41copy_subset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source = 0;
  long __pyx_v_start_index;
  long __pyx_v_end_index;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_subset (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_start_index,&__pyx_n_s_end_index,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_source)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start_index);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end_index);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy_subset") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_source = ((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)values[0]);
    if (values[1]) {
      __pyx_v_start_index = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_start_index == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_start_index = ((long)-1);
    }
    if (values[2]) {
      __pyx_v_end_index = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_end_index == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_end_index = ((long)-1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy_subset", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.copy_subset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_source), __pyx_ptype_8pyzoltan_4core_6carray_BaseArray, 1, "source", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_40copy_subset(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self), __pyx_v_source, __pyx_v_start_index, __pyx_v_end_index);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_40copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, long __pyx_v_start_index, long __pyx_v_end_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_copy_subset __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_subset", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.start_index = __pyx_v_start_index;
  __pyx_t_2.end_index = __pyx_v_end_index;
  __pyx_t_1 = __pyx_vtabptr_8pyzoltan_4core_6carray_UIntArray->__pyx_base.copy_subset(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_source, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.UIntArray.copy_subset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1179
 *             j += 1
 * 
 *     cpdef update_min_max(self):             # <<<<<<<<<<<<<<
 *         """Updates the min and max values of the array.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_43update_min_max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9UIntArray_update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, int __pyx_skip_dispatch) {
  long __pyx_v_i;
  unsigned int __pyx_v_min_val;
  unsigned int __pyx_v_max_val;
  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;
  long __pyx_t_6;
  long __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update_min_max", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_update_min_max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_43update_min_max)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1182
 *         """Updates the min and max values of the array.
 *         """
 *         cdef long i = 0             # <<<<<<<<<<<<<<
 *         cdef unsigned int min_val, max_val
 * 
 */
  __pyx_v_i = 0;

  /* "pyzoltan/core/carray.pyx":1185
 *         cdef unsigned int min_val, max_val
 * 
 *         if self.length == 0:             # <<<<<<<<<<<<<<
 *             self.minimum = <unsigned int>0
 *             self.maximum = <unsigned int>0
 */
  __pyx_t_5 = ((__pyx_v_self->__pyx_base.length == 0) != 0);
  if (__pyx_t_5) {

    /* "pyzoltan/core/carray.pyx":1186
 * 
 *         if self.length == 0:
 *             self.minimum = <unsigned int>0             # <<<<<<<<<<<<<<
 *             self.maximum = <unsigned int>0
 *             return
 */
    __pyx_v_self->minimum = ((unsigned int)0);

    /* "pyzoltan/core/carray.pyx":1187
 *         if self.length == 0:
 *             self.minimum = <unsigned int>0
 *             self.maximum = <unsigned int>0             # <<<<<<<<<<<<<<
 *             return
 * 
 */
    __pyx_v_self->maximum = ((unsigned int)0);

    /* "pyzoltan/core/carray.pyx":1188
 *             self.minimum = <unsigned int>0
 *             self.maximum = <unsigned int>0
 *             return             # <<<<<<<<<<<<<<
 * 
 *         min_val = self.data[0]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "pyzoltan/core/carray.pyx":1190
 *             return
 * 
 *         min_val = self.data[0]             # <<<<<<<<<<<<<<
 *         max_val = self.data[0]
 * 
 */
  __pyx_v_min_val = (__pyx_v_self->data[0]);

  /* "pyzoltan/core/carray.pyx":1191
 * 
 *         min_val = self.data[0]
 *         max_val = self.data[0]             # <<<<<<<<<<<<<<
 * 
 *         for i in range(self.length):
 */
  __pyx_v_max_val = (__pyx_v_self->data[0]);

  /* "pyzoltan/core/carray.pyx":1193
 *         max_val = self.data[0]
 * 
 *         for i in range(self.length):             # <<<<<<<<<<<<<<
 *             if min_val > self.data[i]:
 *                 min_val = self.data[i]
 */
  __pyx_t_6 = __pyx_v_self->__pyx_base.length;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "pyzoltan/core/carray.pyx":1194
 * 
 *         for i in range(self.length):
 *             if min_val > self.data[i]:             # <<<<<<<<<<<<<<
 *                 min_val = self.data[i]
 *             if max_val < self.data[i]:
 */
    __pyx_t_5 = ((__pyx_v_min_val > (__pyx_v_self->data[__pyx_v_i])) != 0);
    if (__pyx_t_5) {

      /* "pyzoltan/core/carray.pyx":1195
 *         for i in range(self.length):
 *             if min_val > self.data[i]:
 *                 min_val = self.data[i]             # <<<<<<<<<<<<<<
 *             if max_val < self.data[i]:
 *                 max_val = self.data[i]
 */
      __pyx_v_min_val = (__pyx_v_self->data[__pyx_v_i]);
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pyzoltan/core/carray.pyx":1196
 *             if min_val > self.data[i]:
 *                 min_val = self.data[i]
 *             if max_val < self.data[i]:             # <<<<<<<<<<<<<<
 *                 max_val = self.data[i]
 * 
 */
    __pyx_t_5 = ((__pyx_v_max_val < (__pyx_v_self->data[__pyx_v_i])) != 0);
    if (__pyx_t_5) {

      /* "pyzoltan/core/carray.pyx":1197
 *                 min_val = self.data[i]
 *             if max_val < self.data[i]:
 *                 max_val = self.data[i]             # <<<<<<<<<<<<<<
 * 
 *         self.minimum = min_val
 */
      __pyx_v_max_val = (__pyx_v_self->data[__pyx_v_i]);
      goto __pyx_L7;
    }
    __pyx_L7:;
  }

  /* "pyzoltan/core/carray.pyx":1199
 *                 max_val = self.data[i]
 * 
 *         self.minimum = min_val             # <<<<<<<<<<<<<<
 *         self.maximum = max_val
 * 
 */
  __pyx_v_self->minimum = __pyx_v_min_val;

  /* "pyzoltan/core/carray.pyx":1200
 * 
 *         self.minimum = min_val
 *         self.maximum = max_val             # <<<<<<<<<<<<<<
 * 
 * # ###########################################################################
 */
  __pyx_v_self->maximum = __pyx_v_max_val;

  /* "pyzoltan/core/carray.pyx":1179
 *             j += 1
 * 
 *     cpdef update_min_max(self):             # <<<<<<<<<<<<<<
 *         """Updates the min and max values of the array.
 *         """
 */

  /* 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("pyzoltan.core.carray.UIntArray.update_min_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_43update_min_max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_42update_min_max[] = "UIntArray.update_min_max(self)\nUpdates the min and max values of the array.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_43update_min_max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_min_max (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_42update_min_max(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_42update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update_min_max", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9UIntArray_update_min_max(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.UIntArray.update_min_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pxd":90
 *     cdef unsigned int *data
 *     cdef unsigned int *_old_data
 *     cdef public unsigned int minimum, maximum             # <<<<<<<<<<<<<<
 *     cdef UIntArray _parent
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_7minimum_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_7minimum_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_7minimum___get__(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_7minimum___get__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->minimum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.UIntArray.minimum.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_9UIntArray_7minimum_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8pyzoltan_4core_6carray_9UIntArray_7minimum_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_7minimum_2__set__(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_7minimum_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  unsigned int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->minimum = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.minimum.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_7maximum_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_7maximum_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_7maximum___get__(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9UIntArray_7maximum___get__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->maximum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.UIntArray.maximum.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_9UIntArray_7maximum_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8pyzoltan_4core_6carray_9UIntArray_7maximum_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_7maximum_2__set__(((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_9UIntArray_7maximum_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  unsigned int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->maximum = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.UIntArray.maximum.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1247
 *     #cdef np.ndarray _npy_array
 * 
 *     def __cinit__(self, long n=0):             # <<<<<<<<<<<<<<
 *         """Constructor for the class.
 *         """
 */

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_9LongArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8pyzoltan_4core_6carray_9LongArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,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);
        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 = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray___cinit__(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self), __pyx_v_n);

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

static int __pyx_pf_8pyzoltan_4core_6carray_9LongArray___cinit__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_n) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "pyzoltan/core/carray.pyx":1250
 *         """Constructor for the class.
 *         """
 *         self.length = n             # <<<<<<<<<<<<<<
 *         self._parent = None
 *         self._old_data = NULL
 */
  __pyx_v_self->__pyx_base.length = __pyx_v_n;

  /* "pyzoltan/core/carray.pyx":1251
 *         """
 *         self.length = n
 *         self._parent = None             # <<<<<<<<<<<<<<
 *         self._old_data = NULL
 *         if n == 0:
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_parent);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_parent));
  __pyx_v_self->_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)Py_None);

  /* "pyzoltan/core/carray.pyx":1252
 *         self.length = n
 *         self._parent = None
 *         self._old_data = NULL             # <<<<<<<<<<<<<<
 *         if n == 0:
 *             n = 16
 */
  __pyx_v_self->_old_data = NULL;

  /* "pyzoltan/core/carray.pyx":1253
 *         self._parent = None
 *         self._old_data = NULL
 *         if n == 0:             # <<<<<<<<<<<<<<
 *             n = 16
 *         self.alloc = n
 */
  __pyx_t_1 = ((__pyx_v_n == 0) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":1254
 *         self._old_data = NULL
 *         if n == 0:
 *             n = 16             # <<<<<<<<<<<<<<
 *         self.alloc = n
 *         self.data = <long*>aligned_malloc(n*sizeof(long))
 */
    __pyx_v_n = 16;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":1255
 *         if n == 0:
 *             n = 16
 *         self.alloc = n             # <<<<<<<<<<<<<<
 *         self.data = <long*>aligned_malloc(n*sizeof(long))
 * 
 */
  __pyx_v_self->__pyx_base.alloc = __pyx_v_n;

  /* "pyzoltan/core/carray.pyx":1256
 *             n = 16
 *         self.alloc = n
 *         self.data = <long*>aligned_malloc(n*sizeof(long))             # <<<<<<<<<<<<<<
 * 
 *         self._setup_npy_array()
 */
  __pyx_v_self->data = ((long *)__pyx_f_8pyzoltan_4core_6carray_aligned_malloc((__pyx_v_n * (sizeof(long)))));

  /* "pyzoltan/core/carray.pyx":1258
 *         self.data = <long*>aligned_malloc(n*sizeof(long))
 * 
 *         self._setup_npy_array()             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->_setup_npy_array(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyzoltan/core/carray.pyx":1247
 *     #cdef np.ndarray _npy_array
 * 
 *     def __cinit__(self, long n=0):             # <<<<<<<<<<<<<<
 *         """Constructor for the class.
 *         """
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1260
 *         self._setup_npy_array()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         """Frees the array.
 *         """
 */

/* Python wrapper */
static void __pyx_pw_8pyzoltan_4core_6carray_9LongArray_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_8pyzoltan_4core_6carray_9LongArray_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_8pyzoltan_4core_6carray_9LongArray_2__dealloc__(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self));

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

static void __pyx_pf_8pyzoltan_4core_6carray_9LongArray_2__dealloc__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "pyzoltan/core/carray.pyx":1263
 *         """Frees the array.
 *         """
 *         if self._old_data == NULL:             # <<<<<<<<<<<<<<
 *             aligned_free(<void*>self.data)
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->_old_data == NULL) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":1264
 *         """
 *         if self._old_data == NULL:
 *             aligned_free(<void*>self.data)             # <<<<<<<<<<<<<<
 *         else:
 *             aligned_free(<void*>self._old_data)
 */
    __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_self->data));
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pyzoltan/core/carray.pyx":1266
 *             aligned_free(<void*>self.data)
 *         else:
 *             aligned_free(<void*>self._old_data)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, long idx):
 */
    __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_self->_old_data));
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":1260
 *         self._setup_npy_array()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         """Frees the array.
 *         """
 */

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

/* "pyzoltan/core/carray.pyx":1268
 *             aligned_free(<void*>self._old_data)
 * 
 *     def __getitem__(self, long idx):             # <<<<<<<<<<<<<<
 *         """Get item at position idx.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9LongArray_4__getitem__[] = "Get item at position idx.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_8pyzoltan_4core_6carray_9LongArray_4__getitem__;
#endif
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx) {
  long __pyx_v_idx;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  assert(__pyx_arg_idx); {
    __pyx_v_idx = __Pyx_PyInt_As_long(__pyx_arg_idx); if (unlikely((__pyx_v_idx == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_4__getitem__(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self), ((long)__pyx_v_idx));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_4__getitem__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_idx) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "pyzoltan/core/carray.pyx":1271
 *         """Get item at position idx.
 *         """
 *         return self.data[idx]             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, long idx, long value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_self->data[__pyx_v_idx])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":1268
 *             aligned_free(<void*>self._old_data)
 * 
 *     def __getitem__(self, long idx):             # <<<<<<<<<<<<<<
 *         """Get item at position idx.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1273
 *         return self.data[idx]
 * 
 *     def __setitem__(self, long idx, long value):             # <<<<<<<<<<<<<<
 *         """Set location idx to value.
 *         """
 */

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_9LongArray_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx, PyObject *__pyx_arg_value); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9LongArray_6__setitem__[] = "Set location idx to value.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_8pyzoltan_4core_6carray_9LongArray_6__setitem__;
#endif
static int __pyx_pw_8pyzoltan_4core_6carray_9LongArray_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx, PyObject *__pyx_arg_value) {
  long __pyx_v_idx;
  long __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  assert(__pyx_arg_idx); {
    __pyx_v_idx = __Pyx_PyInt_As_long(__pyx_arg_idx); if (unlikely((__pyx_v_idx == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1273; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  assert(__pyx_arg_value); {
    __pyx_v_value = __Pyx_PyInt_As_long(__pyx_arg_value); if (unlikely((__pyx_v_value == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1273; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_6__setitem__(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self), ((long)__pyx_v_idx), ((long)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_9LongArray_6__setitem__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_idx, long __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "pyzoltan/core/carray.pyx":1276
 *         """Set location idx to value.
 *         """
 *         self.data[idx] = value             # <<<<<<<<<<<<<<
 * 
 *     cpdef long index(self, long value):
 */
  (__pyx_v_self->data[__pyx_v_idx]) = __pyx_v_value;

  /* "pyzoltan/core/carray.pyx":1273
 *         return self.data[idx]
 * 
 *     def __setitem__(self, long idx, long value):             # <<<<<<<<<<<<<<
 *         """Set location idx to value.
 *         """
 */

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

/* "pyzoltan/core/carray.pyx":1278
 *         self.data[idx] = value
 * 
 *     cpdef long index(self, long value):             # <<<<<<<<<<<<<<
 *         """Returns the index at which value is in self, else -1.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_9index(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static long __pyx_f_8pyzoltan_4core_6carray_9LongArray_index(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_value, int __pyx_skip_dispatch) {
  long __pyx_v_i;
  long __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 = NULL;
  PyObject *__pyx_t_6 = NULL;
  long __pyx_t_7;
  long __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("index", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_9index)) {
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __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;
      __pyx_t_7 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_7;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1282
 *         """
 *         cdef long i
 *         for i in range(self.length):             # <<<<<<<<<<<<<<
 *             if self.data[i] == value:
 *                 return i
 */
  __pyx_t_7 = __pyx_v_self->__pyx_base.length;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pyzoltan/core/carray.pyx":1283
 *         cdef long i
 *         for i in range(self.length):
 *             if self.data[i] == value:             # <<<<<<<<<<<<<<
 *                 return i
 *         return -1
 */
    __pyx_t_9 = (((__pyx_v_self->data[__pyx_v_i]) == __pyx_v_value) != 0);
    if (__pyx_t_9) {

      /* "pyzoltan/core/carray.pyx":1284
 *         for i in range(self.length):
 *             if self.data[i] == value:
 *                 return i             # <<<<<<<<<<<<<<
 *         return -1
 * 
 */
      __pyx_r = __pyx_v_i;
      goto __pyx_L0;
    }
  }

  /* "pyzoltan/core/carray.pyx":1285
 *             if self.data[i] == value:
 *                 return i
 *         return -1             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, long value):
 */
  __pyx_r = -1;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":1278
 *         self.data[idx] = value
 * 
 *     cpdef long index(self, long value):             # <<<<<<<<<<<<<<
 *         """Returns the index at which value is in self, else -1.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("pyzoltan.core.carray.LongArray.index", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_9index(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9LongArray_8index[] = "LongArray.index(self, long value) -> long\nReturns the index at which value is in self, else -1.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_9index(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  long __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("index (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __Pyx_PyInt_As_long(__pyx_arg_value); if (unlikely((__pyx_v_value == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_8index(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self), ((long)__pyx_v_value));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_8index(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("index", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_f_8pyzoltan_4core_6carray_9LongArray_index(__pyx_v_self, __pyx_v_value, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.LongArray.index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1287
 *         return -1
 * 
 *     def __contains__(self, long value):             # <<<<<<<<<<<<<<
 *         """Returns True if value is in self.
 *         """
 */

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_9LongArray_11__contains__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9LongArray_10__contains__[] = "Returns True if value is in self.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_8pyzoltan_4core_6carray_9LongArray_10__contains__;
#endif
static int __pyx_pw_8pyzoltan_4core_6carray_9LongArray_11__contains__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  long __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __Pyx_PyInt_As_long(__pyx_arg_value); if (unlikely((__pyx_v_value == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_10__contains__(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self), ((long)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_9LongArray_10__contains__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "pyzoltan/core/carray.pyx":1290
 *         """Returns True if value is in self.
 *         """
 *         return (self.index(value) >= 0)             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */
  __pyx_r = (((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->index(__pyx_v_self, __pyx_v_value, 0) >= 0);
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":1287
 *         return -1
 * 
 *     def __contains__(self, long value):             # <<<<<<<<<<<<<<
 *         """Returns True if value is in self.
 *         """
 */

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

/* "pyzoltan/core/carray.pyx":1292
 *         return (self.index(value) >= 0)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         """Implemented to facilitate pickling.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_13__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9LongArray_12__reduce__[] = "LongArray.__reduce__(self)\nImplemented to facilitate pickling.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_13__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_12__reduce__(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_12__reduce__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self) {
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce__", 0);

  /* "pyzoltan/core/carray.pyx":1295
 *         """Implemented to facilitate pickling.
 *         """
 *         d = {}             # <<<<<<<<<<<<<<
 *         d['data'] = self.get_npy_array()
 * 
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_d = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":1296
 *         """
 *         d = {}
 *         d['data'] = self.get_npy_array()             # <<<<<<<<<<<<<<
 * 
 *         return (LongArray, (), d)
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_npy_array(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyDict_SetItem(__pyx_v_d, __pyx_n_s_data, __pyx_t_1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":1298
 *         d['data'] = self.get_npy_array()
 * 
 *         return (LongArray, (), d)             # <<<<<<<<<<<<<<
 * 
 *     def __setstate__(self, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_8pyzoltan_4core_6carray_LongArray)));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_8pyzoltan_4core_6carray_LongArray)));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_8pyzoltan_4core_6carray_LongArray)));
  __Pyx_INCREF(__pyx_empty_tuple);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_empty_tuple);
  __Pyx_GIVEREF(__pyx_empty_tuple);
  __Pyx_INCREF(__pyx_v_d);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_d);
  __Pyx_GIVEREF(__pyx_v_d);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":1292
 *         return (self.index(value) >= 0)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         """Implemented to facilitate pickling.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1300
 *         return (LongArray, (), d)
 * 
 *     def __setstate__(self, d):             # <<<<<<<<<<<<<<
 *         """Load the carray from the dictionary d.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_15__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_d); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9LongArray_14__setstate__[] = "LongArray.__setstate__(self, d)\nLoad the carray from the dictionary d.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_15__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_14__setstate__(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self), ((PyObject *)__pyx_v_d));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_14__setstate__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, PyObject *__pyx_v_d) {
  PyArrayObject *__pyx_v_arr = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  long __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate__", 0);

  /* "pyzoltan/core/carray.pyx":1303
 *         """Load the carray from the dictionary d.
 *         """
 *         cdef np.ndarray arr = d['data']             # <<<<<<<<<<<<<<
 *         self.resize(arr.size)
 *         self.set_data(arr)
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_s_data); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1303; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_arr = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":1304
 *         """
 *         cdef np.ndarray arr = d['data']
 *         self.resize(arr.size)             # <<<<<<<<<<<<<<
 *         self.set_data(arr)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_arr), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.resize(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":1305
 *         cdef np.ndarray arr = d['data']
 *         self.resize(arr.size)
 *         self.set_data(arr)             # <<<<<<<<<<<<<<
 * 
 *     cdef _setup_npy_array(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_data(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_arr, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":1300
 *         return (LongArray, (), d)
 * 
 *     def __setstate__(self, d):             # <<<<<<<<<<<<<<
 *         """Load the carray from the dictionary d.
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_arr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1307
 *         self.set_data(arr)
 * 
 *     cdef _setup_npy_array(self):             # <<<<<<<<<<<<<<
 *         """Create the numpy array.
 *         """
 */

static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray__setup_npy_array(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self) {
  int __pyx_v_nd;
  npy_intp __pyx_v_dims;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setup_npy_array", 0);

  /* "pyzoltan/core/carray.pyx":1310
 *         """Create the numpy array.
 *         """
 *         cdef int nd = 1             # <<<<<<<<<<<<<<
 *         cdef np.npy_intp dims = self.length
 * 
 */
  __pyx_v_nd = 1;

  /* "pyzoltan/core/carray.pyx":1311
 *         """
 *         cdef int nd = 1
 *         cdef np.npy_intp dims = self.length             # <<<<<<<<<<<<<<
 * 
 *         self._npy_array = PyArray_SimpleNewFromData(
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  __pyx_v_dims = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":1313
 *         cdef np.npy_intp dims = self.length
 * 
 *         self._npy_array = PyArray_SimpleNewFromData(             # <<<<<<<<<<<<<<
 *             nd, &dims, NPY_LONG, self.data
 *         )
 */
  __pyx_t_2 = ((PyObject *)PyArray_SimpleNewFromData(__pyx_v_nd, (&__pyx_v_dims), NPY_LONG, __pyx_v_self->data)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base._npy_array);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base._npy_array));
  __pyx_v_self->__pyx_base._npy_array = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyzoltan/core/carray.pyx":1307
 *         self.set_data(arr)
 * 
 *     cdef _setup_npy_array(self):             # <<<<<<<<<<<<<<
 *         """Create the numpy array.
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray._setup_npy_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1318
 * 
 * 
 *     cdef void c_align_array(self, LongArray new_indices) nogil:             # <<<<<<<<<<<<<<
 *         """Rearrange the array contents according to the new indices.
 *         """
 */

static void __pyx_f_8pyzoltan_4core_6carray_9LongArray_c_align_array(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_new_indices) {
  long __pyx_v_i;
  long __pyx_v_length;
  long __pyx_v_n_bytes;
  long *__pyx_v_temp;
  long __pyx_t_1;
  long __pyx_t_2;
  int __pyx_t_3;

  /* "pyzoltan/core/carray.pyx":1323
 * 
 *         cdef long i
 *         cdef long length = self.length             # <<<<<<<<<<<<<<
 *         cdef long n_bytes
 *         cdef long *temp
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  __pyx_v_length = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":1327
 *         cdef long *temp
 * 
 *         n_bytes = sizeof(long)*length             # <<<<<<<<<<<<<<
 *         temp = <long*>aligned_malloc(n_bytes)
 * 
 */
  __pyx_v_n_bytes = ((sizeof(long)) * __pyx_v_length);

  /* "pyzoltan/core/carray.pyx":1328
 * 
 *         n_bytes = sizeof(long)*length
 *         temp = <long*>aligned_malloc(n_bytes)             # <<<<<<<<<<<<<<
 * 
 *         memcpy(<void*>temp, <void*>self.data, n_bytes)
 */
  __pyx_v_temp = ((long *)__pyx_f_8pyzoltan_4core_6carray_aligned_malloc(__pyx_v_n_bytes));

  /* "pyzoltan/core/carray.pyx":1330
 *         temp = <long*>aligned_malloc(n_bytes)
 * 
 *         memcpy(<void*>temp, <void*>self.data, n_bytes)             # <<<<<<<<<<<<<<
 * 
 *         # copy the data from the resized portion to the actual positions.
 */
  memcpy(((void *)__pyx_v_temp), ((void *)__pyx_v_self->data), __pyx_v_n_bytes);

  /* "pyzoltan/core/carray.pyx":1333
 * 
 *         # copy the data from the resized portion to the actual positions.
 *         for i in range(length):             # <<<<<<<<<<<<<<
 *             if i != new_indices.data[i]:
 *                 self.data[i] = temp[new_indices.data[i]]
 */
  __pyx_t_1 = __pyx_v_length;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "pyzoltan/core/carray.pyx":1334
 *         # copy the data from the resized portion to the actual positions.
 *         for i in range(length):
 *             if i != new_indices.data[i]:             # <<<<<<<<<<<<<<
 *                 self.data[i] = temp[new_indices.data[i]]
 * 
 */
    __pyx_t_3 = ((__pyx_v_i != (__pyx_v_new_indices->data[__pyx_v_i])) != 0);
    if (__pyx_t_3) {

      /* "pyzoltan/core/carray.pyx":1335
 *         for i in range(length):
 *             if i != new_indices.data[i]:
 *                 self.data[i] = temp[new_indices.data[i]]             # <<<<<<<<<<<<<<
 * 
 *         aligned_free(<void*>temp)
 */
      (__pyx_v_self->data[__pyx_v_i]) = (__pyx_v_temp[(__pyx_v_new_indices->data[__pyx_v_i])]);
      goto __pyx_L5;
    }
    __pyx_L5:;
  }

  /* "pyzoltan/core/carray.pyx":1337
 *                 self.data[i] = temp[new_indices.data[i]]
 * 
 *         aligned_free(<void*>temp)             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_append(self, long value) nogil:
 */
  __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_temp));

  /* "pyzoltan/core/carray.pyx":1318
 * 
 * 
 *     cdef void c_align_array(self, LongArray new_indices) nogil:             # <<<<<<<<<<<<<<
 *         """Rearrange the array contents according to the new indices.
 *         """
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":1339
 *         aligned_free(<void*>temp)
 * 
 *     cdef void c_append(self, long value) nogil:             # <<<<<<<<<<<<<<
 *         cdef long l = self.length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 */

static void __pyx_f_8pyzoltan_4core_6carray_9LongArray_c_append(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_value) {
  long __pyx_v_l;
  PyArrayObject *__pyx_v_arr;
  long __pyx_t_1;
  int __pyx_t_2;

  /* "pyzoltan/core/carray.pyx":1340
 * 
 *     cdef void c_append(self, long value) nogil:
 *         cdef long l = self.length             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  __pyx_v_l = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":1341
 *     cdef void c_append(self, long value) nogil:
 *         cdef long l = self.length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 * 
 *         if l >= self.alloc:
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":1343
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 *         if l >= self.alloc:             # <<<<<<<<<<<<<<
 *             self.c_reserve(l*2)
 *         self.data[l] = value
 */
  __pyx_t_2 = ((__pyx_v_l >= __pyx_v_self->__pyx_base.alloc) != 0);
  if (__pyx_t_2) {

    /* "pyzoltan/core/carray.pyx":1344
 * 
 *         if l >= self.alloc:
 *             self.c_reserve(l*2)             # <<<<<<<<<<<<<<
 *         self.data[l] = value
 *         self.length += 1
 */
    ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), (__pyx_v_l * 2));
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":1345
 *         if l >= self.alloc:
 *             self.c_reserve(l*2)
 *         self.data[l] = value             # <<<<<<<<<<<<<<
 *         self.length += 1
 * 
 */
  (__pyx_v_self->data[__pyx_v_l]) = __pyx_v_value;

  /* "pyzoltan/core/carray.pyx":1346
 *             self.c_reserve(l*2)
 *         self.data[l] = value
 *         self.length += 1             # <<<<<<<<<<<<<<
 * 
 *         # update the numpy arrays length
 */
  __pyx_v_self->__pyx_base.length = (__pyx_v_self->__pyx_base.length + 1);

  /* "pyzoltan/core/carray.pyx":1349
 * 
 *         # update the numpy arrays length
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_reserve(self, long size) nogil:
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":1339
 *         aligned_free(<void*>temp)
 * 
 *     cdef void c_append(self, long value) nogil:             # <<<<<<<<<<<<<<
 *         cdef long l = self.length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":1351
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_reserve(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 */

static void __pyx_f_8pyzoltan_4core_6carray_9LongArray_c_reserve(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_size) {
  PyArrayObject *__pyx_v_arr;
  void *__pyx_v_data;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("c_reserve", 0);
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  /*try:*/ {

    /* "pyzoltan/core/carray.pyx":1352
 * 
 *     cdef void c_reserve(self, long size) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         cdef void* data = NULL
 *         if size > self.alloc:
 */
    __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

    /* "pyzoltan/core/carray.pyx":1353
 *     cdef void c_reserve(self, long size) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL             # <<<<<<<<<<<<<<
 *         if size > self.alloc:
 *             data = <long*>aligned_realloc(
 */
    __pyx_v_data = NULL;

    /* "pyzoltan/core/carray.pyx":1354
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 *         if size > self.alloc:             # <<<<<<<<<<<<<<
 *             data = <long*>aligned_realloc(
 *                 self.data, size*sizeof(long),
 */
    __pyx_t_1 = ((__pyx_v_size > __pyx_v_self->__pyx_base.alloc) != 0);
    if (__pyx_t_1) {

      /* "pyzoltan/core/carray.pyx":1355
 *         cdef void* data = NULL
 *         if size > self.alloc:
 *             data = <long*>aligned_realloc(             # <<<<<<<<<<<<<<
 *                 self.data, size*sizeof(long),
 *                 self.alloc*sizeof(long)
 */
      __pyx_v_data = ((long *)__pyx_f_8pyzoltan_4core_6carray_aligned_realloc(__pyx_v_self->data, (__pyx_v_size * (sizeof(long))), (__pyx_v_self->__pyx_base.alloc * (sizeof(long)))));

      /* "pyzoltan/core/carray.pyx":1360
 *             )
 * 
 *             if data == NULL:             # <<<<<<<<<<<<<<
 *                 aligned_free(<void*>self.data)
 *                 with gil:
 */
      __pyx_t_1 = ((__pyx_v_data == NULL) != 0);
      if (__pyx_t_1) {

        /* "pyzoltan/core/carray.pyx":1361
 * 
 *             if data == NULL:
 *                 aligned_free(<void*>self.data)             # <<<<<<<<<<<<<<
 *                 with gil:
 *                     raise MemoryError
 */
        __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_self->data));

        /* "pyzoltan/core/carray.pyx":1362
 *             if data == NULL:
 *                 aligned_free(<void*>self.data)
 *                 with gil:             # <<<<<<<<<<<<<<
 *                     raise MemoryError
 * 
 */
        {
            #ifdef WITH_THREAD
            PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
            #endif
            /*try:*/ {

              /* "pyzoltan/core/carray.pyx":1363
 *                 aligned_free(<void*>self.data)
 *                 with gil:
 *                     raise MemoryError             # <<<<<<<<<<<<<<
 * 
 *             self.data = <long*>data
 */
              PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
            }

            /* "pyzoltan/core/carray.pyx":1362
 *             if data == NULL:
 *                 aligned_free(<void*>self.data)
 *                 with gil:             # <<<<<<<<<<<<<<
 *                     raise MemoryError
 * 
 */
            /*finally:*/ {
              __pyx_L9_error: {
                #ifdef WITH_THREAD
                PyGILState_Release(__pyx_gilstate_save);
                #endif
                goto __pyx_L4_error;
              }
            }
        }
      }

      /* "pyzoltan/core/carray.pyx":1365
 *                     raise MemoryError
 * 
 *             self.data = <long*>data             # <<<<<<<<<<<<<<
 *             self.alloc = size
 *             arr.data = <char *>self.data
 */
      __pyx_v_self->data = ((long *)__pyx_v_data);

      /* "pyzoltan/core/carray.pyx":1366
 * 
 *             self.data = <long*>data
 *             self.alloc = size             # <<<<<<<<<<<<<<
 *             arr.data = <char *>self.data
 * 
 */
      __pyx_v_self->__pyx_base.alloc = __pyx_v_size;

      /* "pyzoltan/core/carray.pyx":1367
 *             self.data = <long*>data
 *             self.alloc = size
 *             arr.data = <char *>self.data             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_reset(self) nogil:
 */
      __pyx_v_arr->data = ((char *)__pyx_v_self->data);
      goto __pyx_L6;
    }
    __pyx_L6:;
  }

  /* "pyzoltan/core/carray.pyx":1352
 * 
 *     cdef void c_reserve(self, long size) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         cdef void* data = NULL
 *         if size > self.alloc:
 */
  /*finally:*/ {
    /*normal exit:*/{
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L5;
    }
    __pyx_L4_error: {
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "pyzoltan/core/carray.pyx":1351
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_reserve(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pyzoltan.core.carray.LongArray.c_reserve", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "pyzoltan/core/carray.pyx":1369
 *             arr.data = <char *>self.data
 * 
 *     cdef void c_reset(self) nogil:             # <<<<<<<<<<<<<<
 *         BaseArray.c_reset(self)
 *         if self._old_data != NULL:
 */

static void __pyx_f_8pyzoltan_4core_6carray_9LongArray_c_reset(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self) {
  int __pyx_t_1;
  long *__pyx_t_2;

  /* "pyzoltan/core/carray.pyx":1370
 * 
 *     cdef void c_reset(self) nogil:
 *         BaseArray.c_reset(self)             # <<<<<<<<<<<<<<
 *         if self._old_data != NULL:
 *             self.data = self._old_data
 */
  __pyx_f_8pyzoltan_4core_6carray_9BaseArray_c_reset(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

  /* "pyzoltan/core/carray.pyx":1371
 *     cdef void c_reset(self) nogil:
 *         BaseArray.c_reset(self)
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             self.data = self._old_data
 *             self._old_data = NULL
 */
  __pyx_t_1 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":1372
 *         BaseArray.c_reset(self)
 *         if self._old_data != NULL:
 *             self.data = self._old_data             # <<<<<<<<<<<<<<
 *             self._old_data = NULL
 *             self._npy_array.data = <char *>self.data
 */
    __pyx_t_2 = __pyx_v_self->_old_data;
    __pyx_v_self->data = __pyx_t_2;

    /* "pyzoltan/core/carray.pyx":1373
 *         if self._old_data != NULL:
 *             self.data = self._old_data
 *             self._old_data = NULL             # <<<<<<<<<<<<<<
 *             self._npy_array.data = <char *>self.data
 * 
 */
    __pyx_v_self->_old_data = NULL;

    /* "pyzoltan/core/carray.pyx":1374
 *             self.data = self._old_data
 *             self._old_data = NULL
 *             self._npy_array.data = <char *>self.data             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_resize(self, long size) nogil:
 */
    __pyx_v_self->__pyx_base._npy_array->data = ((char *)__pyx_v_self->data);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":1369
 *             arr.data = <char *>self.data
 * 
 *     cdef void c_reset(self) nogil:             # <<<<<<<<<<<<<<
 *         BaseArray.c_reset(self)
 *         if self._old_data != NULL:
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":1376
 *             self._npy_array.data = <char *>self.data
 * 
 *     cdef void c_resize(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 */

static void __pyx_f_8pyzoltan_4core_6carray_9LongArray_c_resize(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_size) {
  PyArrayObject *__pyx_v_arr;
  long __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":1377
 * 
 *     cdef void c_resize(self, long size) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 * 
 *         # reserve memory
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":1380
 * 
 *         # reserve memory
 *         self.c_reserve(size)             # <<<<<<<<<<<<<<
 * 
 *         # update the lengths
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_size);

  /* "pyzoltan/core/carray.pyx":1383
 * 
 *         # update the lengths
 *         self.length = size             # <<<<<<<<<<<<<<
 *         arr.dimensions[0] = self.length
 * 
 */
  __pyx_v_self->__pyx_base.length = __pyx_v_size;

  /* "pyzoltan/core/carray.pyx":1384
 *         # update the lengths
 *         self.length = size
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_set_view(self, long *array, long length) nogil:
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":1376
 *             self._npy_array.data = <char *>self.data
 * 
 *     cdef void c_resize(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":1386
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_set_view(self, long *array, long length) nogil:             # <<<<<<<<<<<<<<
 *         """Create a view of a given raw data pointer with given length.
 *         """
 */

static void __pyx_f_8pyzoltan_4core_6carray_9LongArray_c_set_view(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long *__pyx_v_array, long __pyx_v_length) {
  PyArrayObject *__pyx_v_arr;
  int __pyx_t_1;
  long *__pyx_t_2;
  long __pyx_t_3;

  /* "pyzoltan/core/carray.pyx":1389
 *         """Create a view of a given raw data pointer with given length.
 *         """
 *         if self._old_data == NULL:             # <<<<<<<<<<<<<<
 *             self._old_data = self.data
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->_old_data == NULL) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":1390
 *         """
 *         if self._old_data == NULL:
 *             self._old_data = self.data             # <<<<<<<<<<<<<<
 * 
 *         self.data = array
 */
    __pyx_t_2 = __pyx_v_self->data;
    __pyx_v_self->_old_data = __pyx_t_2;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":1392
 *             self._old_data = self.data
 * 
 *         self.data = array             # <<<<<<<<<<<<<<
 *         self.length = length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 */
  __pyx_v_self->data = __pyx_v_array;

  /* "pyzoltan/core/carray.pyx":1393
 * 
 *         self.data = array
 *         self.length = length             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data
 */
  __pyx_v_self->__pyx_base.length = __pyx_v_length;

  /* "pyzoltan/core/carray.pyx":1394
 *         self.data = array
 *         self.length = length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         arr.data = <char *>self.data
 *         arr.dimensions[0] = self.length
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":1395
 *         self.length = length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data             # <<<<<<<<<<<<<<
 *         arr.dimensions[0] = self.length
 * 
 */
  __pyx_v_arr->data = ((char *)__pyx_v_self->data);

  /* "pyzoltan/core/carray.pyx":1396
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_squeeze(self) nogil:
 */
  __pyx_t_3 = __pyx_v_self->__pyx_base.length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_3;

  /* "pyzoltan/core/carray.pyx":1386
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_set_view(self, long *array, long length) nogil:             # <<<<<<<<<<<<<<
 *         """Create a view of a given raw data pointer with given length.
 *         """
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":1398
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_squeeze(self) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 */

static void __pyx_f_8pyzoltan_4core_6carray_9LongArray_c_squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self) {
  PyArrayObject *__pyx_v_arr;
  void *__pyx_v_data;
  size_t __pyx_v_size;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  long __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("c_squeeze", 0);
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  /*try:*/ {

    /* "pyzoltan/core/carray.pyx":1399
 * 
 *     cdef void c_squeeze(self) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         cdef void* data = NULL
 *         cdef size_t size = max(self.length, 16)
 */
    __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

    /* "pyzoltan/core/carray.pyx":1400
 *     cdef void c_squeeze(self) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL             # <<<<<<<<<<<<<<
 *         cdef size_t size = max(self.length, 16)
 *         data = <long*>aligned_realloc(
 */
    __pyx_v_data = NULL;

    /* "pyzoltan/core/carray.pyx":1401
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 *         cdef size_t size = max(self.length, 16)             # <<<<<<<<<<<<<<
 *         data = <long*>aligned_realloc(
 *             self.data, size*sizeof(long),
 */
    __pyx_t_1 = 16;
    __pyx_t_2 = __pyx_v_self->__pyx_base.length;
    if (((__pyx_t_1 > __pyx_t_2) != 0)) {
      __pyx_t_3 = __pyx_t_1;
    } else {
      __pyx_t_3 = __pyx_t_2;
    }
    __pyx_v_size = __pyx_t_3;

    /* "pyzoltan/core/carray.pyx":1402
 *         cdef void* data = NULL
 *         cdef size_t size = max(self.length, 16)
 *         data = <long*>aligned_realloc(             # <<<<<<<<<<<<<<
 *             self.data, size*sizeof(long),
 *             self.alloc*sizeof(long)
 */
    __pyx_v_data = ((long *)__pyx_f_8pyzoltan_4core_6carray_aligned_realloc(__pyx_v_self->data, (__pyx_v_size * (sizeof(long))), (__pyx_v_self->__pyx_base.alloc * (sizeof(long)))));

    /* "pyzoltan/core/carray.pyx":1407
 *         )
 * 
 *         if data == NULL:             # <<<<<<<<<<<<<<
 *             # free original data
 *             aligned_free(<void*>self.data)
 */
    __pyx_t_4 = ((__pyx_v_data == NULL) != 0);
    if (__pyx_t_4) {

      /* "pyzoltan/core/carray.pyx":1409
 *         if data == NULL:
 *             # free original data
 *             aligned_free(<void*>self.data)             # <<<<<<<<<<<<<<
 *             with gil:
 *                 raise MemoryError
 */
      __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_self->data));

      /* "pyzoltan/core/carray.pyx":1410
 *             # free original data
 *             aligned_free(<void*>self.data)
 *             with gil:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 * 
 */
      {
          #ifdef WITH_THREAD
          PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
          #endif
          /*try:*/ {

            /* "pyzoltan/core/carray.pyx":1411
 *             aligned_free(<void*>self.data)
 *             with gil:
 *                 raise MemoryError             # <<<<<<<<<<<<<<
 * 
 *         self.data = <long*>data
 */
            PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          }

          /* "pyzoltan/core/carray.pyx":1410
 *             # free original data
 *             aligned_free(<void*>self.data)
 *             with gil:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 * 
 */
          /*finally:*/ {
            __pyx_L8_error: {
              #ifdef WITH_THREAD
              PyGILState_Release(__pyx_gilstate_save);
              #endif
              goto __pyx_L4_error;
            }
          }
      }
    }

    /* "pyzoltan/core/carray.pyx":1413
 *                 raise MemoryError
 * 
 *         self.data = <long*>data             # <<<<<<<<<<<<<<
 *         self.alloc = size
 *         arr.data = <char *>self.data
 */
    __pyx_v_self->data = ((long *)__pyx_v_data);

    /* "pyzoltan/core/carray.pyx":1414
 * 
 *         self.data = <long*>data
 *         self.alloc = size             # <<<<<<<<<<<<<<
 *         arr.data = <char *>self.data
 * 
 */
    __pyx_v_self->__pyx_base.alloc = __pyx_v_size;

    /* "pyzoltan/core/carray.pyx":1415
 *         self.data = <long*>data
 *         self.alloc = size
 *         arr.data = <char *>self.data             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_arr->data = ((char *)__pyx_v_self->data);
  }

  /* "pyzoltan/core/carray.pyx":1399
 * 
 *     cdef void c_squeeze(self) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         cdef void* data = NULL
 *         cdef size_t size = max(self.length, 16)
 */
  /*finally:*/ {
    /*normal exit:*/{
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L5;
    }
    __pyx_L4_error: {
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "pyzoltan/core/carray.pyx":1398
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_squeeze(self) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pyzoltan.core.carray.LongArray.c_squeeze", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "pyzoltan/core/carray.pyx":1418
 * 
 * 
 *     cpdef str get_c_type(self):             # <<<<<<<<<<<<<<
 *         """Return the c data type for this array as a string.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_17get_c_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_get_c_type(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, int __pyx_skip_dispatch) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_c_type", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_c_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_17get_c_type)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1418; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1421
 *         """Return the c data type for this array as a string.
 *         """
 *         return 'long'             # <<<<<<<<<<<<<<
 * 
 *     cdef long* get_data_ptr(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_n_s_long);
  __pyx_r = __pyx_n_s_long;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":1418
 * 
 * 
 *     cpdef str get_c_type(self):             # <<<<<<<<<<<<<<
 *         """Return the c data type for this array as a string.
 *         """
 */

  /* 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("pyzoltan.core.carray.LongArray.get_c_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_17get_c_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9LongArray_16get_c_type[] = "LongArray.get_c_type(self) -> str\nReturn the c data type for this array as a string.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_17get_c_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_c_type (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_16get_c_type(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_16get_c_type(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_c_type", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9LongArray_get_c_type(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1418; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.LongArray.get_c_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1423
 *         return 'long'
 * 
 *     cdef long* get_data_ptr(self):             # <<<<<<<<<<<<<<
 *         """Return the internal data pointer.
 *         """
 */

static long *__pyx_f_8pyzoltan_4core_6carray_9LongArray_get_data_ptr(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self) {
  long *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_data_ptr", 0);

  /* "pyzoltan/core/carray.pyx":1426
 *         """Return the internal data pointer.
 *         """
 *         return self.data             # <<<<<<<<<<<<<<
 * 
 *     cpdef long get(self, long idx):
 */
  __pyx_r = __pyx_v_self->data;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":1423
 *         return 'long'
 * 
 *     cdef long* get_data_ptr(self):             # <<<<<<<<<<<<<<
 *         """Return the internal data pointer.
 *         """
 */

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

/* "pyzoltan/core/carray.pyx":1428
 *         return self.data
 * 
 *     cpdef long get(self, long idx):             # <<<<<<<<<<<<<<
 *         """Gets value stored at position `idx`.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_19get(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx); /*proto*/
static long __pyx_f_8pyzoltan_4core_6carray_9LongArray_get(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_idx, int __pyx_skip_dispatch) {
  long __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 = NULL;
  PyObject *__pyx_t_6 = NULL;
  long __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_19get)) {
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_idx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __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;
      __pyx_t_7 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_7;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1431
 *         """Gets value stored at position `idx`.
 *         """
 *         return self.data[idx]             # <<<<<<<<<<<<<<
 * 
 *     cpdef set(self, long idx, long value):
 */
  __pyx_r = (__pyx_v_self->data[__pyx_v_idx]);
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":1428
 *         return self.data
 * 
 *     cpdef long get(self, long idx):             # <<<<<<<<<<<<<<
 *         """Gets value stored at position `idx`.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("pyzoltan.core.carray.LongArray.get", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_19get(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9LongArray_18get[] = "LongArray.get(self, long idx) -> long\nGets value stored at position `idx`.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_19get(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx) {
  long __pyx_v_idx;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  assert(__pyx_arg_idx); {
    __pyx_v_idx = __Pyx_PyInt_As_long(__pyx_arg_idx); if (unlikely((__pyx_v_idx == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_18get(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self), ((long)__pyx_v_idx));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_18get(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_idx) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_f_8pyzoltan_4core_6carray_9LongArray_get(__pyx_v_self, __pyx_v_idx, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.LongArray.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1433
 *         return self.data[idx]
 * 
 *     cpdef set(self, long idx, long value):             # <<<<<<<<<<<<<<
 *         """Sets location `idx` to `value`.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_21set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_set(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_idx, long __pyx_v_value, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_21set)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_idx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      }
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1436
 *         """Sets location `idx` to `value`.
 *         """
 *         self.data[idx] = value             # <<<<<<<<<<<<<<
 * 
 *     cpdef append(self, long value):
 */
  (__pyx_v_self->data[__pyx_v_idx]) = __pyx_v_value;

  /* "pyzoltan/core/carray.pyx":1433
 *         return self.data[idx]
 * 
 *     cpdef set(self, long idx, long value):             # <<<<<<<<<<<<<<
 *         """Sets location `idx` to `value`.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_21set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9LongArray_20set[] = "LongArray.set(self, long idx, long value)\nSets location `idx` to `value`.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_21set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_idx;
  long __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idx,&__pyx_n_s_value,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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_idx)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1433; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1433; __pyx_clineno = __LINE__; goto __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_idx = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_idx == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1433; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_value = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_value == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1433; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1433; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_20set(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self), __pyx_v_idx, __pyx_v_value);

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_20set(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_idx, long __pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9LongArray_set(__pyx_v_self, __pyx_v_idx, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1433; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.LongArray.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1438
 *         self.data[idx] = value
 * 
 *     cpdef append(self, long value):             # <<<<<<<<<<<<<<
 *         """Appends `value` to the end of the array.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_23append(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_append(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_value, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_append); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_23append)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1438; __pyx_clineno = __LINE__; goto __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;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1441
 *         """Appends `value` to the end of the array.
 *         """
 *         self.c_append(value)             # <<<<<<<<<<<<<<
 * 
 *     cpdef reserve(self, long size):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->c_append(__pyx_v_self, __pyx_v_value);

  /* "pyzoltan/core/carray.pyx":1438
 *         self.data[idx] = value
 * 
 *     cpdef append(self, long value):             # <<<<<<<<<<<<<<
 *         """Appends `value` to the end of the array.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_23append(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9LongArray_22append[] = "LongArray.append(self, long value)\nAppends `value` to the end of the array.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_23append(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  long __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __Pyx_PyInt_As_long(__pyx_arg_value); if (unlikely((__pyx_v_value == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1438; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_22append(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self), ((long)__pyx_v_value));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_22append(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9LongArray_append(__pyx_v_self, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1438; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.LongArray.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1443
 *         self.c_append(value)
 * 
 *     cpdef reserve(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes the internal data to ``size*sizeof(long)`` bytes.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_25reserve(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_reserve(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_size, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reserve", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reserve); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_25reserve)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __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;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1446
 *         """Resizes the internal data to ``size*sizeof(long)`` bytes.
 *         """
 *         self.c_reserve(size)             # <<<<<<<<<<<<<<
 * 
 *     cpdef reset(self):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_size);

  /* "pyzoltan/core/carray.pyx":1443
 *         self.c_append(value)
 * 
 *     cpdef reserve(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes the internal data to ``size*sizeof(long)`` bytes.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_25reserve(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9LongArray_24reserve[] = "LongArray.reserve(self, long size)\nResizes the internal data to ``size*sizeof(long)`` bytes.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_25reserve(PyObject *__pyx_v_self, PyObject *__pyx_arg_size) {
  long __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reserve (wrapper)", 0);
  assert(__pyx_arg_size); {
    __pyx_v_size = __Pyx_PyInt_As_long(__pyx_arg_size); if (unlikely((__pyx_v_size == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_24reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self), ((long)__pyx_v_size));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_24reserve(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reserve", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9LongArray_reserve(__pyx_v_self, __pyx_v_size, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.LongArray.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1448
 *         self.c_reserve(size)
 * 
 *     cpdef reset(self):             # <<<<<<<<<<<<<<
 *         """Reset the length of the array to 0.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_27reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_reset(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, int __pyx_skip_dispatch) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reset", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_27reset)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1451
 *         """Reset the length of the array to 0.
 *         """
 *         self.c_reset()             # <<<<<<<<<<<<<<
 *         if self._old_data != NULL:
 *             self._parent = None
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_reset(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

  /* "pyzoltan/core/carray.pyx":1452
 *         """
 *         self.c_reset()
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             self._parent = None
 * 
 */
  __pyx_t_5 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_5) {

    /* "pyzoltan/core/carray.pyx":1453
 *         self.c_reset()
 *         if self._old_data != NULL:
 *             self._parent = None             # <<<<<<<<<<<<<<
 * 
 *     cpdef resize(self, long size):
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_parent);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_parent));
    __pyx_v_self->_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)Py_None);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":1448
 *         self.c_reserve(size)
 * 
 *     cpdef reset(self):             # <<<<<<<<<<<<<<
 *         """Reset the length of the array to 0.
 *         """
 */

  /* 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("pyzoltan.core.carray.LongArray.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_27reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9LongArray_26reset[] = "LongArray.reset(self)\nReset the length of the array to 0.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_27reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_26reset(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_26reset(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reset", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9LongArray_reset(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.LongArray.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1455
 *             self._parent = None
 * 
 *     cpdef resize(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes internal data to ``size*sizeof(long)`` bytes
 *         and sets the length to the new size.
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_29resize(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_resize(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_size, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resize", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_resize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_29resize)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1455; __pyx_clineno = __LINE__; goto __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;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1460
 * 
 *         """
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             raise RuntimeError('Cannot reize array which is a view.')
 * 
 */
  __pyx_t_7 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_7) {

    /* "pyzoltan/core/carray.pyx":1461
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot reize array which is a view.')             # <<<<<<<<<<<<<<
 * 
 *         self.c_resize(size)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":1463
 *             raise RuntimeError('Cannot reize array which is a view.')
 * 
 *         self.c_resize(size)             # <<<<<<<<<<<<<<
 * 
 *     cpdef set_view(self, LongArray parent, long start, long end):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_resize(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_size);

  /* "pyzoltan/core/carray.pyx":1455
 *             self._parent = None
 * 
 *     cpdef resize(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes internal data to ``size*sizeof(long)`` bytes
 *         and sets the length to the new size.
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_29resize(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9LongArray_28resize[] = "LongArray.resize(self, long size)\nResizes internal data to ``size*sizeof(long)`` bytes\n        and sets the length to the new size.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_29resize(PyObject *__pyx_v_self, PyObject *__pyx_arg_size) {
  long __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resize (wrapper)", 0);
  assert(__pyx_arg_size); {
    __pyx_v_size = __Pyx_PyInt_As_long(__pyx_arg_size); if (unlikely((__pyx_v_size == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1455; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_28resize(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self), ((long)__pyx_v_size));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_28resize(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, long __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9LongArray_resize(__pyx_v_self, __pyx_v_size, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1455; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.LongArray.resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1465
 *         self.c_resize(size)
 * 
 *     cpdef set_view(self, LongArray parent, long start, long end):             # <<<<<<<<<<<<<<
 *         """Create a view of a given a `parent` array from start to end.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_31set_view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_set_view(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_parent, long __pyx_v_start, long __pyx_v_end, int __pyx_skip_dispatch) {
  PyArrayObject *__pyx_v_arr;
  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;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  long *__pyx_t_11;
  long __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_view", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_view); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_31set_view)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_parent));
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, ((PyObject *)__pyx_v_parent));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_parent));
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1482
 * 
 *         """
 *         if self._parent is None:             # <<<<<<<<<<<<<<
 *             self._old_data = self.data
 *         self._parent = parent
 */
  __pyx_t_9 = (((PyObject *)__pyx_v_self->_parent) == Py_None);
  __pyx_t_10 = (__pyx_t_9 != 0);
  if (__pyx_t_10) {

    /* "pyzoltan/core/carray.pyx":1483
 *         """
 *         if self._parent is None:
 *             self._old_data = self.data             # <<<<<<<<<<<<<<
 *         self._parent = parent
 *         self.data = parent.data + start
 */
    __pyx_t_11 = __pyx_v_self->data;
    __pyx_v_self->_old_data = __pyx_t_11;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":1484
 *         if self._parent is None:
 *             self._old_data = self.data
 *         self._parent = parent             # <<<<<<<<<<<<<<
 *         self.data = parent.data + start
 *         self.length = end - start
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_parent));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_parent));
  __Pyx_GOTREF(__pyx_v_self->_parent);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_parent));
  __pyx_v_self->_parent = __pyx_v_parent;

  /* "pyzoltan/core/carray.pyx":1485
 *             self._old_data = self.data
 *         self._parent = parent
 *         self.data = parent.data + start             # <<<<<<<<<<<<<<
 *         self.length = end - start
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 */
  __pyx_v_self->data = (__pyx_v_parent->data + __pyx_v_start);

  /* "pyzoltan/core/carray.pyx":1486
 *         self._parent = parent
 *         self.data = parent.data + start
 *         self.length = end - start             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data
 */
  __pyx_v_self->__pyx_base.length = (__pyx_v_end - __pyx_v_start);

  /* "pyzoltan/core/carray.pyx":1487
 *         self.data = parent.data + start
 *         self.length = end - start
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         arr.data = <char *>self.data
 *         arr.dimensions[0] = self.length
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":1488
 *         self.length = end - start
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data             # <<<<<<<<<<<<<<
 *         arr.dimensions[0] = self.length
 * 
 */
  __pyx_v_arr->data = ((char *)__pyx_v_self->data);

  /* "pyzoltan/core/carray.pyx":1489
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cpdef squeeze(self):
 */
  __pyx_t_12 = __pyx_v_self->__pyx_base.length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_12;

  /* "pyzoltan/core/carray.pyx":1465
 *         self.c_resize(size)
 * 
 *     cpdef set_view(self, LongArray parent, long start, long end):             # <<<<<<<<<<<<<<
 *         """Create a view of a given a `parent` array from start to end.
 * 
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.set_view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_31set_view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9LongArray_30set_view[] = "LongArray.set_view(self, LongArray parent, long start, long end)\nCreate a view of a given a `parent` array from start to end.\n\n        Note that this excludes the end index.\n\n        Parameters\n        ----------\n\n        parent : LongArray\n            The parent array of which this is a view.\n        start : long\n            The starting index to start the view from.\n        end : long\n            The ending index to end the view at, excludes the end\n            itself.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_31set_view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_parent = 0;
  long __pyx_v_start;
  long __pyx_v_end;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parent,&__pyx_n_s_start,&__pyx_n_s_end,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parent)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_view", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_view", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_view") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __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_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)values[0]);
    __pyx_v_start = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_start == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_end = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_end == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_view", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.set_view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_8pyzoltan_4core_6carray_LongArray, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_30set_view(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self), __pyx_v_parent, __pyx_v_start, __pyx_v_end);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_30set_view(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_parent, long __pyx_v_start, long __pyx_v_end) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_view", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9LongArray_set_view(__pyx_v_self, __pyx_v_parent, __pyx_v_start, __pyx_v_end, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.LongArray.set_view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1491
 *         arr.dimensions[0] = self.length
 * 
 *     cpdef squeeze(self):             # <<<<<<<<<<<<<<
 *         """Release any unused memory.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_33squeeze(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, int __pyx_skip_dispatch) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("squeeze", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_squeeze); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_33squeeze)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1491; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1494
 *         """Release any unused memory.
 *         """
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             raise RuntimeError('Cannot squeeze array which is a view.')
 * 
 */
  __pyx_t_5 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_5) {

    /* "pyzoltan/core/carray.pyx":1495
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot squeeze array which is a view.')             # <<<<<<<<<<<<<<
 * 
 *         self.c_squeeze()
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1495; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":1497
 *             raise RuntimeError('Cannot squeeze array which is a view.')
 * 
 *         self.c_squeeze()             # <<<<<<<<<<<<<<
 * 
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=0):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_squeeze(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

  /* "pyzoltan/core/carray.pyx":1491
 *         arr.dimensions[0] = self.length
 * 
 *     cpdef squeeze(self):             # <<<<<<<<<<<<<<
 *         """Release any unused memory.
 *         """
 */

  /* 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("pyzoltan.core.carray.LongArray.squeeze", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_33squeeze(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9LongArray_32squeeze[] = "LongArray.squeeze(self)\nRelease any unused memory.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_33squeeze(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("squeeze (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_32squeeze(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_32squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("squeeze", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9LongArray_squeeze(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1491; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.LongArray.squeeze", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1499
 *         self.c_squeeze()
 * 
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=0):             # <<<<<<<<<<<<<<
 *         """Remove the particles with indices in index_list.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_35remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_remove(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9LongArray_remove *__pyx_optional_args) {
  int __pyx_v_input_sorted = ((int)0);
  long __pyx_v_i;
  long __pyx_v_inlength;
  PyArrayObject *__pyx_v_sorted_indices = 0;
  long __pyx_v_id;
  PyArrayObject *__pyx_v_arr;
  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;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  long __pyx_t_9;
  long __pyx_t_10;
  long __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_input_sorted = __pyx_optional_args->input_sorted;
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_35remove)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_input_sorted); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_6 = 1;
        }
      }
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_index_list));
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_index_list));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_index_list));
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1520
 * 
 *         """
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             raise RuntimeError('Cannot remove elements from view array.')
 *         cdef long i
 */
  __pyx_t_8 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_8) {

    /* "pyzoltan/core/carray.pyx":1521
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot remove elements from view array.')             # <<<<<<<<<<<<<<
 *         cdef long i
 *         cdef long inlength = index_list.size
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1521; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":1523
 *             raise RuntimeError('Cannot remove elements from view array.')
 *         cdef long i
 *         cdef long inlength = index_list.size             # <<<<<<<<<<<<<<
 *         cdef np.ndarray sorted_indices
 *         cdef long id
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_index_list), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_inlength = __pyx_t_9;

  /* "pyzoltan/core/carray.pyx":1526
 *         cdef np.ndarray sorted_indices
 *         cdef long id
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 * 
 *         if inlength > self.length:
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":1528
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 *         if inlength > self.length:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_8 = ((__pyx_v_inlength > __pyx_v_self->__pyx_base.length) != 0);
  if (__pyx_t_8) {

    /* "pyzoltan/core/carray.pyx":1529
 * 
 *         if inlength > self.length:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if input_sorted != 1:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "pyzoltan/core/carray.pyx":1531
 *             return
 * 
 *         if input_sorted != 1:             # <<<<<<<<<<<<<<
 *             sorted_indices = np.sort(index_list)
 *         else:
 */
  __pyx_t_8 = ((__pyx_v_input_sorted != 1) != 0);
  if (__pyx_t_8) {

    /* "pyzoltan/core/carray.pyx":1532
 * 
 *         if input_sorted != 1:
 *             sorted_indices = np.sort(index_list)             # <<<<<<<<<<<<<<
 *         else:
 *             sorted_indices = index_list
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sort); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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, ((PyObject *)__pyx_v_index_list)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(((PyObject *)__pyx_v_index_list));
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, ((PyObject *)__pyx_v_index_list));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_index_list));
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_sorted_indices = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pyzoltan/core/carray.pyx":1534
 *             sorted_indices = np.sort(index_list)
 *         else:
 *             sorted_indices = index_list             # <<<<<<<<<<<<<<
 * 
 *         for i in range(inlength):
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_index_list));
    __pyx_v_sorted_indices = __pyx_v_index_list;
  }
  __pyx_L5:;

  /* "pyzoltan/core/carray.pyx":1536
 *             sorted_indices = index_list
 * 
 *         for i in range(inlength):             # <<<<<<<<<<<<<<
 *             id = sorted_indices[inlength-(i+1)]
 *             if id < self.length:
 */
  __pyx_t_9 = __pyx_v_inlength;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_i = __pyx_t_10;

    /* "pyzoltan/core/carray.pyx":1537
 * 
 *         for i in range(inlength):
 *             id = sorted_indices[inlength-(i+1)]             # <<<<<<<<<<<<<<
 *             if id < self.length:
 *                 self.data[id] = self.data[self.length-1]
 */
    __pyx_t_11 = (__pyx_v_inlength - (__pyx_v_i + 1));
    __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_sorted_indices), __pyx_t_11, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1537; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_11 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_id = __pyx_t_11;

    /* "pyzoltan/core/carray.pyx":1538
 *         for i in range(inlength):
 *             id = sorted_indices[inlength-(i+1)]
 *             if id < self.length:             # <<<<<<<<<<<<<<
 *                 self.data[id] = self.data[self.length-1]
 *                 self.length = self.length - 1
 */
    __pyx_t_8 = ((__pyx_v_id < __pyx_v_self->__pyx_base.length) != 0);
    if (__pyx_t_8) {

      /* "pyzoltan/core/carray.pyx":1539
 *             id = sorted_indices[inlength-(i+1)]
 *             if id < self.length:
 *                 self.data[id] = self.data[self.length-1]             # <<<<<<<<<<<<<<
 *                 self.length = self.length - 1
 *                 arr.dimensions[0] = self.length
 */
      (__pyx_v_self->data[__pyx_v_id]) = (__pyx_v_self->data[(__pyx_v_self->__pyx_base.length - 1)]);

      /* "pyzoltan/core/carray.pyx":1540
 *             if id < self.length:
 *                 self.data[id] = self.data[self.length-1]
 *                 self.length = self.length - 1             # <<<<<<<<<<<<<<
 *                 arr.dimensions[0] = self.length
 * 
 */
      __pyx_v_self->__pyx_base.length = (__pyx_v_self->__pyx_base.length - 1);

      /* "pyzoltan/core/carray.pyx":1541
 *                 self.data[id] = self.data[self.length-1]
 *                 self.length = self.length - 1
 *                 arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cpdef extend(self, np.ndarray in_array):
 */
      __pyx_t_11 = __pyx_v_self->__pyx_base.length;
      (__pyx_v_arr->dimensions[0]) = __pyx_t_11;
      goto __pyx_L8;
    }
    __pyx_L8:;
  }

  /* "pyzoltan/core/carray.pyx":1499
 *         self.c_squeeze()
 * 
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=0):             # <<<<<<<<<<<<<<
 *         """Remove the particles with indices in index_list.
 * 
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sorted_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_35remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9LongArray_34remove[] = "LongArray.remove(self, ndarray index_list, bool input_sorted=0)\nRemove the particles with indices in index_list.\n\n        Parameters\n        ----------\n\n        index_list : ndarray\n            a list of indices which should be removed.\n        input_sorted : bool\n            indicates if the input is sorted in ascending order.  if\n            not, the array will be sorted internally.\n\n        Notes\n        -----\n\n         If the input indices are not sorted, sort them in ascending order.\n         Starting with the last element in the index list, start replacing the\n         element at the said index with the last element in the data and update\n         the length of the array.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_35remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_index_list = 0;
  int __pyx_v_input_sorted;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index_list,&__pyx_n_s_input_sorted,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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index_list)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_input_sorted);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "remove") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_index_list = ((PyArrayObject *)values[0]);
    if (values[1]) {
      __pyx_v_input_sorted = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_input_sorted == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_input_sorted = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("remove", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index_list), __pyx_ptype_5numpy_ndarray, 1, "index_list", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_34remove(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self), __pyx_v_index_list, __pyx_v_input_sorted);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_34remove(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_v_input_sorted) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_remove __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.input_sorted = __pyx_v_input_sorted;
  __pyx_t_1 = __pyx_vtabptr_8pyzoltan_4core_6carray_LongArray->__pyx_base.remove(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_index_list, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.LongArray.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1543
 *                 arr.dimensions[0] = self.length
 * 
 *     cpdef extend(self, np.ndarray in_array):             # <<<<<<<<<<<<<<
 *         """Extend the array with data from in_array.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_37extend(PyObject *__pyx_v_self, PyObject *__pyx_v_in_array); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_extend(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array, int __pyx_skip_dispatch) {
  long __pyx_v_len;
  long __pyx_v_i;
  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;
  int __pyx_t_6;
  long __pyx_t_7;
  long __pyx_t_8;
  long __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_37extend)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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, ((PyObject *)__pyx_v_in_array)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_v_in_array));
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, ((PyObject *)__pyx_v_in_array));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_in_array));
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1559
 * 
 *         """
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             raise RuntimeError('Cannot extend array which is a view.')
 *         cdef long len = in_array.size
 */
  __pyx_t_6 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_6) {

    /* "pyzoltan/core/carray.pyx":1560
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot extend array which is a view.')             # <<<<<<<<<<<<<<
 *         cdef long len = in_array.size
 *         cdef long i
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1560; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":1561
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot extend array which is a view.')
 *         cdef long len = in_array.size             # <<<<<<<<<<<<<<
 *         cdef long i
 *         for i in range(len):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_in_array), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_len = __pyx_t_7;

  /* "pyzoltan/core/carray.pyx":1563
 *         cdef long len = in_array.size
 *         cdef long i
 *         for i in range(len):             # <<<<<<<<<<<<<<
 *             self.append(in_array[i])
 * 
 */
  __pyx_t_7 = __pyx_v_len;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pyzoltan/core/carray.pyx":1564
 *         cdef long i
 *         for i in range(len):
 *             self.append(in_array[i])             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy_values(self, LongArray indices, BaseArray dest):
 */
    __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_in_array), __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->append(__pyx_v_self, __pyx_t_9, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1543
 *                 arr.dimensions[0] = self.length
 * 
 *     cpdef extend(self, np.ndarray in_array):             # <<<<<<<<<<<<<<
 *         """Extend the array with data from in_array.
 * 
 */

  /* 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("pyzoltan.core.carray.LongArray.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_37extend(PyObject *__pyx_v_self, PyObject *__pyx_v_in_array); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9LongArray_36extend[] = "LongArray.extend(self, ndarray in_array)\nExtend the array with data from in_array.\n\n        Parameters\n        ----------\n\n        in_array : ndarray\n            a numpy array with data to be added to the current array.\n\n        Notes\n        -----\n\n         - accessing the in_array using the indexing operation seems to be\n           costly. Look at the annotated cython html file.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_37extend(PyObject *__pyx_v_self, PyObject *__pyx_v_in_array) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("extend (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_array), __pyx_ptype_5numpy_ndarray, 1, "in_array", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_36extend(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self), ((PyArrayObject *)__pyx_v_in_array));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_36extend(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9LongArray_extend(__pyx_v_self, __pyx_v_in_array, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.LongArray.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1566
 *             self.append(in_array[i])
 * 
 *     cpdef copy_values(self, LongArray indices, BaseArray dest):             # <<<<<<<<<<<<<<
 *         """Copies values of indices in indices from self to `dest`.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_39copy_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest, int __pyx_skip_dispatch) {
  struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_dest_array = 0;
  long __pyx_v_i;
  long __pyx_v_num_values;
  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;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  long __pyx_t_7;
  long __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_values", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy_values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_39copy_values)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && 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);
          __pyx_t_5 = 1;
        }
      }
      __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_4) {
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_indices));
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, ((PyObject *)__pyx_v_indices));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_indices));
      __Pyx_INCREF(((PyObject *)__pyx_v_dest));
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_dest));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_dest));
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1572
 *         i.e. atleast as long as indices.
 *         """
 *         cdef LongArray dest_array = <LongArray>dest             # <<<<<<<<<<<<<<
 *         cdef long i, num_values
 *         num_values = indices.length
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_dest);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_dest_array = ((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":1574
 *         cdef LongArray dest_array = <LongArray>dest
 *         cdef long i, num_values
 *         num_values = indices.length             # <<<<<<<<<<<<<<
 * 
 *         for i in range(num_values):
 */
  __pyx_t_7 = __pyx_v_indices->__pyx_base.length;
  __pyx_v_num_values = __pyx_t_7;

  /* "pyzoltan/core/carray.pyx":1576
 *         num_values = indices.length
 * 
 *         for i in range(num_values):             # <<<<<<<<<<<<<<
 *             dest_array.data[i] = self.data[indices.data[i]]
 * 
 */
  __pyx_t_7 = __pyx_v_num_values;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pyzoltan/core/carray.pyx":1577
 * 
 *         for i in range(num_values):
 *             dest_array.data[i] = self.data[indices.data[i]]             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy_subset(self, BaseArray source, long start_index=-1,
 */
    (__pyx_v_dest_array->data[__pyx_v_i]) = (__pyx_v_self->data[(__pyx_v_indices->data[__pyx_v_i])]);
  }

  /* "pyzoltan/core/carray.pyx":1566
 *             self.append(in_array[i])
 * 
 *     cpdef copy_values(self, LongArray indices, BaseArray dest):             # <<<<<<<<<<<<<<
 *         """Copies values of indices in indices from self to `dest`.
 * 
 */

  /* 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_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.copy_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dest_array);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_39copy_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9LongArray_38copy_values[] = "LongArray.copy_values(self, LongArray indices, BaseArray dest)\nCopies values of indices in indices from self to `dest`.\n\n        No size check if performed, we assume the dest to of proper size\n        i.e. atleast as long as indices.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_39copy_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices = 0;
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_values (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,&__pyx_n_s_dest,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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indices)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dest)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("copy_values", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy_values") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __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_indices = ((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)values[0]);
    __pyx_v_dest = ((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy_values", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.copy_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_8pyzoltan_4core_6carray_LongArray, 1, "indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dest), __pyx_ptype_8pyzoltan_4core_6carray_BaseArray, 1, "dest", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_38copy_values(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self), __pyx_v_indices, __pyx_v_dest);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_38copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_values", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9LongArray_copy_values(__pyx_v_self, __pyx_v_indices, __pyx_v_dest, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.LongArray.copy_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1579
 *             dest_array.data[i] = self.data[indices.data[i]]
 * 
 *     cpdef copy_subset(self, BaseArray source, long start_index=-1,             # <<<<<<<<<<<<<<
 *                       long end_index=-1):
 *         """Copy a subset of values from src to self.
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_41copy_subset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9LongArray_copy_subset *__pyx_optional_args) {
  long __pyx_v_start_index = ((long)-1);
  long __pyx_v_end_index = ((long)-1);
  long __pyx_v_si;
  long __pyx_v_ei;
  long __pyx_v_s_length;
  long __pyx_v_d_length;
  long __pyx_v_i;
  long __pyx_v_j;
  struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_src = 0;
  PyObject *__pyx_v_msg = 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;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  long __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  long __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_subset", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_start_index = __pyx_optional_args->start_index;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_end_index = __pyx_optional_args->end_index;
      }
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy_subset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_41copy_subset)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_start_index); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_end_index); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_source));
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, ((PyObject *)__pyx_v_source));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_source));
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1594
 *         """
 *         cdef long si, ei, s_length, d_length, i, j
 *         cdef LongArray src = <LongArray>source             # <<<<<<<<<<<<<<
 *         s_length = src.length
 *         d_length = self.length
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_source);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_src = ((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":1595
 *         cdef long si, ei, s_length, d_length, i, j
 *         cdef LongArray src = <LongArray>source
 *         s_length = src.length             # <<<<<<<<<<<<<<
 *         d_length = self.length
 * 
 */
  __pyx_t_9 = __pyx_v_src->__pyx_base.length;
  __pyx_v_s_length = __pyx_t_9;

  /* "pyzoltan/core/carray.pyx":1596
 *         cdef LongArray src = <LongArray>source
 *         s_length = src.length
 *         d_length = self.length             # <<<<<<<<<<<<<<
 * 
 *         if end_index < 0:
 */
  __pyx_t_9 = __pyx_v_self->__pyx_base.length;
  __pyx_v_d_length = __pyx_t_9;

  /* "pyzoltan/core/carray.pyx":1598
 *         d_length = self.length
 * 
 *         if end_index < 0:             # <<<<<<<<<<<<<<
 *             if start_index < 0:
 *                 if s_length != d_length:
 */
  __pyx_t_10 = ((__pyx_v_end_index < 0) != 0);
  if (__pyx_t_10) {

    /* "pyzoltan/core/carray.pyx":1599
 * 
 *         if end_index < 0:
 *             if start_index < 0:             # <<<<<<<<<<<<<<
 *                 if s_length != d_length:
 *                     msg = 'Source length should be same as dest length'
 */
    __pyx_t_10 = ((__pyx_v_start_index < 0) != 0);
    if (__pyx_t_10) {

      /* "pyzoltan/core/carray.pyx":1600
 *         if end_index < 0:
 *             if start_index < 0:
 *                 if s_length != d_length:             # <<<<<<<<<<<<<<
 *                     msg = 'Source length should be same as dest length'
 *                     logger.error(msg)
 */
      __pyx_t_10 = ((__pyx_v_s_length != __pyx_v_d_length) != 0);
      if (__pyx_t_10) {

        /* "pyzoltan/core/carray.pyx":1601
 *             if start_index < 0:
 *                 if s_length != d_length:
 *                     msg = 'Source length should be same as dest length'             # <<<<<<<<<<<<<<
 *                     logger.error(msg)
 *                     raise ValueError, msg
 */
        __Pyx_INCREF(__pyx_kp_s_Source_length_should_be_same_as);
        __pyx_v_msg = __pyx_kp_s_Source_length_should_be_same_as;

        /* "pyzoltan/core/carray.pyx":1602
 *                 if s_length != d_length:
 *                     msg = 'Source length should be same as dest length'
 *                     logger.error(msg)             # <<<<<<<<<<<<<<
 *                     raise ValueError, msg
 *                 si = 0
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        if (!__pyx_t_2) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "pyzoltan/core/carray.pyx":1603
 *                     msg = 'Source length should be same as dest length'
 *                     logger.error(msg)
 *                     raise ValueError, msg             # <<<<<<<<<<<<<<
 *                 si = 0
 *                 ei = self.length
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "pyzoltan/core/carray.pyx":1604
 *                     logger.error(msg)
 *                     raise ValueError, msg
 *                 si = 0             # <<<<<<<<<<<<<<
 *                 ei = self.length
 *             else:
 */
      __pyx_v_si = 0;

      /* "pyzoltan/core/carray.pyx":1605
 *                     raise ValueError, msg
 *                 si = 0
 *                 ei = self.length             # <<<<<<<<<<<<<<
 *             else:
 *                 # meaning we copy from the specified start index to the end of
 */
      __pyx_t_9 = __pyx_v_self->__pyx_base.length;
      __pyx_v_ei = __pyx_t_9;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "pyzoltan/core/carray.pyx":1609
 *                 # meaning we copy from the specified start index to the end of
 *                 # self. make sure the sizes are consistent.
 *                 si = start_index             # <<<<<<<<<<<<<<
 *                 ei = d_length
 * 
 */
      __pyx_v_si = __pyx_v_start_index;

      /* "pyzoltan/core/carray.pyx":1610
 *                 # self. make sure the sizes are consistent.
 *                 si = start_index
 *                 ei = d_length             # <<<<<<<<<<<<<<
 * 
 *                 if start_index > (d_length-1):
 */
      __pyx_v_ei = __pyx_v_d_length;

      /* "pyzoltan/core/carray.pyx":1612
 *                 ei = d_length
 * 
 *                 if start_index > (d_length-1):             # <<<<<<<<<<<<<<
 *                     msg = 'start_index beyond array length'
 *                     logger.error(msg)
 */
      __pyx_t_10 = ((__pyx_v_start_index > (__pyx_v_d_length - 1)) != 0);
      if (__pyx_t_10) {

        /* "pyzoltan/core/carray.pyx":1613
 * 
 *                 if start_index > (d_length-1):
 *                     msg = 'start_index beyond array length'             # <<<<<<<<<<<<<<
 *                     logger.error(msg)
 *                     raise ValueError, msg
 */
        __Pyx_INCREF(__pyx_kp_s_start_index_beyond_array_length);
        __pyx_v_msg = __pyx_kp_s_start_index_beyond_array_length;

        /* "pyzoltan/core/carray.pyx":1614
 *                 if start_index > (d_length-1):
 *                     msg = 'start_index beyond array length'
 *                     logger.error(msg)             # <<<<<<<<<<<<<<
 *                     raise ValueError, msg
 * 
 */
        __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        if (!__pyx_t_5) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "pyzoltan/core/carray.pyx":1615
 *                     msg = 'start_index beyond array length'
 *                     logger.error(msg)
 *                     raise ValueError, msg             # <<<<<<<<<<<<<<
 * 
 *                 if (ei - si) > s_length:
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "pyzoltan/core/carray.pyx":1617
 *                     raise ValueError, msg
 * 
 *                 if (ei - si) > s_length:             # <<<<<<<<<<<<<<
 *                     msg = 'Not enough values in source'
 *                     logger.error(msg)
 */
      __pyx_t_10 = (((__pyx_v_ei - __pyx_v_si) > __pyx_v_s_length) != 0);
      if (__pyx_t_10) {

        /* "pyzoltan/core/carray.pyx":1618
 * 
 *                 if (ei - si) > s_length:
 *                     msg = 'Not enough values in source'             # <<<<<<<<<<<<<<
 *                     logger.error(msg)
 *                     raise ValueError, msg
 */
        __Pyx_INCREF(__pyx_kp_s_Not_enough_values_in_source);
        __pyx_v_msg = __pyx_kp_s_Not_enough_values_in_source;

        /* "pyzoltan/core/carray.pyx":1619
 *                 if (ei - si) > s_length:
 *                     msg = 'Not enough values in source'
 *                     logger.error(msg)             # <<<<<<<<<<<<<<
 *                     raise ValueError, msg
 *         else:
 */
        __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        if (!__pyx_t_8) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __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;

        /* "pyzoltan/core/carray.pyx":1620
 *                     msg = 'Not enough values in source'
 *                     logger.error(msg)
 *                     raise ValueError, msg             # <<<<<<<<<<<<<<
 *         else:
 *             if start_index < 0:
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pyzoltan/core/carray.pyx":1622
 *                     raise ValueError, msg
 *         else:
 *             if start_index < 0:             # <<<<<<<<<<<<<<
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                           end_index)
 */
    __pyx_t_10 = ((__pyx_v_start_index < 0) != 0);
    if (__pyx_t_10) {

      /* "pyzoltan/core/carray.pyx":1623
 *         else:
 *             if start_index < 0:
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,             # <<<<<<<<<<<<<<
 *                                                           end_index)
 *                 logger.error(msg)
 */
      __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_start_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);

      /* "pyzoltan/core/carray.pyx":1624
 *             if start_index < 0:
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                           end_index)             # <<<<<<<<<<<<<<
 *                 logger.error(msg)
 *                 raise ValueError, msg
 */
      __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_end_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);

      /* "pyzoltan/core/carray.pyx":1623
 *         else:
 *             if start_index < 0:
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,             # <<<<<<<<<<<<<<
 *                                                           end_index)
 *                 logger.error(msg)
 */
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_1 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_start_index_d_end_index_d, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_msg = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "pyzoltan/core/carray.pyx":1625
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                           end_index)
 *                 logger.error(msg)             # <<<<<<<<<<<<<<
 *                 raise ValueError, msg
 *             else:
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_v_msg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_msg);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_msg);
        __Pyx_GIVEREF(__pyx_v_msg);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pyzoltan/core/carray.pyx":1626
 *                                                           end_index)
 *                 logger.error(msg)
 *                 raise ValueError, msg             # <<<<<<<<<<<<<<
 *             else:
 *                 if (start_index > (d_length-1) or end_index > d_length or
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    /*else*/ {

      /* "pyzoltan/core/carray.pyx":1628
 *                 raise ValueError, msg
 *             else:
 *                 if (start_index > (d_length-1) or end_index > d_length or             # <<<<<<<<<<<<<<
 *                     start_index > end_index):
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,
 */
      __pyx_t_11 = ((__pyx_v_start_index > (__pyx_v_d_length - 1)) != 0);
      if (!__pyx_t_11) {
      } else {
        __pyx_t_10 = __pyx_t_11;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_11 = ((__pyx_v_end_index > __pyx_v_d_length) != 0);
      if (!__pyx_t_11) {
      } else {
        __pyx_t_10 = __pyx_t_11;
        goto __pyx_L10_bool_binop_done;
      }

      /* "pyzoltan/core/carray.pyx":1629
 *             else:
 *                 if (start_index > (d_length-1) or end_index > d_length or
 *                     start_index > end_index):             # <<<<<<<<<<<<<<
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                               end_index)
 */
      __pyx_t_11 = ((__pyx_v_start_index > __pyx_v_end_index) != 0);
      __pyx_t_10 = __pyx_t_11;
      __pyx_L10_bool_binop_done:;
      if (__pyx_t_10) {

        /* "pyzoltan/core/carray.pyx":1630
 *                 if (start_index > (d_length-1) or end_index > d_length or
 *                     start_index > end_index):
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,             # <<<<<<<<<<<<<<
 *                                                               end_index)
 *                     logger.error(msg)
 */
        __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_start_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);

        /* "pyzoltan/core/carray.pyx":1631
 *                     start_index > end_index):
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                               end_index)             # <<<<<<<<<<<<<<
 *                     logger.error(msg)
 *                     raise ValueError, msg
 */
        __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_end_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);

        /* "pyzoltan/core/carray.pyx":1630
 *                 if (start_index > (d_length-1) or end_index > d_length or
 *                     start_index > end_index):
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,             # <<<<<<<<<<<<<<
 *                                                               end_index)
 *                     logger.error(msg)
 */
        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_2 = 0;
        __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_start_index_d_end_index_d, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_v_msg = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "pyzoltan/core/carray.pyx":1632
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                               end_index)
 *                     logger.error(msg)             # <<<<<<<<<<<<<<
 *                     raise ValueError, msg
 * 
 */
        __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        if (!__pyx_t_8) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1632; __pyx_clineno = __LINE__; goto __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;

        /* "pyzoltan/core/carray.pyx":1633
 *                                                               end_index)
 *                     logger.error(msg)
 *                     raise ValueError, msg             # <<<<<<<<<<<<<<
 * 
 *                 si = start_index
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "pyzoltan/core/carray.pyx":1635
 *                     raise ValueError, msg
 * 
 *                 si = start_index             # <<<<<<<<<<<<<<
 *                 ei = end_index
 * 
 */
      __pyx_v_si = __pyx_v_start_index;

      /* "pyzoltan/core/carray.pyx":1636
 * 
 *                 si = start_index
 *                 ei = end_index             # <<<<<<<<<<<<<<
 * 
 *         # we have valid start and end indices now. can start copying now.
 */
      __pyx_v_ei = __pyx_v_end_index;
    }
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":1639
 * 
 *         # we have valid start and end indices now. can start copying now.
 *         j = 0             # <<<<<<<<<<<<<<
 *         for i in range(si, ei):
 *             self.data[i] = src.data[j]
 */
  __pyx_v_j = 0;

  /* "pyzoltan/core/carray.pyx":1640
 *         # we have valid start and end indices now. can start copying now.
 *         j = 0
 *         for i in range(si, ei):             # <<<<<<<<<<<<<<
 *             self.data[i] = src.data[j]
 *             j += 1
 */
  __pyx_t_9 = __pyx_v_ei;
  for (__pyx_t_12 = __pyx_v_si; __pyx_t_12 < __pyx_t_9; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "pyzoltan/core/carray.pyx":1641
 *         j = 0
 *         for i in range(si, ei):
 *             self.data[i] = src.data[j]             # <<<<<<<<<<<<<<
 *             j += 1
 * 
 */
    (__pyx_v_self->data[__pyx_v_i]) = (__pyx_v_src->data[__pyx_v_j]);

    /* "pyzoltan/core/carray.pyx":1642
 *         for i in range(si, ei):
 *             self.data[i] = src.data[j]
 *             j += 1             # <<<<<<<<<<<<<<
 * 
 *     cpdef update_min_max(self):
 */
    __pyx_v_j = (__pyx_v_j + 1);
  }

  /* "pyzoltan/core/carray.pyx":1579
 *             dest_array.data[i] = self.data[indices.data[i]]
 * 
 *     cpdef copy_subset(self, BaseArray source, long start_index=-1,             # <<<<<<<<<<<<<<
 *                       long end_index=-1):
 *         """Copy a subset of values from src to self.
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.copy_subset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_src);
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_41copy_subset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9LongArray_40copy_subset[] = "LongArray.copy_subset(self, BaseArray source, long start_index=-1, long end_index=-1)\nCopy a subset of values from src to self.\n\n        Parameters\n        ----------\n\n        start_index : long\n            the first index in dest that corresponds to the 0th\n            index in source\n\n        end_index : long\n            the first index in dest from start_index that is not copied\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_41copy_subset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source = 0;
  long __pyx_v_start_index;
  long __pyx_v_end_index;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_subset (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_start_index,&__pyx_n_s_end_index,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_source)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start_index);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end_index);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy_subset") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_source = ((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)values[0]);
    if (values[1]) {
      __pyx_v_start_index = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_start_index == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_start_index = ((long)-1);
    }
    if (values[2]) {
      __pyx_v_end_index = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_end_index == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1580; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_end_index = ((long)-1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy_subset", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.copy_subset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_source), __pyx_ptype_8pyzoltan_4core_6carray_BaseArray, 1, "source", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_40copy_subset(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self), __pyx_v_source, __pyx_v_start_index, __pyx_v_end_index);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_40copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, long __pyx_v_start_index, long __pyx_v_end_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_copy_subset __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_subset", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.start_index = __pyx_v_start_index;
  __pyx_t_2.end_index = __pyx_v_end_index;
  __pyx_t_1 = __pyx_vtabptr_8pyzoltan_4core_6carray_LongArray->__pyx_base.copy_subset(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_source, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.LongArray.copy_subset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1644
 *             j += 1
 * 
 *     cpdef update_min_max(self):             # <<<<<<<<<<<<<<
 *         """Updates the min and max values of the array.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_43update_min_max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_9LongArray_update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, int __pyx_skip_dispatch) {
  long __pyx_v_i;
  long __pyx_v_min_val;
  long __pyx_v_max_val;
  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;
  long __pyx_t_6;
  long __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update_min_max", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_update_min_max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_43update_min_max)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1644; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1647
 *         """Updates the min and max values of the array.
 *         """
 *         cdef long i = 0             # <<<<<<<<<<<<<<
 *         cdef long min_val, max_val
 * 
 */
  __pyx_v_i = 0;

  /* "pyzoltan/core/carray.pyx":1650
 *         cdef long min_val, max_val
 * 
 *         if self.length == 0:             # <<<<<<<<<<<<<<
 *             self.minimum = <long>0
 *             self.maximum = <long>0
 */
  __pyx_t_5 = ((__pyx_v_self->__pyx_base.length == 0) != 0);
  if (__pyx_t_5) {

    /* "pyzoltan/core/carray.pyx":1651
 * 
 *         if self.length == 0:
 *             self.minimum = <long>0             # <<<<<<<<<<<<<<
 *             self.maximum = <long>0
 *             return
 */
    __pyx_v_self->minimum = ((long)0);

    /* "pyzoltan/core/carray.pyx":1652
 *         if self.length == 0:
 *             self.minimum = <long>0
 *             self.maximum = <long>0             # <<<<<<<<<<<<<<
 *             return
 * 
 */
    __pyx_v_self->maximum = ((long)0);

    /* "pyzoltan/core/carray.pyx":1653
 *             self.minimum = <long>0
 *             self.maximum = <long>0
 *             return             # <<<<<<<<<<<<<<
 * 
 *         min_val = self.data[0]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "pyzoltan/core/carray.pyx":1655
 *             return
 * 
 *         min_val = self.data[0]             # <<<<<<<<<<<<<<
 *         max_val = self.data[0]
 * 
 */
  __pyx_v_min_val = (__pyx_v_self->data[0]);

  /* "pyzoltan/core/carray.pyx":1656
 * 
 *         min_val = self.data[0]
 *         max_val = self.data[0]             # <<<<<<<<<<<<<<
 * 
 *         for i in range(self.length):
 */
  __pyx_v_max_val = (__pyx_v_self->data[0]);

  /* "pyzoltan/core/carray.pyx":1658
 *         max_val = self.data[0]
 * 
 *         for i in range(self.length):             # <<<<<<<<<<<<<<
 *             if min_val > self.data[i]:
 *                 min_val = self.data[i]
 */
  __pyx_t_6 = __pyx_v_self->__pyx_base.length;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "pyzoltan/core/carray.pyx":1659
 * 
 *         for i in range(self.length):
 *             if min_val > self.data[i]:             # <<<<<<<<<<<<<<
 *                 min_val = self.data[i]
 *             if max_val < self.data[i]:
 */
    __pyx_t_5 = ((__pyx_v_min_val > (__pyx_v_self->data[__pyx_v_i])) != 0);
    if (__pyx_t_5) {

      /* "pyzoltan/core/carray.pyx":1660
 *         for i in range(self.length):
 *             if min_val > self.data[i]:
 *                 min_val = self.data[i]             # <<<<<<<<<<<<<<
 *             if max_val < self.data[i]:
 *                 max_val = self.data[i]
 */
      __pyx_v_min_val = (__pyx_v_self->data[__pyx_v_i]);
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pyzoltan/core/carray.pyx":1661
 *             if min_val > self.data[i]:
 *                 min_val = self.data[i]
 *             if max_val < self.data[i]:             # <<<<<<<<<<<<<<
 *                 max_val = self.data[i]
 * 
 */
    __pyx_t_5 = ((__pyx_v_max_val < (__pyx_v_self->data[__pyx_v_i])) != 0);
    if (__pyx_t_5) {

      /* "pyzoltan/core/carray.pyx":1662
 *                 min_val = self.data[i]
 *             if max_val < self.data[i]:
 *                 max_val = self.data[i]             # <<<<<<<<<<<<<<
 * 
 *         self.minimum = min_val
 */
      __pyx_v_max_val = (__pyx_v_self->data[__pyx_v_i]);
      goto __pyx_L7;
    }
    __pyx_L7:;
  }

  /* "pyzoltan/core/carray.pyx":1664
 *                 max_val = self.data[i]
 * 
 *         self.minimum = min_val             # <<<<<<<<<<<<<<
 *         self.maximum = max_val
 * 
 */
  __pyx_v_self->minimum = __pyx_v_min_val;

  /* "pyzoltan/core/carray.pyx":1665
 * 
 *         self.minimum = min_val
 *         self.maximum = max_val             # <<<<<<<<<<<<<<
 * 
 * # ###########################################################################
 */
  __pyx_v_self->maximum = __pyx_v_max_val;

  /* "pyzoltan/core/carray.pyx":1644
 *             j += 1
 * 
 *     cpdef update_min_max(self):             # <<<<<<<<<<<<<<
 *         """Updates the min and max values of the array.
 *         """
 */

  /* 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("pyzoltan.core.carray.LongArray.update_min_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_43update_min_max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_9LongArray_42update_min_max[] = "LongArray.update_min_max(self)\nUpdates the min and max values of the array.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_43update_min_max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_min_max (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_42update_min_max(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_42update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update_min_max", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_9LongArray_update_min_max(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1644; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.LongArray.update_min_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pxd":120
 *     cdef long *data
 *     cdef long *_old_data
 *     cdef public long minimum, maximum             # <<<<<<<<<<<<<<
 *     cdef LongArray _parent
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_7minimum_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_7minimum_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_7minimum___get__(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_7minimum___get__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->minimum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.LongArray.minimum.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_9LongArray_7minimum_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8pyzoltan_4core_6carray_9LongArray_7minimum_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_7minimum_2__set__(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_9LongArray_7minimum_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_As_long(__pyx_v_value); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->minimum = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.minimum.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_7maximum_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_9LongArray_7maximum_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_7maximum___get__(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_9LongArray_7maximum___get__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->maximum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.LongArray.maximum.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_9LongArray_7maximum_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8pyzoltan_4core_6carray_9LongArray_7maximum_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_9LongArray_7maximum_2__set__(((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_9LongArray_7maximum_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_As_long(__pyx_v_value); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->maximum = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.LongArray.maximum.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1712
 *     #cdef np.ndarray _npy_array
 * 
 *     def __cinit__(self, long n=0):             # <<<<<<<<<<<<<<
 *         """Constructor for the class.
 *         """
 */

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_10FloatArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8pyzoltan_4core_6carray_10FloatArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,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);
        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 = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray___cinit__(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self), __pyx_v_n);

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

static int __pyx_pf_8pyzoltan_4core_6carray_10FloatArray___cinit__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_n) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "pyzoltan/core/carray.pyx":1715
 *         """Constructor for the class.
 *         """
 *         self.length = n             # <<<<<<<<<<<<<<
 *         self._parent = None
 *         self._old_data = NULL
 */
  __pyx_v_self->__pyx_base.length = __pyx_v_n;

  /* "pyzoltan/core/carray.pyx":1716
 *         """
 *         self.length = n
 *         self._parent = None             # <<<<<<<<<<<<<<
 *         self._old_data = NULL
 *         if n == 0:
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_parent);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_parent));
  __pyx_v_self->_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)Py_None);

  /* "pyzoltan/core/carray.pyx":1717
 *         self.length = n
 *         self._parent = None
 *         self._old_data = NULL             # <<<<<<<<<<<<<<
 *         if n == 0:
 *             n = 16
 */
  __pyx_v_self->_old_data = NULL;

  /* "pyzoltan/core/carray.pyx":1718
 *         self._parent = None
 *         self._old_data = NULL
 *         if n == 0:             # <<<<<<<<<<<<<<
 *             n = 16
 *         self.alloc = n
 */
  __pyx_t_1 = ((__pyx_v_n == 0) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":1719
 *         self._old_data = NULL
 *         if n == 0:
 *             n = 16             # <<<<<<<<<<<<<<
 *         self.alloc = n
 *         self.data = <float*>aligned_malloc(n*sizeof(float))
 */
    __pyx_v_n = 16;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":1720
 *         if n == 0:
 *             n = 16
 *         self.alloc = n             # <<<<<<<<<<<<<<
 *         self.data = <float*>aligned_malloc(n*sizeof(float))
 * 
 */
  __pyx_v_self->__pyx_base.alloc = __pyx_v_n;

  /* "pyzoltan/core/carray.pyx":1721
 *             n = 16
 *         self.alloc = n
 *         self.data = <float*>aligned_malloc(n*sizeof(float))             # <<<<<<<<<<<<<<
 * 
 *         self._setup_npy_array()
 */
  __pyx_v_self->data = ((float *)__pyx_f_8pyzoltan_4core_6carray_aligned_malloc((__pyx_v_n * (sizeof(float)))));

  /* "pyzoltan/core/carray.pyx":1723
 *         self.data = <float*>aligned_malloc(n*sizeof(float))
 * 
 *         self._setup_npy_array()             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->_setup_npy_array(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyzoltan/core/carray.pyx":1712
 *     #cdef np.ndarray _npy_array
 * 
 *     def __cinit__(self, long n=0):             # <<<<<<<<<<<<<<
 *         """Constructor for the class.
 *         """
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1725
 *         self._setup_npy_array()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         """Frees the array.
 *         """
 */

/* Python wrapper */
static void __pyx_pw_8pyzoltan_4core_6carray_10FloatArray_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_8pyzoltan_4core_6carray_10FloatArray_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_2__dealloc__(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self));

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

static void __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_2__dealloc__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "pyzoltan/core/carray.pyx":1728
 *         """Frees the array.
 *         """
 *         if self._old_data == NULL:             # <<<<<<<<<<<<<<
 *             aligned_free(<void*>self.data)
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->_old_data == NULL) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":1729
 *         """
 *         if self._old_data == NULL:
 *             aligned_free(<void*>self.data)             # <<<<<<<<<<<<<<
 *         else:
 *             aligned_free(<void*>self._old_data)
 */
    __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_self->data));
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pyzoltan/core/carray.pyx":1731
 *             aligned_free(<void*>self.data)
 *         else:
 *             aligned_free(<void*>self._old_data)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, long idx):
 */
    __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_self->_old_data));
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":1725
 *         self._setup_npy_array()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         """Frees the array.
 *         """
 */

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

/* "pyzoltan/core/carray.pyx":1733
 *             aligned_free(<void*>self._old_data)
 * 
 *     def __getitem__(self, long idx):             # <<<<<<<<<<<<<<
 *         """Get item at position idx.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_4__getitem__[] = "Get item at position idx.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_8pyzoltan_4core_6carray_10FloatArray_4__getitem__;
#endif
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx) {
  long __pyx_v_idx;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  assert(__pyx_arg_idx); {
    __pyx_v_idx = __Pyx_PyInt_As_long(__pyx_arg_idx); if (unlikely((__pyx_v_idx == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1733; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_4__getitem__(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self), ((long)__pyx_v_idx));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_4__getitem__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_idx) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "pyzoltan/core/carray.pyx":1736
 *         """Get item at position idx.
 *         """
 *         return self.data[idx]             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, long idx, float value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->data[__pyx_v_idx])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":1733
 *             aligned_free(<void*>self._old_data)
 * 
 *     def __getitem__(self, long idx):             # <<<<<<<<<<<<<<
 *         """Get item at position idx.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1738
 *         return self.data[idx]
 * 
 *     def __setitem__(self, long idx, float value):             # <<<<<<<<<<<<<<
 *         """Set location idx to value.
 *         """
 */

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_10FloatArray_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx, PyObject *__pyx_arg_value); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_6__setitem__[] = "Set location idx to value.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_8pyzoltan_4core_6carray_10FloatArray_6__setitem__;
#endif
static int __pyx_pw_8pyzoltan_4core_6carray_10FloatArray_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx, PyObject *__pyx_arg_value) {
  long __pyx_v_idx;
  float __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  assert(__pyx_arg_idx); {
    __pyx_v_idx = __Pyx_PyInt_As_long(__pyx_arg_idx); if (unlikely((__pyx_v_idx == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1738; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsFloat(__pyx_arg_value); if (unlikely((__pyx_v_value == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1738; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_6__setitem__(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self), ((long)__pyx_v_idx), ((float)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_6__setitem__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_idx, float __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "pyzoltan/core/carray.pyx":1741
 *         """Set location idx to value.
 *         """
 *         self.data[idx] = value             # <<<<<<<<<<<<<<
 * 
 *     cpdef long index(self, float value):
 */
  (__pyx_v_self->data[__pyx_v_idx]) = __pyx_v_value;

  /* "pyzoltan/core/carray.pyx":1738
 *         return self.data[idx]
 * 
 *     def __setitem__(self, long idx, float value):             # <<<<<<<<<<<<<<
 *         """Set location idx to value.
 *         """
 */

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

/* "pyzoltan/core/carray.pyx":1743
 *         self.data[idx] = value
 * 
 *     cpdef long index(self, float value):             # <<<<<<<<<<<<<<
 *         """Returns the index at which value is in self, else -1.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_9index(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static long __pyx_f_8pyzoltan_4core_6carray_10FloatArray_index(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, float __pyx_v_value, int __pyx_skip_dispatch) {
  long __pyx_v_i;
  long __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 = NULL;
  PyObject *__pyx_t_6 = NULL;
  long __pyx_t_7;
  long __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("index", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_9index)) {
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __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;
      __pyx_t_7 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_7;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1747
 *         """
 *         cdef long i
 *         for i in range(self.length):             # <<<<<<<<<<<<<<
 *             if self.data[i] == value:
 *                 return i
 */
  __pyx_t_7 = __pyx_v_self->__pyx_base.length;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pyzoltan/core/carray.pyx":1748
 *         cdef long i
 *         for i in range(self.length):
 *             if self.data[i] == value:             # <<<<<<<<<<<<<<
 *                 return i
 *         return -1
 */
    __pyx_t_9 = (((__pyx_v_self->data[__pyx_v_i]) == __pyx_v_value) != 0);
    if (__pyx_t_9) {

      /* "pyzoltan/core/carray.pyx":1749
 *         for i in range(self.length):
 *             if self.data[i] == value:
 *                 return i             # <<<<<<<<<<<<<<
 *         return -1
 * 
 */
      __pyx_r = __pyx_v_i;
      goto __pyx_L0;
    }
  }

  /* "pyzoltan/core/carray.pyx":1750
 *             if self.data[i] == value:
 *                 return i
 *         return -1             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, float value):
 */
  __pyx_r = -1;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":1743
 *         self.data[idx] = value
 * 
 *     cpdef long index(self, float value):             # <<<<<<<<<<<<<<
 *         """Returns the index at which value is in self, else -1.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("pyzoltan.core.carray.FloatArray.index", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_9index(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_8index[] = "FloatArray.index(self, float value) -> long\nReturns the index at which value is in self, else -1.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_9index(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  float __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("index (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsFloat(__pyx_arg_value); if (unlikely((__pyx_v_value == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_8index(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self), ((float)__pyx_v_value));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_8index(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, float __pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("index", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_f_8pyzoltan_4core_6carray_10FloatArray_index(__pyx_v_self, __pyx_v_value, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.FloatArray.index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1752
 *         return -1
 * 
 *     def __contains__(self, float value):             # <<<<<<<<<<<<<<
 *         """Returns True if value is in self.
 *         """
 */

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_10FloatArray_11__contains__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_10__contains__[] = "Returns True if value is in self.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_8pyzoltan_4core_6carray_10FloatArray_10__contains__;
#endif
static int __pyx_pw_8pyzoltan_4core_6carray_10FloatArray_11__contains__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  float __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsFloat(__pyx_arg_value); if (unlikely((__pyx_v_value == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1752; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_10__contains__(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self), ((float)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_10__contains__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, float __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "pyzoltan/core/carray.pyx":1755
 *         """Returns True if value is in self.
 *         """
 *         return (self.index(value) >= 0)             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */
  __pyx_r = (((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->index(__pyx_v_self, __pyx_v_value, 0) >= 0);
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":1752
 *         return -1
 * 
 *     def __contains__(self, float value):             # <<<<<<<<<<<<<<
 *         """Returns True if value is in self.
 *         """
 */

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

/* "pyzoltan/core/carray.pyx":1757
 *         return (self.index(value) >= 0)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         """Implemented to facilitate pickling.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_13__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_12__reduce__[] = "FloatArray.__reduce__(self)\nImplemented to facilitate pickling.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_13__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_12__reduce__(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_12__reduce__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self) {
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce__", 0);

  /* "pyzoltan/core/carray.pyx":1760
 *         """Implemented to facilitate pickling.
 *         """
 *         d = {}             # <<<<<<<<<<<<<<
 *         d['data'] = self.get_npy_array()
 * 
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_d = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":1761
 *         """
 *         d = {}
 *         d['data'] = self.get_npy_array()             # <<<<<<<<<<<<<<
 * 
 *         return (FloatArray, (), d)
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_npy_array(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyDict_SetItem(__pyx_v_d, __pyx_n_s_data, __pyx_t_1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":1763
 *         d['data'] = self.get_npy_array()
 * 
 *         return (FloatArray, (), d)             # <<<<<<<<<<<<<<
 * 
 *     def __setstate__(self, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_8pyzoltan_4core_6carray_FloatArray)));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_8pyzoltan_4core_6carray_FloatArray)));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_8pyzoltan_4core_6carray_FloatArray)));
  __Pyx_INCREF(__pyx_empty_tuple);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_empty_tuple);
  __Pyx_GIVEREF(__pyx_empty_tuple);
  __Pyx_INCREF(__pyx_v_d);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_d);
  __Pyx_GIVEREF(__pyx_v_d);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":1757
 *         return (self.index(value) >= 0)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         """Implemented to facilitate pickling.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1765
 *         return (FloatArray, (), d)
 * 
 *     def __setstate__(self, d):             # <<<<<<<<<<<<<<
 *         """Load the carray from the dictionary d.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_15__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_d); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_14__setstate__[] = "FloatArray.__setstate__(self, d)\nLoad the carray from the dictionary d.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_15__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_14__setstate__(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self), ((PyObject *)__pyx_v_d));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_14__setstate__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, PyObject *__pyx_v_d) {
  PyArrayObject *__pyx_v_arr = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  long __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate__", 0);

  /* "pyzoltan/core/carray.pyx":1768
 *         """Load the carray from the dictionary d.
 *         """
 *         cdef np.ndarray arr = d['data']             # <<<<<<<<<<<<<<
 *         self.resize(arr.size)
 *         self.set_data(arr)
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_s_data); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1768; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_arr = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":1769
 *         """
 *         cdef np.ndarray arr = d['data']
 *         self.resize(arr.size)             # <<<<<<<<<<<<<<
 *         self.set_data(arr)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_arr), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.resize(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":1770
 *         cdef np.ndarray arr = d['data']
 *         self.resize(arr.size)
 *         self.set_data(arr)             # <<<<<<<<<<<<<<
 * 
 *     cdef _setup_npy_array(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_data(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_arr, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":1765
 *         return (FloatArray, (), d)
 * 
 *     def __setstate__(self, d):             # <<<<<<<<<<<<<<
 *         """Load the carray from the dictionary d.
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_arr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1772
 *         self.set_data(arr)
 * 
 *     cdef _setup_npy_array(self):             # <<<<<<<<<<<<<<
 *         """Create the numpy array.
 *         """
 */

static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray__setup_npy_array(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self) {
  int __pyx_v_nd;
  npy_intp __pyx_v_dims;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setup_npy_array", 0);

  /* "pyzoltan/core/carray.pyx":1775
 *         """Create the numpy array.
 *         """
 *         cdef int nd = 1             # <<<<<<<<<<<<<<
 *         cdef np.npy_intp dims = self.length
 * 
 */
  __pyx_v_nd = 1;

  /* "pyzoltan/core/carray.pyx":1776
 *         """
 *         cdef int nd = 1
 *         cdef np.npy_intp dims = self.length             # <<<<<<<<<<<<<<
 * 
 *         self._npy_array = PyArray_SimpleNewFromData(
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  __pyx_v_dims = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":1778
 *         cdef np.npy_intp dims = self.length
 * 
 *         self._npy_array = PyArray_SimpleNewFromData(             # <<<<<<<<<<<<<<
 *             nd, &dims, NPY_FLOAT, self.data
 *         )
 */
  __pyx_t_2 = ((PyObject *)PyArray_SimpleNewFromData(__pyx_v_nd, (&__pyx_v_dims), NPY_FLOAT, __pyx_v_self->data)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base._npy_array);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base._npy_array));
  __pyx_v_self->__pyx_base._npy_array = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyzoltan/core/carray.pyx":1772
 *         self.set_data(arr)
 * 
 *     cdef _setup_npy_array(self):             # <<<<<<<<<<<<<<
 *         """Create the numpy array.
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray._setup_npy_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1783
 * 
 * 
 *     cdef void c_align_array(self, LongArray new_indices) nogil:             # <<<<<<<<<<<<<<
 *         """Rearrange the array contents according to the new indices.
 *         """
 */

static void __pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_align_array(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_new_indices) {
  long __pyx_v_i;
  long __pyx_v_length;
  long __pyx_v_n_bytes;
  float *__pyx_v_temp;
  long __pyx_t_1;
  long __pyx_t_2;
  int __pyx_t_3;

  /* "pyzoltan/core/carray.pyx":1788
 * 
 *         cdef long i
 *         cdef long length = self.length             # <<<<<<<<<<<<<<
 *         cdef long n_bytes
 *         cdef float *temp
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  __pyx_v_length = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":1792
 *         cdef float *temp
 * 
 *         n_bytes = sizeof(float)*length             # <<<<<<<<<<<<<<
 *         temp = <float*>aligned_malloc(n_bytes)
 * 
 */
  __pyx_v_n_bytes = ((sizeof(float)) * __pyx_v_length);

  /* "pyzoltan/core/carray.pyx":1793
 * 
 *         n_bytes = sizeof(float)*length
 *         temp = <float*>aligned_malloc(n_bytes)             # <<<<<<<<<<<<<<
 * 
 *         memcpy(<void*>temp, <void*>self.data, n_bytes)
 */
  __pyx_v_temp = ((float *)__pyx_f_8pyzoltan_4core_6carray_aligned_malloc(__pyx_v_n_bytes));

  /* "pyzoltan/core/carray.pyx":1795
 *         temp = <float*>aligned_malloc(n_bytes)
 * 
 *         memcpy(<void*>temp, <void*>self.data, n_bytes)             # <<<<<<<<<<<<<<
 * 
 *         # copy the data from the resized portion to the actual positions.
 */
  memcpy(((void *)__pyx_v_temp), ((void *)__pyx_v_self->data), __pyx_v_n_bytes);

  /* "pyzoltan/core/carray.pyx":1798
 * 
 *         # copy the data from the resized portion to the actual positions.
 *         for i in range(length):             # <<<<<<<<<<<<<<
 *             if i != new_indices.data[i]:
 *                 self.data[i] = temp[new_indices.data[i]]
 */
  __pyx_t_1 = __pyx_v_length;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "pyzoltan/core/carray.pyx":1799
 *         # copy the data from the resized portion to the actual positions.
 *         for i in range(length):
 *             if i != new_indices.data[i]:             # <<<<<<<<<<<<<<
 *                 self.data[i] = temp[new_indices.data[i]]
 * 
 */
    __pyx_t_3 = ((__pyx_v_i != (__pyx_v_new_indices->data[__pyx_v_i])) != 0);
    if (__pyx_t_3) {

      /* "pyzoltan/core/carray.pyx":1800
 *         for i in range(length):
 *             if i != new_indices.data[i]:
 *                 self.data[i] = temp[new_indices.data[i]]             # <<<<<<<<<<<<<<
 * 
 *         aligned_free(<void*>temp)
 */
      (__pyx_v_self->data[__pyx_v_i]) = (__pyx_v_temp[(__pyx_v_new_indices->data[__pyx_v_i])]);
      goto __pyx_L5;
    }
    __pyx_L5:;
  }

  /* "pyzoltan/core/carray.pyx":1802
 *                 self.data[i] = temp[new_indices.data[i]]
 * 
 *         aligned_free(<void*>temp)             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_append(self, float value) nogil:
 */
  __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_temp));

  /* "pyzoltan/core/carray.pyx":1783
 * 
 * 
 *     cdef void c_align_array(self, LongArray new_indices) nogil:             # <<<<<<<<<<<<<<
 *         """Rearrange the array contents according to the new indices.
 *         """
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":1804
 *         aligned_free(<void*>temp)
 * 
 *     cdef void c_append(self, float value) nogil:             # <<<<<<<<<<<<<<
 *         cdef long l = self.length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 */

static void __pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_append(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, float __pyx_v_value) {
  long __pyx_v_l;
  PyArrayObject *__pyx_v_arr;
  long __pyx_t_1;
  int __pyx_t_2;

  /* "pyzoltan/core/carray.pyx":1805
 * 
 *     cdef void c_append(self, float value) nogil:
 *         cdef long l = self.length             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  __pyx_v_l = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":1806
 *     cdef void c_append(self, float value) nogil:
 *         cdef long l = self.length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 * 
 *         if l >= self.alloc:
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":1808
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 *         if l >= self.alloc:             # <<<<<<<<<<<<<<
 *             self.c_reserve(l*2)
 *         self.data[l] = value
 */
  __pyx_t_2 = ((__pyx_v_l >= __pyx_v_self->__pyx_base.alloc) != 0);
  if (__pyx_t_2) {

    /* "pyzoltan/core/carray.pyx":1809
 * 
 *         if l >= self.alloc:
 *             self.c_reserve(l*2)             # <<<<<<<<<<<<<<
 *         self.data[l] = value
 *         self.length += 1
 */
    ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), (__pyx_v_l * 2));
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":1810
 *         if l >= self.alloc:
 *             self.c_reserve(l*2)
 *         self.data[l] = value             # <<<<<<<<<<<<<<
 *         self.length += 1
 * 
 */
  (__pyx_v_self->data[__pyx_v_l]) = __pyx_v_value;

  /* "pyzoltan/core/carray.pyx":1811
 *             self.c_reserve(l*2)
 *         self.data[l] = value
 *         self.length += 1             # <<<<<<<<<<<<<<
 * 
 *         # update the numpy arrays length
 */
  __pyx_v_self->__pyx_base.length = (__pyx_v_self->__pyx_base.length + 1);

  /* "pyzoltan/core/carray.pyx":1814
 * 
 *         # update the numpy arrays length
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_reserve(self, long size) nogil:
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":1804
 *         aligned_free(<void*>temp)
 * 
 *     cdef void c_append(self, float value) nogil:             # <<<<<<<<<<<<<<
 *         cdef long l = self.length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":1816
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_reserve(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 */

static void __pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_reserve(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_size) {
  PyArrayObject *__pyx_v_arr;
  void *__pyx_v_data;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("c_reserve", 0);
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  /*try:*/ {

    /* "pyzoltan/core/carray.pyx":1817
 * 
 *     cdef void c_reserve(self, long size) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         cdef void* data = NULL
 *         if size > self.alloc:
 */
    __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

    /* "pyzoltan/core/carray.pyx":1818
 *     cdef void c_reserve(self, long size) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL             # <<<<<<<<<<<<<<
 *         if size > self.alloc:
 *             data = <float*>aligned_realloc(
 */
    __pyx_v_data = NULL;

    /* "pyzoltan/core/carray.pyx":1819
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 *         if size > self.alloc:             # <<<<<<<<<<<<<<
 *             data = <float*>aligned_realloc(
 *                 self.data, size*sizeof(float),
 */
    __pyx_t_1 = ((__pyx_v_size > __pyx_v_self->__pyx_base.alloc) != 0);
    if (__pyx_t_1) {

      /* "pyzoltan/core/carray.pyx":1820
 *         cdef void* data = NULL
 *         if size > self.alloc:
 *             data = <float*>aligned_realloc(             # <<<<<<<<<<<<<<
 *                 self.data, size*sizeof(float),
 *                 self.alloc*sizeof(float)
 */
      __pyx_v_data = ((float *)__pyx_f_8pyzoltan_4core_6carray_aligned_realloc(__pyx_v_self->data, (__pyx_v_size * (sizeof(float))), (__pyx_v_self->__pyx_base.alloc * (sizeof(float)))));

      /* "pyzoltan/core/carray.pyx":1825
 *             )
 * 
 *             if data == NULL:             # <<<<<<<<<<<<<<
 *                 aligned_free(<void*>self.data)
 *                 with gil:
 */
      __pyx_t_1 = ((__pyx_v_data == NULL) != 0);
      if (__pyx_t_1) {

        /* "pyzoltan/core/carray.pyx":1826
 * 
 *             if data == NULL:
 *                 aligned_free(<void*>self.data)             # <<<<<<<<<<<<<<
 *                 with gil:
 *                     raise MemoryError
 */
        __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_self->data));

        /* "pyzoltan/core/carray.pyx":1827
 *             if data == NULL:
 *                 aligned_free(<void*>self.data)
 *                 with gil:             # <<<<<<<<<<<<<<
 *                     raise MemoryError
 * 
 */
        {
            #ifdef WITH_THREAD
            PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
            #endif
            /*try:*/ {

              /* "pyzoltan/core/carray.pyx":1828
 *                 aligned_free(<void*>self.data)
 *                 with gil:
 *                     raise MemoryError             # <<<<<<<<<<<<<<
 * 
 *             self.data = <float*>data
 */
              PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1828; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
            }

            /* "pyzoltan/core/carray.pyx":1827
 *             if data == NULL:
 *                 aligned_free(<void*>self.data)
 *                 with gil:             # <<<<<<<<<<<<<<
 *                     raise MemoryError
 * 
 */
            /*finally:*/ {
              __pyx_L9_error: {
                #ifdef WITH_THREAD
                PyGILState_Release(__pyx_gilstate_save);
                #endif
                goto __pyx_L4_error;
              }
            }
        }
      }

      /* "pyzoltan/core/carray.pyx":1830
 *                     raise MemoryError
 * 
 *             self.data = <float*>data             # <<<<<<<<<<<<<<
 *             self.alloc = size
 *             arr.data = <char *>self.data
 */
      __pyx_v_self->data = ((float *)__pyx_v_data);

      /* "pyzoltan/core/carray.pyx":1831
 * 
 *             self.data = <float*>data
 *             self.alloc = size             # <<<<<<<<<<<<<<
 *             arr.data = <char *>self.data
 * 
 */
      __pyx_v_self->__pyx_base.alloc = __pyx_v_size;

      /* "pyzoltan/core/carray.pyx":1832
 *             self.data = <float*>data
 *             self.alloc = size
 *             arr.data = <char *>self.data             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_reset(self) nogil:
 */
      __pyx_v_arr->data = ((char *)__pyx_v_self->data);
      goto __pyx_L6;
    }
    __pyx_L6:;
  }

  /* "pyzoltan/core/carray.pyx":1817
 * 
 *     cdef void c_reserve(self, long size) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         cdef void* data = NULL
 *         if size > self.alloc:
 */
  /*finally:*/ {
    /*normal exit:*/{
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L5;
    }
    __pyx_L4_error: {
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "pyzoltan/core/carray.pyx":1816
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_reserve(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pyzoltan.core.carray.FloatArray.c_reserve", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "pyzoltan/core/carray.pyx":1834
 *             arr.data = <char *>self.data
 * 
 *     cdef void c_reset(self) nogil:             # <<<<<<<<<<<<<<
 *         BaseArray.c_reset(self)
 *         if self._old_data != NULL:
 */

static void __pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_reset(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self) {
  int __pyx_t_1;
  float *__pyx_t_2;

  /* "pyzoltan/core/carray.pyx":1835
 * 
 *     cdef void c_reset(self) nogil:
 *         BaseArray.c_reset(self)             # <<<<<<<<<<<<<<
 *         if self._old_data != NULL:
 *             self.data = self._old_data
 */
  __pyx_f_8pyzoltan_4core_6carray_9BaseArray_c_reset(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

  /* "pyzoltan/core/carray.pyx":1836
 *     cdef void c_reset(self) nogil:
 *         BaseArray.c_reset(self)
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             self.data = self._old_data
 *             self._old_data = NULL
 */
  __pyx_t_1 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":1837
 *         BaseArray.c_reset(self)
 *         if self._old_data != NULL:
 *             self.data = self._old_data             # <<<<<<<<<<<<<<
 *             self._old_data = NULL
 *             self._npy_array.data = <char *>self.data
 */
    __pyx_t_2 = __pyx_v_self->_old_data;
    __pyx_v_self->data = __pyx_t_2;

    /* "pyzoltan/core/carray.pyx":1838
 *         if self._old_data != NULL:
 *             self.data = self._old_data
 *             self._old_data = NULL             # <<<<<<<<<<<<<<
 *             self._npy_array.data = <char *>self.data
 * 
 */
    __pyx_v_self->_old_data = NULL;

    /* "pyzoltan/core/carray.pyx":1839
 *             self.data = self._old_data
 *             self._old_data = NULL
 *             self._npy_array.data = <char *>self.data             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_resize(self, long size) nogil:
 */
    __pyx_v_self->__pyx_base._npy_array->data = ((char *)__pyx_v_self->data);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":1834
 *             arr.data = <char *>self.data
 * 
 *     cdef void c_reset(self) nogil:             # <<<<<<<<<<<<<<
 *         BaseArray.c_reset(self)
 *         if self._old_data != NULL:
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":1841
 *             self._npy_array.data = <char *>self.data
 * 
 *     cdef void c_resize(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 */

static void __pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_resize(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_size) {
  PyArrayObject *__pyx_v_arr;
  long __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":1842
 * 
 *     cdef void c_resize(self, long size) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 * 
 *         # reserve memory
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":1845
 * 
 *         # reserve memory
 *         self.c_reserve(size)             # <<<<<<<<<<<<<<
 * 
 *         # update the lengths
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_size);

  /* "pyzoltan/core/carray.pyx":1848
 * 
 *         # update the lengths
 *         self.length = size             # <<<<<<<<<<<<<<
 *         arr.dimensions[0] = self.length
 * 
 */
  __pyx_v_self->__pyx_base.length = __pyx_v_size;

  /* "pyzoltan/core/carray.pyx":1849
 *         # update the lengths
 *         self.length = size
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_set_view(self, float *array, long length) nogil:
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":1841
 *             self._npy_array.data = <char *>self.data
 * 
 *     cdef void c_resize(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":1851
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_set_view(self, float *array, long length) nogil:             # <<<<<<<<<<<<<<
 *         """Create a view of a given raw data pointer with given length.
 *         """
 */

static void __pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_set_view(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, float *__pyx_v_array, long __pyx_v_length) {
  PyArrayObject *__pyx_v_arr;
  int __pyx_t_1;
  float *__pyx_t_2;
  long __pyx_t_3;

  /* "pyzoltan/core/carray.pyx":1854
 *         """Create a view of a given raw data pointer with given length.
 *         """
 *         if self._old_data == NULL:             # <<<<<<<<<<<<<<
 *             self._old_data = self.data
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->_old_data == NULL) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":1855
 *         """
 *         if self._old_data == NULL:
 *             self._old_data = self.data             # <<<<<<<<<<<<<<
 * 
 *         self.data = array
 */
    __pyx_t_2 = __pyx_v_self->data;
    __pyx_v_self->_old_data = __pyx_t_2;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":1857
 *             self._old_data = self.data
 * 
 *         self.data = array             # <<<<<<<<<<<<<<
 *         self.length = length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 */
  __pyx_v_self->data = __pyx_v_array;

  /* "pyzoltan/core/carray.pyx":1858
 * 
 *         self.data = array
 *         self.length = length             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data
 */
  __pyx_v_self->__pyx_base.length = __pyx_v_length;

  /* "pyzoltan/core/carray.pyx":1859
 *         self.data = array
 *         self.length = length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         arr.data = <char *>self.data
 *         arr.dimensions[0] = self.length
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":1860
 *         self.length = length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data             # <<<<<<<<<<<<<<
 *         arr.dimensions[0] = self.length
 * 
 */
  __pyx_v_arr->data = ((char *)__pyx_v_self->data);

  /* "pyzoltan/core/carray.pyx":1861
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_squeeze(self) nogil:
 */
  __pyx_t_3 = __pyx_v_self->__pyx_base.length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_3;

  /* "pyzoltan/core/carray.pyx":1851
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_set_view(self, float *array, long length) nogil:             # <<<<<<<<<<<<<<
 *         """Create a view of a given raw data pointer with given length.
 *         """
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":1863
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_squeeze(self) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 */

static void __pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self) {
  PyArrayObject *__pyx_v_arr;
  void *__pyx_v_data;
  size_t __pyx_v_size;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  long __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("c_squeeze", 0);
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  /*try:*/ {

    /* "pyzoltan/core/carray.pyx":1864
 * 
 *     cdef void c_squeeze(self) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         cdef void* data = NULL
 *         cdef size_t size = max(self.length, 16)
 */
    __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

    /* "pyzoltan/core/carray.pyx":1865
 *     cdef void c_squeeze(self) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL             # <<<<<<<<<<<<<<
 *         cdef size_t size = max(self.length, 16)
 *         data = <float*>aligned_realloc(
 */
    __pyx_v_data = NULL;

    /* "pyzoltan/core/carray.pyx":1866
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 *         cdef size_t size = max(self.length, 16)             # <<<<<<<<<<<<<<
 *         data = <float*>aligned_realloc(
 *             self.data, size*sizeof(float),
 */
    __pyx_t_1 = 16;
    __pyx_t_2 = __pyx_v_self->__pyx_base.length;
    if (((__pyx_t_1 > __pyx_t_2) != 0)) {
      __pyx_t_3 = __pyx_t_1;
    } else {
      __pyx_t_3 = __pyx_t_2;
    }
    __pyx_v_size = __pyx_t_3;

    /* "pyzoltan/core/carray.pyx":1867
 *         cdef void* data = NULL
 *         cdef size_t size = max(self.length, 16)
 *         data = <float*>aligned_realloc(             # <<<<<<<<<<<<<<
 *             self.data, size*sizeof(float),
 *             self.alloc*sizeof(float)
 */
    __pyx_v_data = ((float *)__pyx_f_8pyzoltan_4core_6carray_aligned_realloc(__pyx_v_self->data, (__pyx_v_size * (sizeof(float))), (__pyx_v_self->__pyx_base.alloc * (sizeof(float)))));

    /* "pyzoltan/core/carray.pyx":1872
 *         )
 * 
 *         if data == NULL:             # <<<<<<<<<<<<<<
 *             # free original data
 *             aligned_free(<void*>self.data)
 */
    __pyx_t_4 = ((__pyx_v_data == NULL) != 0);
    if (__pyx_t_4) {

      /* "pyzoltan/core/carray.pyx":1874
 *         if data == NULL:
 *             # free original data
 *             aligned_free(<void*>self.data)             # <<<<<<<<<<<<<<
 *             with gil:
 *                 raise MemoryError
 */
      __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_self->data));

      /* "pyzoltan/core/carray.pyx":1875
 *             # free original data
 *             aligned_free(<void*>self.data)
 *             with gil:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 * 
 */
      {
          #ifdef WITH_THREAD
          PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
          #endif
          /*try:*/ {

            /* "pyzoltan/core/carray.pyx":1876
 *             aligned_free(<void*>self.data)
 *             with gil:
 *                 raise MemoryError             # <<<<<<<<<<<<<<
 * 
 *         self.data = <float*>data
 */
            PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          }

          /* "pyzoltan/core/carray.pyx":1875
 *             # free original data
 *             aligned_free(<void*>self.data)
 *             with gil:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 * 
 */
          /*finally:*/ {
            __pyx_L8_error: {
              #ifdef WITH_THREAD
              PyGILState_Release(__pyx_gilstate_save);
              #endif
              goto __pyx_L4_error;
            }
          }
      }
    }

    /* "pyzoltan/core/carray.pyx":1878
 *                 raise MemoryError
 * 
 *         self.data = <float*>data             # <<<<<<<<<<<<<<
 *         self.alloc = size
 *         arr.data = <char *>self.data
 */
    __pyx_v_self->data = ((float *)__pyx_v_data);

    /* "pyzoltan/core/carray.pyx":1879
 * 
 *         self.data = <float*>data
 *         self.alloc = size             # <<<<<<<<<<<<<<
 *         arr.data = <char *>self.data
 * 
 */
    __pyx_v_self->__pyx_base.alloc = __pyx_v_size;

    /* "pyzoltan/core/carray.pyx":1880
 *         self.data = <float*>data
 *         self.alloc = size
 *         arr.data = <char *>self.data             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_arr->data = ((char *)__pyx_v_self->data);
  }

  /* "pyzoltan/core/carray.pyx":1864
 * 
 *     cdef void c_squeeze(self) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         cdef void* data = NULL
 *         cdef size_t size = max(self.length, 16)
 */
  /*finally:*/ {
    /*normal exit:*/{
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L5;
    }
    __pyx_L4_error: {
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "pyzoltan/core/carray.pyx":1863
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_squeeze(self) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pyzoltan.core.carray.FloatArray.c_squeeze", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "pyzoltan/core/carray.pyx":1883
 * 
 * 
 *     cpdef str get_c_type(self):             # <<<<<<<<<<<<<<
 *         """Return the c data type for this array as a string.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_17get_c_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_get_c_type(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, int __pyx_skip_dispatch) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_c_type", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_c_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_17get_c_type)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1886
 *         """Return the c data type for this array as a string.
 *         """
 *         return 'float'             # <<<<<<<<<<<<<<
 * 
 *     cdef float* get_data_ptr(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_n_s_float);
  __pyx_r = __pyx_n_s_float;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":1883
 * 
 * 
 *     cpdef str get_c_type(self):             # <<<<<<<<<<<<<<
 *         """Return the c data type for this array as a string.
 *         """
 */

  /* 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("pyzoltan.core.carray.FloatArray.get_c_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_17get_c_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_16get_c_type[] = "FloatArray.get_c_type(self) -> str\nReturn the c data type for this array as a string.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_17get_c_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_c_type (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_16get_c_type(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_16get_c_type(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_c_type", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_10FloatArray_get_c_type(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.FloatArray.get_c_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1888
 *         return 'float'
 * 
 *     cdef float* get_data_ptr(self):             # <<<<<<<<<<<<<<
 *         """Return the internal data pointer.
 *         """
 */

static float *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_get_data_ptr(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self) {
  float *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_data_ptr", 0);

  /* "pyzoltan/core/carray.pyx":1891
 *         """Return the internal data pointer.
 *         """
 *         return self.data             # <<<<<<<<<<<<<<
 * 
 *     cpdef float get(self, long idx):
 */
  __pyx_r = __pyx_v_self->data;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":1888
 *         return 'float'
 * 
 *     cdef float* get_data_ptr(self):             # <<<<<<<<<<<<<<
 *         """Return the internal data pointer.
 *         """
 */

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

/* "pyzoltan/core/carray.pyx":1893
 *         return self.data
 * 
 *     cpdef float get(self, long idx):             # <<<<<<<<<<<<<<
 *         """Gets value stored at position `idx`.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_19get(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx); /*proto*/
static float __pyx_f_8pyzoltan_4core_6carray_10FloatArray_get(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_idx, int __pyx_skip_dispatch) {
  float __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 = NULL;
  PyObject *__pyx_t_6 = NULL;
  float __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_19get)) {
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_idx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __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;
      __pyx_t_7 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_7 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_7;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1896
 *         """Gets value stored at position `idx`.
 *         """
 *         return self.data[idx]             # <<<<<<<<<<<<<<
 * 
 *     cpdef set(self, long idx, float value):
 */
  __pyx_r = (__pyx_v_self->data[__pyx_v_idx]);
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":1893
 *         return self.data
 * 
 *     cpdef float get(self, long idx):             # <<<<<<<<<<<<<<
 *         """Gets value stored at position `idx`.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("pyzoltan.core.carray.FloatArray.get", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_19get(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_18get[] = "FloatArray.get(self, long idx) -> float\nGets value stored at position `idx`.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_19get(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx) {
  long __pyx_v_idx;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  assert(__pyx_arg_idx); {
    __pyx_v_idx = __Pyx_PyInt_As_long(__pyx_arg_idx); if (unlikely((__pyx_v_idx == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_18get(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self), ((long)__pyx_v_idx));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_18get(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_idx) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_f_8pyzoltan_4core_6carray_10FloatArray_get(__pyx_v_self, __pyx_v_idx, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.FloatArray.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1898
 *         return self.data[idx]
 * 
 *     cpdef set(self, long idx, float value):             # <<<<<<<<<<<<<<
 *         """Sets location `idx` to `value`.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_21set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_set(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_idx, float __pyx_v_value, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_21set)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_idx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      }
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1901
 *         """Sets location `idx` to `value`.
 *         """
 *         self.data[idx] = value             # <<<<<<<<<<<<<<
 * 
 *     cpdef append(self, float value):
 */
  (__pyx_v_self->data[__pyx_v_idx]) = __pyx_v_value;

  /* "pyzoltan/core/carray.pyx":1898
 *         return self.data[idx]
 * 
 *     cpdef set(self, long idx, float value):             # <<<<<<<<<<<<<<
 *         """Sets location `idx` to `value`.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_21set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_20set[] = "FloatArray.set(self, long idx, float value)\nSets location `idx` to `value`.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_21set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_idx;
  float __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idx,&__pyx_n_s_value,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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_idx)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __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_idx = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_idx == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_value = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_value == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_20set(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self), __pyx_v_idx, __pyx_v_value);

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_20set(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_idx, float __pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_10FloatArray_set(__pyx_v_self, __pyx_v_idx, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.FloatArray.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1903
 *         self.data[idx] = value
 * 
 *     cpdef append(self, float value):             # <<<<<<<<<<<<<<
 *         """Appends `value` to the end of the array.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_23append(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_append(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, float __pyx_v_value, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_append); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_23append)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __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;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1906
 *         """Appends `value` to the end of the array.
 *         """
 *         self.c_append(value)             # <<<<<<<<<<<<<<
 * 
 *     cpdef reserve(self, long size):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->c_append(__pyx_v_self, __pyx_v_value);

  /* "pyzoltan/core/carray.pyx":1903
 *         self.data[idx] = value
 * 
 *     cpdef append(self, float value):             # <<<<<<<<<<<<<<
 *         """Appends `value` to the end of the array.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_23append(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_22append[] = "FloatArray.append(self, float value)\nAppends `value` to the end of the array.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_23append(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  float __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsFloat(__pyx_arg_value); if (unlikely((__pyx_v_value == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_22append(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self), ((float)__pyx_v_value));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_22append(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, float __pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_10FloatArray_append(__pyx_v_self, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.FloatArray.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1908
 *         self.c_append(value)
 * 
 *     cpdef reserve(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes the internal data to ``size*sizeof(float)`` bytes.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_25reserve(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_reserve(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_size, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reserve", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reserve); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_25reserve)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __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;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1911
 *         """Resizes the internal data to ``size*sizeof(float)`` bytes.
 *         """
 *         self.c_reserve(size)             # <<<<<<<<<<<<<<
 * 
 *     cpdef reset(self):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_size);

  /* "pyzoltan/core/carray.pyx":1908
 *         self.c_append(value)
 * 
 *     cpdef reserve(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes the internal data to ``size*sizeof(float)`` bytes.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_25reserve(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_24reserve[] = "FloatArray.reserve(self, long size)\nResizes the internal data to ``size*sizeof(float)`` bytes.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_25reserve(PyObject *__pyx_v_self, PyObject *__pyx_arg_size) {
  long __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reserve (wrapper)", 0);
  assert(__pyx_arg_size); {
    __pyx_v_size = __Pyx_PyInt_As_long(__pyx_arg_size); if (unlikely((__pyx_v_size == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_24reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self), ((long)__pyx_v_size));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_24reserve(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reserve", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_10FloatArray_reserve(__pyx_v_self, __pyx_v_size, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.FloatArray.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1913
 *         self.c_reserve(size)
 * 
 *     cpdef reset(self):             # <<<<<<<<<<<<<<
 *         """Reset the length of the array to 0.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_27reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_reset(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, int __pyx_skip_dispatch) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reset", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_27reset)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1916
 *         """Reset the length of the array to 0.
 *         """
 *         self.c_reset()             # <<<<<<<<<<<<<<
 *         if self._old_data != NULL:
 *             self._parent = None
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_reset(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

  /* "pyzoltan/core/carray.pyx":1917
 *         """
 *         self.c_reset()
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             self._parent = None
 * 
 */
  __pyx_t_5 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_5) {

    /* "pyzoltan/core/carray.pyx":1918
 *         self.c_reset()
 *         if self._old_data != NULL:
 *             self._parent = None             # <<<<<<<<<<<<<<
 * 
 *     cpdef resize(self, long size):
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_parent);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_parent));
    __pyx_v_self->_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)Py_None);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":1913
 *         self.c_reserve(size)
 * 
 *     cpdef reset(self):             # <<<<<<<<<<<<<<
 *         """Reset the length of the array to 0.
 *         """
 */

  /* 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("pyzoltan.core.carray.FloatArray.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_27reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_26reset[] = "FloatArray.reset(self)\nReset the length of the array to 0.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_27reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_26reset(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_26reset(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reset", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_10FloatArray_reset(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.FloatArray.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1920
 *             self._parent = None
 * 
 *     cpdef resize(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes internal data to ``size*sizeof(float)`` bytes
 *         and sets the length to the new size.
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_29resize(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_resize(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_size, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resize", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_resize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_29resize)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __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;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1925
 * 
 *         """
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             raise RuntimeError('Cannot reize array which is a view.')
 * 
 */
  __pyx_t_7 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_7) {

    /* "pyzoltan/core/carray.pyx":1926
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot reize array which is a view.')             # <<<<<<<<<<<<<<
 * 
 *         self.c_resize(size)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":1928
 *             raise RuntimeError('Cannot reize array which is a view.')
 * 
 *         self.c_resize(size)             # <<<<<<<<<<<<<<
 * 
 *     cpdef set_view(self, FloatArray parent, long start, long end):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_resize(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_size);

  /* "pyzoltan/core/carray.pyx":1920
 *             self._parent = None
 * 
 *     cpdef resize(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes internal data to ``size*sizeof(float)`` bytes
 *         and sets the length to the new size.
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_29resize(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_28resize[] = "FloatArray.resize(self, long size)\nResizes internal data to ``size*sizeof(float)`` bytes\n        and sets the length to the new size.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_29resize(PyObject *__pyx_v_self, PyObject *__pyx_arg_size) {
  long __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resize (wrapper)", 0);
  assert(__pyx_arg_size); {
    __pyx_v_size = __Pyx_PyInt_As_long(__pyx_arg_size); if (unlikely((__pyx_v_size == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_28resize(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self), ((long)__pyx_v_size));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_28resize(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, long __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_10FloatArray_resize(__pyx_v_self, __pyx_v_size, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.FloatArray.resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1930
 *         self.c_resize(size)
 * 
 *     cpdef set_view(self, FloatArray parent, long start, long end):             # <<<<<<<<<<<<<<
 *         """Create a view of a given a `parent` array from start to end.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_31set_view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_set_view(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_parent, long __pyx_v_start, long __pyx_v_end, int __pyx_skip_dispatch) {
  PyArrayObject *__pyx_v_arr;
  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;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  float *__pyx_t_11;
  long __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_view", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_view); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_31set_view)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_parent));
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, ((PyObject *)__pyx_v_parent));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_parent));
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1947
 * 
 *         """
 *         if self._parent is None:             # <<<<<<<<<<<<<<
 *             self._old_data = self.data
 *         self._parent = parent
 */
  __pyx_t_9 = (((PyObject *)__pyx_v_self->_parent) == Py_None);
  __pyx_t_10 = (__pyx_t_9 != 0);
  if (__pyx_t_10) {

    /* "pyzoltan/core/carray.pyx":1948
 *         """
 *         if self._parent is None:
 *             self._old_data = self.data             # <<<<<<<<<<<<<<
 *         self._parent = parent
 *         self.data = parent.data + start
 */
    __pyx_t_11 = __pyx_v_self->data;
    __pyx_v_self->_old_data = __pyx_t_11;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":1949
 *         if self._parent is None:
 *             self._old_data = self.data
 *         self._parent = parent             # <<<<<<<<<<<<<<
 *         self.data = parent.data + start
 *         self.length = end - start
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_parent));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_parent));
  __Pyx_GOTREF(__pyx_v_self->_parent);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_parent));
  __pyx_v_self->_parent = __pyx_v_parent;

  /* "pyzoltan/core/carray.pyx":1950
 *             self._old_data = self.data
 *         self._parent = parent
 *         self.data = parent.data + start             # <<<<<<<<<<<<<<
 *         self.length = end - start
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 */
  __pyx_v_self->data = (__pyx_v_parent->data + __pyx_v_start);

  /* "pyzoltan/core/carray.pyx":1951
 *         self._parent = parent
 *         self.data = parent.data + start
 *         self.length = end - start             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data
 */
  __pyx_v_self->__pyx_base.length = (__pyx_v_end - __pyx_v_start);

  /* "pyzoltan/core/carray.pyx":1952
 *         self.data = parent.data + start
 *         self.length = end - start
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         arr.data = <char *>self.data
 *         arr.dimensions[0] = self.length
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":1953
 *         self.length = end - start
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data             # <<<<<<<<<<<<<<
 *         arr.dimensions[0] = self.length
 * 
 */
  __pyx_v_arr->data = ((char *)__pyx_v_self->data);

  /* "pyzoltan/core/carray.pyx":1954
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cpdef squeeze(self):
 */
  __pyx_t_12 = __pyx_v_self->__pyx_base.length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_12;

  /* "pyzoltan/core/carray.pyx":1930
 *         self.c_resize(size)
 * 
 *     cpdef set_view(self, FloatArray parent, long start, long end):             # <<<<<<<<<<<<<<
 *         """Create a view of a given a `parent` array from start to end.
 * 
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.set_view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_31set_view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_30set_view[] = "FloatArray.set_view(self, FloatArray parent, long start, long end)\nCreate a view of a given a `parent` array from start to end.\n\n        Note that this excludes the end index.\n\n        Parameters\n        ----------\n\n        parent : FloatArray\n            The parent array of which this is a view.\n        start : long\n            The starting index to start the view from.\n        end : long\n            The ending index to end the view at, excludes the end\n            itself.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_31set_view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_parent = 0;
  long __pyx_v_start;
  long __pyx_v_end;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parent,&__pyx_n_s_start,&__pyx_n_s_end,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parent)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_view", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_view", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_view") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __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_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)values[0]);
    __pyx_v_start = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_start == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_end = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_end == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_view", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.set_view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_8pyzoltan_4core_6carray_FloatArray, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_30set_view(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self), __pyx_v_parent, __pyx_v_start, __pyx_v_end);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_30set_view(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_parent, long __pyx_v_start, long __pyx_v_end) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_view", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_10FloatArray_set_view(__pyx_v_self, __pyx_v_parent, __pyx_v_start, __pyx_v_end, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.FloatArray.set_view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1956
 *         arr.dimensions[0] = self.length
 * 
 *     cpdef squeeze(self):             # <<<<<<<<<<<<<<
 *         """Release any unused memory.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_33squeeze(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, int __pyx_skip_dispatch) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("squeeze", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_squeeze); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_33squeeze)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1956; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1959
 *         """Release any unused memory.
 *         """
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             raise RuntimeError('Cannot squeeze array which is a view.')
 * 
 */
  __pyx_t_5 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_5) {

    /* "pyzoltan/core/carray.pyx":1960
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot squeeze array which is a view.')             # <<<<<<<<<<<<<<
 * 
 *         self.c_squeeze()
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":1962
 *             raise RuntimeError('Cannot squeeze array which is a view.')
 * 
 *         self.c_squeeze()             # <<<<<<<<<<<<<<
 * 
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=0):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_squeeze(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

  /* "pyzoltan/core/carray.pyx":1956
 *         arr.dimensions[0] = self.length
 * 
 *     cpdef squeeze(self):             # <<<<<<<<<<<<<<
 *         """Release any unused memory.
 *         """
 */

  /* 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("pyzoltan.core.carray.FloatArray.squeeze", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_33squeeze(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_32squeeze[] = "FloatArray.squeeze(self)\nRelease any unused memory.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_33squeeze(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("squeeze (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_32squeeze(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_32squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("squeeze", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_10FloatArray_squeeze(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1956; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.FloatArray.squeeze", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":1964
 *         self.c_squeeze()
 * 
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=0):             # <<<<<<<<<<<<<<
 *         """Remove the particles with indices in index_list.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_35remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_remove(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_10FloatArray_remove *__pyx_optional_args) {
  int __pyx_v_input_sorted = ((int)0);
  long __pyx_v_i;
  long __pyx_v_inlength;
  PyArrayObject *__pyx_v_sorted_indices = 0;
  long __pyx_v_id;
  PyArrayObject *__pyx_v_arr;
  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;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  long __pyx_t_9;
  long __pyx_t_10;
  long __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_input_sorted = __pyx_optional_args->input_sorted;
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_35remove)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_input_sorted); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_6 = 1;
        }
      }
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_index_list));
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_index_list));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_index_list));
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":1985
 * 
 *         """
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             raise RuntimeError('Cannot remove elements from view array.')
 *         cdef long i
 */
  __pyx_t_8 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_8) {

    /* "pyzoltan/core/carray.pyx":1986
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot remove elements from view array.')             # <<<<<<<<<<<<<<
 *         cdef long i
 *         cdef long inlength = index_list.size
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":1988
 *             raise RuntimeError('Cannot remove elements from view array.')
 *         cdef long i
 *         cdef long inlength = index_list.size             # <<<<<<<<<<<<<<
 *         cdef np.ndarray sorted_indices
 *         cdef long id
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_index_list), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_inlength = __pyx_t_9;

  /* "pyzoltan/core/carray.pyx":1991
 *         cdef np.ndarray sorted_indices
 *         cdef long id
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 * 
 *         if inlength > self.length:
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":1993
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 *         if inlength > self.length:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_8 = ((__pyx_v_inlength > __pyx_v_self->__pyx_base.length) != 0);
  if (__pyx_t_8) {

    /* "pyzoltan/core/carray.pyx":1994
 * 
 *         if inlength > self.length:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if input_sorted != 1:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "pyzoltan/core/carray.pyx":1996
 *             return
 * 
 *         if input_sorted != 1:             # <<<<<<<<<<<<<<
 *             sorted_indices = np.sort(index_list)
 *         else:
 */
  __pyx_t_8 = ((__pyx_v_input_sorted != 1) != 0);
  if (__pyx_t_8) {

    /* "pyzoltan/core/carray.pyx":1997
 * 
 *         if input_sorted != 1:
 *             sorted_indices = np.sort(index_list)             # <<<<<<<<<<<<<<
 *         else:
 *             sorted_indices = index_list
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sort); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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, ((PyObject *)__pyx_v_index_list)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(((PyObject *)__pyx_v_index_list));
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, ((PyObject *)__pyx_v_index_list));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_index_list));
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_sorted_indices = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pyzoltan/core/carray.pyx":1999
 *             sorted_indices = np.sort(index_list)
 *         else:
 *             sorted_indices = index_list             # <<<<<<<<<<<<<<
 * 
 *         for i in range(inlength):
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_index_list));
    __pyx_v_sorted_indices = __pyx_v_index_list;
  }
  __pyx_L5:;

  /* "pyzoltan/core/carray.pyx":2001
 *             sorted_indices = index_list
 * 
 *         for i in range(inlength):             # <<<<<<<<<<<<<<
 *             id = sorted_indices[inlength-(i+1)]
 *             if id < self.length:
 */
  __pyx_t_9 = __pyx_v_inlength;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_i = __pyx_t_10;

    /* "pyzoltan/core/carray.pyx":2002
 * 
 *         for i in range(inlength):
 *             id = sorted_indices[inlength-(i+1)]             # <<<<<<<<<<<<<<
 *             if id < self.length:
 *                 self.data[id] = self.data[self.length-1]
 */
    __pyx_t_11 = (__pyx_v_inlength - (__pyx_v_i + 1));
    __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_sorted_indices), __pyx_t_11, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_11 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_id = __pyx_t_11;

    /* "pyzoltan/core/carray.pyx":2003
 *         for i in range(inlength):
 *             id = sorted_indices[inlength-(i+1)]
 *             if id < self.length:             # <<<<<<<<<<<<<<
 *                 self.data[id] = self.data[self.length-1]
 *                 self.length = self.length - 1
 */
    __pyx_t_8 = ((__pyx_v_id < __pyx_v_self->__pyx_base.length) != 0);
    if (__pyx_t_8) {

      /* "pyzoltan/core/carray.pyx":2004
 *             id = sorted_indices[inlength-(i+1)]
 *             if id < self.length:
 *                 self.data[id] = self.data[self.length-1]             # <<<<<<<<<<<<<<
 *                 self.length = self.length - 1
 *                 arr.dimensions[0] = self.length
 */
      (__pyx_v_self->data[__pyx_v_id]) = (__pyx_v_self->data[(__pyx_v_self->__pyx_base.length - 1)]);

      /* "pyzoltan/core/carray.pyx":2005
 *             if id < self.length:
 *                 self.data[id] = self.data[self.length-1]
 *                 self.length = self.length - 1             # <<<<<<<<<<<<<<
 *                 arr.dimensions[0] = self.length
 * 
 */
      __pyx_v_self->__pyx_base.length = (__pyx_v_self->__pyx_base.length - 1);

      /* "pyzoltan/core/carray.pyx":2006
 *                 self.data[id] = self.data[self.length-1]
 *                 self.length = self.length - 1
 *                 arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cpdef extend(self, np.ndarray in_array):
 */
      __pyx_t_11 = __pyx_v_self->__pyx_base.length;
      (__pyx_v_arr->dimensions[0]) = __pyx_t_11;
      goto __pyx_L8;
    }
    __pyx_L8:;
  }

  /* "pyzoltan/core/carray.pyx":1964
 *         self.c_squeeze()
 * 
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=0):             # <<<<<<<<<<<<<<
 *         """Remove the particles with indices in index_list.
 * 
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sorted_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_35remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_34remove[] = "FloatArray.remove(self, ndarray index_list, bool input_sorted=0)\nRemove the particles with indices in index_list.\n\n        Parameters\n        ----------\n\n        index_list : ndarray\n            a list of indices which should be removed.\n        input_sorted : bool\n            indicates if the input is sorted in ascending order.  if\n            not, the array will be sorted internally.\n\n        Notes\n        -----\n\n         If the input indices are not sorted, sort them in ascending order.\n         Starting with the last element in the index list, start replacing the\n         element at the said index with the last element in the data and update\n         the length of the array.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_35remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_index_list = 0;
  int __pyx_v_input_sorted;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index_list,&__pyx_n_s_input_sorted,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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index_list)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_input_sorted);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "remove") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_index_list = ((PyArrayObject *)values[0]);
    if (values[1]) {
      __pyx_v_input_sorted = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_input_sorted == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_input_sorted = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("remove", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index_list), __pyx_ptype_5numpy_ndarray, 1, "index_list", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_34remove(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self), __pyx_v_index_list, __pyx_v_input_sorted);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_34remove(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_v_input_sorted) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_remove __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.input_sorted = __pyx_v_input_sorted;
  __pyx_t_1 = __pyx_vtabptr_8pyzoltan_4core_6carray_FloatArray->__pyx_base.remove(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_index_list, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.FloatArray.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2008
 *                 arr.dimensions[0] = self.length
 * 
 *     cpdef extend(self, np.ndarray in_array):             # <<<<<<<<<<<<<<
 *         """Extend the array with data from in_array.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_37extend(PyObject *__pyx_v_self, PyObject *__pyx_v_in_array); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_extend(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array, int __pyx_skip_dispatch) {
  long __pyx_v_len;
  long __pyx_v_i;
  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;
  int __pyx_t_6;
  long __pyx_t_7;
  long __pyx_t_8;
  float __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_37extend)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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, ((PyObject *)__pyx_v_in_array)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_v_in_array));
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, ((PyObject *)__pyx_v_in_array));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_in_array));
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2024
 * 
 *         """
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             raise RuntimeError('Cannot extend array which is a view.')
 *         cdef long len = in_array.size
 */
  __pyx_t_6 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_6) {

    /* "pyzoltan/core/carray.pyx":2025
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot extend array which is a view.')             # <<<<<<<<<<<<<<
 *         cdef long len = in_array.size
 *         cdef long i
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":2026
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot extend array which is a view.')
 *         cdef long len = in_array.size             # <<<<<<<<<<<<<<
 *         cdef long i
 *         for i in range(len):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_in_array), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_len = __pyx_t_7;

  /* "pyzoltan/core/carray.pyx":2028
 *         cdef long len = in_array.size
 *         cdef long i
 *         for i in range(len):             # <<<<<<<<<<<<<<
 *             self.append(in_array[i])
 * 
 */
  __pyx_t_7 = __pyx_v_len;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pyzoltan/core/carray.pyx":2029
 *         cdef long i
 *         for i in range(len):
 *             self.append(in_array[i])             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy_values(self, LongArray indices, BaseArray dest):
 */
    __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_in_array), __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2029; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_9 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->append(__pyx_v_self, __pyx_t_9, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2008
 *                 arr.dimensions[0] = self.length
 * 
 *     cpdef extend(self, np.ndarray in_array):             # <<<<<<<<<<<<<<
 *         """Extend the array with data from in_array.
 * 
 */

  /* 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("pyzoltan.core.carray.FloatArray.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_37extend(PyObject *__pyx_v_self, PyObject *__pyx_v_in_array); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_36extend[] = "FloatArray.extend(self, ndarray in_array)\nExtend the array with data from in_array.\n\n        Parameters\n        ----------\n\n        in_array : ndarray\n            a numpy array with data to be added to the current array.\n\n        Notes\n        -----\n\n         - accessing the in_array using the indexing operation seems to be\n           costly. Look at the annotated cython html file.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_37extend(PyObject *__pyx_v_self, PyObject *__pyx_v_in_array) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("extend (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_array), __pyx_ptype_5numpy_ndarray, 1, "in_array", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_36extend(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self), ((PyArrayObject *)__pyx_v_in_array));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_36extend(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_10FloatArray_extend(__pyx_v_self, __pyx_v_in_array, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.FloatArray.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2031
 *             self.append(in_array[i])
 * 
 *     cpdef copy_values(self, LongArray indices, BaseArray dest):             # <<<<<<<<<<<<<<
 *         """Copies values of indices in indices from self to `dest`.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_39copy_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest, int __pyx_skip_dispatch) {
  struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_dest_array = 0;
  long __pyx_v_i;
  long __pyx_v_num_values;
  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;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  long __pyx_t_7;
  long __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_values", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy_values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_39copy_values)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && 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);
          __pyx_t_5 = 1;
        }
      }
      __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_4) {
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_indices));
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, ((PyObject *)__pyx_v_indices));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_indices));
      __Pyx_INCREF(((PyObject *)__pyx_v_dest));
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_dest));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_dest));
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2037
 *         i.e. atleast as long as indices.
 *         """
 *         cdef FloatArray dest_array = <FloatArray>dest             # <<<<<<<<<<<<<<
 *         cdef long i, num_values
 *         num_values = indices.length
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_dest);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_dest_array = ((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":2039
 *         cdef FloatArray dest_array = <FloatArray>dest
 *         cdef long i, num_values
 *         num_values = indices.length             # <<<<<<<<<<<<<<
 * 
 *         for i in range(num_values):
 */
  __pyx_t_7 = __pyx_v_indices->__pyx_base.length;
  __pyx_v_num_values = __pyx_t_7;

  /* "pyzoltan/core/carray.pyx":2041
 *         num_values = indices.length
 * 
 *         for i in range(num_values):             # <<<<<<<<<<<<<<
 *             dest_array.data[i] = self.data[indices.data[i]]
 * 
 */
  __pyx_t_7 = __pyx_v_num_values;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pyzoltan/core/carray.pyx":2042
 * 
 *         for i in range(num_values):
 *             dest_array.data[i] = self.data[indices.data[i]]             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy_subset(self, BaseArray source, long start_index=-1,
 */
    (__pyx_v_dest_array->data[__pyx_v_i]) = (__pyx_v_self->data[(__pyx_v_indices->data[__pyx_v_i])]);
  }

  /* "pyzoltan/core/carray.pyx":2031
 *             self.append(in_array[i])
 * 
 *     cpdef copy_values(self, LongArray indices, BaseArray dest):             # <<<<<<<<<<<<<<
 *         """Copies values of indices in indices from self to `dest`.
 * 
 */

  /* 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_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.copy_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dest_array);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_39copy_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_38copy_values[] = "FloatArray.copy_values(self, LongArray indices, BaseArray dest)\nCopies values of indices in indices from self to `dest`.\n\n        No size check if performed, we assume the dest to of proper size\n        i.e. atleast as long as indices.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_39copy_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices = 0;
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_values (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,&__pyx_n_s_dest,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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indices)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dest)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("copy_values", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy_values") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __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_indices = ((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)values[0]);
    __pyx_v_dest = ((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy_values", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.copy_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_8pyzoltan_4core_6carray_LongArray, 1, "indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dest), __pyx_ptype_8pyzoltan_4core_6carray_BaseArray, 1, "dest", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_38copy_values(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self), __pyx_v_indices, __pyx_v_dest);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_38copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_values", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_10FloatArray_copy_values(__pyx_v_self, __pyx_v_indices, __pyx_v_dest, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.FloatArray.copy_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2044
 *             dest_array.data[i] = self.data[indices.data[i]]
 * 
 *     cpdef copy_subset(self, BaseArray source, long start_index=-1,             # <<<<<<<<<<<<<<
 *                       long end_index=-1):
 *         """Copy a subset of values from src to self.
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_41copy_subset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_10FloatArray_copy_subset *__pyx_optional_args) {
  long __pyx_v_start_index = ((long)-1);
  long __pyx_v_end_index = ((long)-1);
  long __pyx_v_si;
  long __pyx_v_ei;
  long __pyx_v_s_length;
  long __pyx_v_d_length;
  long __pyx_v_i;
  long __pyx_v_j;
  struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_src = 0;
  PyObject *__pyx_v_msg = 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;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  long __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  long __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_subset", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_start_index = __pyx_optional_args->start_index;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_end_index = __pyx_optional_args->end_index;
      }
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy_subset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_41copy_subset)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_start_index); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_end_index); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_source));
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, ((PyObject *)__pyx_v_source));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_source));
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2059
 *         """
 *         cdef long si, ei, s_length, d_length, i, j
 *         cdef FloatArray src = <FloatArray>source             # <<<<<<<<<<<<<<
 *         s_length = src.length
 *         d_length = self.length
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_source);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_src = ((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":2060
 *         cdef long si, ei, s_length, d_length, i, j
 *         cdef FloatArray src = <FloatArray>source
 *         s_length = src.length             # <<<<<<<<<<<<<<
 *         d_length = self.length
 * 
 */
  __pyx_t_9 = __pyx_v_src->__pyx_base.length;
  __pyx_v_s_length = __pyx_t_9;

  /* "pyzoltan/core/carray.pyx":2061
 *         cdef FloatArray src = <FloatArray>source
 *         s_length = src.length
 *         d_length = self.length             # <<<<<<<<<<<<<<
 * 
 *         if end_index < 0:
 */
  __pyx_t_9 = __pyx_v_self->__pyx_base.length;
  __pyx_v_d_length = __pyx_t_9;

  /* "pyzoltan/core/carray.pyx":2063
 *         d_length = self.length
 * 
 *         if end_index < 0:             # <<<<<<<<<<<<<<
 *             if start_index < 0:
 *                 if s_length != d_length:
 */
  __pyx_t_10 = ((__pyx_v_end_index < 0) != 0);
  if (__pyx_t_10) {

    /* "pyzoltan/core/carray.pyx":2064
 * 
 *         if end_index < 0:
 *             if start_index < 0:             # <<<<<<<<<<<<<<
 *                 if s_length != d_length:
 *                     msg = 'Source length should be same as dest length'
 */
    __pyx_t_10 = ((__pyx_v_start_index < 0) != 0);
    if (__pyx_t_10) {

      /* "pyzoltan/core/carray.pyx":2065
 *         if end_index < 0:
 *             if start_index < 0:
 *                 if s_length != d_length:             # <<<<<<<<<<<<<<
 *                     msg = 'Source length should be same as dest length'
 *                     logger.error(msg)
 */
      __pyx_t_10 = ((__pyx_v_s_length != __pyx_v_d_length) != 0);
      if (__pyx_t_10) {

        /* "pyzoltan/core/carray.pyx":2066
 *             if start_index < 0:
 *                 if s_length != d_length:
 *                     msg = 'Source length should be same as dest length'             # <<<<<<<<<<<<<<
 *                     logger.error(msg)
 *                     raise ValueError, msg
 */
        __Pyx_INCREF(__pyx_kp_s_Source_length_should_be_same_as);
        __pyx_v_msg = __pyx_kp_s_Source_length_should_be_same_as;

        /* "pyzoltan/core/carray.pyx":2067
 *                 if s_length != d_length:
 *                     msg = 'Source length should be same as dest length'
 *                     logger.error(msg)             # <<<<<<<<<<<<<<
 *                     raise ValueError, msg
 *                 si = 0
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        if (!__pyx_t_2) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "pyzoltan/core/carray.pyx":2068
 *                     msg = 'Source length should be same as dest length'
 *                     logger.error(msg)
 *                     raise ValueError, msg             # <<<<<<<<<<<<<<
 *                 si = 0
 *                 ei = self.length
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "pyzoltan/core/carray.pyx":2069
 *                     logger.error(msg)
 *                     raise ValueError, msg
 *                 si = 0             # <<<<<<<<<<<<<<
 *                 ei = self.length
 *             else:
 */
      __pyx_v_si = 0;

      /* "pyzoltan/core/carray.pyx":2070
 *                     raise ValueError, msg
 *                 si = 0
 *                 ei = self.length             # <<<<<<<<<<<<<<
 *             else:
 *                 # meaning we copy from the specified start index to the end of
 */
      __pyx_t_9 = __pyx_v_self->__pyx_base.length;
      __pyx_v_ei = __pyx_t_9;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "pyzoltan/core/carray.pyx":2074
 *                 # meaning we copy from the specified start index to the end of
 *                 # self. make sure the sizes are consistent.
 *                 si = start_index             # <<<<<<<<<<<<<<
 *                 ei = d_length
 * 
 */
      __pyx_v_si = __pyx_v_start_index;

      /* "pyzoltan/core/carray.pyx":2075
 *                 # self. make sure the sizes are consistent.
 *                 si = start_index
 *                 ei = d_length             # <<<<<<<<<<<<<<
 * 
 *                 if start_index > (d_length-1):
 */
      __pyx_v_ei = __pyx_v_d_length;

      /* "pyzoltan/core/carray.pyx":2077
 *                 ei = d_length
 * 
 *                 if start_index > (d_length-1):             # <<<<<<<<<<<<<<
 *                     msg = 'start_index beyond array length'
 *                     logger.error(msg)
 */
      __pyx_t_10 = ((__pyx_v_start_index > (__pyx_v_d_length - 1)) != 0);
      if (__pyx_t_10) {

        /* "pyzoltan/core/carray.pyx":2078
 * 
 *                 if start_index > (d_length-1):
 *                     msg = 'start_index beyond array length'             # <<<<<<<<<<<<<<
 *                     logger.error(msg)
 *                     raise ValueError, msg
 */
        __Pyx_INCREF(__pyx_kp_s_start_index_beyond_array_length);
        __pyx_v_msg = __pyx_kp_s_start_index_beyond_array_length;

        /* "pyzoltan/core/carray.pyx":2079
 *                 if start_index > (d_length-1):
 *                     msg = 'start_index beyond array length'
 *                     logger.error(msg)             # <<<<<<<<<<<<<<
 *                     raise ValueError, msg
 * 
 */
        __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        if (!__pyx_t_5) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "pyzoltan/core/carray.pyx":2080
 *                     msg = 'start_index beyond array length'
 *                     logger.error(msg)
 *                     raise ValueError, msg             # <<<<<<<<<<<<<<
 * 
 *                 if (ei - si) > s_length:
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "pyzoltan/core/carray.pyx":2082
 *                     raise ValueError, msg
 * 
 *                 if (ei - si) > s_length:             # <<<<<<<<<<<<<<
 *                     msg = 'Not enough values in source'
 *                     logger.error(msg)
 */
      __pyx_t_10 = (((__pyx_v_ei - __pyx_v_si) > __pyx_v_s_length) != 0);
      if (__pyx_t_10) {

        /* "pyzoltan/core/carray.pyx":2083
 * 
 *                 if (ei - si) > s_length:
 *                     msg = 'Not enough values in source'             # <<<<<<<<<<<<<<
 *                     logger.error(msg)
 *                     raise ValueError, msg
 */
        __Pyx_INCREF(__pyx_kp_s_Not_enough_values_in_source);
        __pyx_v_msg = __pyx_kp_s_Not_enough_values_in_source;

        /* "pyzoltan/core/carray.pyx":2084
 *                 if (ei - si) > s_length:
 *                     msg = 'Not enough values in source'
 *                     logger.error(msg)             # <<<<<<<<<<<<<<
 *                     raise ValueError, msg
 *         else:
 */
        __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        if (!__pyx_t_8) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __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;

        /* "pyzoltan/core/carray.pyx":2085
 *                     msg = 'Not enough values in source'
 *                     logger.error(msg)
 *                     raise ValueError, msg             # <<<<<<<<<<<<<<
 *         else:
 *             if start_index < 0:
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pyzoltan/core/carray.pyx":2087
 *                     raise ValueError, msg
 *         else:
 *             if start_index < 0:             # <<<<<<<<<<<<<<
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                           end_index)
 */
    __pyx_t_10 = ((__pyx_v_start_index < 0) != 0);
    if (__pyx_t_10) {

      /* "pyzoltan/core/carray.pyx":2088
 *         else:
 *             if start_index < 0:
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,             # <<<<<<<<<<<<<<
 *                                                           end_index)
 *                 logger.error(msg)
 */
      __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_start_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);

      /* "pyzoltan/core/carray.pyx":2089
 *             if start_index < 0:
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                           end_index)             # <<<<<<<<<<<<<<
 *                 logger.error(msg)
 *                 raise ValueError, msg
 */
      __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_end_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);

      /* "pyzoltan/core/carray.pyx":2088
 *         else:
 *             if start_index < 0:
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,             # <<<<<<<<<<<<<<
 *                                                           end_index)
 *                 logger.error(msg)
 */
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_1 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_start_index_d_end_index_d, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_msg = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "pyzoltan/core/carray.pyx":2090
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                           end_index)
 *                 logger.error(msg)             # <<<<<<<<<<<<<<
 *                 raise ValueError, msg
 *             else:
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_v_msg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_msg);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_msg);
        __Pyx_GIVEREF(__pyx_v_msg);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pyzoltan/core/carray.pyx":2091
 *                                                           end_index)
 *                 logger.error(msg)
 *                 raise ValueError, msg             # <<<<<<<<<<<<<<
 *             else:
 *                 if (start_index > (d_length-1) or end_index > d_length or
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    /*else*/ {

      /* "pyzoltan/core/carray.pyx":2093
 *                 raise ValueError, msg
 *             else:
 *                 if (start_index > (d_length-1) or end_index > d_length or             # <<<<<<<<<<<<<<
 *                     start_index > end_index):
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,
 */
      __pyx_t_11 = ((__pyx_v_start_index > (__pyx_v_d_length - 1)) != 0);
      if (!__pyx_t_11) {
      } else {
        __pyx_t_10 = __pyx_t_11;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_11 = ((__pyx_v_end_index > __pyx_v_d_length) != 0);
      if (!__pyx_t_11) {
      } else {
        __pyx_t_10 = __pyx_t_11;
        goto __pyx_L10_bool_binop_done;
      }

      /* "pyzoltan/core/carray.pyx":2094
 *             else:
 *                 if (start_index > (d_length-1) or end_index > d_length or
 *                     start_index > end_index):             # <<<<<<<<<<<<<<
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                               end_index)
 */
      __pyx_t_11 = ((__pyx_v_start_index > __pyx_v_end_index) != 0);
      __pyx_t_10 = __pyx_t_11;
      __pyx_L10_bool_binop_done:;
      if (__pyx_t_10) {

        /* "pyzoltan/core/carray.pyx":2095
 *                 if (start_index > (d_length-1) or end_index > d_length or
 *                     start_index > end_index):
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,             # <<<<<<<<<<<<<<
 *                                                               end_index)
 *                     logger.error(msg)
 */
        __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_start_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);

        /* "pyzoltan/core/carray.pyx":2096
 *                     start_index > end_index):
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                               end_index)             # <<<<<<<<<<<<<<
 *                     logger.error(msg)
 *                     raise ValueError, msg
 */
        __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_end_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);

        /* "pyzoltan/core/carray.pyx":2095
 *                 if (start_index > (d_length-1) or end_index > d_length or
 *                     start_index > end_index):
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,             # <<<<<<<<<<<<<<
 *                                                               end_index)
 *                     logger.error(msg)
 */
        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_2 = 0;
        __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_start_index_d_end_index_d, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_v_msg = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "pyzoltan/core/carray.pyx":2097
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                               end_index)
 *                     logger.error(msg)             # <<<<<<<<<<<<<<
 *                     raise ValueError, msg
 * 
 */
        __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        if (!__pyx_t_8) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __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;

        /* "pyzoltan/core/carray.pyx":2098
 *                                                               end_index)
 *                     logger.error(msg)
 *                     raise ValueError, msg             # <<<<<<<<<<<<<<
 * 
 *                 si = start_index
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "pyzoltan/core/carray.pyx":2100
 *                     raise ValueError, msg
 * 
 *                 si = start_index             # <<<<<<<<<<<<<<
 *                 ei = end_index
 * 
 */
      __pyx_v_si = __pyx_v_start_index;

      /* "pyzoltan/core/carray.pyx":2101
 * 
 *                 si = start_index
 *                 ei = end_index             # <<<<<<<<<<<<<<
 * 
 *         # we have valid start and end indices now. can start copying now.
 */
      __pyx_v_ei = __pyx_v_end_index;
    }
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":2104
 * 
 *         # we have valid start and end indices now. can start copying now.
 *         j = 0             # <<<<<<<<<<<<<<
 *         for i in range(si, ei):
 *             self.data[i] = src.data[j]
 */
  __pyx_v_j = 0;

  /* "pyzoltan/core/carray.pyx":2105
 *         # we have valid start and end indices now. can start copying now.
 *         j = 0
 *         for i in range(si, ei):             # <<<<<<<<<<<<<<
 *             self.data[i] = src.data[j]
 *             j += 1
 */
  __pyx_t_9 = __pyx_v_ei;
  for (__pyx_t_12 = __pyx_v_si; __pyx_t_12 < __pyx_t_9; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "pyzoltan/core/carray.pyx":2106
 *         j = 0
 *         for i in range(si, ei):
 *             self.data[i] = src.data[j]             # <<<<<<<<<<<<<<
 *             j += 1
 * 
 */
    (__pyx_v_self->data[__pyx_v_i]) = (__pyx_v_src->data[__pyx_v_j]);

    /* "pyzoltan/core/carray.pyx":2107
 *         for i in range(si, ei):
 *             self.data[i] = src.data[j]
 *             j += 1             # <<<<<<<<<<<<<<
 * 
 *     cpdef update_min_max(self):
 */
    __pyx_v_j = (__pyx_v_j + 1);
  }

  /* "pyzoltan/core/carray.pyx":2044
 *             dest_array.data[i] = self.data[indices.data[i]]
 * 
 *     cpdef copy_subset(self, BaseArray source, long start_index=-1,             # <<<<<<<<<<<<<<
 *                       long end_index=-1):
 *         """Copy a subset of values from src to self.
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.copy_subset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_src);
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_41copy_subset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_40copy_subset[] = "FloatArray.copy_subset(self, BaseArray source, long start_index=-1, long end_index=-1)\nCopy a subset of values from src to self.\n\n        Parameters\n        ----------\n\n        start_index : long\n            the first index in dest that corresponds to the 0th\n            index in source\n\n        end_index : long\n            the first index in dest from start_index that is not copied\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_41copy_subset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source = 0;
  long __pyx_v_start_index;
  long __pyx_v_end_index;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_subset (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_start_index,&__pyx_n_s_end_index,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_source)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start_index);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end_index);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy_subset") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_source = ((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)values[0]);
    if (values[1]) {
      __pyx_v_start_index = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_start_index == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_start_index = ((long)-1);
    }
    if (values[2]) {
      __pyx_v_end_index = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_end_index == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_end_index = ((long)-1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy_subset", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.copy_subset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_source), __pyx_ptype_8pyzoltan_4core_6carray_BaseArray, 1, "source", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_40copy_subset(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self), __pyx_v_source, __pyx_v_start_index, __pyx_v_end_index);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_40copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, long __pyx_v_start_index, long __pyx_v_end_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_copy_subset __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_subset", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.start_index = __pyx_v_start_index;
  __pyx_t_2.end_index = __pyx_v_end_index;
  __pyx_t_1 = __pyx_vtabptr_8pyzoltan_4core_6carray_FloatArray->__pyx_base.copy_subset(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_source, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.FloatArray.copy_subset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2109
 *             j += 1
 * 
 *     cpdef update_min_max(self):             # <<<<<<<<<<<<<<
 *         """Updates the min and max values of the array.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_43update_min_max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_10FloatArray_update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, int __pyx_skip_dispatch) {
  long __pyx_v_i;
  float __pyx_v_min_val;
  float __pyx_v_max_val;
  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;
  long __pyx_t_6;
  long __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update_min_max", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_update_min_max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_43update_min_max)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2112
 *         """Updates the min and max values of the array.
 *         """
 *         cdef long i = 0             # <<<<<<<<<<<<<<
 *         cdef float min_val, max_val
 * 
 */
  __pyx_v_i = 0;

  /* "pyzoltan/core/carray.pyx":2115
 *         cdef float min_val, max_val
 * 
 *         if self.length == 0:             # <<<<<<<<<<<<<<
 *             self.minimum = <float>0
 *             self.maximum = <float>0
 */
  __pyx_t_5 = ((__pyx_v_self->__pyx_base.length == 0) != 0);
  if (__pyx_t_5) {

    /* "pyzoltan/core/carray.pyx":2116
 * 
 *         if self.length == 0:
 *             self.minimum = <float>0             # <<<<<<<<<<<<<<
 *             self.maximum = <float>0
 *             return
 */
    __pyx_v_self->minimum = ((float)0);

    /* "pyzoltan/core/carray.pyx":2117
 *         if self.length == 0:
 *             self.minimum = <float>0
 *             self.maximum = <float>0             # <<<<<<<<<<<<<<
 *             return
 * 
 */
    __pyx_v_self->maximum = ((float)0);

    /* "pyzoltan/core/carray.pyx":2118
 *             self.minimum = <float>0
 *             self.maximum = <float>0
 *             return             # <<<<<<<<<<<<<<
 * 
 *         min_val = self.data[0]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "pyzoltan/core/carray.pyx":2120
 *             return
 * 
 *         min_val = self.data[0]             # <<<<<<<<<<<<<<
 *         max_val = self.data[0]
 * 
 */
  __pyx_v_min_val = (__pyx_v_self->data[0]);

  /* "pyzoltan/core/carray.pyx":2121
 * 
 *         min_val = self.data[0]
 *         max_val = self.data[0]             # <<<<<<<<<<<<<<
 * 
 *         for i in range(self.length):
 */
  __pyx_v_max_val = (__pyx_v_self->data[0]);

  /* "pyzoltan/core/carray.pyx":2123
 *         max_val = self.data[0]
 * 
 *         for i in range(self.length):             # <<<<<<<<<<<<<<
 *             if min_val > self.data[i]:
 *                 min_val = self.data[i]
 */
  __pyx_t_6 = __pyx_v_self->__pyx_base.length;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "pyzoltan/core/carray.pyx":2124
 * 
 *         for i in range(self.length):
 *             if min_val > self.data[i]:             # <<<<<<<<<<<<<<
 *                 min_val = self.data[i]
 *             if max_val < self.data[i]:
 */
    __pyx_t_5 = ((__pyx_v_min_val > (__pyx_v_self->data[__pyx_v_i])) != 0);
    if (__pyx_t_5) {

      /* "pyzoltan/core/carray.pyx":2125
 *         for i in range(self.length):
 *             if min_val > self.data[i]:
 *                 min_val = self.data[i]             # <<<<<<<<<<<<<<
 *             if max_val < self.data[i]:
 *                 max_val = self.data[i]
 */
      __pyx_v_min_val = (__pyx_v_self->data[__pyx_v_i]);
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pyzoltan/core/carray.pyx":2126
 *             if min_val > self.data[i]:
 *                 min_val = self.data[i]
 *             if max_val < self.data[i]:             # <<<<<<<<<<<<<<
 *                 max_val = self.data[i]
 * 
 */
    __pyx_t_5 = ((__pyx_v_max_val < (__pyx_v_self->data[__pyx_v_i])) != 0);
    if (__pyx_t_5) {

      /* "pyzoltan/core/carray.pyx":2127
 *                 min_val = self.data[i]
 *             if max_val < self.data[i]:
 *                 max_val = self.data[i]             # <<<<<<<<<<<<<<
 * 
 *         self.minimum = min_val
 */
      __pyx_v_max_val = (__pyx_v_self->data[__pyx_v_i]);
      goto __pyx_L7;
    }
    __pyx_L7:;
  }

  /* "pyzoltan/core/carray.pyx":2129
 *                 max_val = self.data[i]
 * 
 *         self.minimum = min_val             # <<<<<<<<<<<<<<
 *         self.maximum = max_val
 * 
 */
  __pyx_v_self->minimum = __pyx_v_min_val;

  /* "pyzoltan/core/carray.pyx":2130
 * 
 *         self.minimum = min_val
 *         self.maximum = max_val             # <<<<<<<<<<<<<<
 * 
 * # ###########################################################################
 */
  __pyx_v_self->maximum = __pyx_v_max_val;

  /* "pyzoltan/core/carray.pyx":2109
 *             j += 1
 * 
 *     cpdef update_min_max(self):             # <<<<<<<<<<<<<<
 *         """Updates the min and max values of the array.
 *         """
 */

  /* 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("pyzoltan.core.carray.FloatArray.update_min_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_43update_min_max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_42update_min_max[] = "FloatArray.update_min_max(self)\nUpdates the min and max values of the array.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_43update_min_max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_min_max (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_42update_min_max(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_42update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update_min_max", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_10FloatArray_update_min_max(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.FloatArray.update_min_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pxd":150
 *     cdef float *data
 *     cdef float *_old_data
 *     cdef public float minimum, maximum             # <<<<<<<<<<<<<<
 *     cdef FloatArray _parent
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_7minimum_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_7minimum_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_7minimum___get__(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_7minimum___get__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->minimum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.FloatArray.minimum.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_10FloatArray_7minimum_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8pyzoltan_4core_6carray_10FloatArray_7minimum_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_7minimum_2__set__(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_7minimum_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  float __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->minimum = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.minimum.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_7maximum_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_7maximum_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_7maximum___get__(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_10FloatArray_7maximum___get__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->maximum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.FloatArray.maximum.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_10FloatArray_7maximum_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8pyzoltan_4core_6carray_10FloatArray_7maximum_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_7maximum_2__set__(((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_10FloatArray_7maximum_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  float __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->maximum = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.FloatArray.maximum.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2177
 *     #cdef np.ndarray _npy_array
 * 
 *     def __cinit__(self, long n=0):             # <<<<<<<<<<<<<<
 *         """Constructor for the class.
 *         """
 */

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,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);
        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 = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray___cinit__(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self), __pyx_v_n);

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

static int __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray___cinit__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_n) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "pyzoltan/core/carray.pyx":2180
 *         """Constructor for the class.
 *         """
 *         self.length = n             # <<<<<<<<<<<<<<
 *         self._parent = None
 *         self._old_data = NULL
 */
  __pyx_v_self->__pyx_base.length = __pyx_v_n;

  /* "pyzoltan/core/carray.pyx":2181
 *         """
 *         self.length = n
 *         self._parent = None             # <<<<<<<<<<<<<<
 *         self._old_data = NULL
 *         if n == 0:
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_parent);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_parent));
  __pyx_v_self->_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)Py_None);

  /* "pyzoltan/core/carray.pyx":2182
 *         self.length = n
 *         self._parent = None
 *         self._old_data = NULL             # <<<<<<<<<<<<<<
 *         if n == 0:
 *             n = 16
 */
  __pyx_v_self->_old_data = NULL;

  /* "pyzoltan/core/carray.pyx":2183
 *         self._parent = None
 *         self._old_data = NULL
 *         if n == 0:             # <<<<<<<<<<<<<<
 *             n = 16
 *         self.alloc = n
 */
  __pyx_t_1 = ((__pyx_v_n == 0) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":2184
 *         self._old_data = NULL
 *         if n == 0:
 *             n = 16             # <<<<<<<<<<<<<<
 *         self.alloc = n
 *         self.data = <double*>aligned_malloc(n*sizeof(double))
 */
    __pyx_v_n = 16;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":2185
 *         if n == 0:
 *             n = 16
 *         self.alloc = n             # <<<<<<<<<<<<<<
 *         self.data = <double*>aligned_malloc(n*sizeof(double))
 * 
 */
  __pyx_v_self->__pyx_base.alloc = __pyx_v_n;

  /* "pyzoltan/core/carray.pyx":2186
 *             n = 16
 *         self.alloc = n
 *         self.data = <double*>aligned_malloc(n*sizeof(double))             # <<<<<<<<<<<<<<
 * 
 *         self._setup_npy_array()
 */
  __pyx_v_self->data = ((double *)__pyx_f_8pyzoltan_4core_6carray_aligned_malloc((__pyx_v_n * (sizeof(double)))));

  /* "pyzoltan/core/carray.pyx":2188
 *         self.data = <double*>aligned_malloc(n*sizeof(double))
 * 
 *         self._setup_npy_array()             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->_setup_npy_array(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pyzoltan/core/carray.pyx":2177
 *     #cdef np.ndarray _npy_array
 * 
 *     def __cinit__(self, long n=0):             # <<<<<<<<<<<<<<
 *         """Constructor for the class.
 *         """
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2190
 *         self._setup_npy_array()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         """Frees the array.
 *         """
 */

/* Python wrapper */
static void __pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_2__dealloc__(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self));

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

static void __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_2__dealloc__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "pyzoltan/core/carray.pyx":2193
 *         """Frees the array.
 *         """
 *         if self._old_data == NULL:             # <<<<<<<<<<<<<<
 *             aligned_free(<void*>self.data)
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->_old_data == NULL) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":2194
 *         """
 *         if self._old_data == NULL:
 *             aligned_free(<void*>self.data)             # <<<<<<<<<<<<<<
 *         else:
 *             aligned_free(<void*>self._old_data)
 */
    __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_self->data));
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pyzoltan/core/carray.pyx":2196
 *             aligned_free(<void*>self.data)
 *         else:
 *             aligned_free(<void*>self._old_data)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, long idx):
 */
    __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_self->_old_data));
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":2190
 *         self._setup_npy_array()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         """Frees the array.
 *         """
 */

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

/* "pyzoltan/core/carray.pyx":2198
 *             aligned_free(<void*>self._old_data)
 * 
 *     def __getitem__(self, long idx):             # <<<<<<<<<<<<<<
 *         """Get item at position idx.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_4__getitem__[] = "Get item at position idx.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_8pyzoltan_4core_6carray_11DoubleArray_4__getitem__;
#endif
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx) {
  long __pyx_v_idx;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  assert(__pyx_arg_idx); {
    __pyx_v_idx = __Pyx_PyInt_As_long(__pyx_arg_idx); if (unlikely((__pyx_v_idx == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2198; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_4__getitem__(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self), ((long)__pyx_v_idx));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_4__getitem__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_idx) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "pyzoltan/core/carray.pyx":2201
 *         """Get item at position idx.
 *         """
 *         return self.data[idx]             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, long idx, double value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->data[__pyx_v_idx])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":2198
 *             aligned_free(<void*>self._old_data)
 * 
 *     def __getitem__(self, long idx):             # <<<<<<<<<<<<<<
 *         """Get item at position idx.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2203
 *         return self.data[idx]
 * 
 *     def __setitem__(self, long idx, double value):             # <<<<<<<<<<<<<<
 *         """Set location idx to value.
 *         """
 */

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx, PyObject *__pyx_arg_value); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_6__setitem__[] = "Set location idx to value.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_8pyzoltan_4core_6carray_11DoubleArray_6__setitem__;
#endif
static int __pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx, PyObject *__pyx_arg_value) {
  long __pyx_v_idx;
  double __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  assert(__pyx_arg_idx); {
    __pyx_v_idx = __Pyx_PyInt_As_long(__pyx_arg_idx); if (unlikely((__pyx_v_idx == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsDouble(__pyx_arg_value); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_6__setitem__(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self), ((long)__pyx_v_idx), ((double)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_6__setitem__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_idx, double __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "pyzoltan/core/carray.pyx":2206
 *         """Set location idx to value.
 *         """
 *         self.data[idx] = value             # <<<<<<<<<<<<<<
 * 
 *     cpdef long index(self, double value):
 */
  (__pyx_v_self->data[__pyx_v_idx]) = __pyx_v_value;

  /* "pyzoltan/core/carray.pyx":2203
 *         return self.data[idx]
 * 
 *     def __setitem__(self, long idx, double value):             # <<<<<<<<<<<<<<
 *         """Set location idx to value.
 *         """
 */

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

/* "pyzoltan/core/carray.pyx":2208
 *         self.data[idx] = value
 * 
 *     cpdef long index(self, double value):             # <<<<<<<<<<<<<<
 *         """Returns the index at which value is in self, else -1.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_9index(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static long __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_index(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, double __pyx_v_value, int __pyx_skip_dispatch) {
  long __pyx_v_i;
  long __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 = NULL;
  PyObject *__pyx_t_6 = NULL;
  long __pyx_t_7;
  long __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("index", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_9index)) {
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __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;
      __pyx_t_7 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_7;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2212
 *         """
 *         cdef long i
 *         for i in range(self.length):             # <<<<<<<<<<<<<<
 *             if self.data[i] == value:
 *                 return i
 */
  __pyx_t_7 = __pyx_v_self->__pyx_base.length;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pyzoltan/core/carray.pyx":2213
 *         cdef long i
 *         for i in range(self.length):
 *             if self.data[i] == value:             # <<<<<<<<<<<<<<
 *                 return i
 *         return -1
 */
    __pyx_t_9 = (((__pyx_v_self->data[__pyx_v_i]) == __pyx_v_value) != 0);
    if (__pyx_t_9) {

      /* "pyzoltan/core/carray.pyx":2214
 *         for i in range(self.length):
 *             if self.data[i] == value:
 *                 return i             # <<<<<<<<<<<<<<
 *         return -1
 * 
 */
      __pyx_r = __pyx_v_i;
      goto __pyx_L0;
    }
  }

  /* "pyzoltan/core/carray.pyx":2215
 *             if self.data[i] == value:
 *                 return i
 *         return -1             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, double value):
 */
  __pyx_r = -1;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":2208
 *         self.data[idx] = value
 * 
 *     cpdef long index(self, double value):             # <<<<<<<<<<<<<<
 *         """Returns the index at which value is in self, else -1.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("pyzoltan.core.carray.DoubleArray.index", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_9index(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_8index[] = "DoubleArray.index(self, double value) -> long\nReturns the index at which value is in self, else -1.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_9index(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  double __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("index (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsDouble(__pyx_arg_value); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_8index(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self), ((double)__pyx_v_value));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_8index(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, double __pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("index", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_index(__pyx_v_self, __pyx_v_value, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.DoubleArray.index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2217
 *         return -1
 * 
 *     def __contains__(self, double value):             # <<<<<<<<<<<<<<
 *         """Returns True if value is in self.
 *         """
 */

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_11__contains__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_10__contains__[] = "Returns True if value is in self.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_8pyzoltan_4core_6carray_11DoubleArray_10__contains__;
#endif
static int __pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_11__contains__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  double __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsDouble(__pyx_arg_value); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2217; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_10__contains__(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self), ((double)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_10__contains__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, double __pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__", 0);

  /* "pyzoltan/core/carray.pyx":2220
 *         """Returns True if value is in self.
 *         """
 *         return (self.index(value) >= 0)             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */
  __pyx_r = (((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->index(__pyx_v_self, __pyx_v_value, 0) >= 0);
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":2217
 *         return -1
 * 
 *     def __contains__(self, double value):             # <<<<<<<<<<<<<<
 *         """Returns True if value is in self.
 *         """
 */

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

/* "pyzoltan/core/carray.pyx":2222
 *         return (self.index(value) >= 0)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         """Implemented to facilitate pickling.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_13__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_12__reduce__[] = "DoubleArray.__reduce__(self)\nImplemented to facilitate pickling.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_13__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_12__reduce__(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_12__reduce__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self) {
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce__", 0);

  /* "pyzoltan/core/carray.pyx":2225
 *         """Implemented to facilitate pickling.
 *         """
 *         d = {}             # <<<<<<<<<<<<<<
 *         d['data'] = self.get_npy_array()
 * 
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_d = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":2226
 *         """
 *         d = {}
 *         d['data'] = self.get_npy_array()             # <<<<<<<<<<<<<<
 * 
 *         return (DoubleArray, (), d)
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_npy_array(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyDict_SetItem(__pyx_v_d, __pyx_n_s_data, __pyx_t_1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":2228
 *         d['data'] = self.get_npy_array()
 * 
 *         return (DoubleArray, (), d)             # <<<<<<<<<<<<<<
 * 
 *     def __setstate__(self, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_8pyzoltan_4core_6carray_DoubleArray)));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_8pyzoltan_4core_6carray_DoubleArray)));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_8pyzoltan_4core_6carray_DoubleArray)));
  __Pyx_INCREF(__pyx_empty_tuple);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_empty_tuple);
  __Pyx_GIVEREF(__pyx_empty_tuple);
  __Pyx_INCREF(__pyx_v_d);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_d);
  __Pyx_GIVEREF(__pyx_v_d);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":2222
 *         return (self.index(value) >= 0)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         """Implemented to facilitate pickling.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2230
 *         return (DoubleArray, (), d)
 * 
 *     def __setstate__(self, d):             # <<<<<<<<<<<<<<
 *         """Load the carray from the dictionary d.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_15__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_d); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_14__setstate__[] = "DoubleArray.__setstate__(self, d)\nLoad the carray from the dictionary d.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_15__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_14__setstate__(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self), ((PyObject *)__pyx_v_d));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_14__setstate__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, PyObject *__pyx_v_d) {
  PyArrayObject *__pyx_v_arr = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  long __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate__", 0);

  /* "pyzoltan/core/carray.pyx":2233
 *         """Load the carray from the dictionary d.
 *         """
 *         cdef np.ndarray arr = d['data']             # <<<<<<<<<<<<<<
 *         self.resize(arr.size)
 *         self.set_data(arr)
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_s_data); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2233; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_arr = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":2234
 *         """
 *         cdef np.ndarray arr = d['data']
 *         self.resize(arr.size)             # <<<<<<<<<<<<<<
 *         self.set_data(arr)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_arr), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.resize(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":2235
 *         cdef np.ndarray arr = d['data']
 *         self.resize(arr.size)
 *         self.set_data(arr)             # <<<<<<<<<<<<<<
 * 
 *     cdef _setup_npy_array(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.set_data(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_arr, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":2230
 *         return (DoubleArray, (), d)
 * 
 *     def __setstate__(self, d):             # <<<<<<<<<<<<<<
 *         """Load the carray from the dictionary d.
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_arr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2237
 *         self.set_data(arr)
 * 
 *     cdef _setup_npy_array(self):             # <<<<<<<<<<<<<<
 *         """Create the numpy array.
 *         """
 */

static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray__setup_npy_array(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self) {
  int __pyx_v_nd;
  npy_intp __pyx_v_dims;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_setup_npy_array", 0);

  /* "pyzoltan/core/carray.pyx":2240
 *         """Create the numpy array.
 *         """
 *         cdef int nd = 1             # <<<<<<<<<<<<<<
 *         cdef np.npy_intp dims = self.length
 * 
 */
  __pyx_v_nd = 1;

  /* "pyzoltan/core/carray.pyx":2241
 *         """
 *         cdef int nd = 1
 *         cdef np.npy_intp dims = self.length             # <<<<<<<<<<<<<<
 * 
 *         self._npy_array = PyArray_SimpleNewFromData(
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  __pyx_v_dims = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":2243
 *         cdef np.npy_intp dims = self.length
 * 
 *         self._npy_array = PyArray_SimpleNewFromData(             # <<<<<<<<<<<<<<
 *             nd, &dims, NPY_DOUBLE, self.data
 *         )
 */
  __pyx_t_2 = ((PyObject *)PyArray_SimpleNewFromData(__pyx_v_nd, (&__pyx_v_dims), NPY_DOUBLE, __pyx_v_self->data)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base._npy_array);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base._npy_array));
  __pyx_v_self->__pyx_base._npy_array = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pyzoltan/core/carray.pyx":2237
 *         self.set_data(arr)
 * 
 *     cdef _setup_npy_array(self):             # <<<<<<<<<<<<<<
 *         """Create the numpy array.
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray._setup_npy_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2248
 * 
 * 
 *     cdef void c_align_array(self, LongArray new_indices) nogil:             # <<<<<<<<<<<<<<
 *         """Rearrange the array contents according to the new indices.
 *         """
 */

static void __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_align_array(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_new_indices) {
  long __pyx_v_i;
  long __pyx_v_length;
  long __pyx_v_n_bytes;
  double *__pyx_v_temp;
  long __pyx_t_1;
  long __pyx_t_2;
  int __pyx_t_3;

  /* "pyzoltan/core/carray.pyx":2253
 * 
 *         cdef long i
 *         cdef long length = self.length             # <<<<<<<<<<<<<<
 *         cdef long n_bytes
 *         cdef double *temp
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  __pyx_v_length = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":2257
 *         cdef double *temp
 * 
 *         n_bytes = sizeof(double)*length             # <<<<<<<<<<<<<<
 *         temp = <double*>aligned_malloc(n_bytes)
 * 
 */
  __pyx_v_n_bytes = ((sizeof(double)) * __pyx_v_length);

  /* "pyzoltan/core/carray.pyx":2258
 * 
 *         n_bytes = sizeof(double)*length
 *         temp = <double*>aligned_malloc(n_bytes)             # <<<<<<<<<<<<<<
 * 
 *         memcpy(<void*>temp, <void*>self.data, n_bytes)
 */
  __pyx_v_temp = ((double *)__pyx_f_8pyzoltan_4core_6carray_aligned_malloc(__pyx_v_n_bytes));

  /* "pyzoltan/core/carray.pyx":2260
 *         temp = <double*>aligned_malloc(n_bytes)
 * 
 *         memcpy(<void*>temp, <void*>self.data, n_bytes)             # <<<<<<<<<<<<<<
 * 
 *         # copy the data from the resized portion to the actual positions.
 */
  memcpy(((void *)__pyx_v_temp), ((void *)__pyx_v_self->data), __pyx_v_n_bytes);

  /* "pyzoltan/core/carray.pyx":2263
 * 
 *         # copy the data from the resized portion to the actual positions.
 *         for i in range(length):             # <<<<<<<<<<<<<<
 *             if i != new_indices.data[i]:
 *                 self.data[i] = temp[new_indices.data[i]]
 */
  __pyx_t_1 = __pyx_v_length;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "pyzoltan/core/carray.pyx":2264
 *         # copy the data from the resized portion to the actual positions.
 *         for i in range(length):
 *             if i != new_indices.data[i]:             # <<<<<<<<<<<<<<
 *                 self.data[i] = temp[new_indices.data[i]]
 * 
 */
    __pyx_t_3 = ((__pyx_v_i != (__pyx_v_new_indices->data[__pyx_v_i])) != 0);
    if (__pyx_t_3) {

      /* "pyzoltan/core/carray.pyx":2265
 *         for i in range(length):
 *             if i != new_indices.data[i]:
 *                 self.data[i] = temp[new_indices.data[i]]             # <<<<<<<<<<<<<<
 * 
 *         aligned_free(<void*>temp)
 */
      (__pyx_v_self->data[__pyx_v_i]) = (__pyx_v_temp[(__pyx_v_new_indices->data[__pyx_v_i])]);
      goto __pyx_L5;
    }
    __pyx_L5:;
  }

  /* "pyzoltan/core/carray.pyx":2267
 *                 self.data[i] = temp[new_indices.data[i]]
 * 
 *         aligned_free(<void*>temp)             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_append(self, double value) nogil:
 */
  __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_temp));

  /* "pyzoltan/core/carray.pyx":2248
 * 
 * 
 *     cdef void c_align_array(self, LongArray new_indices) nogil:             # <<<<<<<<<<<<<<
 *         """Rearrange the array contents according to the new indices.
 *         """
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":2269
 *         aligned_free(<void*>temp)
 * 
 *     cdef void c_append(self, double value) nogil:             # <<<<<<<<<<<<<<
 *         cdef long l = self.length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 */

static void __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_append(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, double __pyx_v_value) {
  long __pyx_v_l;
  PyArrayObject *__pyx_v_arr;
  long __pyx_t_1;
  int __pyx_t_2;

  /* "pyzoltan/core/carray.pyx":2270
 * 
 *     cdef void c_append(self, double value) nogil:
 *         cdef long l = self.length             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  __pyx_v_l = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":2271
 *     cdef void c_append(self, double value) nogil:
 *         cdef long l = self.length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 * 
 *         if l >= self.alloc:
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":2273
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 *         if l >= self.alloc:             # <<<<<<<<<<<<<<
 *             self.c_reserve(l*2)
 *         self.data[l] = value
 */
  __pyx_t_2 = ((__pyx_v_l >= __pyx_v_self->__pyx_base.alloc) != 0);
  if (__pyx_t_2) {

    /* "pyzoltan/core/carray.pyx":2274
 * 
 *         if l >= self.alloc:
 *             self.c_reserve(l*2)             # <<<<<<<<<<<<<<
 *         self.data[l] = value
 *         self.length += 1
 */
    ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), (__pyx_v_l * 2));
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":2275
 *         if l >= self.alloc:
 *             self.c_reserve(l*2)
 *         self.data[l] = value             # <<<<<<<<<<<<<<
 *         self.length += 1
 * 
 */
  (__pyx_v_self->data[__pyx_v_l]) = __pyx_v_value;

  /* "pyzoltan/core/carray.pyx":2276
 *             self.c_reserve(l*2)
 *         self.data[l] = value
 *         self.length += 1             # <<<<<<<<<<<<<<
 * 
 *         # update the numpy arrays length
 */
  __pyx_v_self->__pyx_base.length = (__pyx_v_self->__pyx_base.length + 1);

  /* "pyzoltan/core/carray.pyx":2279
 * 
 *         # update the numpy arrays length
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_reserve(self, long size) nogil:
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":2269
 *         aligned_free(<void*>temp)
 * 
 *     cdef void c_append(self, double value) nogil:             # <<<<<<<<<<<<<<
 *         cdef long l = self.length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":2281
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_reserve(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 */

static void __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_reserve(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_size) {
  PyArrayObject *__pyx_v_arr;
  void *__pyx_v_data;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("c_reserve", 0);
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  /*try:*/ {

    /* "pyzoltan/core/carray.pyx":2282
 * 
 *     cdef void c_reserve(self, long size) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         cdef void* data = NULL
 *         if size > self.alloc:
 */
    __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

    /* "pyzoltan/core/carray.pyx":2283
 *     cdef void c_reserve(self, long size) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL             # <<<<<<<<<<<<<<
 *         if size > self.alloc:
 *             data = <double*>aligned_realloc(
 */
    __pyx_v_data = NULL;

    /* "pyzoltan/core/carray.pyx":2284
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 *         if size > self.alloc:             # <<<<<<<<<<<<<<
 *             data = <double*>aligned_realloc(
 *                 self.data, size*sizeof(double),
 */
    __pyx_t_1 = ((__pyx_v_size > __pyx_v_self->__pyx_base.alloc) != 0);
    if (__pyx_t_1) {

      /* "pyzoltan/core/carray.pyx":2285
 *         cdef void* data = NULL
 *         if size > self.alloc:
 *             data = <double*>aligned_realloc(             # <<<<<<<<<<<<<<
 *                 self.data, size*sizeof(double),
 *                 self.alloc*sizeof(double)
 */
      __pyx_v_data = ((double *)__pyx_f_8pyzoltan_4core_6carray_aligned_realloc(__pyx_v_self->data, (__pyx_v_size * (sizeof(double))), (__pyx_v_self->__pyx_base.alloc * (sizeof(double)))));

      /* "pyzoltan/core/carray.pyx":2290
 *             )
 * 
 *             if data == NULL:             # <<<<<<<<<<<<<<
 *                 aligned_free(<void*>self.data)
 *                 with gil:
 */
      __pyx_t_1 = ((__pyx_v_data == NULL) != 0);
      if (__pyx_t_1) {

        /* "pyzoltan/core/carray.pyx":2291
 * 
 *             if data == NULL:
 *                 aligned_free(<void*>self.data)             # <<<<<<<<<<<<<<
 *                 with gil:
 *                     raise MemoryError
 */
        __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_self->data));

        /* "pyzoltan/core/carray.pyx":2292
 *             if data == NULL:
 *                 aligned_free(<void*>self.data)
 *                 with gil:             # <<<<<<<<<<<<<<
 *                     raise MemoryError
 * 
 */
        {
            #ifdef WITH_THREAD
            PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
            #endif
            /*try:*/ {

              /* "pyzoltan/core/carray.pyx":2293
 *                 aligned_free(<void*>self.data)
 *                 with gil:
 *                     raise MemoryError             # <<<<<<<<<<<<<<
 * 
 *             self.data = <double*>data
 */
              PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
            }

            /* "pyzoltan/core/carray.pyx":2292
 *             if data == NULL:
 *                 aligned_free(<void*>self.data)
 *                 with gil:             # <<<<<<<<<<<<<<
 *                     raise MemoryError
 * 
 */
            /*finally:*/ {
              __pyx_L9_error: {
                #ifdef WITH_THREAD
                PyGILState_Release(__pyx_gilstate_save);
                #endif
                goto __pyx_L4_error;
              }
            }
        }
      }

      /* "pyzoltan/core/carray.pyx":2295
 *                     raise MemoryError
 * 
 *             self.data = <double*>data             # <<<<<<<<<<<<<<
 *             self.alloc = size
 *             arr.data = <char *>self.data
 */
      __pyx_v_self->data = ((double *)__pyx_v_data);

      /* "pyzoltan/core/carray.pyx":2296
 * 
 *             self.data = <double*>data
 *             self.alloc = size             # <<<<<<<<<<<<<<
 *             arr.data = <char *>self.data
 * 
 */
      __pyx_v_self->__pyx_base.alloc = __pyx_v_size;

      /* "pyzoltan/core/carray.pyx":2297
 *             self.data = <double*>data
 *             self.alloc = size
 *             arr.data = <char *>self.data             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_reset(self) nogil:
 */
      __pyx_v_arr->data = ((char *)__pyx_v_self->data);
      goto __pyx_L6;
    }
    __pyx_L6:;
  }

  /* "pyzoltan/core/carray.pyx":2282
 * 
 *     cdef void c_reserve(self, long size) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         cdef void* data = NULL
 *         if size > self.alloc:
 */
  /*finally:*/ {
    /*normal exit:*/{
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L5;
    }
    __pyx_L4_error: {
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "pyzoltan/core/carray.pyx":2281
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_reserve(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pyzoltan.core.carray.DoubleArray.c_reserve", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "pyzoltan/core/carray.pyx":2299
 *             arr.data = <char *>self.data
 * 
 *     cdef void c_reset(self) nogil:             # <<<<<<<<<<<<<<
 *         BaseArray.c_reset(self)
 *         if self._old_data != NULL:
 */

static void __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_reset(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self) {
  int __pyx_t_1;
  double *__pyx_t_2;

  /* "pyzoltan/core/carray.pyx":2300
 * 
 *     cdef void c_reset(self) nogil:
 *         BaseArray.c_reset(self)             # <<<<<<<<<<<<<<
 *         if self._old_data != NULL:
 *             self.data = self._old_data
 */
  __pyx_f_8pyzoltan_4core_6carray_9BaseArray_c_reset(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

  /* "pyzoltan/core/carray.pyx":2301
 *     cdef void c_reset(self) nogil:
 *         BaseArray.c_reset(self)
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             self.data = self._old_data
 *             self._old_data = NULL
 */
  __pyx_t_1 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":2302
 *         BaseArray.c_reset(self)
 *         if self._old_data != NULL:
 *             self.data = self._old_data             # <<<<<<<<<<<<<<
 *             self._old_data = NULL
 *             self._npy_array.data = <char *>self.data
 */
    __pyx_t_2 = __pyx_v_self->_old_data;
    __pyx_v_self->data = __pyx_t_2;

    /* "pyzoltan/core/carray.pyx":2303
 *         if self._old_data != NULL:
 *             self.data = self._old_data
 *             self._old_data = NULL             # <<<<<<<<<<<<<<
 *             self._npy_array.data = <char *>self.data
 * 
 */
    __pyx_v_self->_old_data = NULL;

    /* "pyzoltan/core/carray.pyx":2304
 *             self.data = self._old_data
 *             self._old_data = NULL
 *             self._npy_array.data = <char *>self.data             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_resize(self, long size) nogil:
 */
    __pyx_v_self->__pyx_base._npy_array->data = ((char *)__pyx_v_self->data);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":2299
 *             arr.data = <char *>self.data
 * 
 *     cdef void c_reset(self) nogil:             # <<<<<<<<<<<<<<
 *         BaseArray.c_reset(self)
 *         if self._old_data != NULL:
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":2306
 *             self._npy_array.data = <char *>self.data
 * 
 *     cdef void c_resize(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 */

static void __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_resize(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_size) {
  PyArrayObject *__pyx_v_arr;
  long __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":2307
 * 
 *     cdef void c_resize(self, long size) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 * 
 *         # reserve memory
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":2310
 * 
 *         # reserve memory
 *         self.c_reserve(size)             # <<<<<<<<<<<<<<
 * 
 *         # update the lengths
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_size);

  /* "pyzoltan/core/carray.pyx":2313
 * 
 *         # update the lengths
 *         self.length = size             # <<<<<<<<<<<<<<
 *         arr.dimensions[0] = self.length
 * 
 */
  __pyx_v_self->__pyx_base.length = __pyx_v_size;

  /* "pyzoltan/core/carray.pyx":2314
 *         # update the lengths
 *         self.length = size
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_set_view(self, double *array, long length) nogil:
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_1;

  /* "pyzoltan/core/carray.pyx":2306
 *             self._npy_array.data = <char *>self.data
 * 
 *     cdef void c_resize(self, long size) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":2316
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_set_view(self, double *array, long length) nogil:             # <<<<<<<<<<<<<<
 *         """Create a view of a given raw data pointer with given length.
 *         """
 */

static void __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_set_view(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, double *__pyx_v_array, long __pyx_v_length) {
  PyArrayObject *__pyx_v_arr;
  int __pyx_t_1;
  double *__pyx_t_2;
  long __pyx_t_3;

  /* "pyzoltan/core/carray.pyx":2319
 *         """Create a view of a given raw data pointer with given length.
 *         """
 *         if self._old_data == NULL:             # <<<<<<<<<<<<<<
 *             self._old_data = self.data
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->_old_data == NULL) != 0);
  if (__pyx_t_1) {

    /* "pyzoltan/core/carray.pyx":2320
 *         """
 *         if self._old_data == NULL:
 *             self._old_data = self.data             # <<<<<<<<<<<<<<
 * 
 *         self.data = array
 */
    __pyx_t_2 = __pyx_v_self->data;
    __pyx_v_self->_old_data = __pyx_t_2;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":2322
 *             self._old_data = self.data
 * 
 *         self.data = array             # <<<<<<<<<<<<<<
 *         self.length = length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 */
  __pyx_v_self->data = __pyx_v_array;

  /* "pyzoltan/core/carray.pyx":2323
 * 
 *         self.data = array
 *         self.length = length             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data
 */
  __pyx_v_self->__pyx_base.length = __pyx_v_length;

  /* "pyzoltan/core/carray.pyx":2324
 *         self.data = array
 *         self.length = length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         arr.data = <char *>self.data
 *         arr.dimensions[0] = self.length
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":2325
 *         self.length = length
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data             # <<<<<<<<<<<<<<
 *         arr.dimensions[0] = self.length
 * 
 */
  __pyx_v_arr->data = ((char *)__pyx_v_self->data);

  /* "pyzoltan/core/carray.pyx":2326
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cdef void c_squeeze(self) nogil:
 */
  __pyx_t_3 = __pyx_v_self->__pyx_base.length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_3;

  /* "pyzoltan/core/carray.pyx":2316
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_set_view(self, double *array, long length) nogil:             # <<<<<<<<<<<<<<
 *         """Create a view of a given raw data pointer with given length.
 *         """
 */

  /* function exit code */
}

/* "pyzoltan/core/carray.pyx":2328
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_squeeze(self) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 */

static void __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self) {
  PyArrayObject *__pyx_v_arr;
  void *__pyx_v_data;
  size_t __pyx_v_size;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  long __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("c_squeeze", 0);
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  /*try:*/ {

    /* "pyzoltan/core/carray.pyx":2329
 * 
 *     cdef void c_squeeze(self) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         cdef void* data = NULL
 *         cdef size_t size = max(self.length, 16)
 */
    __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

    /* "pyzoltan/core/carray.pyx":2330
 *     cdef void c_squeeze(self) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL             # <<<<<<<<<<<<<<
 *         cdef size_t size = max(self.length, 16)
 *         data = <double*>aligned_realloc(
 */
    __pyx_v_data = NULL;

    /* "pyzoltan/core/carray.pyx":2331
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 *         cdef size_t size = max(self.length, 16)             # <<<<<<<<<<<<<<
 *         data = <double*>aligned_realloc(
 *             self.data, size*sizeof(double),
 */
    __pyx_t_1 = 16;
    __pyx_t_2 = __pyx_v_self->__pyx_base.length;
    if (((__pyx_t_1 > __pyx_t_2) != 0)) {
      __pyx_t_3 = __pyx_t_1;
    } else {
      __pyx_t_3 = __pyx_t_2;
    }
    __pyx_v_size = __pyx_t_3;

    /* "pyzoltan/core/carray.pyx":2332
 *         cdef void* data = NULL
 *         cdef size_t size = max(self.length, 16)
 *         data = <double*>aligned_realloc(             # <<<<<<<<<<<<<<
 *             self.data, size*sizeof(double),
 *             self.alloc*sizeof(double)
 */
    __pyx_v_data = ((double *)__pyx_f_8pyzoltan_4core_6carray_aligned_realloc(__pyx_v_self->data, (__pyx_v_size * (sizeof(double))), (__pyx_v_self->__pyx_base.alloc * (sizeof(double)))));

    /* "pyzoltan/core/carray.pyx":2337
 *         )
 * 
 *         if data == NULL:             # <<<<<<<<<<<<<<
 *             # free original data
 *             aligned_free(<void*>self.data)
 */
    __pyx_t_4 = ((__pyx_v_data == NULL) != 0);
    if (__pyx_t_4) {

      /* "pyzoltan/core/carray.pyx":2339
 *         if data == NULL:
 *             # free original data
 *             aligned_free(<void*>self.data)             # <<<<<<<<<<<<<<
 *             with gil:
 *                 raise MemoryError
 */
      __pyx_f_8pyzoltan_4core_6carray_aligned_free(((void *)__pyx_v_self->data));

      /* "pyzoltan/core/carray.pyx":2340
 *             # free original data
 *             aligned_free(<void*>self.data)
 *             with gil:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 * 
 */
      {
          #ifdef WITH_THREAD
          PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
          #endif
          /*try:*/ {

            /* "pyzoltan/core/carray.pyx":2341
 *             aligned_free(<void*>self.data)
 *             with gil:
 *                 raise MemoryError             # <<<<<<<<<<<<<<
 * 
 *         self.data = <double*>data
 */
            PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          }

          /* "pyzoltan/core/carray.pyx":2340
 *             # free original data
 *             aligned_free(<void*>self.data)
 *             with gil:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 * 
 */
          /*finally:*/ {
            __pyx_L8_error: {
              #ifdef WITH_THREAD
              PyGILState_Release(__pyx_gilstate_save);
              #endif
              goto __pyx_L4_error;
            }
          }
      }
    }

    /* "pyzoltan/core/carray.pyx":2343
 *                 raise MemoryError
 * 
 *         self.data = <double*>data             # <<<<<<<<<<<<<<
 *         self.alloc = size
 *         arr.data = <char *>self.data
 */
    __pyx_v_self->data = ((double *)__pyx_v_data);

    /* "pyzoltan/core/carray.pyx":2344
 * 
 *         self.data = <double*>data
 *         self.alloc = size             # <<<<<<<<<<<<<<
 *         arr.data = <char *>self.data
 * 
 */
    __pyx_v_self->__pyx_base.alloc = __pyx_v_size;

    /* "pyzoltan/core/carray.pyx":2345
 *         self.data = <double*>data
 *         self.alloc = size
 *         arr.data = <char *>self.data             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_arr->data = ((char *)__pyx_v_self->data);
  }

  /* "pyzoltan/core/carray.pyx":2329
 * 
 *     cdef void c_squeeze(self) nogil:
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         cdef void* data = NULL
 *         cdef size_t size = max(self.length, 16)
 */
  /*finally:*/ {
    /*normal exit:*/{
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L5;
    }
    __pyx_L4_error: {
      #ifdef WITH_THREAD
      __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "pyzoltan/core/carray.pyx":2328
 *         arr.dimensions[0] = self.length
 * 
 *     cdef void c_squeeze(self) nogil:             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         cdef void* data = NULL
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pyzoltan.core.carray.DoubleArray.c_squeeze", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "pyzoltan/core/carray.pyx":2348
 * 
 * 
 *     cpdef str get_c_type(self):             # <<<<<<<<<<<<<<
 *         """Return the c data type for this array as a string.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_17get_c_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_get_c_type(CYTHON_UNUSED struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, int __pyx_skip_dispatch) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_c_type", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_c_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_17get_c_type)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 2348; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2351
 *         """Return the c data type for this array as a string.
 *         """
 *         return 'double'             # <<<<<<<<<<<<<<
 * 
 *     cdef double* get_data_ptr(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_n_s_double);
  __pyx_r = __pyx_n_s_double;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":2348
 * 
 * 
 *     cpdef str get_c_type(self):             # <<<<<<<<<<<<<<
 *         """Return the c data type for this array as a string.
 *         """
 */

  /* 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("pyzoltan.core.carray.DoubleArray.get_c_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_17get_c_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_16get_c_type[] = "DoubleArray.get_c_type(self) -> str\nReturn the c data type for this array as a string.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_17get_c_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_c_type (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_16get_c_type(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_16get_c_type(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_c_type", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_get_c_type(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2348; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.DoubleArray.get_c_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2353
 *         return 'double'
 * 
 *     cdef double* get_data_ptr(self):             # <<<<<<<<<<<<<<
 *         """Return the internal data pointer.
 *         """
 */

static double *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_get_data_ptr(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self) {
  double *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_data_ptr", 0);

  /* "pyzoltan/core/carray.pyx":2356
 *         """Return the internal data pointer.
 *         """
 *         return self.data             # <<<<<<<<<<<<<<
 * 
 *     cpdef double get(self, long idx):
 */
  __pyx_r = __pyx_v_self->data;
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":2353
 *         return 'double'
 * 
 *     cdef double* get_data_ptr(self):             # <<<<<<<<<<<<<<
 *         """Return the internal data pointer.
 *         """
 */

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

/* "pyzoltan/core/carray.pyx":2358
 *         return self.data
 * 
 *     cpdef double get(self, long idx):             # <<<<<<<<<<<<<<
 *         """Gets value stored at position `idx`.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_19get(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx); /*proto*/
static double __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_get(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_idx, int __pyx_skip_dispatch) {
  double __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 = NULL;
  PyObject *__pyx_t_6 = NULL;
  double __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_19get)) {
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_idx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __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;
      __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_7;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2361
 *         """Gets value stored at position `idx`.
 *         """
 *         return self.data[idx]             # <<<<<<<<<<<<<<
 * 
 *     cpdef set(self, long idx, double value):
 */
  __pyx_r = (__pyx_v_self->data[__pyx_v_idx]);
  goto __pyx_L0;

  /* "pyzoltan/core/carray.pyx":2358
 *         return self.data
 * 
 *     cpdef double get(self, long idx):             # <<<<<<<<<<<<<<
 *         """Gets value stored at position `idx`.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("pyzoltan.core.carray.DoubleArray.get", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_19get(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_18get[] = "DoubleArray.get(self, long idx) -> double\nGets value stored at position `idx`.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_19get(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx) {
  long __pyx_v_idx;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  assert(__pyx_arg_idx); {
    __pyx_v_idx = __Pyx_PyInt_As_long(__pyx_arg_idx); if (unlikely((__pyx_v_idx == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_18get(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self), ((long)__pyx_v_idx));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_18get(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_idx) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_get(__pyx_v_self, __pyx_v_idx, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.DoubleArray.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2363
 *         return self.data[idx]
 * 
 *     cpdef set(self, long idx, double value):             # <<<<<<<<<<<<<<
 *         """Sets location `idx` to `value`.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_21set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_set(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_idx, double __pyx_v_value, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_21set)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_idx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      }
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2366
 *         """Sets location `idx` to `value`.
 *         """
 *         self.data[idx] = value             # <<<<<<<<<<<<<<
 * 
 *     cpdef append(self, double value):
 */
  (__pyx_v_self->data[__pyx_v_idx]) = __pyx_v_value;

  /* "pyzoltan/core/carray.pyx":2363
 *         return self.data[idx]
 * 
 *     cpdef set(self, long idx, double value):             # <<<<<<<<<<<<<<
 *         """Sets location `idx` to `value`.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_21set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_20set[] = "DoubleArray.set(self, long idx, double value)\nSets location `idx` to `value`.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_21set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_idx;
  double __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idx,&__pyx_n_s_value,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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_idx)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __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_idx = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_idx == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_value = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_20set(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self), __pyx_v_idx, __pyx_v_value);

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_20set(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_idx, double __pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_set(__pyx_v_self, __pyx_v_idx, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.DoubleArray.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2368
 *         self.data[idx] = value
 * 
 *     cpdef append(self, double value):             # <<<<<<<<<<<<<<
 *         """Appends `value` to the end of the array.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_23append(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_append(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, double __pyx_v_value, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_append); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_23append)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2368; __pyx_clineno = __LINE__; goto __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;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2371
 *         """Appends `value` to the end of the array.
 *         """
 *         self.c_append(value)             # <<<<<<<<<<<<<<
 * 
 *     cpdef reserve(self, long size):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->c_append(__pyx_v_self, __pyx_v_value);

  /* "pyzoltan/core/carray.pyx":2368
 *         self.data[idx] = value
 * 
 *     cpdef append(self, double value):             # <<<<<<<<<<<<<<
 *         """Appends `value` to the end of the array.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_23append(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_22append[] = "DoubleArray.append(self, double value)\nAppends `value` to the end of the array.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_23append(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  double __pyx_v_value;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsDouble(__pyx_arg_value); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2368; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_22append(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self), ((double)__pyx_v_value));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_22append(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, double __pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_append(__pyx_v_self, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2368; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.DoubleArray.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2373
 *         self.c_append(value)
 * 
 *     cpdef reserve(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes the internal data to ``size*sizeof(double)`` bytes.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_25reserve(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_reserve(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_size, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reserve", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reserve); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_25reserve)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __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;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2376
 *         """Resizes the internal data to ``size*sizeof(double)`` bytes.
 *         """
 *         self.c_reserve(size)             # <<<<<<<<<<<<<<
 * 
 *     cpdef reset(self):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_size);

  /* "pyzoltan/core/carray.pyx":2373
 *         self.c_append(value)
 * 
 *     cpdef reserve(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes the internal data to ``size*sizeof(double)`` bytes.
 *         """
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_25reserve(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_24reserve[] = "DoubleArray.reserve(self, long size)\nResizes the internal data to ``size*sizeof(double)`` bytes.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_25reserve(PyObject *__pyx_v_self, PyObject *__pyx_arg_size) {
  long __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reserve (wrapper)", 0);
  assert(__pyx_arg_size); {
    __pyx_v_size = __Pyx_PyInt_As_long(__pyx_arg_size); if (unlikely((__pyx_v_size == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_24reserve(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self), ((long)__pyx_v_size));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_24reserve(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reserve", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_reserve(__pyx_v_self, __pyx_v_size, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.DoubleArray.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2378
 *         self.c_reserve(size)
 * 
 *     cpdef reset(self):             # <<<<<<<<<<<<<<
 *         """Reset the length of the array to 0.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_27reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_reset(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, int __pyx_skip_dispatch) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reset", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_27reset)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 2378; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2381
 *         """Reset the length of the array to 0.
 *         """
 *         self.c_reset()             # <<<<<<<<<<<<<<
 *         if self._old_data != NULL:
 *             self._parent = None
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_reset(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

  /* "pyzoltan/core/carray.pyx":2382
 *         """
 *         self.c_reset()
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             self._parent = None
 * 
 */
  __pyx_t_5 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_5) {

    /* "pyzoltan/core/carray.pyx":2383
 *         self.c_reset()
 *         if self._old_data != NULL:
 *             self._parent = None             # <<<<<<<<<<<<<<
 * 
 *     cpdef resize(self, long size):
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_parent);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_parent));
    __pyx_v_self->_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)Py_None);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":2378
 *         self.c_reserve(size)
 * 
 *     cpdef reset(self):             # <<<<<<<<<<<<<<
 *         """Reset the length of the array to 0.
 *         """
 */

  /* 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("pyzoltan.core.carray.DoubleArray.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_27reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_26reset[] = "DoubleArray.reset(self)\nReset the length of the array to 0.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_27reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_26reset(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_26reset(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reset", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_reset(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2378; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.DoubleArray.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2385
 *             self._parent = None
 * 
 *     cpdef resize(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes internal data to ``size*sizeof(double)`` bytes
 *         and sets the length to the new size.
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_29resize(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_resize(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_size, int __pyx_skip_dispatch) {
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resize", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_resize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_29resize)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2385; __pyx_clineno = __LINE__; goto __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;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2390
 * 
 *         """
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             raise RuntimeError('Cannot reize array which is a view.')
 * 
 */
  __pyx_t_7 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_7) {

    /* "pyzoltan/core/carray.pyx":2391
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot reize array which is a view.')             # <<<<<<<<<<<<<<
 * 
 *         self.c_resize(size)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2391; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":2393
 *             raise RuntimeError('Cannot reize array which is a view.')
 * 
 *         self.c_resize(size)             # <<<<<<<<<<<<<<
 * 
 *     cpdef set_view(self, DoubleArray parent, long start, long end):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_resize(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_size);

  /* "pyzoltan/core/carray.pyx":2385
 *             self._parent = None
 * 
 *     cpdef resize(self, long size):             # <<<<<<<<<<<<<<
 *         """Resizes internal data to ``size*sizeof(double)`` bytes
 *         and sets the length to the new size.
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_29resize(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_28resize[] = "DoubleArray.resize(self, long size)\nResizes internal data to ``size*sizeof(double)`` bytes\n        and sets the length to the new size.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_29resize(PyObject *__pyx_v_self, PyObject *__pyx_arg_size) {
  long __pyx_v_size;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resize (wrapper)", 0);
  assert(__pyx_arg_size); {
    __pyx_v_size = __Pyx_PyInt_As_long(__pyx_arg_size); if (unlikely((__pyx_v_size == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2385; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_28resize(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self), ((long)__pyx_v_size));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_28resize(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, long __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_resize(__pyx_v_self, __pyx_v_size, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2385; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.DoubleArray.resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2395
 *         self.c_resize(size)
 * 
 *     cpdef set_view(self, DoubleArray parent, long start, long end):             # <<<<<<<<<<<<<<
 *         """Create a view of a given a `parent` array from start to end.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_31set_view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_set_view(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_parent, long __pyx_v_start, long __pyx_v_end, int __pyx_skip_dispatch) {
  PyArrayObject *__pyx_v_arr;
  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;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  double *__pyx_t_11;
  long __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_view", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_view); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_31set_view)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_parent));
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, ((PyObject *)__pyx_v_parent));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_parent));
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2412
 * 
 *         """
 *         if self._parent is None:             # <<<<<<<<<<<<<<
 *             self._old_data = self.data
 *         self._parent = parent
 */
  __pyx_t_9 = (((PyObject *)__pyx_v_self->_parent) == Py_None);
  __pyx_t_10 = (__pyx_t_9 != 0);
  if (__pyx_t_10) {

    /* "pyzoltan/core/carray.pyx":2413
 *         """
 *         if self._parent is None:
 *             self._old_data = self.data             # <<<<<<<<<<<<<<
 *         self._parent = parent
 *         self.data = parent.data + start
 */
    __pyx_t_11 = __pyx_v_self->data;
    __pyx_v_self->_old_data = __pyx_t_11;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":2414
 *         if self._parent is None:
 *             self._old_data = self.data
 *         self._parent = parent             # <<<<<<<<<<<<<<
 *         self.data = parent.data + start
 *         self.length = end - start
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_parent));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_parent));
  __Pyx_GOTREF(__pyx_v_self->_parent);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->_parent));
  __pyx_v_self->_parent = __pyx_v_parent;

  /* "pyzoltan/core/carray.pyx":2415
 *             self._old_data = self.data
 *         self._parent = parent
 *         self.data = parent.data + start             # <<<<<<<<<<<<<<
 *         self.length = end - start
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 */
  __pyx_v_self->data = (__pyx_v_parent->data + __pyx_v_start);

  /* "pyzoltan/core/carray.pyx":2416
 *         self._parent = parent
 *         self.data = parent.data + start
 *         self.length = end - start             # <<<<<<<<<<<<<<
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data
 */
  __pyx_v_self->__pyx_base.length = (__pyx_v_end - __pyx_v_start);

  /* "pyzoltan/core/carray.pyx":2417
 *         self.data = parent.data + start
 *         self.length = end - start
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 *         arr.data = <char *>self.data
 *         arr.dimensions[0] = self.length
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":2418
 *         self.length = end - start
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data             # <<<<<<<<<<<<<<
 *         arr.dimensions[0] = self.length
 * 
 */
  __pyx_v_arr->data = ((char *)__pyx_v_self->data);

  /* "pyzoltan/core/carray.pyx":2419
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 *         arr.data = <char *>self.data
 *         arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cpdef squeeze(self):
 */
  __pyx_t_12 = __pyx_v_self->__pyx_base.length;
  (__pyx_v_arr->dimensions[0]) = __pyx_t_12;

  /* "pyzoltan/core/carray.pyx":2395
 *         self.c_resize(size)
 * 
 *     cpdef set_view(self, DoubleArray parent, long start, long end):             # <<<<<<<<<<<<<<
 *         """Create a view of a given a `parent` array from start to end.
 * 
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.set_view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_31set_view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_30set_view[] = "DoubleArray.set_view(self, DoubleArray parent, long start, long end)\nCreate a view of a given a `parent` array from start to end.\n\n        Note that this excludes the end index.\n\n        Parameters\n        ----------\n\n        parent : DoubleArray\n            The parent array of which this is a view.\n        start : long\n            The starting index to start the view from.\n        end : long\n            The ending index to end the view at, excludes the end\n            itself.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_31set_view(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_parent = 0;
  long __pyx_v_start;
  long __pyx_v_end;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_view (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parent,&__pyx_n_s_start,&__pyx_n_s_end,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parent)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_view", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2395; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_view", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2395; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_view") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2395; __pyx_clineno = __LINE__; goto __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_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)values[0]);
    __pyx_v_start = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_start == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2395; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_end = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_end == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2395; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_view", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2395; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.set_view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_8pyzoltan_4core_6carray_DoubleArray, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_30set_view(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self), __pyx_v_parent, __pyx_v_start, __pyx_v_end);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_30set_view(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_parent, long __pyx_v_start, long __pyx_v_end) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_view", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_set_view(__pyx_v_self, __pyx_v_parent, __pyx_v_start, __pyx_v_end, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2395; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.DoubleArray.set_view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2421
 *         arr.dimensions[0] = self.length
 * 
 *     cpdef squeeze(self):             # <<<<<<<<<<<<<<
 *         """Release any unused memory.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_33squeeze(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, int __pyx_skip_dispatch) {
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("squeeze", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_squeeze); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_33squeeze)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2424
 *         """Release any unused memory.
 *         """
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             raise RuntimeError('Cannot squeeze array which is a view.')
 * 
 */
  __pyx_t_5 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_5) {

    /* "pyzoltan/core/carray.pyx":2425
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot squeeze array which is a view.')             # <<<<<<<<<<<<<<
 * 
 *         self.c_squeeze()
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2425; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":2427
 *             raise RuntimeError('Cannot squeeze array which is a view.')
 * 
 *         self.c_squeeze()             # <<<<<<<<<<<<<<
 * 
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=0):
 */
  ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.c_squeeze(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self));

  /* "pyzoltan/core/carray.pyx":2421
 *         arr.dimensions[0] = self.length
 * 
 *     cpdef squeeze(self):             # <<<<<<<<<<<<<<
 *         """Release any unused memory.
 *         """
 */

  /* 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("pyzoltan.core.carray.DoubleArray.squeeze", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_33squeeze(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_32squeeze[] = "DoubleArray.squeeze(self)\nRelease any unused memory.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_33squeeze(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("squeeze (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_32squeeze(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_32squeeze(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("squeeze", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_squeeze(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.DoubleArray.squeeze", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2429
 *         self.c_squeeze()
 * 
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=0):             # <<<<<<<<<<<<<<
 *         """Remove the particles with indices in index_list.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_35remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_remove(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_11DoubleArray_remove *__pyx_optional_args) {
  int __pyx_v_input_sorted = ((int)0);
  long __pyx_v_i;
  long __pyx_v_inlength;
  PyArrayObject *__pyx_v_sorted_indices = 0;
  long __pyx_v_id;
  PyArrayObject *__pyx_v_arr;
  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;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  long __pyx_t_9;
  long __pyx_t_10;
  long __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_input_sorted = __pyx_optional_args->input_sorted;
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_remove); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_35remove)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_input_sorted); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_6 = 1;
        }
      }
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_index_list));
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_index_list));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_index_list));
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2450
 * 
 *         """
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             raise RuntimeError('Cannot remove elements from view array.')
 *         cdef long i
 */
  __pyx_t_8 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_8) {

    /* "pyzoltan/core/carray.pyx":2451
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot remove elements from view array.')             # <<<<<<<<<<<<<<
 *         cdef long i
 *         cdef long inlength = index_list.size
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2451; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":2453
 *             raise RuntimeError('Cannot remove elements from view array.')
 *         cdef long i
 *         cdef long inlength = index_list.size             # <<<<<<<<<<<<<<
 *         cdef np.ndarray sorted_indices
 *         cdef long id
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_index_list), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_inlength = __pyx_t_9;

  /* "pyzoltan/core/carray.pyx":2456
 *         cdef np.ndarray sorted_indices
 *         cdef long id
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array             # <<<<<<<<<<<<<<
 * 
 *         if inlength > self.length:
 */
  __pyx_v_arr = ((PyArrayObject *)__pyx_v_self->__pyx_base._npy_array);

  /* "pyzoltan/core/carray.pyx":2458
 *         cdef PyArrayObject* arr = <PyArrayObject*>self._npy_array
 * 
 *         if inlength > self.length:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_8 = ((__pyx_v_inlength > __pyx_v_self->__pyx_base.length) != 0);
  if (__pyx_t_8) {

    /* "pyzoltan/core/carray.pyx":2459
 * 
 *         if inlength > self.length:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if input_sorted != 1:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "pyzoltan/core/carray.pyx":2461
 *             return
 * 
 *         if input_sorted != 1:             # <<<<<<<<<<<<<<
 *             sorted_indices = np.sort(index_list)
 *         else:
 */
  __pyx_t_8 = ((__pyx_v_input_sorted != 1) != 0);
  if (__pyx_t_8) {

    /* "pyzoltan/core/carray.pyx":2462
 * 
 *         if input_sorted != 1:
 *             sorted_indices = np.sort(index_list)             # <<<<<<<<<<<<<<
 *         else:
 *             sorted_indices = index_list
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sort); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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, ((PyObject *)__pyx_v_index_list)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(((PyObject *)__pyx_v_index_list));
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, ((PyObject *)__pyx_v_index_list));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_index_list));
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_sorted_indices = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pyzoltan/core/carray.pyx":2464
 *             sorted_indices = np.sort(index_list)
 *         else:
 *             sorted_indices = index_list             # <<<<<<<<<<<<<<
 * 
 *         for i in range(inlength):
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_index_list));
    __pyx_v_sorted_indices = __pyx_v_index_list;
  }
  __pyx_L5:;

  /* "pyzoltan/core/carray.pyx":2466
 *             sorted_indices = index_list
 * 
 *         for i in range(inlength):             # <<<<<<<<<<<<<<
 *             id = sorted_indices[inlength-(i+1)]
 *             if id < self.length:
 */
  __pyx_t_9 = __pyx_v_inlength;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_i = __pyx_t_10;

    /* "pyzoltan/core/carray.pyx":2467
 * 
 *         for i in range(inlength):
 *             id = sorted_indices[inlength-(i+1)]             # <<<<<<<<<<<<<<
 *             if id < self.length:
 *                 self.data[id] = self.data[self.length-1]
 */
    __pyx_t_11 = (__pyx_v_inlength - (__pyx_v_i + 1));
    __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_sorted_indices), __pyx_t_11, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2467; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_11 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_id = __pyx_t_11;

    /* "pyzoltan/core/carray.pyx":2468
 *         for i in range(inlength):
 *             id = sorted_indices[inlength-(i+1)]
 *             if id < self.length:             # <<<<<<<<<<<<<<
 *                 self.data[id] = self.data[self.length-1]
 *                 self.length = self.length - 1
 */
    __pyx_t_8 = ((__pyx_v_id < __pyx_v_self->__pyx_base.length) != 0);
    if (__pyx_t_8) {

      /* "pyzoltan/core/carray.pyx":2469
 *             id = sorted_indices[inlength-(i+1)]
 *             if id < self.length:
 *                 self.data[id] = self.data[self.length-1]             # <<<<<<<<<<<<<<
 *                 self.length = self.length - 1
 *                 arr.dimensions[0] = self.length
 */
      (__pyx_v_self->data[__pyx_v_id]) = (__pyx_v_self->data[(__pyx_v_self->__pyx_base.length - 1)]);

      /* "pyzoltan/core/carray.pyx":2470
 *             if id < self.length:
 *                 self.data[id] = self.data[self.length-1]
 *                 self.length = self.length - 1             # <<<<<<<<<<<<<<
 *                 arr.dimensions[0] = self.length
 * 
 */
      __pyx_v_self->__pyx_base.length = (__pyx_v_self->__pyx_base.length - 1);

      /* "pyzoltan/core/carray.pyx":2471
 *                 self.data[id] = self.data[self.length-1]
 *                 self.length = self.length - 1
 *                 arr.dimensions[0] = self.length             # <<<<<<<<<<<<<<
 * 
 *     cpdef extend(self, np.ndarray in_array):
 */
      __pyx_t_11 = __pyx_v_self->__pyx_base.length;
      (__pyx_v_arr->dimensions[0]) = __pyx_t_11;
      goto __pyx_L8;
    }
    __pyx_L8:;
  }

  /* "pyzoltan/core/carray.pyx":2429
 *         self.c_squeeze()
 * 
 *     cpdef remove(self, np.ndarray index_list, bint input_sorted=0):             # <<<<<<<<<<<<<<
 *         """Remove the particles with indices in index_list.
 * 
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sorted_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_35remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_34remove[] = "DoubleArray.remove(self, ndarray index_list, bool input_sorted=0)\nRemove the particles with indices in index_list.\n\n        Parameters\n        ----------\n\n        index_list : ndarray\n            a list of indices which should be removed.\n        input_sorted : bool\n            indicates if the input is sorted in ascending order.  if\n            not, the array will be sorted internally.\n\n        Notes\n        -----\n\n         If the input indices are not sorted, sort them in ascending order.\n         Starting with the last element in the index list, start replacing the\n         element at the said index with the last element in the data and update\n         the length of the array.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_35remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_index_list = 0;
  int __pyx_v_input_sorted;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index_list,&__pyx_n_s_input_sorted,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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index_list)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_input_sorted);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "remove") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2429; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_index_list = ((PyArrayObject *)values[0]);
    if (values[1]) {
      __pyx_v_input_sorted = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_input_sorted == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2429; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_input_sorted = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("remove", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2429; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index_list), __pyx_ptype_5numpy_ndarray, 1, "index_list", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_34remove(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self), __pyx_v_index_list, __pyx_v_input_sorted);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_34remove(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, PyArrayObject *__pyx_v_index_list, int __pyx_v_input_sorted) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_remove __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.input_sorted = __pyx_v_input_sorted;
  __pyx_t_1 = __pyx_vtabptr_8pyzoltan_4core_6carray_DoubleArray->__pyx_base.remove(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_index_list, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2429; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.DoubleArray.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2473
 *                 arr.dimensions[0] = self.length
 * 
 *     cpdef extend(self, np.ndarray in_array):             # <<<<<<<<<<<<<<
 *         """Extend the array with data from in_array.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_37extend(PyObject *__pyx_v_self, PyObject *__pyx_v_in_array); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_extend(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array, int __pyx_skip_dispatch) {
  long __pyx_v_len;
  long __pyx_v_i;
  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;
  int __pyx_t_6;
  long __pyx_t_7;
  long __pyx_t_8;
  double __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_37extend)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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, ((PyObject *)__pyx_v_in_array)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_v_in_array));
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, ((PyObject *)__pyx_v_in_array));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_in_array));
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2489
 * 
 *         """
 *         if self._old_data != NULL:             # <<<<<<<<<<<<<<
 *             raise RuntimeError('Cannot extend array which is a view.')
 *         cdef long len = in_array.size
 */
  __pyx_t_6 = ((__pyx_v_self->_old_data != NULL) != 0);
  if (__pyx_t_6) {

    /* "pyzoltan/core/carray.pyx":2490
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot extend array which is a view.')             # <<<<<<<<<<<<<<
 *         cdef long len = in_array.size
 *         cdef long i
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pyzoltan/core/carray.pyx":2491
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot extend array which is a view.')
 *         cdef long len = in_array.size             # <<<<<<<<<<<<<<
 *         cdef long i
 *         for i in range(len):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_in_array), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_len = __pyx_t_7;

  /* "pyzoltan/core/carray.pyx":2493
 *         cdef long len = in_array.size
 *         cdef long i
 *         for i in range(len):             # <<<<<<<<<<<<<<
 *             self.append(in_array[i])
 * 
 */
  __pyx_t_7 = __pyx_v_len;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pyzoltan/core/carray.pyx":2494
 *         cdef long i
 *         for i in range(len):
 *             self.append(in_array[i])             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy_values(self, LongArray indices, BaseArray dest):
 */
    __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_in_array), __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2494; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = ((struct __pyx_vtabstruct_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self->__pyx_base.__pyx_vtab)->append(__pyx_v_self, __pyx_t_9, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2473
 *                 arr.dimensions[0] = self.length
 * 
 *     cpdef extend(self, np.ndarray in_array):             # <<<<<<<<<<<<<<
 *         """Extend the array with data from in_array.
 * 
 */

  /* 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("pyzoltan.core.carray.DoubleArray.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_37extend(PyObject *__pyx_v_self, PyObject *__pyx_v_in_array); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_36extend[] = "DoubleArray.extend(self, ndarray in_array)\nExtend the array with data from in_array.\n\n        Parameters\n        ----------\n\n        in_array : ndarray\n            a numpy array with data to be added to the current array.\n\n        Notes\n        -----\n\n         - accessing the in_array using the indexing operation seems to be\n           costly. Look at the annotated cython html file.\n\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_37extend(PyObject *__pyx_v_self, PyObject *__pyx_v_in_array) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("extend (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_array), __pyx_ptype_5numpy_ndarray, 1, "in_array", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_36extend(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self), ((PyArrayObject *)__pyx_v_in_array));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_36extend(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, PyArrayObject *__pyx_v_in_array) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_extend(__pyx_v_self, __pyx_v_in_array, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2473; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.DoubleArray.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2496
 *             self.append(in_array[i])
 * 
 *     cpdef copy_values(self, LongArray indices, BaseArray dest):             # <<<<<<<<<<<<<<
 *         """Copies values of indices in indices from self to `dest`.
 * 
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_39copy_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest, int __pyx_skip_dispatch) {
  struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_dest_array = 0;
  long __pyx_v_i;
  long __pyx_v_num_values;
  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;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  long __pyx_t_7;
  long __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_values", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy_values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_39copy_values)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && 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);
          __pyx_t_5 = 1;
        }
      }
      __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_4) {
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_indices));
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, ((PyObject *)__pyx_v_indices));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_indices));
      __Pyx_INCREF(((PyObject *)__pyx_v_dest));
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, ((PyObject *)__pyx_v_dest));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_dest));
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2502
 *         i.e. atleast as long as indices.
 *         """
 *         cdef DoubleArray dest_array = <DoubleArray>dest             # <<<<<<<<<<<<<<
 *         cdef long i, num_values
 *         num_values = indices.length
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_dest);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_dest_array = ((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":2504
 *         cdef DoubleArray dest_array = <DoubleArray>dest
 *         cdef long i, num_values
 *         num_values = indices.length             # <<<<<<<<<<<<<<
 * 
 *         for i in range(num_values):
 */
  __pyx_t_7 = __pyx_v_indices->__pyx_base.length;
  __pyx_v_num_values = __pyx_t_7;

  /* "pyzoltan/core/carray.pyx":2506
 *         num_values = indices.length
 * 
 *         for i in range(num_values):             # <<<<<<<<<<<<<<
 *             dest_array.data[i] = self.data[indices.data[i]]
 * 
 */
  __pyx_t_7 = __pyx_v_num_values;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pyzoltan/core/carray.pyx":2507
 * 
 *         for i in range(num_values):
 *             dest_array.data[i] = self.data[indices.data[i]]             # <<<<<<<<<<<<<<
 * 
 *     cpdef copy_subset(self, BaseArray source, long start_index=-1,
 */
    (__pyx_v_dest_array->data[__pyx_v_i]) = (__pyx_v_self->data[(__pyx_v_indices->data[__pyx_v_i])]);
  }

  /* "pyzoltan/core/carray.pyx":2496
 *             self.append(in_array[i])
 * 
 *     cpdef copy_values(self, LongArray indices, BaseArray dest):             # <<<<<<<<<<<<<<
 *         """Copies values of indices in indices from self to `dest`.
 * 
 */

  /* 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_6);
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.copy_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_dest_array);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_39copy_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_38copy_values[] = "DoubleArray.copy_values(self, LongArray indices, BaseArray dest)\nCopies values of indices in indices from self to `dest`.\n\n        No size check if performed, we assume the dest to of proper size\n        i.e. atleast as long as indices.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_39copy_values(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices = 0;
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_values (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indices,&__pyx_n_s_dest,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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indices)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dest)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("copy_values", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2496; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy_values") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2496; __pyx_clineno = __LINE__; goto __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_indices = ((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)values[0]);
    __pyx_v_dest = ((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy_values", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2496; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.copy_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_8pyzoltan_4core_6carray_LongArray, 1, "indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dest), __pyx_ptype_8pyzoltan_4core_6carray_BaseArray, 1, "dest", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_38copy_values(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self), __pyx_v_indices, __pyx_v_dest);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_38copy_values(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *__pyx_v_indices, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_dest) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_values", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_copy_values(__pyx_v_self, __pyx_v_indices, __pyx_v_dest, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2496; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.DoubleArray.copy_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2509
 *             dest_array.data[i] = self.data[indices.data[i]]
 * 
 *     cpdef copy_subset(self, BaseArray source, long start_index=-1,             # <<<<<<<<<<<<<<
 *                       long end_index=-1):
 *         """Copy a subset of values from src to self.
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_41copy_subset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_11DoubleArray_copy_subset *__pyx_optional_args) {
  long __pyx_v_start_index = ((long)-1);
  long __pyx_v_end_index = ((long)-1);
  long __pyx_v_si;
  long __pyx_v_ei;
  long __pyx_v_s_length;
  long __pyx_v_d_length;
  long __pyx_v_i;
  long __pyx_v_j;
  struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_src = 0;
  PyObject *__pyx_v_msg = 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;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  long __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  long __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_subset", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_start_index = __pyx_optional_args->start_index;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_end_index = __pyx_optional_args->end_index;
      }
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy_subset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_41copy_subset)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_start_index); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_end_index); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_source));
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, ((PyObject *)__pyx_v_source));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_source));
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2524
 *         """
 *         cdef long si, ei, s_length, d_length, i, j
 *         cdef DoubleArray src = <DoubleArray>source             # <<<<<<<<<<<<<<
 *         s_length = src.length
 *         d_length = self.length
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_source);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_src = ((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":2525
 *         cdef long si, ei, s_length, d_length, i, j
 *         cdef DoubleArray src = <DoubleArray>source
 *         s_length = src.length             # <<<<<<<<<<<<<<
 *         d_length = self.length
 * 
 */
  __pyx_t_9 = __pyx_v_src->__pyx_base.length;
  __pyx_v_s_length = __pyx_t_9;

  /* "pyzoltan/core/carray.pyx":2526
 *         cdef DoubleArray src = <DoubleArray>source
 *         s_length = src.length
 *         d_length = self.length             # <<<<<<<<<<<<<<
 * 
 *         if end_index < 0:
 */
  __pyx_t_9 = __pyx_v_self->__pyx_base.length;
  __pyx_v_d_length = __pyx_t_9;

  /* "pyzoltan/core/carray.pyx":2528
 *         d_length = self.length
 * 
 *         if end_index < 0:             # <<<<<<<<<<<<<<
 *             if start_index < 0:
 *                 if s_length != d_length:
 */
  __pyx_t_10 = ((__pyx_v_end_index < 0) != 0);
  if (__pyx_t_10) {

    /* "pyzoltan/core/carray.pyx":2529
 * 
 *         if end_index < 0:
 *             if start_index < 0:             # <<<<<<<<<<<<<<
 *                 if s_length != d_length:
 *                     msg = 'Source length should be same as dest length'
 */
    __pyx_t_10 = ((__pyx_v_start_index < 0) != 0);
    if (__pyx_t_10) {

      /* "pyzoltan/core/carray.pyx":2530
 *         if end_index < 0:
 *             if start_index < 0:
 *                 if s_length != d_length:             # <<<<<<<<<<<<<<
 *                     msg = 'Source length should be same as dest length'
 *                     logger.error(msg)
 */
      __pyx_t_10 = ((__pyx_v_s_length != __pyx_v_d_length) != 0);
      if (__pyx_t_10) {

        /* "pyzoltan/core/carray.pyx":2531
 *             if start_index < 0:
 *                 if s_length != d_length:
 *                     msg = 'Source length should be same as dest length'             # <<<<<<<<<<<<<<
 *                     logger.error(msg)
 *                     raise ValueError, msg
 */
        __Pyx_INCREF(__pyx_kp_s_Source_length_should_be_same_as);
        __pyx_v_msg = __pyx_kp_s_Source_length_should_be_same_as;

        /* "pyzoltan/core/carray.pyx":2532
 *                 if s_length != d_length:
 *                     msg = 'Source length should be same as dest length'
 *                     logger.error(msg)             # <<<<<<<<<<<<<<
 *                     raise ValueError, msg
 *                 si = 0
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        if (!__pyx_t_2) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "pyzoltan/core/carray.pyx":2533
 *                     msg = 'Source length should be same as dest length'
 *                     logger.error(msg)
 *                     raise ValueError, msg             # <<<<<<<<<<<<<<
 *                 si = 0
 *                 ei = self.length
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "pyzoltan/core/carray.pyx":2534
 *                     logger.error(msg)
 *                     raise ValueError, msg
 *                 si = 0             # <<<<<<<<<<<<<<
 *                 ei = self.length
 *             else:
 */
      __pyx_v_si = 0;

      /* "pyzoltan/core/carray.pyx":2535
 *                     raise ValueError, msg
 *                 si = 0
 *                 ei = self.length             # <<<<<<<<<<<<<<
 *             else:
 *                 # meaning we copy from the specified start index to the end of
 */
      __pyx_t_9 = __pyx_v_self->__pyx_base.length;
      __pyx_v_ei = __pyx_t_9;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "pyzoltan/core/carray.pyx":2539
 *                 # meaning we copy from the specified start index to the end of
 *                 # self. make sure the sizes are consistent.
 *                 si = start_index             # <<<<<<<<<<<<<<
 *                 ei = d_length
 * 
 */
      __pyx_v_si = __pyx_v_start_index;

      /* "pyzoltan/core/carray.pyx":2540
 *                 # self. make sure the sizes are consistent.
 *                 si = start_index
 *                 ei = d_length             # <<<<<<<<<<<<<<
 * 
 *                 if start_index > (d_length-1):
 */
      __pyx_v_ei = __pyx_v_d_length;

      /* "pyzoltan/core/carray.pyx":2542
 *                 ei = d_length
 * 
 *                 if start_index > (d_length-1):             # <<<<<<<<<<<<<<
 *                     msg = 'start_index beyond array length'
 *                     logger.error(msg)
 */
      __pyx_t_10 = ((__pyx_v_start_index > (__pyx_v_d_length - 1)) != 0);
      if (__pyx_t_10) {

        /* "pyzoltan/core/carray.pyx":2543
 * 
 *                 if start_index > (d_length-1):
 *                     msg = 'start_index beyond array length'             # <<<<<<<<<<<<<<
 *                     logger.error(msg)
 *                     raise ValueError, msg
 */
        __Pyx_INCREF(__pyx_kp_s_start_index_beyond_array_length);
        __pyx_v_msg = __pyx_kp_s_start_index_beyond_array_length;

        /* "pyzoltan/core/carray.pyx":2544
 *                 if start_index > (d_length-1):
 *                     msg = 'start_index beyond array length'
 *                     logger.error(msg)             # <<<<<<<<<<<<<<
 *                     raise ValueError, msg
 * 
 */
        __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        if (!__pyx_t_5) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "pyzoltan/core/carray.pyx":2545
 *                     msg = 'start_index beyond array length'
 *                     logger.error(msg)
 *                     raise ValueError, msg             # <<<<<<<<<<<<<<
 * 
 *                 if (ei - si) > s_length:
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "pyzoltan/core/carray.pyx":2547
 *                     raise ValueError, msg
 * 
 *                 if (ei - si) > s_length:             # <<<<<<<<<<<<<<
 *                     msg = 'Not enough values in source'
 *                     logger.error(msg)
 */
      __pyx_t_10 = (((__pyx_v_ei - __pyx_v_si) > __pyx_v_s_length) != 0);
      if (__pyx_t_10) {

        /* "pyzoltan/core/carray.pyx":2548
 * 
 *                 if (ei - si) > s_length:
 *                     msg = 'Not enough values in source'             # <<<<<<<<<<<<<<
 *                     logger.error(msg)
 *                     raise ValueError, msg
 */
        __Pyx_INCREF(__pyx_kp_s_Not_enough_values_in_source);
        __pyx_v_msg = __pyx_kp_s_Not_enough_values_in_source;

        /* "pyzoltan/core/carray.pyx":2549
 *                 if (ei - si) > s_length:
 *                     msg = 'Not enough values in source'
 *                     logger.error(msg)             # <<<<<<<<<<<<<<
 *                     raise ValueError, msg
 *         else:
 */
        __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        if (!__pyx_t_8) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2549; __pyx_clineno = __LINE__; goto __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;

        /* "pyzoltan/core/carray.pyx":2550
 *                     msg = 'Not enough values in source'
 *                     logger.error(msg)
 *                     raise ValueError, msg             # <<<<<<<<<<<<<<
 *         else:
 *             if start_index < 0:
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pyzoltan/core/carray.pyx":2552
 *                     raise ValueError, msg
 *         else:
 *             if start_index < 0:             # <<<<<<<<<<<<<<
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                           end_index)
 */
    __pyx_t_10 = ((__pyx_v_start_index < 0) != 0);
    if (__pyx_t_10) {

      /* "pyzoltan/core/carray.pyx":2553
 *         else:
 *             if start_index < 0:
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,             # <<<<<<<<<<<<<<
 *                                                           end_index)
 *                 logger.error(msg)
 */
      __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_start_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);

      /* "pyzoltan/core/carray.pyx":2554
 *             if start_index < 0:
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                           end_index)             # <<<<<<<<<<<<<<
 *                 logger.error(msg)
 *                 raise ValueError, msg
 */
      __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_end_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);

      /* "pyzoltan/core/carray.pyx":2553
 *         else:
 *             if start_index < 0:
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,             # <<<<<<<<<<<<<<
 *                                                           end_index)
 *                 logger.error(msg)
 */
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_1 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_start_index_d_end_index_d, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_msg = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "pyzoltan/core/carray.pyx":2555
 *                 msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                           end_index)
 *                 logger.error(msg)             # <<<<<<<<<<<<<<
 *                 raise ValueError, msg
 *             else:
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_v_msg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_msg);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_msg);
        __Pyx_GIVEREF(__pyx_v_msg);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pyzoltan/core/carray.pyx":2556
 *                                                           end_index)
 *                 logger.error(msg)
 *                 raise ValueError, msg             # <<<<<<<<<<<<<<
 *             else:
 *                 if (start_index > (d_length-1) or end_index > d_length or
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    /*else*/ {

      /* "pyzoltan/core/carray.pyx":2558
 *                 raise ValueError, msg
 *             else:
 *                 if (start_index > (d_length-1) or end_index > d_length or             # <<<<<<<<<<<<<<
 *                     start_index > end_index):
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,
 */
      __pyx_t_11 = ((__pyx_v_start_index > (__pyx_v_d_length - 1)) != 0);
      if (!__pyx_t_11) {
      } else {
        __pyx_t_10 = __pyx_t_11;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_11 = ((__pyx_v_end_index > __pyx_v_d_length) != 0);
      if (!__pyx_t_11) {
      } else {
        __pyx_t_10 = __pyx_t_11;
        goto __pyx_L10_bool_binop_done;
      }

      /* "pyzoltan/core/carray.pyx":2559
 *             else:
 *                 if (start_index > (d_length-1) or end_index > d_length or
 *                     start_index > end_index):             # <<<<<<<<<<<<<<
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                               end_index)
 */
      __pyx_t_11 = ((__pyx_v_start_index > __pyx_v_end_index) != 0);
      __pyx_t_10 = __pyx_t_11;
      __pyx_L10_bool_binop_done:;
      if (__pyx_t_10) {

        /* "pyzoltan/core/carray.pyx":2560
 *                 if (start_index > (d_length-1) or end_index > d_length or
 *                     start_index > end_index):
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,             # <<<<<<<<<<<<<<
 *                                                               end_index)
 *                     logger.error(msg)
 */
        __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_start_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);

        /* "pyzoltan/core/carray.pyx":2561
 *                     start_index > end_index):
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                               end_index)             # <<<<<<<<<<<<<<
 *                     logger.error(msg)
 *                     raise ValueError, msg
 */
        __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_end_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);

        /* "pyzoltan/core/carray.pyx":2560
 *                 if (start_index > (d_length-1) or end_index > d_length or
 *                     start_index > end_index):
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,             # <<<<<<<<<<<<<<
 *                                                               end_index)
 *                     logger.error(msg)
 */
        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_2 = 0;
        __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_start_index_d_end_index_d, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_v_msg = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "pyzoltan/core/carray.pyx":2562
 *                     msg = 'start_index : %d, end_index : %d'%(start_index,
 *                                                               end_index)
 *                     logger.error(msg)             # <<<<<<<<<<<<<<
 *                     raise ValueError, msg
 * 
 */
        __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        if (!__pyx_t_8) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2562; __pyx_clineno = __LINE__; goto __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;

        /* "pyzoltan/core/carray.pyx":2563
 *                                                               end_index)
 *                     logger.error(msg)
 *                     raise ValueError, msg             # <<<<<<<<<<<<<<
 * 
 *                 si = start_index
 */
        __Pyx_Raise(__pyx_builtin_ValueError, __pyx_v_msg, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "pyzoltan/core/carray.pyx":2565
 *                     raise ValueError, msg
 * 
 *                 si = start_index             # <<<<<<<<<<<<<<
 *                 ei = end_index
 * 
 */
      __pyx_v_si = __pyx_v_start_index;

      /* "pyzoltan/core/carray.pyx":2566
 * 
 *                 si = start_index
 *                 ei = end_index             # <<<<<<<<<<<<<<
 * 
 *         # we have valid start and end indices now. can start copying now.
 */
      __pyx_v_ei = __pyx_v_end_index;
    }
  }
  __pyx_L3:;

  /* "pyzoltan/core/carray.pyx":2569
 * 
 *         # we have valid start and end indices now. can start copying now.
 *         j = 0             # <<<<<<<<<<<<<<
 *         for i in range(si, ei):
 *             self.data[i] = src.data[j]
 */
  __pyx_v_j = 0;

  /* "pyzoltan/core/carray.pyx":2570
 *         # we have valid start and end indices now. can start copying now.
 *         j = 0
 *         for i in range(si, ei):             # <<<<<<<<<<<<<<
 *             self.data[i] = src.data[j]
 *             j += 1
 */
  __pyx_t_9 = __pyx_v_ei;
  for (__pyx_t_12 = __pyx_v_si; __pyx_t_12 < __pyx_t_9; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "pyzoltan/core/carray.pyx":2571
 *         j = 0
 *         for i in range(si, ei):
 *             self.data[i] = src.data[j]             # <<<<<<<<<<<<<<
 *             j += 1
 * 
 */
    (__pyx_v_self->data[__pyx_v_i]) = (__pyx_v_src->data[__pyx_v_j]);

    /* "pyzoltan/core/carray.pyx":2572
 *         for i in range(si, ei):
 *             self.data[i] = src.data[j]
 *             j += 1             # <<<<<<<<<<<<<<
 * 
 *     cpdef update_min_max(self):
 */
    __pyx_v_j = (__pyx_v_j + 1);
  }

  /* "pyzoltan/core/carray.pyx":2509
 *             dest_array.data[i] = self.data[indices.data[i]]
 * 
 *     cpdef copy_subset(self, BaseArray source, long start_index=-1,             # <<<<<<<<<<<<<<
 *                       long end_index=-1):
 *         """Copy a subset of values from src to self.
 */

  /* 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_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.copy_subset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_src);
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_41copy_subset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_40copy_subset[] = "DoubleArray.copy_subset(self, BaseArray source, long start_index=-1, long end_index=-1)\nCopy a subset of values from src to self.\n\n        Parameters\n        ----------\n\n        start_index : long\n            the first index in dest that corresponds to the 0th\n            index in source\n\n        end_index : long\n            the first index in dest from start_index that is not copied\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_41copy_subset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source = 0;
  long __pyx_v_start_index;
  long __pyx_v_end_index;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_subset (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_start_index,&__pyx_n_s_end_index,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_source)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start_index);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end_index);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy_subset") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2509; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_source = ((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)values[0]);
    if (values[1]) {
      __pyx_v_start_index = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_start_index == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2509; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_start_index = ((long)-1);
    }
    if (values[2]) {
      __pyx_v_end_index = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_end_index == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2510; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_end_index = ((long)-1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy_subset", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2509; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.copy_subset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_source), __pyx_ptype_8pyzoltan_4core_6carray_BaseArray, 1, "source", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_40copy_subset(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self), __pyx_v_source, __pyx_v_start_index, __pyx_v_end_index);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_40copy_subset(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *__pyx_v_source, long __pyx_v_start_index, long __pyx_v_end_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_copy_subset __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy_subset", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.start_index = __pyx_v_start_index;
  __pyx_t_2.end_index = __pyx_v_end_index;
  __pyx_t_1 = __pyx_vtabptr_8pyzoltan_4core_6carray_DoubleArray->__pyx_base.copy_subset(((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)__pyx_v_self), __pyx_v_source, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2509; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.DoubleArray.copy_subset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pyx":2574
 *             j += 1
 * 
 *     cpdef update_min_max(self):             # <<<<<<<<<<<<<<
 *         """Updates the min and max values of the array.
 *         """
 */

static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_43update_min_max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, int __pyx_skip_dispatch) {
  long __pyx_v_i;
  double __pyx_v_min_val;
  double __pyx_v_max_val;
  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;
  long __pyx_t_6;
  long __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update_min_max", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_update_min_max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_43update_min_max)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 2574; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pyzoltan/core/carray.pyx":2577
 *         """Updates the min and max values of the array.
 *         """
 *         cdef long i = 0             # <<<<<<<<<<<<<<
 *         cdef double min_val, max_val
 * 
 */
  __pyx_v_i = 0;

  /* "pyzoltan/core/carray.pyx":2580
 *         cdef double min_val, max_val
 * 
 *         if self.length == 0:             # <<<<<<<<<<<<<<
 *             self.minimum = <double>0
 *             self.maximum = <double>0
 */
  __pyx_t_5 = ((__pyx_v_self->__pyx_base.length == 0) != 0);
  if (__pyx_t_5) {

    /* "pyzoltan/core/carray.pyx":2581
 * 
 *         if self.length == 0:
 *             self.minimum = <double>0             # <<<<<<<<<<<<<<
 *             self.maximum = <double>0
 *             return
 */
    __pyx_v_self->minimum = ((double)0);

    /* "pyzoltan/core/carray.pyx":2582
 *         if self.length == 0:
 *             self.minimum = <double>0
 *             self.maximum = <double>0             # <<<<<<<<<<<<<<
 *             return
 * 
 */
    __pyx_v_self->maximum = ((double)0);

    /* "pyzoltan/core/carray.pyx":2583
 *             self.minimum = <double>0
 *             self.maximum = <double>0
 *             return             # <<<<<<<<<<<<<<
 * 
 *         min_val = self.data[0]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }

  /* "pyzoltan/core/carray.pyx":2585
 *             return
 * 
 *         min_val = self.data[0]             # <<<<<<<<<<<<<<
 *         max_val = self.data[0]
 * 
 */
  __pyx_v_min_val = (__pyx_v_self->data[0]);

  /* "pyzoltan/core/carray.pyx":2586
 * 
 *         min_val = self.data[0]
 *         max_val = self.data[0]             # <<<<<<<<<<<<<<
 * 
 *         for i in range(self.length):
 */
  __pyx_v_max_val = (__pyx_v_self->data[0]);

  /* "pyzoltan/core/carray.pyx":2588
 *         max_val = self.data[0]
 * 
 *         for i in range(self.length):             # <<<<<<<<<<<<<<
 *             if min_val > self.data[i]:
 *                 min_val = self.data[i]
 */
  __pyx_t_6 = __pyx_v_self->__pyx_base.length;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "pyzoltan/core/carray.pyx":2589
 * 
 *         for i in range(self.length):
 *             if min_val > self.data[i]:             # <<<<<<<<<<<<<<
 *                 min_val = self.data[i]
 *             if max_val < self.data[i]:
 */
    __pyx_t_5 = ((__pyx_v_min_val > (__pyx_v_self->data[__pyx_v_i])) != 0);
    if (__pyx_t_5) {

      /* "pyzoltan/core/carray.pyx":2590
 *         for i in range(self.length):
 *             if min_val > self.data[i]:
 *                 min_val = self.data[i]             # <<<<<<<<<<<<<<
 *             if max_val < self.data[i]:
 *                 max_val = self.data[i]
 */
      __pyx_v_min_val = (__pyx_v_self->data[__pyx_v_i]);
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pyzoltan/core/carray.pyx":2591
 *             if min_val > self.data[i]:
 *                 min_val = self.data[i]
 *             if max_val < self.data[i]:             # <<<<<<<<<<<<<<
 *                 max_val = self.data[i]
 * 
 */
    __pyx_t_5 = ((__pyx_v_max_val < (__pyx_v_self->data[__pyx_v_i])) != 0);
    if (__pyx_t_5) {

      /* "pyzoltan/core/carray.pyx":2592
 *                 min_val = self.data[i]
 *             if max_val < self.data[i]:
 *                 max_val = self.data[i]             # <<<<<<<<<<<<<<
 * 
 *         self.minimum = min_val
 */
      __pyx_v_max_val = (__pyx_v_self->data[__pyx_v_i]);
      goto __pyx_L7;
    }
    __pyx_L7:;
  }

  /* "pyzoltan/core/carray.pyx":2594
 *                 max_val = self.data[i]
 * 
 *         self.minimum = min_val             # <<<<<<<<<<<<<<
 *         self.maximum = max_val
 * 
 */
  __pyx_v_self->minimum = __pyx_v_min_val;

  /* "pyzoltan/core/carray.pyx":2595
 * 
 *         self.minimum = min_val
 *         self.maximum = max_val             # <<<<<<<<<<<<<<
 * 
 */
  __pyx_v_self->maximum = __pyx_v_max_val;

  /* "pyzoltan/core/carray.pyx":2574
 *             j += 1
 * 
 *     cpdef update_min_max(self):             # <<<<<<<<<<<<<<
 *         """Updates the min and max values of the array.
 *         """
 */

  /* 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("pyzoltan.core.carray.DoubleArray.update_min_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_43update_min_max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_42update_min_max[] = "DoubleArray.update_min_max(self)\nUpdates the min and max values of the array.\n        ";
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_43update_min_max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_min_max (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_42update_min_max(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_42update_min_max(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update_min_max", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8pyzoltan_4core_6carray_11DoubleArray_update_min_max(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.DoubleArray.update_min_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pyzoltan/core/carray.pxd":180
 *     cdef double *data
 *     cdef double *_old_data
 *     cdef public double minimum, maximum             # <<<<<<<<<<<<<<
 *     cdef DoubleArray _parent
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_7minimum_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_7minimum_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_7minimum___get__(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_7minimum___get__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->minimum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.DoubleArray.minimum.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_7minimum_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_7minimum_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_7minimum_2__set__(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_7minimum_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->minimum = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.minimum.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_7maximum_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_7maximum_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_7maximum___get__(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self));

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

static PyObject *__pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_7maximum___get__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->maximum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __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("pyzoltan.core.carray.DoubleArray.maximum.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_7maximum_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_7maximum_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_7maximum_2__set__(((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_8pyzoltan_4core_6carray_11DoubleArray_7maximum_2__set__(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->maximum = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pyzoltan.core.carray.DoubleArray.maximum.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":197
 *         # 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 fullfill 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_copy_shape;
  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_v_hasfields;
  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;
  PyObject *__pyx_t_6 = NULL;
  char *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  if (__pyx_v_info != NULL) {
    __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_info->obj);
  }

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":203
 *             # of flags
 * 
 *             if info == NULL: return             # <<<<<<<<<<<<<<
 * 
 *             cdef int copy_shape, i, ndim
 */
  __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":206
 * 
 *             cdef int copy_shape, i, ndim
 *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 */
  __pyx_v_endian_detector = 1;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":207
 *             cdef int copy_shape, 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);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":209
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":211
 *             ndim = PyArray_NDIM(self)
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 copy_shape = 1
 *             else:
 */
  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  if (__pyx_t_1) {

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":212
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 copy_shape = 1             # <<<<<<<<<<<<<<
 *             else:
 *                 copy_shape = 0
 */
    __pyx_v_copy_shape = 1;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":214
 *                 copy_shape = 1
 *             else:
 *                 copy_shape = 0             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 */
    __pyx_v_copy_shape = 0;
  }
  __pyx_L4:;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
 *                 copy_shape = 0
 * 
 *             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_L6_bool_binop_done;
  }

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":217
 * 
 *             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_L6_bool_binop_done:;
  if (__pyx_t_1) {

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":218
 *             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__22, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
 *                 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_L9_bool_binop_done;
  }

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":221
 * 
 *             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_L9_bool_binop_done:;
  if (__pyx_t_1) {

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":222
 *             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__23, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":224
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
 *             info.ndim = ndim
 *             if copy_shape:
 */
  __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":225
 * 
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim             # <<<<<<<<<<<<<<
 *             if copy_shape:
 *                 # Allocate new buffer for strides and shape info.
 */
  __pyx_v_info->ndim = __pyx_v_ndim;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":226
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim
 *             if copy_shape:             # <<<<<<<<<<<<<<
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 */
  __pyx_t_1 = (__pyx_v_copy_shape != 0);
  if (__pyx_t_1) {

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":229
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)             # <<<<<<<<<<<<<<
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 */
    __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":230
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
 *                 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);

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":231
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
 *                 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;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_i = __pyx_t_5;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":232
 *                 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]);

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":233
 *                 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]);
    }
    goto __pyx_L11;
  }
  /*else*/ {

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":235
 *                     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
 */
    __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":236
 *             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_L11:;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":237
 *                 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;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":238
 *                 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);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":239
 *             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));

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":242
 * 
 *             cdef int t
 *             cdef char* f = NULL             # <<<<<<<<<<<<<<
 *             cdef dtype descr = self.descr
 *             cdef list stack
 */
  __pyx_v_f = NULL;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":243
 *             cdef int t
 *             cdef char* f = NULL
 *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
 *             cdef list stack
 *             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;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":247
 *             cdef int offset
 * 
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields and not copy_shape:
 */
  __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":249
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
 * 
 *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
 *                 # do not call releasebuffer
 *                 info.obj = None
 */
  __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L15_bool_binop_done;
  }
  __pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L15_bool_binop_done:;
  if (__pyx_t_1) {

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":251
 *             if not hasfields and not copy_shape:
 *                 # do not call releasebuffer
 *                 info.obj = None             # <<<<<<<<<<<<<<
 *             else:
 *                 # need to call releasebuffer
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = Py_None;
    goto __pyx_L14;
  }
  /*else*/ {

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":254
 *             else:
 *                 # need to call releasebuffer
 *                 info.obj = self             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields:
 */
    __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);
  }
  __pyx_L14:;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":256
 *                 info.obj = self
 * 
 *             if not hasfields:             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 */
  __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
  if (__pyx_t_1) {

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
 * 
 *             if not hasfields:
 *                 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;

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":258
 *             if not hasfields:
 *                 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_L20_next_or;
    } else {
    }
    __pyx_t_2 = (__pyx_v_little_endian != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L19_bool_binop_done;
    }
    __pyx_L20_next_or:;

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":259
 *                 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_L19_bool_binop_done;
    }
    __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L19_bool_binop_done:;
    if (__pyx_t_1) {

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":260
 *                 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__24, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":277
 *                 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)
 */
    switch (__pyx_v_t) {

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":261
 *                     (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"
 */
      case NPY_BYTE:
      __pyx_v_f = __pyx_k_b;
      break;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":262
 *                     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 = __pyx_k_B;
      break;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":263
 *                 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 = __pyx_k_h;
      break;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":264
 *                 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 = __pyx_k_H;
      break;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":265
 *                 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 = __pyx_k_i;
      break;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":266
 *                 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 = __pyx_k_I;
      break;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":267
 *                 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 = __pyx_k_l;
      break;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":268
 *                 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 = __pyx_k_L;
      break;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":269
 *                 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 = __pyx_k_q;
      break;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
 *                 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 = __pyx_k_Q;
      break;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":271
 *                 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 = __pyx_k_f;
      break;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":272
 *                 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 = __pyx_k_d;
      break;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":273
 *                 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 = __pyx_k_g;
      break;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
 *                 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 = __pyx_k_Zf;
      break;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":275
 *                 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 = __pyx_k_Zd;
      break;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":276
 *                 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 = __pyx_k_Zg;
      break;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":277
 *                 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 = __pyx_k_O;
      break;
      default:

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":279
 *                 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_filename = __pyx_f[2]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      break;
    }

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":280
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f             # <<<<<<<<<<<<<<
 *                 return
 *             else:
 */
    __pyx_v_info->format = __pyx_v_f;

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":281
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f
 *                 return             # <<<<<<<<<<<<<<
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":283
 *                 return
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
 *                 info.format[0] = c'^' # Native data types, manual alignment
 *                 offset = 0
 */
    __pyx_v_info->format = ((char *)malloc(255));

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":284
 *             else:
 *                 info.format = <char*>stdlib.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]) = '^';

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":285
 *                 info.format = <char*>stdlib.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;

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":286
 *                 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_7 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_f = __pyx_t_7;

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":289
 *                                       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';
  }

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":197
 *         # 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 fullfill the PEP.
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
 *                 f[0] = c'\0' # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.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);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":292
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
  if (__pyx_t_1) {

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":293
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)             # <<<<<<<<<<<<<<
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 stdlib.free(info.strides)
 */
    free(__pyx_v_info->format);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":294
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 stdlib.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) {

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":295
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 stdlib.free(info.strides)             # <<<<<<<<<<<<<<
 *                 # info.shape was stored after info.strides in the same block
 * 
 */
    free(__pyx_v_info->strides);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
 *                 f[0] = c'\0' # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 */

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

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":771
 * 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":772
 * 
 * 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_filename = __pyx_f[2]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":771
 * 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;
}

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":774
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":775
 * 
 * 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_filename = __pyx_f[2]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":774
 *     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;
}

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":777
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":778
 * 
 * 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_filename = __pyx_f[2]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":777
 *     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;
}

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":780
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":781
 * 
 * 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_filename = __pyx_f[2]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":780
 *     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;
}

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":783
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":784
 * 
 * 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 char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
 */
  __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_filename = __pyx_f[2]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":783
 *     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;
}

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":786
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_util_dtypestring", 0);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":793
 *     cdef int delta_offset
 *     cdef tuple i
 *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 *     cdef tuple fields
 */
  __pyx_v_endian_detector = 1;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794
 *     cdef tuple i
 *     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);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":797
 *     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_filename = __pyx_f[2]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON
    __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_filename = __pyx_f[2]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":798
 * 
 *     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_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":799
 *     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;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      __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_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      #endif
    } else {
      __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __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;

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
 *         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_filename = __pyx_f[2]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __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 (__pyx_t_6) {

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":802
 * 
 *         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__25, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":804
 *             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:;

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":805
 * 
 *         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:;
    if (__pyx_t_6) {

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":806
 *         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__26, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":816
 * 
 *         # 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_filename = __pyx_f[2]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!__pyx_t_6) break;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":817
 *         # Output padding bytes
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
 *             f += 1
 *             offset[0] += 1
 */
      (__pyx_v_f[0]) = 120;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":818
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte
 *             f += 1             # <<<<<<<<<<<<<<
 *             offset[0] += 1
 * 
 */
      __pyx_v_f = (__pyx_v_f + 1);

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":819
 *             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);
    }

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":821
 *             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);

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":823
 *         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) {

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":824
 * 
 *         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_filename = __pyx_f[2]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":825
 *         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 (__pyx_t_6) {

        /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":826
 *             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__27, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":829
 * 
 *             # 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 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 98;
        goto __pyx_L15;
      }

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":830
 *             # 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 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 66;
        goto __pyx_L15;
      }

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":831
 *             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 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 104;
        goto __pyx_L15;
      }

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":832
 *             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 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 72;
        goto __pyx_L15;
      }

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":833
 *             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 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 105;
        goto __pyx_L15;
      }

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":834
 *             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 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 73;
        goto __pyx_L15;
      }

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":835
 *             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 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 108;
        goto __pyx_L15;
      }

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":836
 *             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 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 76;
        goto __pyx_L15;
      }

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":837
 *             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 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 113;
        goto __pyx_L15;
      }

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":838
 *             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 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 81;
        goto __pyx_L15;
      }

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":839
 *             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 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 102;
        goto __pyx_L15;
      }

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":840
 *             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 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 100;
        goto __pyx_L15;
      }

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":841
 *             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 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 103;
        goto __pyx_L15;
      }

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":842
 *             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 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __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]) = 102;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L15;
      }

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":843
 *             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 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __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]) = 100;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L15;
      }

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":844
 *             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 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __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]) = 103;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L15;
      }

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":845
 *             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 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 79;
        goto __pyx_L15;
      }
      /*else*/ {

        /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":847
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *             f += 1
 *         else:
 */
        __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L15:;

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":848
 *             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);
      goto __pyx_L13;
    }
    /*else*/ {

      /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":852
 *             # Cython ignores struct boundary information ("T{...}"),
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
 *     return f
 * 
 */
      __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 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_f = __pyx_t_9;
    }
    __pyx_L13:;

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":797
 *     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;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":853
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)
 *     return f             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_f;
  goto __pyx_L0;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":786
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * 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;
}

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":969
 * 
 * 
 * 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);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":971
 * 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) {

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":972
 *      cdef PyObject* baseptr
 *      if base is None:
 *          baseptr = NULL             # <<<<<<<<<<<<<<
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 */
    __pyx_v_baseptr = NULL;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":974
 *          baseptr = NULL
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!             # <<<<<<<<<<<<<<
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)
 */
    Py_INCREF(__pyx_v_base);

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":975
 *      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:;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":976
 *          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);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977
 *          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;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":969
 * 
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *      cdef PyObject* baseptr
 *      if base is None:
 */

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

/* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":979
 *      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);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":980
 * 
 * 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) {

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":981
 * 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_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":983
 *         return None
 *     else:
 *         return <object>arr.base             # <<<<<<<<<<<<<<
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
    __pyx_r = ((PyObject *)__pyx_v_arr->base);
    goto __pyx_L0;
  }

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":979
 *      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;
}
static struct __pyx_vtabstruct_8pyzoltan_4core_6carray_BaseArray __pyx_vtable_8pyzoltan_4core_6carray_BaseArray;

static PyObject *__pyx_tp_new_8pyzoltan_4core_6carray_BaseArray(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)o);
  p->__pyx_vtab = __pyx_vtabptr_8pyzoltan_4core_6carray_BaseArray;
  p->_npy_array = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_8pyzoltan_4core_6carray_BaseArray(PyObject *o) {
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *p = (struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_npy_array);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_8pyzoltan_4core_6carray_BaseArray(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *p = (struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)o;
  if (p->_npy_array) {
    e = (*v)(((PyObject*)p->_npy_array), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8pyzoltan_4core_6carray_BaseArray(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *p = (struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)o;
  tmp = ((PyObject*)p->_npy_array);
  p->_npy_array = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_8pyzoltan_4core_6carray_9BaseArray_length(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_6length_1__get__(o);
}

static int __pyx_setprop_8pyzoltan_4core_6carray_9BaseArray_length(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_6length_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8pyzoltan_4core_6carray_9BaseArray_alloc(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_5alloc_1__get__(o);
}

static int __pyx_setprop_8pyzoltan_4core_6carray_9BaseArray_alloc(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_5alloc_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_8pyzoltan_4core_6carray_BaseArray[] = {
  {"get_c_type", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_1get_c_type, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_get_c_type},
  {"reserve", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_3reserve, METH_O, __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_2reserve},
  {"resize", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_5resize, METH_O, __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_4resize},
  {"get_npy_array", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_7get_npy_array, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_6get_npy_array},
  {"set_data", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_9set_data, METH_O, __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_8set_data},
  {"squeeze", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_11squeeze, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_10squeeze},
  {"remove", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_13remove, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_12remove},
  {"extend", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_15extend, METH_O, __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_14extend},
  {"align_array", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_17align_array, METH_O, __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_16align_array},
  {"reset", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_19reset, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_18reset},
  {"copy_values", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_21copy_values, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_20copy_values},
  {"copy_subset", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_23copy_subset, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_22copy_subset},
  {"update_min_max", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9BaseArray_25update_min_max, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_24update_min_max},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8pyzoltan_4core_6carray_BaseArray[] = {
  {(char *)"length", __pyx_getprop_8pyzoltan_4core_6carray_9BaseArray_length, __pyx_setprop_8pyzoltan_4core_6carray_9BaseArray_length, __pyx_k_length_long, 0},
  {(char *)"alloc", __pyx_getprop_8pyzoltan_4core_6carray_9BaseArray_alloc, __pyx_setprop_8pyzoltan_4core_6carray_9BaseArray_alloc, __pyx_k_alloc_long, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_BaseArray = {
  __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_27__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_BaseArray = {
  __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_27__len__, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_8pyzoltan_4core_6carray_BaseArray = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyzoltan.core.carray.BaseArray", /*tp_name*/
  sizeof(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8pyzoltan_4core_6carray_BaseArray, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_BaseArray, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_BaseArray, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Base class for managed C-arrays.\n    ", /*tp_doc*/
  __pyx_tp_traverse_8pyzoltan_4core_6carray_BaseArray, /*tp_traverse*/
  __pyx_tp_clear_8pyzoltan_4core_6carray_BaseArray, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_29__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8pyzoltan_4core_6carray_BaseArray, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8pyzoltan_4core_6carray_BaseArray, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8pyzoltan_4core_6carray_BaseArray, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_8pyzoltan_4core_6carray_LongArray __pyx_vtable_8pyzoltan_4core_6carray_LongArray;

static PyObject *__pyx_tp_new_8pyzoltan_4core_6carray_LongArray(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *p;
  PyObject *o = __pyx_tp_new_8pyzoltan_4core_6carray_BaseArray(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8pyzoltan_4core_6carray_BaseArray*)__pyx_vtabptr_8pyzoltan_4core_6carray_LongArray;
  p->_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_8pyzoltan_4core_6carray_9LongArray_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8pyzoltan_4core_6carray_LongArray(PyObject *o) {
  struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *p = (struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_8pyzoltan_4core_6carray_9LongArray_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_parent);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_8pyzoltan_4core_6carray_BaseArray(o);
}

static int __pyx_tp_traverse_8pyzoltan_4core_6carray_LongArray(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *p = (struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)o;
  e = __pyx_tp_traverse_8pyzoltan_4core_6carray_BaseArray(o, v, a); if (e) return e;
  if (p->_parent) {
    e = (*v)(((PyObject*)p->_parent), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8pyzoltan_4core_6carray_LongArray(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *p = (struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)o;
  __pyx_tp_clear_8pyzoltan_4core_6carray_BaseArray(o);
  tmp = ((PyObject*)p->_parent);
  p->_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_8pyzoltan_4core_6carray_LongArray(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_8pyzoltan_4core_6carray_LongArray(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_8pyzoltan_4core_6carray_9LongArray_7__setitem__(o, i, v);
  }
  else {
    if (__pyx_ptype_8pyzoltan_4core_6carray_BaseArray->tp_as_mapping && __pyx_ptype_8pyzoltan_4core_6carray_BaseArray->tp_as_mapping->mp_ass_subscript)
      return __pyx_ptype_8pyzoltan_4core_6carray_BaseArray->tp_as_mapping->mp_ass_subscript(o, i, v);
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_getprop_8pyzoltan_4core_6carray_9LongArray_minimum(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8pyzoltan_4core_6carray_9LongArray_7minimum_1__get__(o);
}

static int __pyx_setprop_8pyzoltan_4core_6carray_9LongArray_minimum(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8pyzoltan_4core_6carray_9LongArray_7minimum_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8pyzoltan_4core_6carray_9LongArray_maximum(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8pyzoltan_4core_6carray_9LongArray_7maximum_1__get__(o);
}

static int __pyx_setprop_8pyzoltan_4core_6carray_9LongArray_maximum(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8pyzoltan_4core_6carray_9LongArray_7maximum_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_8pyzoltan_4core_6carray_LongArray[] = {
  {"index", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_9index, METH_O, __pyx_doc_8pyzoltan_4core_6carray_9LongArray_8index},
  {"__reduce__", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_13__reduce__, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_9LongArray_12__reduce__},
  {"__setstate__", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_15__setstate__, METH_O, __pyx_doc_8pyzoltan_4core_6carray_9LongArray_14__setstate__},
  {"get_c_type", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_17get_c_type, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_9LongArray_16get_c_type},
  {"get", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_19get, METH_O, __pyx_doc_8pyzoltan_4core_6carray_9LongArray_18get},
  {"set", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_21set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_9LongArray_20set},
  {"append", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_23append, METH_O, __pyx_doc_8pyzoltan_4core_6carray_9LongArray_22append},
  {"reserve", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_25reserve, METH_O, __pyx_doc_8pyzoltan_4core_6carray_9LongArray_24reserve},
  {"reset", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_27reset, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_9LongArray_26reset},
  {"resize", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_29resize, METH_O, __pyx_doc_8pyzoltan_4core_6carray_9LongArray_28resize},
  {"set_view", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_31set_view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_9LongArray_30set_view},
  {"squeeze", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_33squeeze, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_9LongArray_32squeeze},
  {"remove", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_35remove, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_9LongArray_34remove},
  {"extend", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_37extend, METH_O, __pyx_doc_8pyzoltan_4core_6carray_9LongArray_36extend},
  {"copy_values", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_39copy_values, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_9LongArray_38copy_values},
  {"copy_subset", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_41copy_subset, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_9LongArray_40copy_subset},
  {"update_min_max", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9LongArray_43update_min_max, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_9LongArray_42update_min_max},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8pyzoltan_4core_6carray_LongArray[] = {
  {(char *)"minimum", __pyx_getprop_8pyzoltan_4core_6carray_9LongArray_minimum, __pyx_setprop_8pyzoltan_4core_6carray_9LongArray_minimum, __pyx_k_minimum_long, 0},
  {(char *)"maximum", __pyx_getprop_8pyzoltan_4core_6carray_9LongArray_maximum, __pyx_setprop_8pyzoltan_4core_6carray_9LongArray_maximum, __pyx_k_maximum_long, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_LongArray = {
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_27__len__, /*sq_length*/
  #else
  0, /*sq_length*/
  #endif
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_8pyzoltan_4core_6carray_LongArray, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_8pyzoltan_4core_6carray_9LongArray_11__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_LongArray = {
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_27__len__, /*mp_length*/
  #else
  0, /*mp_length*/
  #endif
  __pyx_pw_8pyzoltan_4core_6carray_9LongArray_5__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_8pyzoltan_4core_6carray_LongArray, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_8pyzoltan_4core_6carray_LongArray = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyzoltan.core.carray.LongArray", /*tp_name*/
  sizeof(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8pyzoltan_4core_6carray_LongArray, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_LongArray, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_LongArray, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Represents an array of `longs`\n\n    Mallocs a memory buffer of size (n*sizeof(long)) and sets up\n    the numpy array.  The memory is aligned to 64 byte boundaries.\n\n    Parameters\n    ----------\n\n    n : long\n        Length of the array.\n\n    Attributes\n    ----------\n    data: pointer\n        Pointer to an integer array.\n    length: long\n        Size of the array itself.\n    alloc: long\n        Size of the data buffer allocated.\n\n    Examples\n    --------\n\n    >>> x = LongArray()\n    >>> x.resize(5)\n    >>> x.set_data(np.arange(5))\n    >>> x[0]\n    0\n\n    >>> x = LongArray(5)\n    >>> xnp = x.get_npy_array()\n    >>> xnp[:] = np.arange(5)\n    >>> x[0], x[4]\n    (0.0, 4.0)\n\n    ", /*tp_doc*/
  __pyx_tp_traverse_8pyzoltan_4core_6carray_LongArray, /*tp_traverse*/
  __pyx_tp_clear_8pyzoltan_4core_6carray_LongArray, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_29__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_8pyzoltan_4core_6carray_LongArray, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8pyzoltan_4core_6carray_LongArray, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8pyzoltan_4core_6carray_LongArray, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_8pyzoltan_4core_6carray_BaseArrayIter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArrayIter *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArrayIter *)o);
  p->arr = ((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_8pyzoltan_4core_6carray_BaseArrayIter(PyObject *o) {
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArrayIter *p = (struct __pyx_obj_8pyzoltan_4core_6carray_BaseArrayIter *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->arr);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_8pyzoltan_4core_6carray_BaseArrayIter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArrayIter *p = (struct __pyx_obj_8pyzoltan_4core_6carray_BaseArrayIter *)o;
  if (p->arr) {
    e = (*v)(((PyObject*)p->arr), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8pyzoltan_4core_6carray_BaseArrayIter(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8pyzoltan_4core_6carray_BaseArrayIter *p = (struct __pyx_obj_8pyzoltan_4core_6carray_BaseArrayIter *)o;
  tmp = ((PyObject*)p->arr);
  p->arr = ((struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_8pyzoltan_4core_6carray_BaseArrayIter[] = {
  {"__next__", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_13BaseArrayIter_3__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_8pyzoltan_4core_6carray_BaseArrayIter = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyzoltan.core.carray.BaseArrayIter", /*tp_name*/
  sizeof(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArrayIter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8pyzoltan_4core_6carray_BaseArrayIter, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "BaseArrayIter(BaseArray arr)\n Iteration object to support iteration over BaseArray. ", /*tp_doc*/
  __pyx_tp_traverse_8pyzoltan_4core_6carray_BaseArrayIter, /*tp_traverse*/
  __pyx_tp_clear_8pyzoltan_4core_6carray_BaseArrayIter, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_8pyzoltan_4core_6carray_13BaseArrayIter_5__iter__, /*tp_iter*/
  __pyx_pw_8pyzoltan_4core_6carray_13BaseArrayIter_3__next__, /*tp_iternext*/
  __pyx_methods_8pyzoltan_4core_6carray_BaseArrayIter, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_8pyzoltan_4core_6carray_13BaseArrayIter_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8pyzoltan_4core_6carray_BaseArrayIter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_8pyzoltan_4core_6carray_IntArray __pyx_vtable_8pyzoltan_4core_6carray_IntArray;

static PyObject *__pyx_tp_new_8pyzoltan_4core_6carray_IntArray(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *p;
  PyObject *o = __pyx_tp_new_8pyzoltan_4core_6carray_BaseArray(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8pyzoltan_4core_6carray_BaseArray*)__pyx_vtabptr_8pyzoltan_4core_6carray_IntArray;
  p->_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_8pyzoltan_4core_6carray_8IntArray_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8pyzoltan_4core_6carray_IntArray(PyObject *o) {
  struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *p = (struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_8pyzoltan_4core_6carray_8IntArray_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_parent);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_8pyzoltan_4core_6carray_BaseArray(o);
}

static int __pyx_tp_traverse_8pyzoltan_4core_6carray_IntArray(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *p = (struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)o;
  e = __pyx_tp_traverse_8pyzoltan_4core_6carray_BaseArray(o, v, a); if (e) return e;
  if (p->_parent) {
    e = (*v)(((PyObject*)p->_parent), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8pyzoltan_4core_6carray_IntArray(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *p = (struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)o;
  __pyx_tp_clear_8pyzoltan_4core_6carray_BaseArray(o);
  tmp = ((PyObject*)p->_parent);
  p->_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_8pyzoltan_4core_6carray_IntArray(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_8pyzoltan_4core_6carray_IntArray(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_8pyzoltan_4core_6carray_8IntArray_7__setitem__(o, i, v);
  }
  else {
    if (__pyx_ptype_8pyzoltan_4core_6carray_BaseArray->tp_as_mapping && __pyx_ptype_8pyzoltan_4core_6carray_BaseArray->tp_as_mapping->mp_ass_subscript)
      return __pyx_ptype_8pyzoltan_4core_6carray_BaseArray->tp_as_mapping->mp_ass_subscript(o, i, v);
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_getprop_8pyzoltan_4core_6carray_8IntArray_minimum(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8pyzoltan_4core_6carray_8IntArray_7minimum_1__get__(o);
}

static int __pyx_setprop_8pyzoltan_4core_6carray_8IntArray_minimum(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8pyzoltan_4core_6carray_8IntArray_7minimum_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8pyzoltan_4core_6carray_8IntArray_maximum(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8pyzoltan_4core_6carray_8IntArray_7maximum_1__get__(o);
}

static int __pyx_setprop_8pyzoltan_4core_6carray_8IntArray_maximum(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8pyzoltan_4core_6carray_8IntArray_7maximum_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_8pyzoltan_4core_6carray_IntArray[] = {
  {"index", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_9index, METH_O, __pyx_doc_8pyzoltan_4core_6carray_8IntArray_8index},
  {"__reduce__", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_13__reduce__, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_8IntArray_12__reduce__},
  {"__setstate__", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_15__setstate__, METH_O, __pyx_doc_8pyzoltan_4core_6carray_8IntArray_14__setstate__},
  {"get_c_type", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_17get_c_type, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_8IntArray_16get_c_type},
  {"get", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_19get, METH_O, __pyx_doc_8pyzoltan_4core_6carray_8IntArray_18get},
  {"set", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_21set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_8IntArray_20set},
  {"append", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_23append, METH_O, __pyx_doc_8pyzoltan_4core_6carray_8IntArray_22append},
  {"reserve", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_25reserve, METH_O, __pyx_doc_8pyzoltan_4core_6carray_8IntArray_24reserve},
  {"reset", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_27reset, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_8IntArray_26reset},
  {"resize", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_29resize, METH_O, __pyx_doc_8pyzoltan_4core_6carray_8IntArray_28resize},
  {"set_view", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_31set_view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_8IntArray_30set_view},
  {"squeeze", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_33squeeze, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_8IntArray_32squeeze},
  {"remove", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_35remove, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_8IntArray_34remove},
  {"extend", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_37extend, METH_O, __pyx_doc_8pyzoltan_4core_6carray_8IntArray_36extend},
  {"copy_values", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_39copy_values, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_8IntArray_38copy_values},
  {"copy_subset", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_41copy_subset, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_8IntArray_40copy_subset},
  {"update_min_max", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_8IntArray_43update_min_max, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_8IntArray_42update_min_max},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8pyzoltan_4core_6carray_IntArray[] = {
  {(char *)"minimum", __pyx_getprop_8pyzoltan_4core_6carray_8IntArray_minimum, __pyx_setprop_8pyzoltan_4core_6carray_8IntArray_minimum, __pyx_k_minimum_int, 0},
  {(char *)"maximum", __pyx_getprop_8pyzoltan_4core_6carray_8IntArray_maximum, __pyx_setprop_8pyzoltan_4core_6carray_8IntArray_maximum, __pyx_k_maximum_int, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_IntArray = {
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_27__len__, /*sq_length*/
  #else
  0, /*sq_length*/
  #endif
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_8pyzoltan_4core_6carray_IntArray, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_8pyzoltan_4core_6carray_8IntArray_11__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_IntArray = {
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_27__len__, /*mp_length*/
  #else
  0, /*mp_length*/
  #endif
  __pyx_pw_8pyzoltan_4core_6carray_8IntArray_5__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_8pyzoltan_4core_6carray_IntArray, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_8pyzoltan_4core_6carray_IntArray = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyzoltan.core.carray.IntArray", /*tp_name*/
  sizeof(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8pyzoltan_4core_6carray_IntArray, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_IntArray, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_IntArray, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Represents an array of `ints`\n\n    Mallocs a memory buffer of size (n*sizeof(int)) and sets up\n    the numpy array.  The memory is aligned to 64 byte boundaries.\n\n    Parameters\n    ----------\n\n    n : long\n        Length of the array.\n\n    Attributes\n    ----------\n    data: pointer\n        Pointer to an integer array.\n    length: long\n        Size of the array itself.\n    alloc: long\n        Size of the data buffer allocated.\n\n    Examples\n    --------\n\n    >>> x = IntArray()\n    >>> x.resize(5)\n    >>> x.set_data(np.arange(5))\n    >>> x[0]\n    0\n\n    >>> x = IntArray(5)\n    >>> xnp = x.get_npy_array()\n    >>> xnp[:] = np.arange(5)\n    >>> x[0], x[4]\n    (0.0, 4.0)\n\n    ", /*tp_doc*/
  __pyx_tp_traverse_8pyzoltan_4core_6carray_IntArray, /*tp_traverse*/
  __pyx_tp_clear_8pyzoltan_4core_6carray_IntArray, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_29__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_8pyzoltan_4core_6carray_IntArray, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8pyzoltan_4core_6carray_IntArray, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8pyzoltan_4core_6carray_IntArray, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_8pyzoltan_4core_6carray_UIntArray __pyx_vtable_8pyzoltan_4core_6carray_UIntArray;

static PyObject *__pyx_tp_new_8pyzoltan_4core_6carray_UIntArray(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *p;
  PyObject *o = __pyx_tp_new_8pyzoltan_4core_6carray_BaseArray(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8pyzoltan_4core_6carray_BaseArray*)__pyx_vtabptr_8pyzoltan_4core_6carray_UIntArray;
  p->_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8pyzoltan_4core_6carray_UIntArray(PyObject *o) {
  struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *p = (struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_8pyzoltan_4core_6carray_9UIntArray_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_parent);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_8pyzoltan_4core_6carray_BaseArray(o);
}

static int __pyx_tp_traverse_8pyzoltan_4core_6carray_UIntArray(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *p = (struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)o;
  e = __pyx_tp_traverse_8pyzoltan_4core_6carray_BaseArray(o, v, a); if (e) return e;
  if (p->_parent) {
    e = (*v)(((PyObject*)p->_parent), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8pyzoltan_4core_6carray_UIntArray(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *p = (struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)o;
  __pyx_tp_clear_8pyzoltan_4core_6carray_BaseArray(o);
  tmp = ((PyObject*)p->_parent);
  p->_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_8pyzoltan_4core_6carray_UIntArray(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_8pyzoltan_4core_6carray_UIntArray(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_8pyzoltan_4core_6carray_9UIntArray_7__setitem__(o, i, v);
  }
  else {
    if (__pyx_ptype_8pyzoltan_4core_6carray_BaseArray->tp_as_mapping && __pyx_ptype_8pyzoltan_4core_6carray_BaseArray->tp_as_mapping->mp_ass_subscript)
      return __pyx_ptype_8pyzoltan_4core_6carray_BaseArray->tp_as_mapping->mp_ass_subscript(o, i, v);
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_getprop_8pyzoltan_4core_6carray_9UIntArray_minimum(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8pyzoltan_4core_6carray_9UIntArray_7minimum_1__get__(o);
}

static int __pyx_setprop_8pyzoltan_4core_6carray_9UIntArray_minimum(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8pyzoltan_4core_6carray_9UIntArray_7minimum_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8pyzoltan_4core_6carray_9UIntArray_maximum(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8pyzoltan_4core_6carray_9UIntArray_7maximum_1__get__(o);
}

static int __pyx_setprop_8pyzoltan_4core_6carray_9UIntArray_maximum(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8pyzoltan_4core_6carray_9UIntArray_7maximum_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_8pyzoltan_4core_6carray_UIntArray[] = {
  {"index", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_9index, METH_O, __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_8index},
  {"__reduce__", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_13__reduce__, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_12__reduce__},
  {"__setstate__", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_15__setstate__, METH_O, __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_14__setstate__},
  {"get_c_type", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_17get_c_type, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_16get_c_type},
  {"get", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_19get, METH_O, __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_18get},
  {"set", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_21set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_20set},
  {"append", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_23append, METH_O, __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_22append},
  {"reserve", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_25reserve, METH_O, __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_24reserve},
  {"reset", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_27reset, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_26reset},
  {"resize", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_29resize, METH_O, __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_28resize},
  {"set_view", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_31set_view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_30set_view},
  {"squeeze", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_33squeeze, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_32squeeze},
  {"remove", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_35remove, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_34remove},
  {"extend", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_37extend, METH_O, __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_36extend},
  {"copy_values", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_39copy_values, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_38copy_values},
  {"copy_subset", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_41copy_subset, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_40copy_subset},
  {"update_min_max", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_9UIntArray_43update_min_max, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_42update_min_max},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8pyzoltan_4core_6carray_UIntArray[] = {
  {(char *)"minimum", __pyx_getprop_8pyzoltan_4core_6carray_9UIntArray_minimum, __pyx_setprop_8pyzoltan_4core_6carray_9UIntArray_minimum, __pyx_k_minimum_unsigned_int, 0},
  {(char *)"maximum", __pyx_getprop_8pyzoltan_4core_6carray_9UIntArray_maximum, __pyx_setprop_8pyzoltan_4core_6carray_9UIntArray_maximum, __pyx_k_maximum_unsigned_int, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_UIntArray = {
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_27__len__, /*sq_length*/
  #else
  0, /*sq_length*/
  #endif
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_8pyzoltan_4core_6carray_UIntArray, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_8pyzoltan_4core_6carray_9UIntArray_11__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_UIntArray = {
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_27__len__, /*mp_length*/
  #else
  0, /*mp_length*/
  #endif
  __pyx_pw_8pyzoltan_4core_6carray_9UIntArray_5__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_8pyzoltan_4core_6carray_UIntArray, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_8pyzoltan_4core_6carray_UIntArray = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyzoltan.core.carray.UIntArray", /*tp_name*/
  sizeof(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8pyzoltan_4core_6carray_UIntArray, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_UIntArray, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_UIntArray, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Represents an array of `unsigned ints`\n\n    Mallocs a memory buffer of size (n*sizeof(unsigned int)) and sets up\n    the numpy array.  The memory is aligned to 64 byte boundaries.\n\n    Parameters\n    ----------\n\n    n : long\n        Length of the array.\n\n    Attributes\n    ----------\n    data: pointer\n        Pointer to an integer array.\n    length: long\n        Size of the array itself.\n    alloc: long\n        Size of the data buffer allocated.\n\n    Examples\n    --------\n\n    >>> x = UIntArray()\n    >>> x.resize(5)\n    >>> x.set_data(np.arange(5))\n    >>> x[0]\n    0\n\n    >>> x = UIntArray(5)\n    >>> xnp = x.get_npy_array()\n    >>> xnp[:] = np.arange(5)\n    >>> x[0], x[4]\n    (0.0, 4.0)\n\n    ", /*tp_doc*/
  __pyx_tp_traverse_8pyzoltan_4core_6carray_UIntArray, /*tp_traverse*/
  __pyx_tp_clear_8pyzoltan_4core_6carray_UIntArray, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_29__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_8pyzoltan_4core_6carray_UIntArray, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8pyzoltan_4core_6carray_UIntArray, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8pyzoltan_4core_6carray_UIntArray, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_8pyzoltan_4core_6carray_FloatArray __pyx_vtable_8pyzoltan_4core_6carray_FloatArray;

static PyObject *__pyx_tp_new_8pyzoltan_4core_6carray_FloatArray(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *p;
  PyObject *o = __pyx_tp_new_8pyzoltan_4core_6carray_BaseArray(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8pyzoltan_4core_6carray_BaseArray*)__pyx_vtabptr_8pyzoltan_4core_6carray_FloatArray;
  p->_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8pyzoltan_4core_6carray_FloatArray(PyObject *o) {
  struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *p = (struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_8pyzoltan_4core_6carray_10FloatArray_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_parent);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_8pyzoltan_4core_6carray_BaseArray(o);
}

static int __pyx_tp_traverse_8pyzoltan_4core_6carray_FloatArray(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *p = (struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)o;
  e = __pyx_tp_traverse_8pyzoltan_4core_6carray_BaseArray(o, v, a); if (e) return e;
  if (p->_parent) {
    e = (*v)(((PyObject*)p->_parent), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8pyzoltan_4core_6carray_FloatArray(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *p = (struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)o;
  __pyx_tp_clear_8pyzoltan_4core_6carray_BaseArray(o);
  tmp = ((PyObject*)p->_parent);
  p->_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_8pyzoltan_4core_6carray_FloatArray(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_8pyzoltan_4core_6carray_FloatArray(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_8pyzoltan_4core_6carray_10FloatArray_7__setitem__(o, i, v);
  }
  else {
    if (__pyx_ptype_8pyzoltan_4core_6carray_BaseArray->tp_as_mapping && __pyx_ptype_8pyzoltan_4core_6carray_BaseArray->tp_as_mapping->mp_ass_subscript)
      return __pyx_ptype_8pyzoltan_4core_6carray_BaseArray->tp_as_mapping->mp_ass_subscript(o, i, v);
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_getprop_8pyzoltan_4core_6carray_10FloatArray_minimum(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8pyzoltan_4core_6carray_10FloatArray_7minimum_1__get__(o);
}

static int __pyx_setprop_8pyzoltan_4core_6carray_10FloatArray_minimum(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8pyzoltan_4core_6carray_10FloatArray_7minimum_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8pyzoltan_4core_6carray_10FloatArray_maximum(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8pyzoltan_4core_6carray_10FloatArray_7maximum_1__get__(o);
}

static int __pyx_setprop_8pyzoltan_4core_6carray_10FloatArray_maximum(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8pyzoltan_4core_6carray_10FloatArray_7maximum_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_8pyzoltan_4core_6carray_FloatArray[] = {
  {"index", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_9index, METH_O, __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_8index},
  {"__reduce__", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_13__reduce__, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_12__reduce__},
  {"__setstate__", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_15__setstate__, METH_O, __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_14__setstate__},
  {"get_c_type", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_17get_c_type, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_16get_c_type},
  {"get", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_19get, METH_O, __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_18get},
  {"set", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_21set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_20set},
  {"append", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_23append, METH_O, __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_22append},
  {"reserve", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_25reserve, METH_O, __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_24reserve},
  {"reset", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_27reset, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_26reset},
  {"resize", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_29resize, METH_O, __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_28resize},
  {"set_view", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_31set_view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_30set_view},
  {"squeeze", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_33squeeze, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_32squeeze},
  {"remove", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_35remove, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_34remove},
  {"extend", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_37extend, METH_O, __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_36extend},
  {"copy_values", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_39copy_values, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_38copy_values},
  {"copy_subset", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_41copy_subset, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_40copy_subset},
  {"update_min_max", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_10FloatArray_43update_min_max, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_42update_min_max},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8pyzoltan_4core_6carray_FloatArray[] = {
  {(char *)"minimum", __pyx_getprop_8pyzoltan_4core_6carray_10FloatArray_minimum, __pyx_setprop_8pyzoltan_4core_6carray_10FloatArray_minimum, __pyx_k_minimum_float, 0},
  {(char *)"maximum", __pyx_getprop_8pyzoltan_4core_6carray_10FloatArray_maximum, __pyx_setprop_8pyzoltan_4core_6carray_10FloatArray_maximum, __pyx_k_maximum_float, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_FloatArray = {
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_27__len__, /*sq_length*/
  #else
  0, /*sq_length*/
  #endif
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_8pyzoltan_4core_6carray_FloatArray, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_8pyzoltan_4core_6carray_10FloatArray_11__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_FloatArray = {
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_27__len__, /*mp_length*/
  #else
  0, /*mp_length*/
  #endif
  __pyx_pw_8pyzoltan_4core_6carray_10FloatArray_5__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_8pyzoltan_4core_6carray_FloatArray, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_8pyzoltan_4core_6carray_FloatArray = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyzoltan.core.carray.FloatArray", /*tp_name*/
  sizeof(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8pyzoltan_4core_6carray_FloatArray, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_FloatArray, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_FloatArray, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Represents an array of `floats`\n\n    Mallocs a memory buffer of size (n*sizeof(float)) and sets up\n    the numpy array.  The memory is aligned to 64 byte boundaries.\n\n    Parameters\n    ----------\n\n    n : long\n        Length of the array.\n\n    Attributes\n    ----------\n    data: pointer\n        Pointer to an integer array.\n    length: long\n        Size of the array itself.\n    alloc: long\n        Size of the data buffer allocated.\n\n    Examples\n    --------\n\n    >>> x = FloatArray()\n    >>> x.resize(5)\n    >>> x.set_data(np.arange(5))\n    >>> x[0]\n    0\n\n    >>> x = FloatArray(5)\n    >>> xnp = x.get_npy_array()\n    >>> xnp[:] = np.arange(5)\n    >>> x[0], x[4]\n    (0.0, 4.0)\n\n    ", /*tp_doc*/
  __pyx_tp_traverse_8pyzoltan_4core_6carray_FloatArray, /*tp_traverse*/
  __pyx_tp_clear_8pyzoltan_4core_6carray_FloatArray, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_29__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_8pyzoltan_4core_6carray_FloatArray, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8pyzoltan_4core_6carray_FloatArray, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8pyzoltan_4core_6carray_FloatArray, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_8pyzoltan_4core_6carray_DoubleArray __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray;

static PyObject *__pyx_tp_new_8pyzoltan_4core_6carray_DoubleArray(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *p;
  PyObject *o = __pyx_tp_new_8pyzoltan_4core_6carray_BaseArray(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8pyzoltan_4core_6carray_BaseArray*)__pyx_vtabptr_8pyzoltan_4core_6carray_DoubleArray;
  p->_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8pyzoltan_4core_6carray_DoubleArray(PyObject *o) {
  struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *p = (struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_parent);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_8pyzoltan_4core_6carray_BaseArray(o);
}

static int __pyx_tp_traverse_8pyzoltan_4core_6carray_DoubleArray(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *p = (struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)o;
  e = __pyx_tp_traverse_8pyzoltan_4core_6carray_BaseArray(o, v, a); if (e) return e;
  if (p->_parent) {
    e = (*v)(((PyObject*)p->_parent), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8pyzoltan_4core_6carray_DoubleArray(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *p = (struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)o;
  __pyx_tp_clear_8pyzoltan_4core_6carray_BaseArray(o);
  tmp = ((PyObject*)p->_parent);
  p->_parent = ((struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_8pyzoltan_4core_6carray_DoubleArray(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_8pyzoltan_4core_6carray_DoubleArray(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_7__setitem__(o, i, v);
  }
  else {
    if (__pyx_ptype_8pyzoltan_4core_6carray_BaseArray->tp_as_mapping && __pyx_ptype_8pyzoltan_4core_6carray_BaseArray->tp_as_mapping->mp_ass_subscript)
      return __pyx_ptype_8pyzoltan_4core_6carray_BaseArray->tp_as_mapping->mp_ass_subscript(o, i, v);
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_getprop_8pyzoltan_4core_6carray_11DoubleArray_minimum(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_7minimum_1__get__(o);
}

static int __pyx_setprop_8pyzoltan_4core_6carray_11DoubleArray_minimum(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_7minimum_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8pyzoltan_4core_6carray_11DoubleArray_maximum(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_7maximum_1__get__(o);
}

static int __pyx_setprop_8pyzoltan_4core_6carray_11DoubleArray_maximum(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_7maximum_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_8pyzoltan_4core_6carray_DoubleArray[] = {
  {"index", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_9index, METH_O, __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_8index},
  {"__reduce__", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_13__reduce__, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_12__reduce__},
  {"__setstate__", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_15__setstate__, METH_O, __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_14__setstate__},
  {"get_c_type", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_17get_c_type, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_16get_c_type},
  {"get", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_19get, METH_O, __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_18get},
  {"set", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_21set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_20set},
  {"append", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_23append, METH_O, __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_22append},
  {"reserve", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_25reserve, METH_O, __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_24reserve},
  {"reset", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_27reset, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_26reset},
  {"resize", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_29resize, METH_O, __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_28resize},
  {"set_view", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_31set_view, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_30set_view},
  {"squeeze", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_33squeeze, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_32squeeze},
  {"remove", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_35remove, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_34remove},
  {"extend", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_37extend, METH_O, __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_36extend},
  {"copy_values", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_39copy_values, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_38copy_values},
  {"copy_subset", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_41copy_subset, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_40copy_subset},
  {"update_min_max", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_43update_min_max, METH_NOARGS, __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_42update_min_max},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8pyzoltan_4core_6carray_DoubleArray[] = {
  {(char *)"minimum", __pyx_getprop_8pyzoltan_4core_6carray_11DoubleArray_minimum, __pyx_setprop_8pyzoltan_4core_6carray_11DoubleArray_minimum, __pyx_k_minimum_double, 0},
  {(char *)"maximum", __pyx_getprop_8pyzoltan_4core_6carray_11DoubleArray_maximum, __pyx_setprop_8pyzoltan_4core_6carray_11DoubleArray_maximum, __pyx_k_maximum_double, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_DoubleArray = {
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_27__len__, /*sq_length*/
  #else
  0, /*sq_length*/
  #endif
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_8pyzoltan_4core_6carray_DoubleArray, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_11__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_DoubleArray = {
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_27__len__, /*mp_length*/
  #else
  0, /*mp_length*/
  #endif
  __pyx_pw_8pyzoltan_4core_6carray_11DoubleArray_5__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_8pyzoltan_4core_6carray_DoubleArray, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_8pyzoltan_4core_6carray_DoubleArray = {
  PyVarObject_HEAD_INIT(0, 0)
  "pyzoltan.core.carray.DoubleArray", /*tp_name*/
  sizeof(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8pyzoltan_4core_6carray_DoubleArray, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_DoubleArray, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_DoubleArray, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Represents an array of `doubles`\n\n    Mallocs a memory buffer of size (n*sizeof(double)) and sets up\n    the numpy array.  The memory is aligned to 64 byte boundaries.\n\n    Parameters\n    ----------\n\n    n : long\n        Length of the array.\n\n    Attributes\n    ----------\n    data: pointer\n        Pointer to an integer array.\n    length: long\n        Size of the array itself.\n    alloc: long\n        Size of the data buffer allocated.\n\n    Examples\n    --------\n\n    >>> x = DoubleArray()\n    >>> x.resize(5)\n    >>> x.set_data(np.arange(5))\n    >>> x[0]\n    0\n\n    >>> x = DoubleArray(5)\n    >>> xnp = x.get_npy_array()\n    >>> xnp[:] = np.arange(5)\n    >>> x[0], x[4]\n    (0.0, 4.0)\n\n    ", /*tp_doc*/
  __pyx_tp_traverse_8pyzoltan_4core_6carray_DoubleArray, /*tp_traverse*/
  __pyx_tp_clear_8pyzoltan_4core_6carray_DoubleArray, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_8pyzoltan_4core_6carray_9BaseArray_29__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_8pyzoltan_4core_6carray_DoubleArray, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8pyzoltan_4core_6carray_DoubleArray, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8pyzoltan_4core_6carray_DoubleArray, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {"py_aligned", (PyCFunction)__pyx_pw_8pyzoltan_4core_6carray_1py_aligned, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pyzoltan_4core_6carray_py_aligned},
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
  #if PY_VERSION_HEX < 0x03020000
    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  #else
    PyModuleDef_HEAD_INIT,
  #endif
    "carray",
    __pyx_k_Implementation_of_resizeable_ar, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_BaseArray_copy_subset, __pyx_k_BaseArray_copy_subset, sizeof(__pyx_k_BaseArray_copy_subset), 0, 0, 1, 0},
  {&__pyx_kp_s_BaseArray_copy_values, __pyx_k_BaseArray_copy_values, sizeof(__pyx_k_BaseArray_copy_values), 0, 0, 1, 0},
  {&__pyx_kp_s_BaseArray_extend, __pyx_k_BaseArray_extend, sizeof(__pyx_k_BaseArray_extend), 0, 0, 1, 0},
  {&__pyx_kp_s_BaseArray_get_c_type, __pyx_k_BaseArray_get_c_type, sizeof(__pyx_k_BaseArray_get_c_type), 0, 0, 1, 0},
  {&__pyx_kp_s_BaseArray_remove, __pyx_k_BaseArray_remove, sizeof(__pyx_k_BaseArray_remove), 0, 0, 1, 0},
  {&__pyx_kp_s_BaseArray_reserve, __pyx_k_BaseArray_reserve, sizeof(__pyx_k_BaseArray_reserve), 0, 0, 1, 0},
  {&__pyx_kp_s_BaseArray_reset, __pyx_k_BaseArray_reset, sizeof(__pyx_k_BaseArray_reset), 0, 0, 1, 0},
  {&__pyx_kp_s_BaseArray_resize, __pyx_k_BaseArray_resize, sizeof(__pyx_k_BaseArray_resize), 0, 0, 1, 0},
  {&__pyx_kp_s_BaseArray_squeeze, __pyx_k_BaseArray_squeeze, sizeof(__pyx_k_BaseArray_squeeze), 0, 0, 1, 0},
  {&__pyx_kp_s_BaseArray_update_min_max, __pyx_k_BaseArray_update_min_max, sizeof(__pyx_k_BaseArray_update_min_max), 0, 0, 1, 0},
  {&__pyx_kp_s_Cannot_extend_array_which_is_a_v, __pyx_k_Cannot_extend_array_which_is_a_v, sizeof(__pyx_k_Cannot_extend_array_which_is_a_v), 0, 0, 1, 0},
  {&__pyx_kp_s_Cannot_reize_array_which_is_a_vi, __pyx_k_Cannot_reize_array_which_is_a_vi, sizeof(__pyx_k_Cannot_reize_array_which_is_a_vi), 0, 0, 1, 0},
  {&__pyx_kp_s_Cannot_remove_elements_from_view, __pyx_k_Cannot_remove_elements_from_view, sizeof(__pyx_k_Cannot_remove_elements_from_view), 0, 0, 1, 0},
  {&__pyx_kp_s_Cannot_squeeze_array_which_is_a, __pyx_k_Cannot_squeeze_array_which_is_a, sizeof(__pyx_k_Cannot_squeeze_array_which_is_a), 0, 0, 1, 0},
  {&__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_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 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_kp_s_Not_enough_values_in_source, __pyx_k_Not_enough_values_in_source, sizeof(__pyx_k_Not_enough_values_in_source), 0, 0, 1, 0},
  {&__pyx_kp_s_Passed_pointer_is_not_aligned, __pyx_k_Passed_pointer_is_not_aligned, sizeof(__pyx_k_Passed_pointer_is_not_aligned), 0, 0, 1, 0},
  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  {&__pyx_kp_s_Source_length_should_be_same_as, __pyx_k_Source_length_should_be_same_as, sizeof(__pyx_k_Source_length_should_be_same_as), 0, 0, 1, 0},
  {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1},
  {&__pyx_kp_s_Unequal_array_lengths, __pyx_k_Unequal_array_lengths, sizeof(__pyx_k_Unequal_array_lengths), 0, 0, 1, 0},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_n_s_align_array, __pyx_k_align_array, sizeof(__pyx_k_align_array), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_arr, __pyx_k_arr, sizeof(__pyx_k_arr), 0, 0, 1, 1},
  {&__pyx_kp_s_array_size_mismatch, __pyx_k_array_size_mismatch, sizeof(__pyx_k_array_size_mismatch), 0, 0, 1, 0},
  {&__pyx_n_s_copy_subset, __pyx_k_copy_subset, sizeof(__pyx_k_copy_subset), 0, 0, 1, 1},
  {&__pyx_n_s_copy_values, __pyx_k_copy_values, sizeof(__pyx_k_copy_values), 0, 0, 1, 1},
  {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
  {&__pyx_n_s_dest, __pyx_k_dest, sizeof(__pyx_k_dest), 0, 0, 1, 1},
  {&__pyx_n_s_double, __pyx_k_double, sizeof(__pyx_k_double), 0, 0, 1, 1},
  {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
  {&__pyx_n_s_end_index, __pyx_k_end_index, sizeof(__pyx_k_end_index), 0, 0, 1, 1},
  {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
  {&__pyx_n_s_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 0, 0, 1, 1},
  {&__pyx_n_s_float, __pyx_k_float, sizeof(__pyx_k_float), 0, 0, 1, 1},
  {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
  {&__pyx_n_s_getLogger, __pyx_k_getLogger, sizeof(__pyx_k_getLogger), 0, 0, 1, 1},
  {&__pyx_n_s_get_c_type, __pyx_k_get_c_type, sizeof(__pyx_k_get_c_type), 0, 0, 1, 1},
  {&__pyx_n_s_get_npy_array, __pyx_k_get_npy_array, sizeof(__pyx_k_get_npy_array), 0, 0, 1, 1},
  {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
  {&__pyx_n_s_index_list, __pyx_k_index_list, sizeof(__pyx_k_index_list), 0, 0, 1, 1},
  {&__pyx_n_s_indices, __pyx_k_indices, sizeof(__pyx_k_indices), 0, 0, 1, 1},
  {&__pyx_n_s_input_sorted, __pyx_k_input_sorted, sizeof(__pyx_k_input_sorted), 0, 0, 1, 1},
  {&__pyx_n_s_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 0, 1, 1},
  {&__pyx_n_s_item_size, __pyx_k_item_size, sizeof(__pyx_k_item_size), 0, 0, 1, 1},
  {&__pyx_n_s_logger, __pyx_k_logger, sizeof(__pyx_k_logger), 0, 0, 1, 1},
  {&__pyx_n_s_logging, __pyx_k_logging, sizeof(__pyx_k_logging), 0, 0, 1, 1},
  {&__pyx_n_s_long, __pyx_k_long, sizeof(__pyx_k_long), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 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_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  {&__pyx_n_s_parent, __pyx_k_parent, sizeof(__pyx_k_parent), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_remove, __pyx_k_remove, sizeof(__pyx_k_remove), 0, 0, 1, 1},
  {&__pyx_n_s_reserve, __pyx_k_reserve, sizeof(__pyx_k_reserve), 0, 0, 1, 1},
  {&__pyx_n_s_reset, __pyx_k_reset, sizeof(__pyx_k_reset), 0, 0, 1, 1},
  {&__pyx_n_s_resize, __pyx_k_resize, sizeof(__pyx_k_resize), 0, 0, 1, 1},
  {&__pyx_n_s_set, __pyx_k_set, sizeof(__pyx_k_set), 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_view, __pyx_k_set_view, sizeof(__pyx_k_set_view), 0, 0, 1, 1},
  {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
  {&__pyx_n_s_sort, __pyx_k_sort, sizeof(__pyx_k_sort), 0, 0, 1, 1},
  {&__pyx_n_s_source, __pyx_k_source, sizeof(__pyx_k_source), 0, 0, 1, 1},
  {&__pyx_n_s_squeeze, __pyx_k_squeeze, sizeof(__pyx_k_squeeze), 0, 0, 1, 1},
  {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  {&__pyx_n_s_start_index, __pyx_k_start_index, sizeof(__pyx_k_start_index), 0, 0, 1, 1},
  {&__pyx_kp_s_start_index_beyond_array_length, __pyx_k_start_index_beyond_array_length, sizeof(__pyx_k_start_index_beyond_array_length), 0, 0, 1, 0},
  {&__pyx_kp_s_start_index_d_end_index_d, __pyx_k_start_index_d_end_index_d, sizeof(__pyx_k_start_index_d_end_index_d), 0, 0, 1, 0},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 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_kp_s_unsigned_int, __pyx_k_unsigned_int, sizeof(__pyx_k_unsigned_int), 0, 0, 1, 0},
  {&__pyx_n_s_update_min_max, __pyx_k_update_min_max, sizeof(__pyx_k_update_min_max), 0, 0, 1, 1},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "pyzoltan/core/carray.pyx":125
 *     if <void*>(<uintptr_t>(base+cache_size)&-(cache_size)) != ptr:
 *         with gil:
 *             raise MemoryError("Passed pointer is not aligned.")             # <<<<<<<<<<<<<<
 *     return <void*>base
 * 
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Passed_pointer_is_not_aligned); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "pyzoltan/core/carray.pyx":531
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot reize array which is a view.')             # <<<<<<<<<<<<<<
 * 
 *         self.c_resize(size)
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Cannot_reize_array_which_is_a_vi); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "pyzoltan/core/carray.pyx":565
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot squeeze array which is a view.')             # <<<<<<<<<<<<<<
 * 
 *         self.c_squeeze()
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Cannot_squeeze_array_which_is_a); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "pyzoltan/core/carray.pyx":591
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot remove elements from view array.')             # <<<<<<<<<<<<<<
 *         cdef long i
 *         cdef long inlength = index_list.size
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_Cannot_remove_elements_from_view); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "pyzoltan/core/carray.pyx":630
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot extend array which is a view.')             # <<<<<<<<<<<<<<
 *         cdef long len = in_array.size
 *         cdef long i
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_Cannot_extend_array_which_is_a_v); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "pyzoltan/core/carray.pyx":996
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot reize array which is a view.')             # <<<<<<<<<<<<<<
 * 
 *         self.c_resize(size)
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_Cannot_reize_array_which_is_a_vi); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "pyzoltan/core/carray.pyx":1030
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot squeeze array which is a view.')             # <<<<<<<<<<<<<<
 * 
 *         self.c_squeeze()
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Cannot_squeeze_array_which_is_a); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "pyzoltan/core/carray.pyx":1056
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot remove elements from view array.')             # <<<<<<<<<<<<<<
 *         cdef long i
 *         cdef long inlength = index_list.size
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Cannot_remove_elements_from_view); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "pyzoltan/core/carray.pyx":1095
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot extend array which is a view.')             # <<<<<<<<<<<<<<
 *         cdef long len = in_array.size
 *         cdef long i
 */
  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_Cannot_extend_array_which_is_a_v); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "pyzoltan/core/carray.pyx":1461
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot reize array which is a view.')             # <<<<<<<<<<<<<<
 * 
 *         self.c_resize(size)
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Cannot_reize_array_which_is_a_vi); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "pyzoltan/core/carray.pyx":1495
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot squeeze array which is a view.')             # <<<<<<<<<<<<<<
 * 
 *         self.c_squeeze()
 */
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Cannot_squeeze_array_which_is_a); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "pyzoltan/core/carray.pyx":1521
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot remove elements from view array.')             # <<<<<<<<<<<<<<
 *         cdef long i
 *         cdef long inlength = index_list.size
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Cannot_remove_elements_from_view); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "pyzoltan/core/carray.pyx":1560
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot extend array which is a view.')             # <<<<<<<<<<<<<<
 *         cdef long len = in_array.size
 *         cdef long i
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Cannot_extend_array_which_is_a_v); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "pyzoltan/core/carray.pyx":1926
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot reize array which is a view.')             # <<<<<<<<<<<<<<
 * 
 *         self.c_resize(size)
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Cannot_reize_array_which_is_a_vi); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "pyzoltan/core/carray.pyx":1960
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot squeeze array which is a view.')             # <<<<<<<<<<<<<<
 * 
 *         self.c_squeeze()
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Cannot_squeeze_array_which_is_a); if (unlikely(!__pyx_tuple__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "pyzoltan/core/carray.pyx":1986
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot remove elements from view array.')             # <<<<<<<<<<<<<<
 *         cdef long i
 *         cdef long inlength = index_list.size
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Cannot_remove_elements_from_view); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "pyzoltan/core/carray.pyx":2025
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot extend array which is a view.')             # <<<<<<<<<<<<<<
 *         cdef long len = in_array.size
 *         cdef long i
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Cannot_extend_array_which_is_a_v); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "pyzoltan/core/carray.pyx":2391
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot reize array which is a view.')             # <<<<<<<<<<<<<<
 * 
 *         self.c_resize(size)
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Cannot_reize_array_which_is_a_vi); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "pyzoltan/core/carray.pyx":2425
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot squeeze array which is a view.')             # <<<<<<<<<<<<<<
 * 
 *         self.c_squeeze()
 */
  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Cannot_squeeze_array_which_is_a); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "pyzoltan/core/carray.pyx":2451
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot remove elements from view array.')             # <<<<<<<<<<<<<<
 *         cdef long i
 *         cdef long inlength = index_list.size
 */
  __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Cannot_remove_elements_from_view); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "pyzoltan/core/carray.pyx":2490
 *         """
 *         if self._old_data != NULL:
 *             raise RuntimeError('Cannot extend array which is a view.')             # <<<<<<<<<<<<<<
 *         cdef long len = in_array.size
 *         cdef long i
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Cannot_extend_array_which_is_a_v); if (unlikely(!__pyx_tuple__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":218
 *             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__22 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":222
 *             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__23 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__23)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":260
 *                 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__24 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__24)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":802
 * 
 *         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__25 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__25)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":806
 *         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__26 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__26)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":826
 *             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__27 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initcarray(void); /*proto*/
PyMODINIT_FUNC initcarray(void)
#else
PyMODINIT_FUNC PyInit_carray(void); /*proto*/
PyMODINIT_FUNC PyInit_carray(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #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("PyMODINIT_FUNC PyInit_carray(void)", 0);
  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __Pyx_CyFunction_USED
  if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __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 PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("carray", __pyx_methods, __pyx_k_Implementation_of_resizeable_ar, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  if (__pyx_module_is_main_pyzoltan__core__carray) {
    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!PyDict_GetItemString(modules, "pyzoltan.core.carray")) {
      if (unlikely(PyDict_SetItemString(modules, "pyzoltan.core.carray", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  if (__Pyx_ExportFunction("aligned", (void (*)(void))__pyx_f_8pyzoltan_4core_6carray_aligned, "long (long, int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("aligned_malloc", (void (*)(void))__pyx_f_8pyzoltan_4core_6carray_aligned_malloc, "void *(size_t)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("aligned_realloc", (void (*)(void))__pyx_f_8pyzoltan_4core_6carray_aligned_realloc, "void *(void *, size_t, size_t)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ExportFunction("aligned_free", (void (*)(void))__pyx_f_8pyzoltan_4core_6carray_aligned_free, "void (void *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Type init code ---*/
  __pyx_vtabptr_8pyzoltan_4core_6carray_BaseArray = &__pyx_vtable_8pyzoltan_4core_6carray_BaseArray;
  __pyx_vtable_8pyzoltan_4core_6carray_BaseArray.c_align_array = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *))__pyx_f_8pyzoltan_4core_6carray_9BaseArray_c_align_array;
  __pyx_vtable_8pyzoltan_4core_6carray_BaseArray.c_reserve = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long))__pyx_f_8pyzoltan_4core_6carray_9BaseArray_c_reserve;
  __pyx_vtable_8pyzoltan_4core_6carray_BaseArray.c_reset = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *))__pyx_f_8pyzoltan_4core_6carray_9BaseArray_c_reset;
  __pyx_vtable_8pyzoltan_4core_6carray_BaseArray.c_resize = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long))__pyx_f_8pyzoltan_4core_6carray_9BaseArray_c_resize;
  __pyx_vtable_8pyzoltan_4core_6carray_BaseArray.c_squeeze = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *))__pyx_f_8pyzoltan_4core_6carray_9BaseArray_c_squeeze;
  __pyx_vtable_8pyzoltan_4core_6carray_BaseArray.reserve = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9BaseArray_reserve;
  __pyx_vtable_8pyzoltan_4core_6carray_BaseArray.resize = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9BaseArray_resize;
  __pyx_vtable_8pyzoltan_4core_6carray_BaseArray.get_npy_array = (PyArrayObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9BaseArray_get_npy_array;
  __pyx_vtable_8pyzoltan_4core_6carray_BaseArray.set_data = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9BaseArray_set_data;
  __pyx_vtable_8pyzoltan_4core_6carray_BaseArray.squeeze = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9BaseArray_squeeze;
  __pyx_vtable_8pyzoltan_4core_6carray_BaseArray.remove = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_remove *__pyx_optional_args))__pyx_f_8pyzoltan_4core_6carray_9BaseArray_remove;
  __pyx_vtable_8pyzoltan_4core_6carray_BaseArray.extend = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9BaseArray_extend;
  __pyx_vtable_8pyzoltan_4core_6carray_BaseArray.reset = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9BaseArray_reset;
  __pyx_vtable_8pyzoltan_4core_6carray_BaseArray.align_array = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9BaseArray_align_array;
  __pyx_vtable_8pyzoltan_4core_6carray_BaseArray.get_c_type = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9BaseArray_get_c_type;
  __pyx_vtable_8pyzoltan_4core_6carray_BaseArray.copy_values = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9BaseArray_copy_values;
  __pyx_vtable_8pyzoltan_4core_6carray_BaseArray.copy_subset = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_copy_subset *__pyx_optional_args))__pyx_f_8pyzoltan_4core_6carray_9BaseArray_copy_subset;
  __pyx_vtable_8pyzoltan_4core_6carray_BaseArray.update_min_max = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9BaseArray_update_min_max;
  if (PyType_Ready(&__pyx_type_8pyzoltan_4core_6carray_BaseArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_8pyzoltan_4core_6carray_BaseArray.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_8pyzoltan_4core_6carray_BaseArray, "__iter__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_8pyzoltan_4core_6carray_9BaseArray_28__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_8pyzoltan_4core_6carray_9BaseArray_28__iter__.doc = __pyx_doc_8pyzoltan_4core_6carray_9BaseArray_28__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_8pyzoltan_4core_6carray_9BaseArray_28__iter__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_8pyzoltan_4core_6carray_BaseArray.tp_dict, __pyx_vtabptr_8pyzoltan_4core_6carray_BaseArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyObject_SetAttrString(__pyx_m, "BaseArray", (PyObject *)&__pyx_type_8pyzoltan_4core_6carray_BaseArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_8pyzoltan_4core_6carray_BaseArray = &__pyx_type_8pyzoltan_4core_6carray_BaseArray;
  __pyx_vtabptr_8pyzoltan_4core_6carray_LongArray = &__pyx_vtable_8pyzoltan_4core_6carray_LongArray;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.__pyx_base = *__pyx_vtabptr_8pyzoltan_4core_6carray_BaseArray;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.__pyx_base.c_align_array = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *))__pyx_f_8pyzoltan_4core_6carray_9LongArray_c_align_array;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.__pyx_base.c_reserve = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long))__pyx_f_8pyzoltan_4core_6carray_9LongArray_c_reserve;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.__pyx_base.c_reset = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *))__pyx_f_8pyzoltan_4core_6carray_9LongArray_c_reset;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.__pyx_base.c_resize = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long))__pyx_f_8pyzoltan_4core_6carray_9LongArray_c_resize;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.__pyx_base.c_squeeze = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *))__pyx_f_8pyzoltan_4core_6carray_9LongArray_c_squeeze;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.__pyx_base.reserve = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9LongArray_reserve;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.__pyx_base.resize = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9LongArray_resize;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.__pyx_base.squeeze = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9LongArray_squeeze;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.__pyx_base.remove = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_remove *__pyx_optional_args))__pyx_f_8pyzoltan_4core_6carray_9LongArray_remove;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.__pyx_base.extend = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9LongArray_extend;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.__pyx_base.reset = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9LongArray_reset;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.__pyx_base.get_c_type = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9LongArray_get_c_type;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.__pyx_base.copy_values = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9LongArray_copy_values;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.__pyx_base.copy_subset = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_copy_subset *__pyx_optional_args))__pyx_f_8pyzoltan_4core_6carray_9LongArray_copy_subset;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.__pyx_base.update_min_max = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9LongArray_update_min_max;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray._setup_npy_array = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *))__pyx_f_8pyzoltan_4core_6carray_9LongArray__setup_npy_array;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.c_append = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, long))__pyx_f_8pyzoltan_4core_6carray_9LongArray_c_append;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.c_set_view = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, long *, long))__pyx_f_8pyzoltan_4core_6carray_9LongArray_c_set_view;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.get_data_ptr = (long *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *))__pyx_f_8pyzoltan_4core_6carray_9LongArray_get_data_ptr;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.get = (long (*)(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9LongArray_get;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.set = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, long, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9LongArray_set;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.append = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9LongArray_append;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.set_view = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, long, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9LongArray_set_view;
  __pyx_vtable_8pyzoltan_4core_6carray_LongArray.index = (long (*)(struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9LongArray_index;
  __pyx_type_8pyzoltan_4core_6carray_LongArray.tp_base = __pyx_ptype_8pyzoltan_4core_6carray_BaseArray;
  if (PyType_Ready(&__pyx_type_8pyzoltan_4core_6carray_LongArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_8pyzoltan_4core_6carray_LongArray.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_8pyzoltan_4core_6carray_LongArray, "__getitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_8pyzoltan_4core_6carray_9LongArray_4__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_8pyzoltan_4core_6carray_9LongArray_4__getitem__.doc = __pyx_doc_8pyzoltan_4core_6carray_9LongArray_4__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_8pyzoltan_4core_6carray_9LongArray_4__getitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_8pyzoltan_4core_6carray_LongArray, "__setitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_8pyzoltan_4core_6carray_9LongArray_6__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_8pyzoltan_4core_6carray_9LongArray_6__setitem__.doc = __pyx_doc_8pyzoltan_4core_6carray_9LongArray_6__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_8pyzoltan_4core_6carray_9LongArray_6__setitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_8pyzoltan_4core_6carray_LongArray, "__contains__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_8pyzoltan_4core_6carray_9LongArray_10__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_8pyzoltan_4core_6carray_9LongArray_10__contains__.doc = __pyx_doc_8pyzoltan_4core_6carray_9LongArray_10__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_8pyzoltan_4core_6carray_9LongArray_10__contains__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_8pyzoltan_4core_6carray_LongArray.tp_dict, __pyx_vtabptr_8pyzoltan_4core_6carray_LongArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyObject_SetAttrString(__pyx_m, "LongArray", (PyObject *)&__pyx_type_8pyzoltan_4core_6carray_LongArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_8pyzoltan_4core_6carray_LongArray = &__pyx_type_8pyzoltan_4core_6carray_LongArray;
  if (PyType_Ready(&__pyx_type_8pyzoltan_4core_6carray_BaseArrayIter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_8pyzoltan_4core_6carray_BaseArrayIter.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "BaseArrayIter", (PyObject *)&__pyx_type_8pyzoltan_4core_6carray_BaseArrayIter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_8pyzoltan_4core_6carray_BaseArrayIter = &__pyx_type_8pyzoltan_4core_6carray_BaseArrayIter;
  __pyx_vtabptr_8pyzoltan_4core_6carray_IntArray = &__pyx_vtable_8pyzoltan_4core_6carray_IntArray;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.__pyx_base = *__pyx_vtabptr_8pyzoltan_4core_6carray_BaseArray;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.__pyx_base.c_align_array = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *))__pyx_f_8pyzoltan_4core_6carray_8IntArray_c_align_array;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.__pyx_base.c_reserve = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long))__pyx_f_8pyzoltan_4core_6carray_8IntArray_c_reserve;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.__pyx_base.c_reset = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *))__pyx_f_8pyzoltan_4core_6carray_8IntArray_c_reset;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.__pyx_base.c_resize = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long))__pyx_f_8pyzoltan_4core_6carray_8IntArray_c_resize;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.__pyx_base.c_squeeze = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *))__pyx_f_8pyzoltan_4core_6carray_8IntArray_c_squeeze;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.__pyx_base.reserve = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_8IntArray_reserve;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.__pyx_base.resize = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_8IntArray_resize;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.__pyx_base.squeeze = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_8IntArray_squeeze;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.__pyx_base.remove = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_remove *__pyx_optional_args))__pyx_f_8pyzoltan_4core_6carray_8IntArray_remove;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.__pyx_base.extend = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_8IntArray_extend;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.__pyx_base.reset = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_8IntArray_reset;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.__pyx_base.get_c_type = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_8IntArray_get_c_type;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.__pyx_base.copy_values = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_8IntArray_copy_values;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.__pyx_base.copy_subset = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_copy_subset *__pyx_optional_args))__pyx_f_8pyzoltan_4core_6carray_8IntArray_copy_subset;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.__pyx_base.update_min_max = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_8IntArray_update_min_max;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray._setup_npy_array = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *))__pyx_f_8pyzoltan_4core_6carray_8IntArray__setup_npy_array;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.c_append = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *, int))__pyx_f_8pyzoltan_4core_6carray_8IntArray_c_append;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.c_set_view = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *, int *, long))__pyx_f_8pyzoltan_4core_6carray_8IntArray_c_set_view;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.get_data_ptr = (int *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *))__pyx_f_8pyzoltan_4core_6carray_8IntArray_get_data_ptr;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.get = (int (*)(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_8IntArray_get;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.set = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *, long, int, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_8IntArray_set;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.append = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *, int, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_8IntArray_append;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.set_view = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *, struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *, long, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_8IntArray_set_view;
  __pyx_vtable_8pyzoltan_4core_6carray_IntArray.index = (long (*)(struct __pyx_obj_8pyzoltan_4core_6carray_IntArray *, int, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_8IntArray_index;
  __pyx_type_8pyzoltan_4core_6carray_IntArray.tp_base = __pyx_ptype_8pyzoltan_4core_6carray_BaseArray;
  if (PyType_Ready(&__pyx_type_8pyzoltan_4core_6carray_IntArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_8pyzoltan_4core_6carray_IntArray.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_8pyzoltan_4core_6carray_IntArray, "__getitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_8pyzoltan_4core_6carray_8IntArray_4__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_8pyzoltan_4core_6carray_8IntArray_4__getitem__.doc = __pyx_doc_8pyzoltan_4core_6carray_8IntArray_4__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_8pyzoltan_4core_6carray_8IntArray_4__getitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_8pyzoltan_4core_6carray_IntArray, "__setitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_8pyzoltan_4core_6carray_8IntArray_6__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_8pyzoltan_4core_6carray_8IntArray_6__setitem__.doc = __pyx_doc_8pyzoltan_4core_6carray_8IntArray_6__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_8pyzoltan_4core_6carray_8IntArray_6__setitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_8pyzoltan_4core_6carray_IntArray, "__contains__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_8pyzoltan_4core_6carray_8IntArray_10__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_8pyzoltan_4core_6carray_8IntArray_10__contains__.doc = __pyx_doc_8pyzoltan_4core_6carray_8IntArray_10__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_8pyzoltan_4core_6carray_8IntArray_10__contains__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_8pyzoltan_4core_6carray_IntArray.tp_dict, __pyx_vtabptr_8pyzoltan_4core_6carray_IntArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyObject_SetAttrString(__pyx_m, "IntArray", (PyObject *)&__pyx_type_8pyzoltan_4core_6carray_IntArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_8pyzoltan_4core_6carray_IntArray = &__pyx_type_8pyzoltan_4core_6carray_IntArray;
  __pyx_vtabptr_8pyzoltan_4core_6carray_UIntArray = &__pyx_vtable_8pyzoltan_4core_6carray_UIntArray;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.__pyx_base = *__pyx_vtabptr_8pyzoltan_4core_6carray_BaseArray;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.__pyx_base.c_align_array = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_align_array;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.__pyx_base.c_reserve = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_reserve;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.__pyx_base.c_reset = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_reset;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.__pyx_base.c_resize = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_resize;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.__pyx_base.c_squeeze = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_squeeze;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.__pyx_base.reserve = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_reserve;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.__pyx_base.resize = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_resize;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.__pyx_base.squeeze = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_squeeze;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.__pyx_base.remove = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_remove *__pyx_optional_args))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_remove;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.__pyx_base.extend = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_extend;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.__pyx_base.reset = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_reset;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.__pyx_base.get_c_type = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_get_c_type;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.__pyx_base.copy_values = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_copy_values;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.__pyx_base.copy_subset = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_copy_subset *__pyx_optional_args))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_copy_subset;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.__pyx_base.update_min_max = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_update_min_max;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray._setup_npy_array = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *))__pyx_f_8pyzoltan_4core_6carray_9UIntArray__setup_npy_array;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.c_append = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *, unsigned int))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_append;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.c_set_view = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *, unsigned int *, long))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_c_set_view;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.get_data_ptr = (unsigned int *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_get_data_ptr;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.get = (unsigned int (*)(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_get;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.set = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *, long, unsigned int, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_set;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.append = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *, unsigned int, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_append;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.set_view = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *, struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *, long, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_set_view;
  __pyx_vtable_8pyzoltan_4core_6carray_UIntArray.index = (long (*)(struct __pyx_obj_8pyzoltan_4core_6carray_UIntArray *, unsigned int, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_9UIntArray_index;
  __pyx_type_8pyzoltan_4core_6carray_UIntArray.tp_base = __pyx_ptype_8pyzoltan_4core_6carray_BaseArray;
  if (PyType_Ready(&__pyx_type_8pyzoltan_4core_6carray_UIntArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_8pyzoltan_4core_6carray_UIntArray.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_8pyzoltan_4core_6carray_UIntArray, "__getitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_8pyzoltan_4core_6carray_9UIntArray_4__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_8pyzoltan_4core_6carray_9UIntArray_4__getitem__.doc = __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_4__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_8pyzoltan_4core_6carray_9UIntArray_4__getitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_8pyzoltan_4core_6carray_UIntArray, "__setitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_8pyzoltan_4core_6carray_9UIntArray_6__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_8pyzoltan_4core_6carray_9UIntArray_6__setitem__.doc = __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_6__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_8pyzoltan_4core_6carray_9UIntArray_6__setitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_8pyzoltan_4core_6carray_UIntArray, "__contains__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_8pyzoltan_4core_6carray_9UIntArray_10__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_8pyzoltan_4core_6carray_9UIntArray_10__contains__.doc = __pyx_doc_8pyzoltan_4core_6carray_9UIntArray_10__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_8pyzoltan_4core_6carray_9UIntArray_10__contains__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_8pyzoltan_4core_6carray_UIntArray.tp_dict, __pyx_vtabptr_8pyzoltan_4core_6carray_UIntArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyObject_SetAttrString(__pyx_m, "UIntArray", (PyObject *)&__pyx_type_8pyzoltan_4core_6carray_UIntArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_8pyzoltan_4core_6carray_UIntArray = &__pyx_type_8pyzoltan_4core_6carray_UIntArray;
  __pyx_vtabptr_8pyzoltan_4core_6carray_FloatArray = &__pyx_vtable_8pyzoltan_4core_6carray_FloatArray;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.__pyx_base = *__pyx_vtabptr_8pyzoltan_4core_6carray_BaseArray;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.__pyx_base.c_align_array = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_align_array;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.__pyx_base.c_reserve = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_reserve;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.__pyx_base.c_reset = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_reset;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.__pyx_base.c_resize = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_resize;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.__pyx_base.c_squeeze = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_squeeze;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.__pyx_base.reserve = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_reserve;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.__pyx_base.resize = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_resize;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.__pyx_base.squeeze = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_squeeze;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.__pyx_base.remove = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_remove *__pyx_optional_args))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_remove;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.__pyx_base.extend = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_extend;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.__pyx_base.reset = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_reset;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.__pyx_base.get_c_type = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_get_c_type;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.__pyx_base.copy_values = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_copy_values;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.__pyx_base.copy_subset = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_copy_subset *__pyx_optional_args))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_copy_subset;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.__pyx_base.update_min_max = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_update_min_max;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray._setup_npy_array = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *))__pyx_f_8pyzoltan_4core_6carray_10FloatArray__setup_npy_array;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.c_append = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *, float))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_append;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.c_set_view = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *, float *, long))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_c_set_view;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.get_data_ptr = (float *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_get_data_ptr;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.get = (float (*)(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_get;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.set = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *, long, float, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_set;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.append = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *, float, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_append;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.set_view = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *, struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *, long, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_set_view;
  __pyx_vtable_8pyzoltan_4core_6carray_FloatArray.index = (long (*)(struct __pyx_obj_8pyzoltan_4core_6carray_FloatArray *, float, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_10FloatArray_index;
  __pyx_type_8pyzoltan_4core_6carray_FloatArray.tp_base = __pyx_ptype_8pyzoltan_4core_6carray_BaseArray;
  if (PyType_Ready(&__pyx_type_8pyzoltan_4core_6carray_FloatArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_8pyzoltan_4core_6carray_FloatArray.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_8pyzoltan_4core_6carray_FloatArray, "__getitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_8pyzoltan_4core_6carray_10FloatArray_4__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_8pyzoltan_4core_6carray_10FloatArray_4__getitem__.doc = __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_4__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_8pyzoltan_4core_6carray_10FloatArray_4__getitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_8pyzoltan_4core_6carray_FloatArray, "__setitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_8pyzoltan_4core_6carray_10FloatArray_6__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_8pyzoltan_4core_6carray_10FloatArray_6__setitem__.doc = __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_6__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_8pyzoltan_4core_6carray_10FloatArray_6__setitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_8pyzoltan_4core_6carray_FloatArray, "__contains__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_8pyzoltan_4core_6carray_10FloatArray_10__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_8pyzoltan_4core_6carray_10FloatArray_10__contains__.doc = __pyx_doc_8pyzoltan_4core_6carray_10FloatArray_10__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_8pyzoltan_4core_6carray_10FloatArray_10__contains__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_8pyzoltan_4core_6carray_FloatArray.tp_dict, __pyx_vtabptr_8pyzoltan_4core_6carray_FloatArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyObject_SetAttrString(__pyx_m, "FloatArray", (PyObject *)&__pyx_type_8pyzoltan_4core_6carray_FloatArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_8pyzoltan_4core_6carray_FloatArray = &__pyx_type_8pyzoltan_4core_6carray_FloatArray;
  __pyx_vtabptr_8pyzoltan_4core_6carray_DoubleArray = &__pyx_vtable_8pyzoltan_4core_6carray_DoubleArray;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.__pyx_base = *__pyx_vtabptr_8pyzoltan_4core_6carray_BaseArray;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.__pyx_base.c_align_array = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_align_array;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.__pyx_base.c_reserve = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_reserve;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.__pyx_base.c_reset = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_reset;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.__pyx_base.c_resize = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_resize;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.__pyx_base.c_squeeze = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_squeeze;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.__pyx_base.reserve = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_reserve;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.__pyx_base.resize = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_resize;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.__pyx_base.squeeze = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_squeeze;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.__pyx_base.remove = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_remove *__pyx_optional_args))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_remove;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.__pyx_base.extend = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_extend;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.__pyx_base.reset = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_reset;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.__pyx_base.get_c_type = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_get_c_type;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.__pyx_base.copy_values = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_LongArray *, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_copy_values;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.__pyx_base.copy_subset = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch, struct __pyx_opt_args_8pyzoltan_4core_6carray_9BaseArray_copy_subset *__pyx_optional_args))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_copy_subset;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.__pyx_base.update_min_max = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_BaseArray *, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_update_min_max;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray._setup_npy_array = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray__setup_npy_array;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.c_append = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *, double))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_append;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.c_set_view = (void (*)(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *, double *, long))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_c_set_view;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.get_data_ptr = (double *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_get_data_ptr;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.get = (double (*)(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_get;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.set = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *, long, double, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_set;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.append = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *, double, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_append;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.set_view = (PyObject *(*)(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *, struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *, long, long, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_set_view;
  __pyx_vtable_8pyzoltan_4core_6carray_DoubleArray.index = (long (*)(struct __pyx_obj_8pyzoltan_4core_6carray_DoubleArray *, double, int __pyx_skip_dispatch))__pyx_f_8pyzoltan_4core_6carray_11DoubleArray_index;
  __pyx_type_8pyzoltan_4core_6carray_DoubleArray.tp_base = __pyx_ptype_8pyzoltan_4core_6carray_BaseArray;
  if (PyType_Ready(&__pyx_type_8pyzoltan_4core_6carray_DoubleArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_8pyzoltan_4core_6carray_DoubleArray.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_8pyzoltan_4core_6carray_DoubleArray, "__getitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_8pyzoltan_4core_6carray_11DoubleArray_4__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_8pyzoltan_4core_6carray_11DoubleArray_4__getitem__.doc = __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_4__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_8pyzoltan_4core_6carray_11DoubleArray_4__getitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_8pyzoltan_4core_6carray_DoubleArray, "__setitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_8pyzoltan_4core_6carray_11DoubleArray_6__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_8pyzoltan_4core_6carray_11DoubleArray_6__setitem__.doc = __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_6__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_8pyzoltan_4core_6carray_11DoubleArray_6__setitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_8pyzoltan_4core_6carray_DoubleArray, "__contains__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_8pyzoltan_4core_6carray_11DoubleArray_10__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_8pyzoltan_4core_6carray_11DoubleArray_10__contains__.doc = __pyx_doc_8pyzoltan_4core_6carray_11DoubleArray_10__contains__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_8pyzoltan_4core_6carray_11DoubleArray_10__contains__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_8pyzoltan_4core_6carray_DoubleArray.tp_dict, __pyx_vtabptr_8pyzoltan_4core_6carray_DoubleArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyObject_SetAttrString(__pyx_m, "DoubleArray", (PyObject *)&__pyx_type_8pyzoltan_4core_6carray_DoubleArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_8pyzoltan_4core_6carray_DoubleArray = &__pyx_type_8pyzoltan_4core_6carray_DoubleArray;
  /*--- Type import code ---*/
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
  #if CYTHON_COMPILING_IN_PYPY
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "pyzoltan/core/carray.pyx":39
 * cimport numpy as np
 * 
 * import numpy as np             # <<<<<<<<<<<<<<
 * 
 * # logging imports
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":42
 * 
 * # logging imports
 * import logging             # <<<<<<<<<<<<<<
 * logger = logging.getLogger()
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_logging, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_logging, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":43
 * # logging imports
 * import logging
 * logger = logging.getLogger()             # <<<<<<<<<<<<<<
 * 
 * # 'importing' some Numpy C-api functions.
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getLogger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_logger, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pyzoltan/core/carray.pyx":68
 * 
 * # numpy module initialization call
 * import_array()             # <<<<<<<<<<<<<<
 * 
 * cdef inline long aligned(long n, int item_size) nogil:
 */
  import_array();

  /* "pyzoltan/core/carray.pyx":1
 * # This file (carray.pxd) has been generated automatically.             # <<<<<<<<<<<<<<
 * # DO NOT modify this file
 * # To make changes modify the source templates (carray.pxd.mako) and regenerate
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":979
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init pyzoltan.core.carray", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init pyzoltan.core.carray");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* --- Runtime support code --- */
#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

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;
}

static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
    long r = a % b;
    r += ((r != 0) & ((r ^ b) < 0)) * b;
    return r;
}

static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
    long q = a / b;
    long r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    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);
#else
    PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(type, value, tb);
#endif
}

static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __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);
    }
}

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);
}

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
}

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;
}

#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

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    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_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) {
                if (PyObject_IsSubclass(instance_class, type)) {
                    type = instance_class;
                } else {
                    instance_class = NULL;
                }
            }
        }
        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 PY_VERSION_HEX >= 0x03030000
    if (cause) {
#else
    if (cause && cause != Py_None) {
#endif
        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 = PyThreadState_GET();
        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

#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

#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) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject* args = PyTuple_Pack(1, arg);
    return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
}
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_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

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

static CYTHON_INLINE int __Pyx_PyObject_SetSlice(
        PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_ass_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (PyErr_ExceptionMatches(PyExc_OverflowError))
                    PyErr_Clear();
                else
                    goto bad;
            }
        }
        return ms->sq_ass_slice(obj, cstart, cstop, value);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_ass_subscript))
#endif
    {
        int result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_COMPILING_IN_CPYTHON
        result = mp->mp_ass_subscript(obj, py_slice, value);
#else
        result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object does not support slice %.10s",
        Py_TYPE(obj)->tp_name, value ? "assignment" : "deletion");
bad:
    return -1;
}

static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
}
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (likely(Py_TYPE(obj) == type)) return 1;
        #if PY_MAJOR_VERSION == 2
        else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(PyObject_TypeCheck(obj, type))) return 1;
    }
    __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
    return 0;
}

static CYTHON_INLINE 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,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, 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,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, 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, int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    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))
                        PyErr_Clear();
                    else
                        return NULL;
                }
            }
            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));
}

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
    result = PyDict_GetItem(__pyx_d, name);
    if (likely(result)) {
        Py_INCREF(result);
    } else {
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

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);
}

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");
}

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

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) / 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);
}

#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;
    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(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        __pyx_d,      /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = py_line;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

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_VERSION_HEX < 0x03030000
    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, '.')) {
                #if PY_VERSION_HEX < 0x03030000
                PyObject *py_level = PyInt_FromLong(1);
                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, 1);
                #endif
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_VERSION_HEX < 0x03030000
            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_VERSION_HEX < 0x03030000
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)       \
    {                                                                     \
        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 (is_unsigned && unlikely(value < zero))                \
                    goto raise_neg_overflow;                              \
                else                                                      \
                    goto raise_overflow;                                  \
            }                                                             \
        }                                                                 \
        return (target_type) value;                                       \
    }

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif

static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) -1, const_zero = 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_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(long) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
            } else if (sizeof(long) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
            }
        }
        {
#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_Int(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_Int(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;
}

static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) -1, const_zero = 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_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(int) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
            } else if (sizeof(int) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
            }
        }
        {
#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_Int(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_Int(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;
}

static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) {
    const unsigned int neg_one = (unsigned int) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(unsigned int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (unsigned int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(unsigned int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(unsigned int) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(unsigned int,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(unsigned int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(unsigned int, long, PyLong_AsLong(x))
            } else if (sizeof(unsigned int) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(unsigned int, long long, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            unsigned int val;
            PyObject *v = __Pyx_PyNumber_Int(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 (unsigned int) -1;
        }
    } else {
        unsigned int val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned int) -1;
        val = __Pyx_PyInt_As_unsigned_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to unsigned int");
    return (unsigned int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to unsigned int");
    return (unsigned int) -1;
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) -1, const_zero = 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);
        } else if (sizeof(long) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) -1, const_zero = 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);
        } else if (sizeof(int) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) {
    const unsigned int neg_one = (unsigned int) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(unsigned int) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(unsigned int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned int) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned int),
                                     little, !is_unsigned);
    }
}

#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

#if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eqf(__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_sumf(__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_difff(__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_prodf(__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;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        float denom = b.real * b.real + b.imag * b.imag;
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__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_zerof(__pyx_t_float_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__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_absf(__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_powf(__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_prodf(a, a);
                        return __Pyx_c_prodf(a, a);
                    case 3:
                        z = __Pyx_c_prodf(a, a);
                        return __Pyx_c_prodf(z, a);
                    case 4:
                        z = __Pyx_c_prodf(a, a);
                        return __Pyx_c_prodf(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                }
                r = a.real;
                theta = 0;
            } else {
                r = __Pyx_c_absf(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

#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

#if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq(__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(__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(__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(__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;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        double denom = b.real * b.real + b.imag * b.imag;
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__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(__pyx_t_double_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__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(__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(__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(a, a);
                        return __Pyx_c_prod(a, a);
                    case 3:
                        z = __Pyx_c_prod(a, a);
                        return __Pyx_c_prod(z, a);
                    case 4:
                        z = __Pyx_c_prod(a, a);
                        return __Pyx_c_prod(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                }
                r = a.real;
                theta = 0;
            } else {
                r = __Pyx_c_abs(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

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;
}

static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
    if (!d) {
        PyErr_Clear();
        d = PyDict_New();
        if (!d)
            goto bad;
        Py_INCREF(d);
        if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
            goto bad;
    }
    tmp.fp = f;
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(tmp.p, sig, 0);
#else
    cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
#endif
    if (!cobj)
        goto bad;
    if (PyDict_SetItemString(d, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(cobj);
    Py_XDECREF(d);
    return -1;
}

#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

#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",
            module_name, class_name);
        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",
            module_name, class_name);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

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;
        ++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 char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE 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)) {
#if PY_VERSION_HEX < 0x03030000
        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
        if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (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
    } else
#endif
#if !CYTHON_COMPILING_IN_PYPY
    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 CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_MAJOR_VERSION < 3
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%.4s__ returned non-%.4s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  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)))
      return PyInt_AS_LONG(b);
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
     #if CYTHON_USE_PYLONG_INTERNALS
       switch (Py_SIZE(b)) {
       case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
       case  0: return 0;
       case  1: return ((PyLongObject*)b)->ob_digit[0];
       }
     #endif
    #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 */
