/* Generated by Cython 0.15.1 on Fri Jun 29 12:00:35 2012 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#else

#include <stddef.h> /* For offsetof */
#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

#if PY_VERSION_HEX < 0x02040000
  #define METH_COEXIST 0
  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
  #define PyDict_Contains(d,o)   PySequence_Contains(d,o)
#endif

#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
  #define PyNumber_Index(o)    PyNumber_Int(o)
  #define PyIndex_Check(o)     PyNumber_Check(o)
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#endif

#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)

  typedef struct {
     void *buf;
     PyObject *obj;
     Py_ssize_t len;
     Py_ssize_t itemsize;
     int readonly;
     int ndim;
     char *format;
     Py_ssize_t *shape;
     Py_ssize_t *strides;
     Py_ssize_t *suboffsets;
     void *internal;
  } Py_buffer;

  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)

#endif

#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#endif

#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif

#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#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_VERSION_HEX < 0x02060000
  #define PyBytesObject                PyStringObject
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_Check                PyString_Check
  #define PyBytes_CheckExact           PyString_CheckExact
  #define PyBytes_FromString           PyString_FromString
  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
  #define PyBytes_FromFormat           PyString_FromFormat
  #define PyBytes_DecodeEscape         PyString_DecodeEscape
  #define PyBytes_AsString             PyString_AsString
  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
  #define PyBytes_Size                 PyString_Size
  #define PyBytes_AS_STRING            PyString_AS_STRING
  #define PyBytes_GET_SIZE             PyString_GET_SIZE
  #define PyBytes_Repr                 PyString_Repr
  #define PyBytes_Concat               PyString_Concat
  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#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
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif

#if PY_VERSION_HEX < 0x03020000
  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_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#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__pandas___sparse
#define __PYX_HAVE_API__pandas___sparse
#include "stdio.h"
#include "stdlib.h"
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif


/* inline attribute */
#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

/* unused attribute */
#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)
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif

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


/* Type Conversion Predeclarations */

#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))

#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);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);

#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))


#ifdef __GNUC__
  /* Test for GCC > 2.95 */
  #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
    #define likely(x)   __builtin_expect(!!(x), 1)
    #define unlikely(x) __builtin_expect(!!(x), 0)
  #else /* __GNUC__ > 2 ... */
    #define likely(x)   (x)
    #define unlikely(x) (x)
  #endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
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[] = {
  "sparse.pyx",
  "numpy.pxd",
};

/* "numpy.pxd":724
 * # 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;

/* "numpy.pxd":725
 * 
 * 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;

/* "numpy.pxd":726
 * 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;

/* "numpy.pxd":727
 * 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;

/* "numpy.pxd":731
 * #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;

/* "numpy.pxd":732
 * 
 * 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;

/* "numpy.pxd":733
 * 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;

/* "numpy.pxd":734
 * 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;

/* "numpy.pxd":738
 * #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;

/* "numpy.pxd":739
 * 
 * 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;

/* "numpy.pxd":748
 * # 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;

/* "numpy.pxd":749
 * # 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;

/* "numpy.pxd":750
 * 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;

/* "numpy.pxd":752
 * 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;

/* "numpy.pxd":753
 * 
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 */
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

/* "numpy.pxd":754
 * 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;

/* "numpy.pxd":756
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uintp      uintp_t
 * 
 */
typedef npy_intp __pyx_t_5numpy_intp_t;

/* "numpy.pxd":757
 * 
 * ctypedef npy_intp       intp_t
 * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_double     float_t
 */
typedef npy_uintp __pyx_t_5numpy_uintp_t;

/* "numpy.pxd":759
 * 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;

/* "numpy.pxd":760
 * 
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longdouble longdouble_t
 * 
 */
typedef npy_double __pyx_t_5numpy_double_t;

/* "numpy.pxd":761
 * 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_6pandas_7_sparse_BlockMerge;
struct __pyx_obj_6pandas_7_sparse_SparseIndex;
struct __pyx_obj_6pandas_7_sparse_BlockIndex;
struct __pyx_obj_6pandas_7_sparse_IntIndex;
struct __pyx_obj_6pandas_7_sparse_BlockIntersection;
struct __pyx_obj_6pandas_7_sparse_BlockUnion;

/* "numpy.pxd":763
 * 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;

/* "numpy.pxd":764
 * 
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
 * ctypedef npy_clongdouble clongdouble_t
 * 
 */
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

/* "numpy.pxd":765
 * 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;

/* "numpy.pxd":767
 * ctypedef npy_clongdouble clongdouble_t
 * 
 * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 */
typedef npy_cdouble __pyx_t_5numpy_complex_t;

/* "pandas/src/sparse.pyx":688
 * # Sparse arithmetic
 * 
 * ctypedef float64_t (* double_func)(float64_t a, float64_t b)             # <<<<<<<<<<<<<<
 * 
 * cdef inline tuple sparse_nancombine(ndarray x, SparseIndex xindex,
 */
typedef __pyx_t_5numpy_float64_t (*__pyx_t_6pandas_7_sparse_double_func)(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t);

/* "pandas/src/sparse.pyx":527
 * 
 * 
 * cdef class BlockMerge(object):             # <<<<<<<<<<<<<<
 *     '''
 *     Object-oriented approach makes sharing state between recursive functions a
 */
struct __pyx_obj_6pandas_7_sparse_BlockMerge {
  PyObject_HEAD
  struct __pyx_vtabstruct_6pandas_7_sparse_BlockMerge *__pyx_vtab;
  struct __pyx_obj_6pandas_7_sparse_BlockIndex *x;
  struct __pyx_obj_6pandas_7_sparse_BlockIndex *y;
  struct __pyx_obj_6pandas_7_sparse_BlockIndex *result;
  PyArrayObject *xstart;
  PyArrayObject *xlen;
  PyArrayObject *xend;
  PyArrayObject *ystart;
  PyArrayObject *ylen;
  PyArrayObject *yend;
  __pyx_t_5numpy_int32_t xi;
  __pyx_t_5numpy_int32_t yi;
};


/* "pandas/src/sparse.pyx":25
 * 
 * 
 * cdef class SparseIndex:             # <<<<<<<<<<<<<<
 *     '''
 *     Abstract superclass for sparse index types
 */
struct __pyx_obj_6pandas_7_sparse_SparseIndex {
  PyObject_HEAD
};


/* "pandas/src/sparse.pyx":259
 * # BlockIndex
 * 
 * cdef class BlockIndex(SparseIndex):             # <<<<<<<<<<<<<<
 *     '''
 *     Object for holding block-based sparse indexing information
 */
struct __pyx_obj_6pandas_7_sparse_BlockIndex {
  struct __pyx_obj_6pandas_7_sparse_SparseIndex __pyx_base;
  struct __pyx_vtabstruct_6pandas_7_sparse_BlockIndex *__pyx_vtab;
  Py_ssize_t nblocks;
  Py_ssize_t npoints;
  Py_ssize_t length;
  PyArrayObject *blocs;
  PyArrayObject *blengths;
  PyObject *__weakref__;
  __pyx_t_5numpy_int32_t *locbuf;
  __pyx_t_5numpy_int32_t *lenbuf;
};


/* "pandas/src/sparse.pyx":33
 * 
 * 
 * cdef class IntIndex(SparseIndex):             # <<<<<<<<<<<<<<
 *     '''
 *     Object for holding exact integer sparse indexing information
 */
struct __pyx_obj_6pandas_7_sparse_IntIndex {
  struct __pyx_obj_6pandas_7_sparse_SparseIndex __pyx_base;
  struct __pyx_vtabstruct_6pandas_7_sparse_IntIndex *__pyx_vtab;
  Py_ssize_t length;
  Py_ssize_t npoints;
  PyArrayObject *indices;
};


/* "pandas/src/sparse.pyx":569
 *             self.yi = xi
 * 
 * cdef class BlockIntersection(BlockMerge):             # <<<<<<<<<<<<<<
 *     '''
 *     not done yet
 */
struct __pyx_obj_6pandas_7_sparse_BlockIntersection {
  struct __pyx_obj_6pandas_7_sparse_BlockMerge __pyx_base;
};


/* "pandas/src/sparse.pyx":575
 *     pass
 * 
 * cdef class BlockUnion(BlockMerge):             # <<<<<<<<<<<<<<
 *     '''
 *     Object-oriented approach makes sharing state between recursive functions a
 */
struct __pyx_obj_6pandas_7_sparse_BlockUnion {
  struct __pyx_obj_6pandas_7_sparse_BlockMerge __pyx_base;
};



/* "pandas/src/sparse.pyx":527
 * 
 * 
 * cdef class BlockMerge(object):             # <<<<<<<<<<<<<<
 *     '''
 *     Object-oriented approach makes sharing state between recursive functions a
 */

struct __pyx_vtabstruct_6pandas_7_sparse_BlockMerge {
  PyObject *(*_make_merged_blocks)(struct __pyx_obj_6pandas_7_sparse_BlockMerge *);
  PyObject *(*_set_current_indices)(struct __pyx_obj_6pandas_7_sparse_BlockMerge *, __pyx_t_5numpy_int32_t, __pyx_t_5numpy_int32_t, int);
};
static struct __pyx_vtabstruct_6pandas_7_sparse_BlockMerge *__pyx_vtabptr_6pandas_7_sparse_BlockMerge;


/* "pandas/src/sparse.pyx":569
 *             self.yi = xi
 * 
 * cdef class BlockIntersection(BlockMerge):             # <<<<<<<<<<<<<<
 *     '''
 *     not done yet
 */

struct __pyx_vtabstruct_6pandas_7_sparse_BlockIntersection {
  struct __pyx_vtabstruct_6pandas_7_sparse_BlockMerge __pyx_base;
};
static struct __pyx_vtabstruct_6pandas_7_sparse_BlockIntersection *__pyx_vtabptr_6pandas_7_sparse_BlockIntersection;


/* "pandas/src/sparse.pyx":575
 *     pass
 * 
 * cdef class BlockUnion(BlockMerge):             # <<<<<<<<<<<<<<
 *     '''
 *     Object-oriented approach makes sharing state between recursive functions a
 */

struct __pyx_vtabstruct_6pandas_7_sparse_BlockUnion {
  struct __pyx_vtabstruct_6pandas_7_sparse_BlockMerge __pyx_base;
  __pyx_t_5numpy_int32_t (*_find_next_block_end)(struct __pyx_obj_6pandas_7_sparse_BlockUnion *, int);
};
static struct __pyx_vtabstruct_6pandas_7_sparse_BlockUnion *__pyx_vtabptr_6pandas_7_sparse_BlockUnion;


/* "pandas/src/sparse.pyx":259
 * # BlockIndex
 * 
 * cdef class BlockIndex(SparseIndex):             # <<<<<<<<<<<<<<
 *     '''
 *     Object for holding block-based sparse indexing information
 */

struct __pyx_vtabstruct_6pandas_7_sparse_BlockIndex {
  PyObject *(*check_integrity)(struct __pyx_obj_6pandas_7_sparse_BlockIndex *, int __pyx_skip_dispatch);
  struct __pyx_obj_6pandas_7_sparse_BlockIndex *(*intersect)(struct __pyx_obj_6pandas_7_sparse_BlockIndex *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch);
  struct __pyx_obj_6pandas_7_sparse_BlockIndex *(*make_union)(struct __pyx_obj_6pandas_7_sparse_BlockIndex *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch);
  PyObject *(*lookup)(struct __pyx_obj_6pandas_7_sparse_BlockIndex *, Py_ssize_t, int __pyx_skip_dispatch);
  PyArrayObject *(*reindex)(struct __pyx_obj_6pandas_7_sparse_BlockIndex *, PyArrayObject *, __pyx_t_5numpy_float64_t, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch);
  PyObject *(*put)(struct __pyx_obj_6pandas_7_sparse_BlockIndex *, PyArrayObject *, PyArrayObject *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*take)(struct __pyx_obj_6pandas_7_sparse_BlockIndex *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pandas_7_sparse_BlockIndex *__pyx_vtabptr_6pandas_7_sparse_BlockIndex;



/* "pandas/src/sparse.pyx":33
 * 
 * 
 * cdef class IntIndex(SparseIndex):             # <<<<<<<<<<<<<<
 *     '''
 *     Object for holding exact integer sparse indexing information
 */

struct __pyx_vtabstruct_6pandas_7_sparse_IntIndex {
  struct __pyx_obj_6pandas_7_sparse_IntIndex *(*intersect)(struct __pyx_obj_6pandas_7_sparse_IntIndex *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch);
  struct __pyx_obj_6pandas_7_sparse_IntIndex *(*make_union)(struct __pyx_obj_6pandas_7_sparse_IntIndex *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch);
  PyObject *(*lookup)(struct __pyx_obj_6pandas_7_sparse_IntIndex *, Py_ssize_t, int __pyx_skip_dispatch);
  PyArrayObject *(*reindex)(struct __pyx_obj_6pandas_7_sparse_IntIndex *, PyArrayObject *, __pyx_t_5numpy_float64_t, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch);
  PyObject *(*put)(struct __pyx_obj_6pandas_7_sparse_IntIndex *, PyArrayObject *, PyArrayObject *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*take)(struct __pyx_obj_6pandas_7_sparse_IntIndex *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pandas_7_sparse_IntIndex *__pyx_vtabptr_6pandas_7_sparse_IntIndex;

#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); /*proto*/
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  #define __Pyx_RefNannySetupContext(name)           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  #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)
  #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 /* CYTHON_REFNANNY */

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

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

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict,
    const char* function_name, int kw_allowed); /*proto*/

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

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

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

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

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

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

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

/* Run-time type information about structs used with buffers */
struct __Pyx_StructField_;

typedef struct {
  const char* name; /* for error messages only */
  struct __Pyx_StructField_* fields;
  size_t size;     /* sizeof(type) */
  char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */
} __Pyx_TypeInfo;

typedef struct __Pyx_StructField_ {
  __Pyx_TypeInfo* type;
  const char* name;
  size_t offset;
} __Pyx_StructField;

typedef struct {
  __Pyx_StructField* field;
  size_t parent_offset;
} __Pyx_BufFmt_StackElem;


static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);

static void __Pyx_RaiseBufferFallbackError(void); /*proto*/
static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/
#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)

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

static CYTHON_INLINE int __Pyx_NegateNonNeg(int b) { 
    return unlikely(b < 0) ? b : !b; 
}
static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
    return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
}

static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);

#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    if (unlikely(d == Py_None)) {
        __Pyx_RaiseNoneIndexingError();
        return NULL;
    }
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred())
            PyErr_SetObject(PyExc_KeyError, key);
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#else
    #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#endif

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

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

Py_ssize_t __Pyx_zeros[] = {0};
Py_ssize_t __Pyx_minusones[] = {-1};

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32);

static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject *);

#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(__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 CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);

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

static int __Pyx_check_binary_version(void);

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

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

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

static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
                               int __pyx_lineno, const char *__pyx_filename); /*proto*/

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

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

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

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

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

/* 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 PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/

/* Module declarations from 'cython.cython.view' */

/* Module declarations from 'cython' */

/* Module declarations from 'pandas._sparse' */
static PyTypeObject *__pyx_ptype_6pandas_7_sparse_SparseIndex = 0;
static PyTypeObject *__pyx_ptype_6pandas_7_sparse_IntIndex = 0;
static PyTypeObject *__pyx_ptype_6pandas_7_sparse_BlockIndex = 0;
static PyTypeObject *__pyx_ptype_6pandas_7_sparse_BlockMerge = 0;
static PyTypeObject *__pyx_ptype_6pandas_7_sparse_BlockIntersection = 0;
static PyTypeObject *__pyx_ptype_6pandas_7_sparse_BlockUnion = 0;
static __pyx_t_5numpy_float64_t __pyx_v_6pandas_7_sparse_NaN;
static __pyx_t_5numpy_float64_t __pyx_v_6pandas_7_sparse_INF;
static CYTHON_INLINE int __pyx_f_6pandas_7_sparse_int_max(int, int); /*proto*/
static CYTHON_INLINE int __pyx_f_6pandas_7_sparse_int_min(int, int); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_get_blocks(PyArrayObject *, int __pyx_skip_dispatch); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_6pandas_7_sparse_sparse_nancombine(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_6pandas_7_sparse_double_func); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_6pandas_7_sparse_sparse_combine(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, __pyx_t_6pandas_7_sparse_double_func); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_6pandas_7_sparse_block_nanop(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_BlockIndex *, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_BlockIndex *, __pyx_t_6pandas_7_sparse_double_func); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_6pandas_7_sparse_int_nanop(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_IntIndex *, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_IntIndex *, __pyx_t_6pandas_7_sparse_double_func); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_6pandas_7_sparse_block_op(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_BlockIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_BlockIndex *, __pyx_t_5numpy_float64_t, __pyx_t_6pandas_7_sparse_double_func); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_6pandas_7_sparse_int_op(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_IntIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_IntIndex *, __pyx_t_5numpy_float64_t, __pyx_t_6pandas_7_sparse_double_func); /*proto*/
static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___add(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___sub(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___rsub(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___div(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___rdiv(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___floordiv(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___rfloordiv(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___mul(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___eq(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___ne(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___lt(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___gt(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___pow(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___rpow(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_nanadd(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_nansub(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_nanrsub(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_nanmul(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_nandiv(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_nanrdiv(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_nanfloordiv(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_nanrfloordiv(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_nanpow(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_nanrpow(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_add(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_sub(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_rsub(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_mul(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_div(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_rdiv(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_floordiv(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_rfloordiv(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_pow(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_rpow(PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, __pyx_t_5numpy_float64_t, int __pyx_skip_dispatch); /*proto*/
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), 'I' };
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), 'R' };
static __Pyx_TypeInfo __Pyx_TypeInfo_object = { "Python object", NULL, sizeof(PyObject *), 'O' };
#define __Pyx_MODULE_NAME "pandas._sparse"
int __pyx_module_is_main_pandas___sparse = 0;

/* Implementation of 'pandas._sparse' */
static PyObject *__pyx_builtin_property;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_RuntimeError;
static char __pyx_k_1[] = "IntIndex\n";
static char __pyx_k_2[] = "Indices: %s\n";
static char __pyx_k_3[] = "Indices must reference same underlying length";
static char __pyx_k_6[] = "BlockIndex\n";
static char __pyx_k_7[] = "Block locations: %s\n";
static char __pyx_k_8[] = "Block lengths: %s";
static char __pyx_k_9[] = "block bound arrays must be same length";
static char __pyx_k_11[] = "Locations not in ascending order";
static char __pyx_k_13[] = "Block %d overlaps";
static char __pyx_k_14[] = "Block %d extends beyond end";
static char __pyx_k_15[] = "Zero-length block %d";
static char __pyx_k_18[] = "Mode must be 0 or 1";
static char __pyx_k_20[] = "ndarray is not C contiguous";
static char __pyx_k_22[] = "ndarray is not Fortran contiguous";
static char __pyx_k_24[] = "Non-native byte order not supported";
static char __pyx_k_26[] = "unknown dtype code in numpy.pxd (%d)";
static char __pyx_k_27[] = "Format string allocated too short, see comment in numpy.pxd";
static char __pyx_k_30[] = "Format string allocated too short.";
static char __pyx_k_32[] = "pandas._sparse";
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__q[] = "q";
static char __pyx_k__x[] = "x";
static char __pyx_k__y[] = "y";
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__NaN[] = "NaN";
static char __pyx_k__inf[] = "inf";
static char __pyx_k__put[] = "put";
static char __pyx_k__sum[] = "sum";
static char __pyx_k__sys[] = "sys";
static char __pyx_k__fill[] = "fill";
static char __pyx_k__take[] = "take";
static char __pyx_k__blocs[] = "blocs";
static char __pyx_k__dtype[] = "dtype";
static char __pyx_k__empty[] = "empty";
static char __pyx_k__int32[] = "int32";
static char __pyx_k__ngaps[] = "ngaps";
static char __pyx_k__numpy[] = "numpy";
static char __pyx_k__range[] = "range";
static char __pyx_k__xfill[] = "xfill";
static char __pyx_k__yfill[] = "yfill";
static char __pyx_k__length[] = "length";
static char __pyx_k__lookup[] = "lookup";
static char __pyx_k__other_[] = "other_";
static char __pyx_k__to_put[] = "to_put";
static char __pyx_k__values[] = "values";
static char __pyx_k__xindex[] = "xindex";
static char __pyx_k__yindex[] = "yindex";
static char __pyx_k__float64[] = "float64";
static char __pyx_k__indexer[] = "indexer";
static char __pyx_k__indices[] = "indices";
static char __pyx_k__reindex[] = "reindex";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__blengths[] = "blengths";
static char __pyx_k__operator[] = "operator";
static char __pyx_k__property[] = "property";
static char __pyx_k__Exception[] = "Exception";
static char __pyx_k__index_map[] = "index_map";
static char __pyx_k__intersect[] = "intersect";
static char __pyx_k__ValueError[] = "ValueError";
static char __pyx_k__fill_value[] = "fill_value";
static char __pyx_k__make_union[] = "make_union";
static char __pyx_k__sparse_div[] = "sparse_div";
static char __pyx_k__array_equal[] = "array_equal";
static char __pyx_k__sparse_rdiv[] = "sparse_rdiv";
static char __pyx_k__RuntimeError[] = "RuntimeError";
static char __pyx_k__searchsorted[] = "searchsorted";
static char __pyx_k__sparse_index[] = "sparse_index";
static char __pyx_k__to_int_index[] = "to_int_index";
static char __pyx_k__get_reindexer[] = "get_reindexer";
static char __pyx_k__sparse_nandiv[] = "sparse_nandiv";
static char __pyx_k__sparse_nanrdiv[] = "sparse_nanrdiv";
static char __pyx_k__sparse_truediv[] = "sparse_truediv";
static char __pyx_k__to_block_index[] = "to_block_index";
static char __pyx_k__check_integrity[] = "check_integrity";
static char __pyx_k__reindex_integer[] = "reindex_integer";
static char __pyx_k__sparse_rtruediv[] = "sparse_rtruediv";
static char __pyx_k__ascontiguousarray[] = "ascontiguousarray";
static char __pyx_k__sparse_nantruediv[] = "sparse_nantruediv";
static char __pyx_k__sparse_nanrtruediv[] = "sparse_nanrtruediv";
static char __pyx_k__NotImplementedError[] = "NotImplementedError";
static PyObject *__pyx_n_s_1;
static PyObject *__pyx_kp_s_11;
static PyObject *__pyx_kp_s_13;
static PyObject *__pyx_kp_s_14;
static PyObject *__pyx_kp_s_15;
static PyObject *__pyx_kp_s_18;
static PyObject *__pyx_kp_s_2;
static PyObject *__pyx_kp_u_20;
static PyObject *__pyx_kp_u_22;
static PyObject *__pyx_kp_u_24;
static PyObject *__pyx_kp_u_26;
static PyObject *__pyx_kp_u_27;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_kp_u_30;
static PyObject *__pyx_n_s_32;
static PyObject *__pyx_n_s_6;
static PyObject *__pyx_kp_s_7;
static PyObject *__pyx_kp_s_8;
static PyObject *__pyx_kp_s_9;
static PyObject *__pyx_n_s__Exception;
static PyObject *__pyx_n_s__NaN;
static PyObject *__pyx_n_s__NotImplementedError;
static PyObject *__pyx_n_s__RuntimeError;
static PyObject *__pyx_n_s__ValueError;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s__array_equal;
static PyObject *__pyx_n_s__ascontiguousarray;
static PyObject *__pyx_n_s__blengths;
static PyObject *__pyx_n_s__blocs;
static PyObject *__pyx_n_s__check_integrity;
static PyObject *__pyx_n_s__dtype;
static PyObject *__pyx_n_s__empty;
static PyObject *__pyx_n_s__fill;
static PyObject *__pyx_n_s__fill_value;
static PyObject *__pyx_n_s__float64;
static PyObject *__pyx_n_s__get_reindexer;
static PyObject *__pyx_n_s__index_map;
static PyObject *__pyx_n_s__indexer;
static PyObject *__pyx_n_s__indices;
static PyObject *__pyx_n_s__inf;
static PyObject *__pyx_n_s__int32;
static PyObject *__pyx_n_s__intersect;
static PyObject *__pyx_n_s__length;
static PyObject *__pyx_n_s__lookup;
static PyObject *__pyx_n_s__make_union;
static PyObject *__pyx_n_s__ngaps;
static PyObject *__pyx_n_s__np;
static PyObject *__pyx_n_s__numpy;
static PyObject *__pyx_n_s__operator;
static PyObject *__pyx_n_s__other_;
static PyObject *__pyx_n_s__property;
static PyObject *__pyx_n_s__put;
static PyObject *__pyx_n_s__range;
static PyObject *__pyx_n_s__reindex;
static PyObject *__pyx_n_s__reindex_integer;
static PyObject *__pyx_n_s__searchsorted;
static PyObject *__pyx_n_s__sparse_div;
static PyObject *__pyx_n_s__sparse_index;
static PyObject *__pyx_n_s__sparse_nandiv;
static PyObject *__pyx_n_s__sparse_nanrdiv;
static PyObject *__pyx_n_s__sparse_nanrtruediv;
static PyObject *__pyx_n_s__sparse_nantruediv;
static PyObject *__pyx_n_s__sparse_rdiv;
static PyObject *__pyx_n_s__sparse_rtruediv;
static PyObject *__pyx_n_s__sparse_truediv;
static PyObject *__pyx_n_s__sum;
static PyObject *__pyx_n_s__sys;
static PyObject *__pyx_n_s__take;
static PyObject *__pyx_n_s__to_block_index;
static PyObject *__pyx_n_s__to_int_index;
static PyObject *__pyx_n_s__to_put;
static PyObject *__pyx_n_s__values;
static PyObject *__pyx_n_s__x;
static PyObject *__pyx_n_s__xfill;
static PyObject *__pyx_n_s__xindex;
static PyObject *__pyx_n_s__y;
static PyObject *__pyx_n_s__yfill;
static PyObject *__pyx_n_s__yindex;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_int_15;
static PyObject *__pyx_k_tuple_4;
static PyObject *__pyx_k_tuple_5;
static PyObject *__pyx_k_tuple_10;
static PyObject *__pyx_k_tuple_12;
static PyObject *__pyx_k_tuple_16;
static PyObject *__pyx_k_tuple_17;
static PyObject *__pyx_k_tuple_19;
static PyObject *__pyx_k_tuple_21;
static PyObject *__pyx_k_tuple_23;
static PyObject *__pyx_k_tuple_25;
static PyObject *__pyx_k_tuple_28;
static PyObject *__pyx_k_tuple_29;
static PyObject *__pyx_k_tuple_31;

/* "pandas/src/sparse.pyx":19
 * cdef float64_t INF = <float64_t> np.inf
 * 
 * cdef inline int int_max(int a, int b): return a if a >= b else b             # <<<<<<<<<<<<<<
 * cdef inline int int_min(int a, int b): return a if a <= b else b
 * 
 */

static CYTHON_INLINE int __pyx_f_6pandas_7_sparse_int_max(int __pyx_v_a, int __pyx_v_b) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("int_max");
  if ((__pyx_v_a >= __pyx_v_b)) {
    __pyx_t_1 = __pyx_v_a;
  } else {
    __pyx_t_1 = __pyx_v_b;
  }
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":20
 * 
 * cdef inline int int_max(int a, int b): return a if a >= b else b
 * cdef inline int int_min(int a, int b): return a if a <= b else b             # <<<<<<<<<<<<<<
 * 
 * #-------------------------------------------------------------------------------
 */

static CYTHON_INLINE int __pyx_f_6pandas_7_sparse_int_min(int __pyx_v_a, int __pyx_v_b) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("int_min");
  if ((__pyx_v_a <= __pyx_v_b)) {
    __pyx_t_1 = __pyx_v_a;
  } else {
    __pyx_t_1 = __pyx_v_b;
  }
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":29
 *     Abstract superclass for sparse index types
 *     '''
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

static int __pyx_pf_6pandas_7_sparse_11SparseIndex___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_6pandas_7_sparse_11SparseIndex___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;

  /* "pandas/src/sparse.pyx":30
 *     '''
 *     def __init__(self):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pandas._sparse.SparseIndex.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":47
 *         ndarray indices
 * 
 *     def __init__(self, Py_ssize_t length, indices):             # <<<<<<<<<<<<<<
 *         self.length = length
 *         self.indices = np.ascontiguousarray(indices, dtype=np.int32)
 */

static int __pyx_pf_6pandas_7_sparse_8IntIndex___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_6pandas_7_sparse_8IntIndex___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  Py_ssize_t __pyx_v_length;
  PyObject *__pyx_v_indices = 0;
  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;
  Py_ssize_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__length,&__pyx_n_s__indices,0};
  __Pyx_RefNannySetupContext("__init__");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__length);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indices);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __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_length = __Pyx_PyIndex_AsSsize_t(values[0]); if (unlikely((__pyx_v_length == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_indices = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.IntIndex.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "pandas/src/sparse.pyx":48
 * 
 *     def __init__(self, Py_ssize_t length, indices):
 *         self.length = length             # <<<<<<<<<<<<<<
 *         self.indices = np.ascontiguousarray(indices, dtype=np.int32)
 *         self.npoints = len(self.indices)
 */
  ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->length = __pyx_v_length;

  /* "pandas/src/sparse.pyx":49
 *     def __init__(self, Py_ssize_t length, indices):
 *         self.length = length
 *         self.indices = np.ascontiguousarray(indices, dtype=np.int32)             # <<<<<<<<<<<<<<
 *         self.npoints = len(self.indices)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_indices);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_indices);
  __Pyx_GIVEREF(__pyx_v_indices);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->indices);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->indices));
  ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->indices = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/src/sparse.pyx":50
 *         self.length = length
 *         self.indices = np.ascontiguousarray(indices, dtype=np.int32)
 *         self.npoints = len(self.indices)             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */
  __pyx_t_5 = ((PyObject *)((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->indices);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_6 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->npoints = __pyx_t_6;

  __pyx_r = 0;
  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("pandas._sparse.IntIndex.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":52
 *         self.npoints = len(self.indices)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         args = (self.length, self.indices)
 *         return (IntIndex, args)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_1__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_1__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_v_args = NULL;
  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("__reduce__");

  /* "pandas/src/sparse.pyx":53
 * 
 *     def __reduce__(self):
 *         args = (self.length, self.indices)             # <<<<<<<<<<<<<<
 *         return (IntIndex, args)
 * 
 */
  __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->indices));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->indices));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->indices));
  __pyx_t_1 = 0;
  __pyx_v_args = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pandas/src/sparse.pyx":54
 *     def __reduce__(self):
 *         args = (self.length, self.indices)
 *         return (IntIndex, args)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6pandas_7_sparse_IntIndex)));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)__pyx_ptype_6pandas_7_sparse_IntIndex)));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6pandas_7_sparse_IntIndex)));
  __Pyx_INCREF(((PyObject *)__pyx_v_args));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_args));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_args));
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __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_AddTraceback("pandas._sparse.IntIndex.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":56
 *         return (IntIndex, args)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         output = 'IntIndex\n'
 *         output += 'Indices: %s\n' % repr(self.indices)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_2__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_2__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_output = NULL;
  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("__repr__");

  /* "pandas/src/sparse.pyx":57
 * 
 *     def __repr__(self):
 *         output = 'IntIndex\n'             # <<<<<<<<<<<<<<
 *         output += 'Indices: %s\n' % repr(self.indices)
 *         return output
 */
  __Pyx_INCREF(((PyObject *)__pyx_n_s_1));
  __pyx_v_output = ((PyObject *)__pyx_n_s_1);

  /* "pandas/src/sparse.pyx":58
 *     def __repr__(self):
 *         output = 'IntIndex\n'
 *         output += 'Indices: %s\n' % repr(self.indices)             # <<<<<<<<<<<<<<
 *         return output
 * 
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->indices);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_output, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_output);
  __pyx_v_output = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pandas/src/sparse.pyx":59
 *         output = 'IntIndex\n'
 *         output += 'Indices: %s\n' % repr(self.indices)
 *         return output             # <<<<<<<<<<<<<<
 * 
 *     def check_integrity(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_output);
  __pyx_r = __pyx_v_output;
  goto __pyx_L0;

  __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_AddTraceback("pandas._sparse.IntIndex.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_output);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":61
 *         return output
 * 
 *     def check_integrity(self):             # <<<<<<<<<<<<<<
 *         '''
 *         Only need be strictly ascending and nothing less than 0 or greater than
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_3check_integrity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pandas_7_sparse_8IntIndex_3check_integrity[] = "\n        Only need be strictly ascending and nothing less than 0 or greater than\n        totall ength\n        ";
static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_3check_integrity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_integrity");

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":68
 *         pass
 * 
 *     def equals(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(other, IntIndex):
 *             return False
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_4equals(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_4equals(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_v_same_length = NULL;
  PyObject *__pyx_v_same_indices = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  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("equals");

  /* "pandas/src/sparse.pyx":69
 * 
 *     def equals(self, other):
 *         if not isinstance(other, IntIndex):             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_6pandas_7_sparse_IntIndex));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "pandas/src/sparse.pyx":70
 *     def equals(self, other):
 *         if not isinstance(other, IntIndex):
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         if self is other:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pandas/src/sparse.pyx":72
 *             return False
 * 
 *         if self is other:             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  __pyx_t_3 = (__pyx_v_self == __pyx_v_other);
  if (__pyx_t_3) {

    /* "pandas/src/sparse.pyx":73
 * 
 *         if self is other:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         same_length = self.length == other.length
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pandas/src/sparse.pyx":75
 *             return True
 * 
 *         same_length = self.length == other.length             # <<<<<<<<<<<<<<
 *         same_indices = np.array_equal(self.indices, other.indices)
 *         return same_length and same_indices
 */
  __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_same_length = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pandas/src/sparse.pyx":76
 * 
 *         same_length = self.length == other.length
 *         same_indices = np.array_equal(self.indices, other.indices)             # <<<<<<<<<<<<<<
 *         return same_length and same_indices
 * 
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__array_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__indices); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->indices));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->indices));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->indices));
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_same_indices = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pandas/src/sparse.pyx":77
 *         same_length = self.length == other.length
 *         same_indices = np.array_equal(self.indices, other.indices)
 *         return same_length and same_indices             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_same_length); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {
    __Pyx_INCREF(__pyx_v_same_indices);
    __pyx_t_5 = __pyx_v_same_indices;
  } else {
    __Pyx_INCREF(__pyx_v_same_length);
    __pyx_t_5 = __pyx_v_same_length;
  }
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pandas._sparse.IntIndex.equals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_same_length);
  __Pyx_XDECREF(__pyx_v_same_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":80
 * 
 *     @property
 *     def ngaps(self):             # <<<<<<<<<<<<<<
 *         return self.length - self.npoints
 * 
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_5ngaps(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_5ngaps(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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("ngaps");

  /* "pandas/src/sparse.pyx":81
 *     @property
 *     def ngaps(self):
 *         return self.length - self.npoints             # <<<<<<<<<<<<<<
 * 
 *     def to_int_index(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t((((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->length - ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->npoints)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.IntIndex.ngaps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":83
 *         return self.length - self.npoints
 * 
 *     def to_int_index(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_6to_int_index(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_6to_int_index(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_int_index");

  /* "pandas/src/sparse.pyx":84
 * 
 *     def to_int_index(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def to_block_index(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":86
 *         return self
 * 
 *     def to_block_index(self):             # <<<<<<<<<<<<<<
 *         locs, lens = get_blocks(self.indices)
 *         return BlockIndex(self.length, locs, lens)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_7to_block_index(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_7to_block_index(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_v_locs = NULL;
  PyObject *__pyx_v_lens = 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)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_block_index");

  /* "pandas/src/sparse.pyx":87
 * 
 *     def to_block_index(self):
 *         locs, lens = get_blocks(self.indices)             # <<<<<<<<<<<<<<
 *         return BlockIndex(self.length, locs, lens)
 * 
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->indices);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_6pandas_7_sparse_get_blocks(((PyArrayObject *)__pyx_t_1), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    if (likely(PyTuple_CheckExact(sequence))) {
      if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
        if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
        if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
    if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_locs = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_lens = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pandas/src/sparse.pyx":88
 *     def to_block_index(self):
 *         locs, lens = get_blocks(self.indices)
 *         return BlockIndex(self.length, locs, lens)             # <<<<<<<<<<<<<<
 * 
 *     cpdef IntIndex intersect(self, SparseIndex y_):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_locs);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_locs);
  __Pyx_GIVEREF(__pyx_v_locs);
  __Pyx_INCREF(__pyx_v_lens);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_lens);
  __Pyx_GIVEREF(__pyx_v_lens);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pandas_7_sparse_BlockIndex)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __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("pandas._sparse.IntIndex.to_block_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_locs);
  __Pyx_XDECREF(__pyx_v_lens);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":90
 *         return BlockIndex(self.length, locs, lens)
 * 
 *     cpdef IntIndex intersect(self, SparseIndex y_):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t out_length, xi, yi = 0
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_8intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_y_); /*proto*/
static struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_f_6pandas_7_sparse_8IntIndex_intersect(struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_v_self, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_y_, int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_xi;
  Py_ssize_t __pyx_v_yi;
  __pyx_t_5numpy_int32_t __pyx_v_xind;
  PyArrayObject *__pyx_v_xindices = 0;
  PyArrayObject *__pyx_v_yindices = 0;
  PyObject *__pyx_v_new_list = 0;
  struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_v_y = 0;
  Py_buffer __pyx_bstruct_yindices;
  Py_ssize_t __pyx_bstride_0_yindices = 0;
  Py_ssize_t __pyx_bshape_0_yindices = 0;
  Py_buffer __pyx_bstruct_xindices;
  Py_ssize_t __pyx_bstride_0_xindices = 0;
  Py_ssize_t __pyx_bshape_0_xindices = 0;
  struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyArrayObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  int __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("intersect");
  __pyx_bstruct_xindices.buf = NULL;
  __pyx_bstruct_yindices.buf = NULL;
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__intersect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_7_sparse_8IntIndex_8intersect)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_v_y_));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_y_));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_y_));
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pandas_7_sparse_IntIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/sparse.pyx":92
 *     cpdef IntIndex intersect(self, SparseIndex y_):
 *         cdef:
 *             Py_ssize_t out_length, xi, yi = 0             # <<<<<<<<<<<<<<
 *             int32_t xind
 *             ndarray[int32_t, ndim=1] xindices, yindices
 */
  __pyx_v_yi = 0;

  /* "pandas/src/sparse.pyx":95
 *             int32_t xind
 *             ndarray[int32_t, ndim=1] xindices, yindices
 *             list new_list = []             # <<<<<<<<<<<<<<
 *             IntIndex y
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_new_list = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/src/sparse.pyx":99
 * 
 *         # if is one already, returns self
 *         y = y_.to_int_index()             # <<<<<<<<<<<<<<
 * 
 *         if self.length != y.length:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_y_), __pyx_n_s__to_int_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pandas_7_sparse_IntIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_y = ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/src/sparse.pyx":101
 *         y = y_.to_int_index()
 * 
 *         if self.length != y.length:             # <<<<<<<<<<<<<<
 *             raise Exception('Indices must reference same underlying length')
 * 
 */
  __pyx_t_4 = (__pyx_v_self->length != __pyx_v_y->length);
  if (__pyx_t_4) {

    /* "pandas/src/sparse.pyx":102
 * 
 *         if self.length != y.length:
 *             raise Exception('Indices must reference same underlying length')             # <<<<<<<<<<<<<<
 * 
 *         xindices = self.indices
 */
    __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __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[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/sparse.pyx":104
 *             raise Exception('Indices must reference same underlying length')
 * 
 *         xindices = self.indices             # <<<<<<<<<<<<<<
 *         yindices = y.indices
 * 
 */
  __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->indices);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices);
    __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xindices, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_6 < 0)) {
      PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xindices, (PyObject*)__pyx_v_xindices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      }
    }
    __pyx_bstride_0_xindices = __pyx_bstruct_xindices.strides[0];
    __pyx_bshape_0_xindices = __pyx_bstruct_xindices.shape[0];
    if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_self->indices));
  __pyx_v_xindices = ((PyArrayObject *)__pyx_v_self->indices);

  /* "pandas/src/sparse.pyx":105
 * 
 *         xindices = self.indices
 *         yindices = y.indices             # <<<<<<<<<<<<<<
 * 
 *         for xi from 0 <= xi < self.npoints:
 */
  __pyx_t_5 = ((PyArrayObject *)__pyx_v_y->indices);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices);
    __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_yindices, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_6 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_yindices, (PyObject*)__pyx_v_yindices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7);
      }
    }
    __pyx_bstride_0_yindices = __pyx_bstruct_yindices.strides[0];
    __pyx_bshape_0_yindices = __pyx_bstruct_yindices.shape[0];
    if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_y->indices));
  __pyx_v_yindices = ((PyArrayObject *)__pyx_v_y->indices);

  /* "pandas/src/sparse.pyx":107
 *         yindices = y.indices
 * 
 *         for xi from 0 <= xi < self.npoints:             # <<<<<<<<<<<<<<
 *             xind = xindices[xi]
 * 
 */
  __pyx_t_10 = __pyx_v_self->npoints;
  for (__pyx_v_xi = 0; __pyx_v_xi < __pyx_t_10; __pyx_v_xi++) {

    /* "pandas/src/sparse.pyx":108
 * 
 *         for xi from 0 <= xi < self.npoints:
 *             xind = xindices[xi]             # <<<<<<<<<<<<<<
 * 
 *             while yi < y.npoints and yindices[yi] < xind:
 */
    __pyx_t_11 = __pyx_v_xi;
    __pyx_t_6 = -1;
    if (__pyx_t_11 < 0) {
      __pyx_t_11 += __pyx_bshape_0_xindices;
      if (unlikely(__pyx_t_11 < 0)) __pyx_t_6 = 0;
    } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_xindices)) __pyx_t_6 = 0;
    if (unlikely(__pyx_t_6 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_6);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_xind = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xindices.buf, __pyx_t_11, __pyx_bstride_0_xindices));

    /* "pandas/src/sparse.pyx":110
 *             xind = xindices[xi]
 * 
 *             while yi < y.npoints and yindices[yi] < xind:             # <<<<<<<<<<<<<<
 *                 yi += 1
 * 
 */
    while (1) {
      __pyx_t_4 = (__pyx_v_yi < __pyx_v_y->npoints);
      if (__pyx_t_4) {
        __pyx_t_12 = __pyx_v_yi;
        __pyx_t_6 = -1;
        if (__pyx_t_12 < 0) {
          __pyx_t_12 += __pyx_bshape_0_yindices;
          if (unlikely(__pyx_t_12 < 0)) __pyx_t_6 = 0;
        } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_yindices)) __pyx_t_6 = 0;
        if (unlikely(__pyx_t_6 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_6);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yindices.buf, __pyx_t_12, __pyx_bstride_0_yindices)) < __pyx_v_xind);
        __pyx_t_14 = __pyx_t_13;
      } else {
        __pyx_t_14 = __pyx_t_4;
      }
      if (!__pyx_t_14) break;

      /* "pandas/src/sparse.pyx":111
 * 
 *             while yi < y.npoints and yindices[yi] < xind:
 *                 yi += 1             # <<<<<<<<<<<<<<
 * 
 *             if yi >= y.npoints:
 */
      __pyx_v_yi = (__pyx_v_yi + 1);
    }

    /* "pandas/src/sparse.pyx":113
 *                 yi += 1
 * 
 *             if yi >= y.npoints:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
    __pyx_t_14 = (__pyx_v_yi >= __pyx_v_y->npoints);
    if (__pyx_t_14) {

      /* "pandas/src/sparse.pyx":114
 * 
 *             if yi >= y.npoints:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             # TODO: would a two-pass algorithm be faster?
 */
      goto __pyx_L5_break;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "pandas/src/sparse.pyx":117
 * 
 *             # TODO: would a two-pass algorithm be faster?
 *             if yindices[yi] == xind:             # <<<<<<<<<<<<<<
 *                 new_list.append(xind)
 * 
 */
    __pyx_t_15 = __pyx_v_yi;
    __pyx_t_6 = -1;
    if (__pyx_t_15 < 0) {
      __pyx_t_15 += __pyx_bshape_0_yindices;
      if (unlikely(__pyx_t_15 < 0)) __pyx_t_6 = 0;
    } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_yindices)) __pyx_t_6 = 0;
    if (unlikely(__pyx_t_6 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_6);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_14 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yindices.buf, __pyx_t_15, __pyx_bstride_0_yindices)) == __pyx_v_xind);
    if (__pyx_t_14) {

      /* "pandas/src/sparse.pyx":118
 *             # TODO: would a two-pass algorithm be faster?
 *             if yindices[yi] == xind:
 *                 new_list.append(xind)             # <<<<<<<<<<<<<<
 * 
 *         return IntIndex(self.length, new_list)
 */
      if (unlikely(((PyObject *)__pyx_v_new_list) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_3 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_xind); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_16 = PyList_Append(__pyx_v_new_list, __pyx_t_3); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L9;
    }
    __pyx_L9:;
  }
  __pyx_L5_break:;

  /* "pandas/src/sparse.pyx":120
 *                 new_list.append(xind)
 * 
 *         return IntIndex(self.length, new_list)             # <<<<<<<<<<<<<<
 * 
 *     cpdef IntIndex make_union(self, SparseIndex y_):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_new_list));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_new_list));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_new_list));
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pandas_7_sparse_IntIndex)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.IntIndex.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_xindices);
  __Pyx_XDECREF((PyObject *)__pyx_v_yindices);
  __Pyx_XDECREF(__pyx_v_new_list);
  __Pyx_XDECREF((PyObject *)__pyx_v_y);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":90
 *         return BlockIndex(self.length, locs, lens)
 * 
 *     cpdef IntIndex intersect(self, SparseIndex y_):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t out_length, xi, yi = 0
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_8intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_y_); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_8intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_y_) {
  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("intersect");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "y_", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6pandas_7_sparse_IntIndex *)((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->__pyx_vtab)->intersect(((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self), ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)__pyx_v_y_), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __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;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.IntIndex.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":122
 *         return IntIndex(self.length, new_list)
 * 
 *     cpdef IntIndex make_union(self, SparseIndex y_):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t out_length, i, xi, yi
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_9make_union(PyObject *__pyx_v_self, PyObject *__pyx_v_y_); /*proto*/
static struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_f_6pandas_7_sparse_8IntIndex_make_union(struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_v_self, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_y_, int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_xi;
  Py_ssize_t __pyx_v_yi;
  __pyx_t_5numpy_int32_t __pyx_v_xind;
  PyArrayObject *__pyx_v_xindices = 0;
  PyArrayObject *__pyx_v_yindices = 0;
  PyObject *__pyx_v_new_list = 0;
  struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_v_y = 0;
  PyObject *__pyx_v_yind = NULL;
  Py_buffer __pyx_bstruct_yindices;
  Py_ssize_t __pyx_bstride_0_yindices = 0;
  Py_ssize_t __pyx_bshape_0_yindices = 0;
  Py_buffer __pyx_bstruct_xindices;
  Py_ssize_t __pyx_bstride_0_xindices = 0;
  Py_ssize_t __pyx_bshape_0_xindices = 0;
  struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyArrayObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("make_union");
  __pyx_bstruct_xindices.buf = NULL;
  __pyx_bstruct_yindices.buf = NULL;
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__make_union); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_7_sparse_8IntIndex_9make_union)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_v_y_));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_y_));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_y_));
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pandas_7_sparse_IntIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/sparse.pyx":127
 *             int32_t xind
 *             ndarray[int32_t, ndim=1] xindices, yindices
 *             list new_list = []             # <<<<<<<<<<<<<<
 *             IntIndex x, y
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_new_list = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/src/sparse.pyx":130
 *             IntIndex x, y
 * 
 *         x = self             # <<<<<<<<<<<<<<
 * 
 *         # if is one already, returns self
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_v_x = __pyx_v_self;

  /* "pandas/src/sparse.pyx":133
 * 
 *         # if is one already, returns self
 *         y = y_.to_int_index()             # <<<<<<<<<<<<<<
 * 
 *         if self.length != y.length:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_y_), __pyx_n_s__to_int_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pandas_7_sparse_IntIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_y = ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/src/sparse.pyx":135
 *         y = y_.to_int_index()
 * 
 *         if self.length != y.length:             # <<<<<<<<<<<<<<
 *             raise Exception('Indices must reference same underlying length')
 * 
 */
  __pyx_t_4 = (__pyx_v_self->length != __pyx_v_y->length);
  if (__pyx_t_4) {

    /* "pandas/src/sparse.pyx":136
 * 
 *         if self.length != y.length:
 *             raise Exception('Indices must reference same underlying length')             # <<<<<<<<<<<<<<
 * 
 *         xindices = self.indices
 */
    __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __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[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/sparse.pyx":138
 *             raise Exception('Indices must reference same underlying length')
 * 
 *         xindices = self.indices             # <<<<<<<<<<<<<<
 *         yindices = y.indices
 * 
 */
  __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->indices);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices);
    __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xindices, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_6 < 0)) {
      PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xindices, (PyObject*)__pyx_v_xindices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      }
    }
    __pyx_bstride_0_xindices = __pyx_bstruct_xindices.strides[0];
    __pyx_bshape_0_xindices = __pyx_bstruct_xindices.shape[0];
    if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_self->indices));
  __pyx_v_xindices = ((PyArrayObject *)__pyx_v_self->indices);

  /* "pandas/src/sparse.pyx":139
 * 
 *         xindices = self.indices
 *         yindices = y.indices             # <<<<<<<<<<<<<<
 * 
 *         xi = yi = 0
 */
  __pyx_t_5 = ((PyArrayObject *)__pyx_v_y->indices);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices);
    __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_yindices, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_6 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_yindices, (PyObject*)__pyx_v_yindices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7);
      }
    }
    __pyx_bstride_0_yindices = __pyx_bstruct_yindices.strides[0];
    __pyx_bshape_0_yindices = __pyx_bstruct_yindices.shape[0];
    if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_y->indices));
  __pyx_v_yindices = ((PyArrayObject *)__pyx_v_y->indices);

  /* "pandas/src/sparse.pyx":141
 *         yindices = y.indices
 * 
 *         xi = yi = 0             # <<<<<<<<<<<<<<
 *         while True:
 *             if xi == x.npoints:
 */
  __pyx_v_xi = 0;
  __pyx_v_yi = 0;

  /* "pandas/src/sparse.pyx":142
 * 
 *         xi = yi = 0
 *         while True:             # <<<<<<<<<<<<<<
 *             if xi == x.npoints:
 *                 while yi < y.npoints:
 */
  while (1) {
    if (!1) break;

    /* "pandas/src/sparse.pyx":143
 *         xi = yi = 0
 *         while True:
 *             if xi == x.npoints:             # <<<<<<<<<<<<<<
 *                 while yi < y.npoints:
 *                     new_list.append(yindices[yi])
 */
    __pyx_t_4 = (__pyx_v_xi == __pyx_v_x->npoints);
    if (__pyx_t_4) {

      /* "pandas/src/sparse.pyx":144
 *         while True:
 *             if xi == x.npoints:
 *                 while yi < y.npoints:             # <<<<<<<<<<<<<<
 *                     new_list.append(yindices[yi])
 *                     yi += 1
 */
      while (1) {
        __pyx_t_4 = (__pyx_v_yi < __pyx_v_y->npoints);
        if (!__pyx_t_4) break;

        /* "pandas/src/sparse.pyx":145
 *             if xi == x.npoints:
 *                 while yi < y.npoints:
 *                     new_list.append(yindices[yi])             # <<<<<<<<<<<<<<
 *                     yi += 1
 *                 break
 */
        if (unlikely(((PyObject *)__pyx_v_new_list) == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
        }
        __pyx_t_10 = __pyx_v_yi;
        __pyx_t_6 = -1;
        if (__pyx_t_10 < 0) {
          __pyx_t_10 += __pyx_bshape_0_yindices;
          if (unlikely(__pyx_t_10 < 0)) __pyx_t_6 = 0;
        } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_yindices)) __pyx_t_6 = 0;
        if (unlikely(__pyx_t_6 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_6);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_3 = __Pyx_PyInt_to_py_npy_int32((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yindices.buf, __pyx_t_10, __pyx_bstride_0_yindices))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_11 = PyList_Append(__pyx_v_new_list, __pyx_t_3); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "pandas/src/sparse.pyx":146
 *                 while yi < y.npoints:
 *                     new_list.append(yindices[yi])
 *                     yi += 1             # <<<<<<<<<<<<<<
 *                 break
 *             elif yi == y.npoints:
 */
        __pyx_v_yi = (__pyx_v_yi + 1);
      }

      /* "pandas/src/sparse.pyx":147
 *                     new_list.append(yindices[yi])
 *                     yi += 1
 *                 break             # <<<<<<<<<<<<<<
 *             elif yi == y.npoints:
 *                 while xi < x.npoints:
 */
      goto __pyx_L5_break;
      goto __pyx_L6;
    }

    /* "pandas/src/sparse.pyx":148
 *                     yi += 1
 *                 break
 *             elif yi == y.npoints:             # <<<<<<<<<<<<<<
 *                 while xi < x.npoints:
 *                     new_list.append(xindices[xi])
 */
    __pyx_t_4 = (__pyx_v_yi == __pyx_v_y->npoints);
    if (__pyx_t_4) {

      /* "pandas/src/sparse.pyx":149
 *                 break
 *             elif yi == y.npoints:
 *                 while xi < x.npoints:             # <<<<<<<<<<<<<<
 *                     new_list.append(xindices[xi])
 *                     xi += 1
 */
      while (1) {
        __pyx_t_4 = (__pyx_v_xi < __pyx_v_x->npoints);
        if (!__pyx_t_4) break;

        /* "pandas/src/sparse.pyx":150
 *             elif yi == y.npoints:
 *                 while xi < x.npoints:
 *                     new_list.append(xindices[xi])             # <<<<<<<<<<<<<<
 *                     xi += 1
 *                 break
 */
        if (unlikely(((PyObject *)__pyx_v_new_list) == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
        }
        __pyx_t_12 = __pyx_v_xi;
        __pyx_t_6 = -1;
        if (__pyx_t_12 < 0) {
          __pyx_t_12 += __pyx_bshape_0_xindices;
          if (unlikely(__pyx_t_12 < 0)) __pyx_t_6 = 0;
        } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_xindices)) __pyx_t_6 = 0;
        if (unlikely(__pyx_t_6 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_6);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_3 = __Pyx_PyInt_to_py_npy_int32((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xindices.buf, __pyx_t_12, __pyx_bstride_0_xindices))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_11 = PyList_Append(__pyx_v_new_list, __pyx_t_3); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "pandas/src/sparse.pyx":151
 *                 while xi < x.npoints:
 *                     new_list.append(xindices[xi])
 *                     xi += 1             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
        __pyx_v_xi = (__pyx_v_xi + 1);
      }

      /* "pandas/src/sparse.pyx":152
 *                     new_list.append(xindices[xi])
 *                     xi += 1
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             xind = xindices[xi]
 */
      goto __pyx_L5_break;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/sparse.pyx":154
 *                 break
 * 
 *             xind = xindices[xi]             # <<<<<<<<<<<<<<
 *             yind = yindices[yi]
 * 
 */
    __pyx_t_13 = __pyx_v_xi;
    __pyx_t_6 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_bshape_0_xindices;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_6 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_xindices)) __pyx_t_6 = 0;
    if (unlikely(__pyx_t_6 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_6);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_xind = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xindices.buf, __pyx_t_13, __pyx_bstride_0_xindices));

    /* "pandas/src/sparse.pyx":155
 * 
 *             xind = xindices[xi]
 *             yind = yindices[yi]             # <<<<<<<<<<<<<<
 * 
 *             if xind == yind:
 */
    __pyx_t_14 = __pyx_v_yi;
    __pyx_t_6 = -1;
    if (__pyx_t_14 < 0) {
      __pyx_t_14 += __pyx_bshape_0_yindices;
      if (unlikely(__pyx_t_14 < 0)) __pyx_t_6 = 0;
    } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_yindices)) __pyx_t_6 = 0;
    if (unlikely(__pyx_t_6 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_6);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = __Pyx_PyInt_to_py_npy_int32((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yindices.buf, __pyx_t_14, __pyx_bstride_0_yindices))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF(__pyx_v_yind);
    __pyx_v_yind = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pandas/src/sparse.pyx":157
 *             yind = yindices[yi]
 * 
 *             if xind == yind:             # <<<<<<<<<<<<<<
 *                 new_list.append(xind)
 *                 xi += 1
 */
    __pyx_t_3 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_xind); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_v_yind, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "pandas/src/sparse.pyx":158
 * 
 *             if xind == yind:
 *                 new_list.append(xind)             # <<<<<<<<<<<<<<
 *                 xi += 1
 *                 yi += 1
 */
      if (unlikely(((PyObject *)__pyx_v_new_list) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_1 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_xind); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_11 = PyList_Append(__pyx_v_new_list, __pyx_t_1); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pandas/src/sparse.pyx":159
 *             if xind == yind:
 *                 new_list.append(xind)
 *                 xi += 1             # <<<<<<<<<<<<<<
 *                 yi += 1
 *             elif xind < yind:
 */
      __pyx_v_xi = (__pyx_v_xi + 1);

      /* "pandas/src/sparse.pyx":160
 *                 new_list.append(xind)
 *                 xi += 1
 *                 yi += 1             # <<<<<<<<<<<<<<
 *             elif xind < yind:
 *                 new_list.append(xind)
 */
      __pyx_v_yi = (__pyx_v_yi + 1);
      goto __pyx_L11;
    }

    /* "pandas/src/sparse.pyx":161
 *                 xi += 1
 *                 yi += 1
 *             elif xind < yind:             # <<<<<<<<<<<<<<
 *                 new_list.append(xind)
 *                 xi += 1
 */
    __pyx_t_1 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_xind); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_v_yind, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "pandas/src/sparse.pyx":162
 *                 yi += 1
 *             elif xind < yind:
 *                 new_list.append(xind)             # <<<<<<<<<<<<<<
 *                 xi += 1
 *             else:
 */
      if (unlikely(((PyObject *)__pyx_v_new_list) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_3 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_xind); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_11 = PyList_Append(__pyx_v_new_list, __pyx_t_3); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "pandas/src/sparse.pyx":163
 *             elif xind < yind:
 *                 new_list.append(xind)
 *                 xi += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 new_list.append(yind)
 */
      __pyx_v_xi = (__pyx_v_xi + 1);
      goto __pyx_L11;
    }
    /*else*/ {

      /* "pandas/src/sparse.pyx":165
 *                 xi += 1
 *             else:
 *                 new_list.append(yind)             # <<<<<<<<<<<<<<
 *                 yi += 1
 * 
 */
      if (unlikely(((PyObject *)__pyx_v_new_list) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_11 = PyList_Append(__pyx_v_new_list, __pyx_v_yind); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pandas/src/sparse.pyx":166
 *             else:
 *                 new_list.append(yind)
 *                 yi += 1             # <<<<<<<<<<<<<<
 * 
 *         return IntIndex(x.length, new_list)
 */
      __pyx_v_yi = (__pyx_v_yi + 1);
    }
    __pyx_L11:;
  }
  __pyx_L5_break:;

  /* "pandas/src/sparse.pyx":168
 *                 yi += 1
 * 
 *         return IntIndex(x.length, new_list)             # <<<<<<<<<<<<<<
 * 
 *     @cython.wraparound(False)
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_x->length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_new_list));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_new_list));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_new_list));
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pandas_7_sparse_IntIndex)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.IntIndex.make_union", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_xindices);
  __Pyx_XDECREF((PyObject *)__pyx_v_yindices);
  __Pyx_XDECREF(__pyx_v_new_list);
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XDECREF((PyObject *)__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_yind);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":122
 *         return IntIndex(self.length, new_list)
 * 
 *     cpdef IntIndex make_union(self, SparseIndex y_):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t out_length, i, xi, yi
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_9make_union(PyObject *__pyx_v_self, PyObject *__pyx_v_y_); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_9make_union(PyObject *__pyx_v_self, PyObject *__pyx_v_y_) {
  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("make_union");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "y_", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6pandas_7_sparse_IntIndex *)((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->__pyx_vtab)->make_union(((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self), ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)__pyx_v_y_), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.IntIndex.make_union", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":171
 * 
 *     @cython.wraparound(False)
 *     cpdef lookup(self, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t res, n, cum_len = 0
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_10lookup(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_8IntIndex_lookup(struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_v_self, Py_ssize_t __pyx_v_index, int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_res;
  Py_ssize_t __pyx_v_cum_len;
  PyArrayObject *__pyx_v_inds = 0;
  Py_buffer __pyx_bstruct_inds;
  Py_ssize_t __pyx_bstride_0_inds = 0;
  Py_ssize_t __pyx_bshape_0_inds = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyArrayObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lookup");
  __pyx_bstruct_inds.buf = NULL;
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__lookup); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_7_sparse_8IntIndex_10lookup)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__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;
  }

  /* "pandas/src/sparse.pyx":173
 *     cpdef lookup(self, Py_ssize_t index):
 *         cdef:
 *             Py_ssize_t res, n, cum_len = 0             # <<<<<<<<<<<<<<
 *             ndarray[int32_t, ndim=1] inds
 * 
 */
  __pyx_v_cum_len = 0;

  /* "pandas/src/sparse.pyx":176
 *             ndarray[int32_t, ndim=1] inds
 * 
 *         inds = self.indices             # <<<<<<<<<<<<<<
 *         res = inds.searchsorted(index)
 *         if res == self.npoints:
 */
  __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->indices);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inds);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_inds, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_inds, (PyObject*)__pyx_v_inds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_bstride_0_inds = __pyx_bstruct_inds.strides[0];
    __pyx_bshape_0_inds = __pyx_bstruct_inds.shape[0];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_self->indices));
  __pyx_v_inds = ((PyArrayObject *)__pyx_v_self->indices);

  /* "pandas/src/sparse.pyx":177
 * 
 *         inds = self.indices
 *         res = inds.searchsorted(index)             # <<<<<<<<<<<<<<
 *         if res == self.npoints:
 *             return -1
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_inds), __pyx_n_s__searchsorted); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_res = __pyx_t_9;

  /* "pandas/src/sparse.pyx":178
 *         inds = self.indices
 *         res = inds.searchsorted(index)
 *         if res == self.npoints:             # <<<<<<<<<<<<<<
 *             return -1
 *         elif inds[res] == index:
 */
  __pyx_t_10 = (__pyx_v_res == __pyx_v_self->npoints);
  if (__pyx_t_10) {

    /* "pandas/src/sparse.pyx":179
 *         res = inds.searchsorted(index)
 *         if res == self.npoints:
 *             return -1             # <<<<<<<<<<<<<<
 *         elif inds[res] == index:
 *             return res
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_neg_1);
    __pyx_r = __pyx_int_neg_1;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "pandas/src/sparse.pyx":180
 *         if res == self.npoints:
 *             return -1
 *         elif inds[res] == index:             # <<<<<<<<<<<<<<
 *             return res
 *         else:
 */
  __pyx_t_9 = __pyx_v_res;
  __pyx_t_5 = -1;
  if (__pyx_t_9 < 0) {
    __pyx_t_5 = 0;
  } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_inds)) __pyx_t_5 = 0;
  if (unlikely(__pyx_t_5 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_5);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_10 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_inds.buf, __pyx_t_9, __pyx_bstride_0_inds)) == __pyx_v_index);
  if (__pyx_t_10) {

    /* "pandas/src/sparse.pyx":181
 *             return -1
 *         elif inds[res] == index:
 *             return res             # <<<<<<<<<<<<<<
 *         else:
 *             return -1
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_res); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/sparse.pyx":183
 *             return res
 *         else:
 *             return -1             # <<<<<<<<<<<<<<
 * 
 *     cpdef ndarray reindex(self, ndarray[float64_t, ndim=1] values,
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_neg_1);
    __pyx_r = __pyx_int_neg_1;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inds);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.IntIndex.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inds);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_inds);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":171
 * 
 *     @cython.wraparound(False)
 *     cpdef lookup(self, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t res, n, cum_len = 0
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_10lookup(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_10lookup(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) {
  Py_ssize_t __pyx_v_index;
  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("lookup");
  assert(__pyx_arg_index); {
    __pyx_v_index = __Pyx_PyIndex_AsSsize_t(__pyx_arg_index); if (unlikely((__pyx_v_index == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.IntIndex.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pandas_7_sparse_IntIndex *)((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->__pyx_vtab)->lookup(((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self), __pyx_v_index, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.IntIndex.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":185
 *             return -1
 * 
 *     cpdef ndarray reindex(self, ndarray[float64_t, ndim=1] values,             # <<<<<<<<<<<<<<
 *                           float64_t fill_value, SparseIndex other_):
 *         cdef:
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_11reindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyArrayObject *__pyx_f_6pandas_7_sparse_8IntIndex_reindex(struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_v_self, PyArrayObject *__pyx_v_values, __pyx_t_5numpy_float64_t __pyx_v_fill_value, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_other_, int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_v_other = 0;
  PyArrayObject *__pyx_v_result = 0;
  PyArrayObject *__pyx_v_sinds = 0;
  PyArrayObject *__pyx_v_oinds = 0;
  Py_buffer __pyx_bstruct_sinds;
  Py_ssize_t __pyx_bstride_0_sinds = 0;
  Py_ssize_t __pyx_bshape_0_sinds = 0;
  Py_buffer __pyx_bstruct_oinds;
  Py_ssize_t __pyx_bstride_0_oinds = 0;
  Py_ssize_t __pyx_bshape_0_oinds = 0;
  Py_buffer __pyx_bstruct_values;
  Py_ssize_t __pyx_bstride_0_values = 0;
  Py_ssize_t __pyx_bshape_0_values = 0;
  Py_buffer __pyx_bstruct_result;
  Py_ssize_t __pyx_bstride_0_result = 0;
  Py_ssize_t __pyx_bshape_0_result = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyArrayObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyArrayObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reindex");
  __pyx_bstruct_result.buf = NULL;
  __pyx_bstruct_sinds.buf = NULL;
  __pyx_bstruct_oinds.buf = NULL;
  __pyx_bstruct_values.buf = NULL;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_values = __pyx_bstruct_values.strides[0];
  __pyx_bshape_0_values = __pyx_bstruct_values.shape[0];
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__reindex); 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) != (void *)&__pyx_pf_6pandas_7_sparse_8IntIndex_11reindex)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_fill_value); 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_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_INCREF(((PyObject *)__pyx_v_values));
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_values));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_values));
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_other_));
      PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_other_));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_other_));
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), 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(((PyObject *)__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 = 185; __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;
  }

  /* "pandas/src/sparse.pyx":188
 *                           float64_t fill_value, SparseIndex other_):
 *         cdef:
 *             Py_ssize_t i = 0, j = 0             # <<<<<<<<<<<<<<
 *             IntIndex other
 *             ndarray[float64_t, ndim=1] result
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "pandas/src/sparse.pyx":193
 *             ndarray[int32_t, ndim=1] sinds, oinds
 * 
 *         other = other_.to_int_index()             # <<<<<<<<<<<<<<
 * 
 *         oinds = other.indices
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_other_), __pyx_n_s__to_int_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6pandas_7_sparse_IntIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_other = ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/src/sparse.pyx":195
 *         other = other_.to_int_index()
 * 
 *         oinds = other.indices             # <<<<<<<<<<<<<<
 *         sinds = self.indices
 * 
 */
  __pyx_t_4 = ((PyArrayObject *)__pyx_v_other->indices);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_oinds);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_oinds, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_oinds, (PyObject*)__pyx_v_oinds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_bstride_0_oinds = __pyx_bstruct_oinds.strides[0];
    __pyx_bshape_0_oinds = __pyx_bstruct_oinds.shape[0];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_other->indices));
  __pyx_v_oinds = ((PyArrayObject *)__pyx_v_other->indices);

  /* "pandas/src/sparse.pyx":196
 * 
 *         oinds = other.indices
 *         sinds = self.indices             # <<<<<<<<<<<<<<
 * 
 *         result = np.empty(other.npoints, dtype=np.float64)
 */
  __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->indices);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sinds);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_sinds, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_sinds, (PyObject*)__pyx_v_sinds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_bstride_0_sinds = __pyx_bstruct_sinds.strides[0];
    __pyx_bshape_0_sinds = __pyx_bstruct_sinds.shape[0];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_self->indices));
  __pyx_v_sinds = ((PyArrayObject *)__pyx_v_self->indices);

  /* "pandas/src/sparse.pyx":198
 *         sinds = self.indices
 * 
 *         result = np.empty(other.npoints, dtype=np.float64)             # <<<<<<<<<<<<<<
 *         result.fill(fill_value)
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_other->npoints); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float64); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_10);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_bstride_0_result = __pyx_bstruct_result.strides[0];
    __pyx_bshape_0_result = __pyx_bstruct_result.shape[0];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_11 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "pandas/src/sparse.pyx":199
 * 
 *         result = np.empty(other.npoints, dtype=np.float64)
 *         result.fill(fill_value)             # <<<<<<<<<<<<<<
 * 
 *         for 0 <= i < other.npoints:
 */
  __pyx_t_10 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__fill); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_fill_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/src/sparse.pyx":201
 *         result.fill(fill_value)
 * 
 *         for 0 <= i < other.npoints:             # <<<<<<<<<<<<<<
 *             while oinds[i] > sinds[j] and j < self.npoints:
 *                 j += 1
 */
  __pyx_t_12 = __pyx_v_other->npoints;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_12; __pyx_v_i++) {

    /* "pandas/src/sparse.pyx":202
 * 
 *         for 0 <= i < other.npoints:
 *             while oinds[i] > sinds[j] and j < self.npoints:             # <<<<<<<<<<<<<<
 *                 j += 1
 * 
 */
    while (1) {
      __pyx_t_13 = __pyx_v_i;
      __pyx_t_5 = -1;
      if (__pyx_t_13 < 0) {
        __pyx_t_13 += __pyx_bshape_0_oinds;
        if (unlikely(__pyx_t_13 < 0)) __pyx_t_5 = 0;
      } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_oinds)) __pyx_t_5 = 0;
      if (unlikely(__pyx_t_5 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_5);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_14 = __pyx_v_j;
      __pyx_t_5 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_14 += __pyx_bshape_0_sinds;
        if (unlikely(__pyx_t_14 < 0)) __pyx_t_5 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_sinds)) __pyx_t_5 = 0;
      if (unlikely(__pyx_t_5 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_5);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_oinds.buf, __pyx_t_13, __pyx_bstride_0_oinds)) > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_sinds.buf, __pyx_t_14, __pyx_bstride_0_sinds)));
      if (__pyx_t_15) {
        __pyx_t_16 = (__pyx_v_j < __pyx_v_self->npoints);
        __pyx_t_17 = __pyx_t_16;
      } else {
        __pyx_t_17 = __pyx_t_15;
      }
      if (!__pyx_t_17) break;

      /* "pandas/src/sparse.pyx":203
 *         for 0 <= i < other.npoints:
 *             while oinds[i] > sinds[j] and j < self.npoints:
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *             if j == self.npoints:
 */
      __pyx_v_j = (__pyx_v_j + 1);
    }

    /* "pandas/src/sparse.pyx":205
 *                 j += 1
 * 
 *             if j == self.npoints:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
    __pyx_t_17 = (__pyx_v_j == __pyx_v_self->npoints);
    if (__pyx_t_17) {

      /* "pandas/src/sparse.pyx":206
 * 
 *             if j == self.npoints:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             if oinds[i] < sinds[j]:
 */
      goto __pyx_L4_break;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "pandas/src/sparse.pyx":208
 *                 break
 * 
 *             if oinds[i] < sinds[j]:             # <<<<<<<<<<<<<<
 *                 continue
 *             elif oinds[i] == sinds[j]:
 */
    __pyx_t_18 = __pyx_v_i;
    __pyx_t_5 = -1;
    if (__pyx_t_18 < 0) {
      __pyx_t_18 += __pyx_bshape_0_oinds;
      if (unlikely(__pyx_t_18 < 0)) __pyx_t_5 = 0;
    } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_oinds)) __pyx_t_5 = 0;
    if (unlikely(__pyx_t_5 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_5);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_19 = __pyx_v_j;
    __pyx_t_5 = -1;
    if (__pyx_t_19 < 0) {
      __pyx_t_19 += __pyx_bshape_0_sinds;
      if (unlikely(__pyx_t_19 < 0)) __pyx_t_5 = 0;
    } else if (unlikely(__pyx_t_19 >= __pyx_bshape_0_sinds)) __pyx_t_5 = 0;
    if (unlikely(__pyx_t_5 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_5);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_17 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_oinds.buf, __pyx_t_18, __pyx_bstride_0_oinds)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_sinds.buf, __pyx_t_19, __pyx_bstride_0_sinds)));
    if (__pyx_t_17) {

      /* "pandas/src/sparse.pyx":209
 * 
 *             if oinds[i] < sinds[j]:
 *                 continue             # <<<<<<<<<<<<<<
 *             elif oinds[i] == sinds[j]:
 *                 result[i] = values[j]
 */
      goto __pyx_L3_continue;
      goto __pyx_L8;
    }

    /* "pandas/src/sparse.pyx":210
 *             if oinds[i] < sinds[j]:
 *                 continue
 *             elif oinds[i] == sinds[j]:             # <<<<<<<<<<<<<<
 *                 result[i] = values[j]
 *                 j += 1
 */
    __pyx_t_20 = __pyx_v_i;
    __pyx_t_5 = -1;
    if (__pyx_t_20 < 0) {
      __pyx_t_20 += __pyx_bshape_0_oinds;
      if (unlikely(__pyx_t_20 < 0)) __pyx_t_5 = 0;
    } else if (unlikely(__pyx_t_20 >= __pyx_bshape_0_oinds)) __pyx_t_5 = 0;
    if (unlikely(__pyx_t_5 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_5);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_21 = __pyx_v_j;
    __pyx_t_5 = -1;
    if (__pyx_t_21 < 0) {
      __pyx_t_21 += __pyx_bshape_0_sinds;
      if (unlikely(__pyx_t_21 < 0)) __pyx_t_5 = 0;
    } else if (unlikely(__pyx_t_21 >= __pyx_bshape_0_sinds)) __pyx_t_5 = 0;
    if (unlikely(__pyx_t_5 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_5);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_17 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_oinds.buf, __pyx_t_20, __pyx_bstride_0_oinds)) == (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_sinds.buf, __pyx_t_21, __pyx_bstride_0_sinds)));
    if (__pyx_t_17) {

      /* "pandas/src/sparse.pyx":211
 *                 continue
 *             elif oinds[i] == sinds[j]:
 *                 result[i] = values[j]             # <<<<<<<<<<<<<<
 *                 j += 1
 * 
 */
      __pyx_t_22 = __pyx_v_j;
      __pyx_t_5 = -1;
      if (__pyx_t_22 < 0) {
        __pyx_t_22 += __pyx_bshape_0_values;
        if (unlikely(__pyx_t_22 < 0)) __pyx_t_5 = 0;
      } else if (unlikely(__pyx_t_22 >= __pyx_bshape_0_values)) __pyx_t_5 = 0;
      if (unlikely(__pyx_t_5 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_5);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_23 = __pyx_v_i;
      __pyx_t_5 = -1;
      if (__pyx_t_23 < 0) {
        __pyx_t_23 += __pyx_bshape_0_result;
        if (unlikely(__pyx_t_23 < 0)) __pyx_t_5 = 0;
      } else if (unlikely(__pyx_t_23 >= __pyx_bshape_0_result)) __pyx_t_5 = 0;
      if (unlikely(__pyx_t_5 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_5);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_result.buf, __pyx_t_23, __pyx_bstride_0_result) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_values.buf, __pyx_t_22, __pyx_bstride_0_values));

      /* "pandas/src/sparse.pyx":212
 *             elif oinds[i] == sinds[j]:
 *                 result[i] = values[j]
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *         return result
 */
      __pyx_v_j = (__pyx_v_j + 1);
      goto __pyx_L8;
    }
    __pyx_L8:;
    __pyx_L3_continue:;
  }
  __pyx_L4_break:;

  /* "pandas/src/sparse.pyx":214
 *                 j += 1
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     cpdef put(self, ndarray[float64_t, ndim=1] values,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyArrayObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = ((PyArrayObject *)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_9);
  __Pyx_XDECREF(__pyx_t_10);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sinds);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_oinds);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.IntIndex.reindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sinds);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_oinds);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_other);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF((PyObject *)__pyx_v_sinds);
  __Pyx_XDECREF((PyObject *)__pyx_v_oinds);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":185
 *             return -1
 * 
 *     cpdef ndarray reindex(self, ndarray[float64_t, ndim=1] values,             # <<<<<<<<<<<<<<
 *                           float64_t fill_value, SparseIndex other_):
 *         cdef:
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_11reindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_11reindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  __pyx_t_5numpy_float64_t __pyx_v_fill_value;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_other_ = 0;
  Py_buffer __pyx_bstruct_values;
  Py_ssize_t __pyx_bstride_0_values = 0;
  Py_ssize_t __pyx_bshape_0_values = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__fill_value,&__pyx_n_s__other_,0};
  __Pyx_RefNannySetupContext("reindex");
  {
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("reindex", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other_);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("reindex", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "reindex") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __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_values = ((PyArrayObject *)values[0]);
    __pyx_v_fill_value = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fill_value == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_other_ = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("reindex", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.IntIndex.reindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_bstruct_values.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other_), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "other_", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_values = __pyx_bstruct_values.strides[0];
  __pyx_bshape_0_values = __pyx_bstruct_values.shape[0];
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6pandas_7_sparse_IntIndex *)((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->__pyx_vtab)->reindex(((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self), __pyx_v_values, __pyx_v_fill_value, __pyx_v_other_, 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;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.IntIndex.reindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":216
 *         return result
 * 
 *     cpdef put(self, ndarray[float64_t, ndim=1] values,             # <<<<<<<<<<<<<<
 *               ndarray[int32_t, ndim=1] indices, object to_put):
 *         pass
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_12put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_8IntIndex_put(struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_v_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indices, PyObject *__pyx_v_to_put, int __pyx_skip_dispatch) {
  Py_buffer __pyx_bstruct_indices;
  Py_ssize_t __pyx_bstride_0_indices = 0;
  Py_ssize_t __pyx_bshape_0_indices = 0;
  Py_buffer __pyx_bstruct_values;
  Py_ssize_t __pyx_bstride_0_values = 0;
  Py_ssize_t __pyx_bshape_0_values = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  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_RefNannySetupContext("put");
  __pyx_bstruct_values.buf = NULL;
  __pyx_bstruct_indices.buf = NULL;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_values = __pyx_bstruct_values.strides[0];
  __pyx_bshape_0_values = __pyx_bstruct_values.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0];
  __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0];
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__put); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_7_sparse_8IntIndex_12put)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_v_values));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_values));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_values));
      __Pyx_INCREF(((PyObject *)__pyx_v_indices));
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_indices));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_indices));
      __Pyx_INCREF(__pyx_v_to_put);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_to_put);
      __Pyx_GIVEREF(__pyx_v_to_put);
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/sparse.pyx":218
 *     cpdef put(self, ndarray[float64_t, ndim=1] values,
 *               ndarray[int32_t, ndim=1] indices, object to_put):
 *         pass             # <<<<<<<<<<<<<<
 * 
 *     cpdef take(self, ndarray[float64_t, ndim=1] values,
 */

  __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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.IntIndex.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":216
 *         return result
 * 
 *     cpdef put(self, ndarray[float64_t, ndim=1] values,             # <<<<<<<<<<<<<<
 *               ndarray[int32_t, ndim=1] indices, object to_put):
 *         pass
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_12put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_12put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_indices = 0;
  PyObject *__pyx_v_to_put = 0;
  Py_buffer __pyx_bstruct_indices;
  Py_ssize_t __pyx_bstride_0_indices = 0;
  Py_ssize_t __pyx_bshape_0_indices = 0;
  Py_buffer __pyx_bstruct_values;
  Py_ssize_t __pyx_bstride_0_values = 0;
  Py_ssize_t __pyx_bshape_0_values = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indices,&__pyx_n_s__to_put,0};
  __Pyx_RefNannySetupContext("put");
  {
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indices);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("put", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__to_put);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("put", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "put") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __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_values = ((PyArrayObject *)values[0]);
    __pyx_v_indices = ((PyArrayObject *)values[1]);
    __pyx_v_to_put = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("put", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.IntIndex.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_bstruct_values.buf = NULL;
  __pyx_bstruct_indices.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_5numpy_ndarray, 1, "indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_values = __pyx_bstruct_values.strides[0];
  __pyx_bshape_0_values = __pyx_bstruct_values.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0];
  __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0];
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pandas_7_sparse_IntIndex *)((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->__pyx_vtab)->put(((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self), __pyx_v_values, __pyx_v_indices, __pyx_v_to_put, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.IntIndex.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":220
 *         pass
 * 
 *     cpdef take(self, ndarray[float64_t, ndim=1] values,             # <<<<<<<<<<<<<<
 *                ndarray[int32_t, ndim=1] indices):
 *         pass
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_13take(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_8IntIndex_take(struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_v_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indices, int __pyx_skip_dispatch) {
  Py_buffer __pyx_bstruct_indices;
  Py_ssize_t __pyx_bstride_0_indices = 0;
  Py_ssize_t __pyx_bshape_0_indices = 0;
  Py_buffer __pyx_bstruct_values;
  Py_ssize_t __pyx_bstride_0_values = 0;
  Py_ssize_t __pyx_bshape_0_values = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  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_RefNannySetupContext("take");
  __pyx_bstruct_values.buf = NULL;
  __pyx_bstruct_indices.buf = NULL;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_values = __pyx_bstruct_values.strides[0];
  __pyx_bshape_0_values = __pyx_bstruct_values.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0];
  __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0];
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__take); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_7_sparse_8IntIndex_13take)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_v_values));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_values));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_values));
      __Pyx_INCREF(((PyObject *)__pyx_v_indices));
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_indices));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_indices));
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/sparse.pyx":222
 *     cpdef take(self, ndarray[float64_t, ndim=1] values,
 *                ndarray[int32_t, ndim=1] indices):
 *         pass             # <<<<<<<<<<<<<<
 * 
 * cpdef get_blocks(ndarray[int32_t, ndim=1] indices):
 */

  __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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.IntIndex.take", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":220
 *         pass
 * 
 *     cpdef take(self, ndarray[float64_t, ndim=1] values,             # <<<<<<<<<<<<<<
 *                ndarray[int32_t, ndim=1] indices):
 *         pass
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_13take(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_13take(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_indices = 0;
  Py_buffer __pyx_bstruct_indices;
  Py_ssize_t __pyx_bstride_0_indices = 0;
  Py_ssize_t __pyx_bshape_0_indices = 0;
  Py_buffer __pyx_bstruct_values;
  Py_ssize_t __pyx_bstride_0_values = 0;
  Py_ssize_t __pyx_bshape_0_values = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indices,0};
  __Pyx_RefNannySetupContext("take");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indices);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "take") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __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_values = ((PyArrayObject *)values[0]);
    __pyx_v_indices = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.IntIndex.take", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_bstruct_values.buf = NULL;
  __pyx_bstruct_indices.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_5numpy_ndarray, 1, "indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_values = __pyx_bstruct_values.strides[0];
  __pyx_bshape_0_values = __pyx_bstruct_values.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0];
  __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0];
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pandas_7_sparse_IntIndex *)((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->__pyx_vtab)->take(((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self), __pyx_v_values, __pyx_v_indices, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.IntIndex.take", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":44
 *     '''
 *     cdef readonly:
 *         Py_ssize_t length, npoints             # <<<<<<<<<<<<<<
 *         ndarray indices
 * 
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_6length___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_6length___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.IntIndex.length.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_7npoints___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_7npoints___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->npoints); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.IntIndex.npoints.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":45
 *     cdef readonly:
 *         Py_ssize_t length, npoints
 *         ndarray indices             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, Py_ssize_t length, indices):
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_7indices___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_8IntIndex_7indices___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->indices));
  __pyx_r = ((PyObject *)((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_v_self)->indices);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":224
 *         pass
 * 
 * cpdef get_blocks(ndarray[int32_t, ndim=1] indices):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, npoints
 */

static PyObject *__pyx_pf_6pandas_7_sparse_get_blocks(PyObject *__pyx_self, PyObject *__pyx_v_indices); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_get_blocks(PyArrayObject *__pyx_v_indices, int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_npoints;
  __pyx_t_5numpy_int32_t __pyx_v_block;
  __pyx_t_5numpy_int32_t __pyx_v_length;
  __pyx_t_5numpy_int32_t __pyx_v_cur;
  __pyx_t_5numpy_int32_t __pyx_v_prev;
  PyObject *__pyx_v_locs = 0;
  PyObject *__pyx_v_lens = 0;
  Py_buffer __pyx_bstruct_indices;
  Py_ssize_t __pyx_bstride_0_indices = 0;
  Py_ssize_t __pyx_bshape_0_indices = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  long __pyx_t_6;
  int __pyx_t_7;
  __pyx_t_5numpy_int32_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_blocks");
  __pyx_bstruct_indices.buf = NULL;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0];
  __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0];

  /* "pandas/src/sparse.pyx":227
 *     cdef:
 *         Py_ssize_t i, npoints
 *         int32_t block, length = 1, cur, prev             # <<<<<<<<<<<<<<
 *         list locs = [], lens = []
 * 
 */
  __pyx_v_length = 1;

  /* "pandas/src/sparse.pyx":228
 *         Py_ssize_t i, npoints
 *         int32_t block, length = 1, cur, prev
 *         list locs = [], lens = []             # <<<<<<<<<<<<<<
 * 
 *     npoints = len(indices)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_locs = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_lens = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/src/sparse.pyx":230
 *         list locs = [], lens = []
 * 
 *     npoints = len(indices)             # <<<<<<<<<<<<<<
 * 
 *     # just handle the special empty case separately
 */
  __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_indices)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_npoints = __pyx_t_2;

  /* "pandas/src/sparse.pyx":233
 * 
 *     # just handle the special empty case separately
 *     if npoints == 0:             # <<<<<<<<<<<<<<
 *         return [], []
 * 
 */
  __pyx_t_3 = (__pyx_v_npoints == 0);
  if (__pyx_t_3) {

    /* "pandas/src/sparse.pyx":234
 *     # just handle the special empty case separately
 *     if npoints == 0:
 *         return [], []             # <<<<<<<<<<<<<<
 * 
 *     # TODO: two-pass algorithm faster?
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_1 = 0;
    __pyx_t_4 = 0;
    __pyx_r = ((PyObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/sparse.pyx":237
 * 
 *     # TODO: two-pass algorithm faster?
 *     prev = block = indices[0]             # <<<<<<<<<<<<<<
 *     for i from 1 <= i < npoints:
 *         cur = indices[i]
 */
  __pyx_t_6 = 0;
  __pyx_t_7 = -1;
  if (__pyx_t_6 < 0) {
    __pyx_t_6 += __pyx_bshape_0_indices;
    if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 0;
  } else if (unlikely(__pyx_t_6 >= __pyx_bshape_0_indices)) __pyx_t_7 = 0;
  if (unlikely(__pyx_t_7 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_7);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_8 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_indices.buf, __pyx_t_6, __pyx_bstride_0_indices));
  __pyx_v_prev = __pyx_t_8;
  __pyx_v_block = __pyx_t_8;

  /* "pandas/src/sparse.pyx":238
 *     # TODO: two-pass algorithm faster?
 *     prev = block = indices[0]
 *     for i from 1 <= i < npoints:             # <<<<<<<<<<<<<<
 *         cur = indices[i]
 *         if cur - prev > 1:
 */
  __pyx_t_2 = __pyx_v_npoints;
  for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {

    /* "pandas/src/sparse.pyx":239
 *     prev = block = indices[0]
 *     for i from 1 <= i < npoints:
 *         cur = indices[i]             # <<<<<<<<<<<<<<
 *         if cur - prev > 1:
 *             # new block
 */
    __pyx_t_9 = __pyx_v_i;
    __pyx_t_7 = -1;
    if (__pyx_t_9 < 0) {
      __pyx_t_9 += __pyx_bshape_0_indices;
      if (unlikely(__pyx_t_9 < 0)) __pyx_t_7 = 0;
    } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_indices)) __pyx_t_7 = 0;
    if (unlikely(__pyx_t_7 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_7);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_cur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_indices.buf, __pyx_t_9, __pyx_bstride_0_indices));

    /* "pandas/src/sparse.pyx":240
 *     for i from 1 <= i < npoints:
 *         cur = indices[i]
 *         if cur - prev > 1:             # <<<<<<<<<<<<<<
 *             # new block
 *             locs.append(block)
 */
    __pyx_t_3 = ((__pyx_v_cur - __pyx_v_prev) > 1);
    if (__pyx_t_3) {

      /* "pandas/src/sparse.pyx":242
 *         if cur - prev > 1:
 *             # new block
 *             locs.append(block)             # <<<<<<<<<<<<<<
 *             lens.append(length)
 *             block = cur
 */
      if (unlikely(((PyObject *)__pyx_v_locs) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_5 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_block); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_10 = PyList_Append(__pyx_v_locs, __pyx_t_5); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "pandas/src/sparse.pyx":243
 *             # new block
 *             locs.append(block)
 *             lens.append(length)             # <<<<<<<<<<<<<<
 *             block = cur
 *             length = 1
 */
      if (unlikely(((PyObject *)__pyx_v_lens) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_5 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_length); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_10 = PyList_Append(__pyx_v_lens, __pyx_t_5); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "pandas/src/sparse.pyx":244
 *             locs.append(block)
 *             lens.append(length)
 *             block = cur             # <<<<<<<<<<<<<<
 *             length = 1
 *         else:
 */
      __pyx_v_block = __pyx_v_cur;

      /* "pandas/src/sparse.pyx":245
 *             lens.append(length)
 *             block = cur
 *             length = 1             # <<<<<<<<<<<<<<
 *         else:
 *             # same block, increment length
 */
      __pyx_v_length = 1;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "pandas/src/sparse.pyx":248
 *         else:
 *             # same block, increment length
 *             length += 1             # <<<<<<<<<<<<<<
 * 
 *         prev = cur
 */
      __pyx_v_length = (__pyx_v_length + 1);
    }
    __pyx_L6:;

    /* "pandas/src/sparse.pyx":250
 *             length += 1
 * 
 *         prev = cur             # <<<<<<<<<<<<<<
 * 
 *     locs.append(block)
 */
    __pyx_v_prev = __pyx_v_cur;
  }

  /* "pandas/src/sparse.pyx":252
 *         prev = cur
 * 
 *     locs.append(block)             # <<<<<<<<<<<<<<
 *     lens.append(length)
 *     return locs, lens
 */
  if (unlikely(((PyObject *)__pyx_v_locs) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_5 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_block); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_10 = PyList_Append(__pyx_v_locs, __pyx_t_5); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pandas/src/sparse.pyx":253
 * 
 *     locs.append(block)
 *     lens.append(length)             # <<<<<<<<<<<<<<
 *     return locs, lens
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_lens) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_5 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_length); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_10 = PyList_Append(__pyx_v_lens, __pyx_t_5); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "pandas/src/sparse.pyx":254
 *     locs.append(block)
 *     lens.append(length)
 *     return locs, lens             # <<<<<<<<<<<<<<
 * 
 * #-------------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(((PyObject *)__pyx_v_locs));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_locs));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_locs));
  __Pyx_INCREF(((PyObject *)__pyx_v_lens));
  PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_lens));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lens));
  __pyx_r = ((PyObject *)__pyx_t_5);
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.get_blocks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_locs);
  __Pyx_XDECREF(__pyx_v_lens);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":224
 *         pass
 * 
 * cpdef get_blocks(ndarray[int32_t, ndim=1] indices):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, npoints
 */

static PyObject *__pyx_pf_6pandas_7_sparse_get_blocks(PyObject *__pyx_self, PyObject *__pyx_v_indices); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_get_blocks(PyObject *__pyx_self, PyObject *__pyx_v_indices) {
  Py_buffer __pyx_bstruct_indices;
  Py_ssize_t __pyx_bstride_0_indices = 0;
  Py_ssize_t __pyx_bshape_0_indices = 0;
  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_blocks");
  __pyx_self = __pyx_self;
  __pyx_bstruct_indices.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_5numpy_ndarray, 1, "indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0];
  __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0];
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_get_blocks(((PyArrayObject *)__pyx_v_indices), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.get_blocks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":274
 *         int32_t* locbuf, *lenbuf
 * 
 *     def __init__(self, length, blocs, blengths):             # <<<<<<<<<<<<<<
 * 
 *         self.blocs = np.ascontiguousarray(blocs, dtype=np.int32)
 */

static int __pyx_pf_6pandas_7_sparse_10BlockIndex___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_6pandas_7_sparse_10BlockIndex___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_length = 0;
  PyObject *__pyx_v_blocs = 0;
  PyObject *__pyx_v_blengths = 0;
  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;
  Py_ssize_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__length,&__pyx_n_s__blocs,&__pyx_n_s__blengths,0};
  __Pyx_RefNannySetupContext("__init__");
  {
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__length);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__blocs);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__blengths);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __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_length = values[0];
    __pyx_v_blocs = values[1];
    __pyx_v_blengths = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "pandas/src/sparse.pyx":276
 *     def __init__(self, length, blocs, blengths):
 * 
 *         self.blocs = np.ascontiguousarray(blocs, dtype=np.int32)             # <<<<<<<<<<<<<<
 *         self.blengths = np.ascontiguousarray(blengths, dtype=np.int32)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_blocs);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_blocs);
  __Pyx_GIVEREF(__pyx_v_blocs);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blocs);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blocs));
  ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blocs = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/src/sparse.pyx":277
 * 
 *         self.blocs = np.ascontiguousarray(blocs, dtype=np.int32)
 *         self.blengths = np.ascontiguousarray(blengths, dtype=np.int32)             # <<<<<<<<<<<<<<
 * 
 *         # in case we need
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(__pyx_v_blengths);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_blengths);
  __Pyx_GIVEREF(__pyx_v_blengths);
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blengths);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blengths));
  ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blengths = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pandas/src/sparse.pyx":280
 * 
 *         # in case we need
 *         self.locbuf = <int32_t*> self.blocs.data             # <<<<<<<<<<<<<<
 *         self.lenbuf = <int32_t*> self.blengths.data
 * 
 */
  ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->locbuf = ((__pyx_t_5numpy_int32_t *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blocs->data);

  /* "pandas/src/sparse.pyx":281
 *         # in case we need
 *         self.locbuf = <int32_t*> self.blocs.data
 *         self.lenbuf = <int32_t*> self.blengths.data             # <<<<<<<<<<<<<<
 * 
 *         self.length = length
 */
  ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->lenbuf = ((__pyx_t_5numpy_int32_t *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blengths->data);

  /* "pandas/src/sparse.pyx":283
 *         self.lenbuf = <int32_t*> self.blengths.data
 * 
 *         self.length = length             # <<<<<<<<<<<<<<
 *         self.nblocks = len(self.blocs)
 *         self.npoints = self.blengths.sum()
 */
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_length); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->length = __pyx_t_6;

  /* "pandas/src/sparse.pyx":284
 * 
 *         self.length = length
 *         self.nblocks = len(self.blocs)             # <<<<<<<<<<<<<<
 *         self.npoints = self.blengths.sum()
 * 
 */
  __pyx_t_4 = ((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blocs);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_6 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->nblocks = __pyx_t_6;

  /* "pandas/src/sparse.pyx":285
 *         self.length = length
 *         self.nblocks = len(self.blocs)
 *         self.npoints = self.blengths.sum()             # <<<<<<<<<<<<<<
 * 
 *         # self.block_start = blocs
 */
  __pyx_t_4 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blengths), __pyx_n_s__sum); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->npoints = __pyx_t_6;

  /* "pandas/src/sparse.pyx":290
 *         # self.block_end = blocs + blengths
 * 
 *         self.check_integrity()             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pandas_7_sparse_BlockIndex *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->__pyx_vtab)->check_integrity(((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = 0;
  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("pandas._sparse.BlockIndex.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":292
 *         self.check_integrity()
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         args = (self.length, self.blocs, self.blengths)
 *         return (BlockIndex, args)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_1__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_1__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_v_args = NULL;
  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("__reduce__");

  /* "pandas/src/sparse.pyx":293
 * 
 *     def __reduce__(self):
 *         args = (self.length, self.blocs, self.blengths)             # <<<<<<<<<<<<<<
 *         return (BlockIndex, args)
 * 
 */
  __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blocs));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blocs));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blocs));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blengths));
  PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blengths));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blengths));
  __pyx_t_1 = 0;
  __pyx_v_args = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pandas/src/sparse.pyx":294
 *     def __reduce__(self):
 *         args = (self.length, self.blocs, self.blengths)
 *         return (BlockIndex, args)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6pandas_7_sparse_BlockIndex)));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)__pyx_ptype_6pandas_7_sparse_BlockIndex)));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6pandas_7_sparse_BlockIndex)));
  __Pyx_INCREF(((PyObject *)__pyx_v_args));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_args));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_args));
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __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_AddTraceback("pandas._sparse.BlockIndex.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":296
 *         return (BlockIndex, args)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         output = 'BlockIndex\n'
 *         output += 'Block locations: %s\n' % repr(self.blocs)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_2__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_2__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_output = NULL;
  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("__repr__");

  /* "pandas/src/sparse.pyx":297
 * 
 *     def __repr__(self):
 *         output = 'BlockIndex\n'             # <<<<<<<<<<<<<<
 *         output += 'Block locations: %s\n' % repr(self.blocs)
 *         output += 'Block lengths: %s' % repr(self.blengths)
 */
  __Pyx_INCREF(((PyObject *)__pyx_n_s_6));
  __pyx_v_output = ((PyObject *)__pyx_n_s_6);

  /* "pandas/src/sparse.pyx":298
 *     def __repr__(self):
 *         output = 'BlockIndex\n'
 *         output += 'Block locations: %s\n' % repr(self.blocs)             # <<<<<<<<<<<<<<
 *         output += 'Block lengths: %s' % repr(self.blengths)
 * 
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blocs);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_output, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_output);
  __pyx_v_output = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pandas/src/sparse.pyx":299
 *         output = 'BlockIndex\n'
 *         output += 'Block locations: %s\n' % repr(self.blocs)
 *         output += 'Block lengths: %s' % repr(self.blengths)             # <<<<<<<<<<<<<<
 * 
 *         return output
 */
  __pyx_t_2 = ((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blengths);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Repr(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_output, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_output);
  __pyx_v_output = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/src/sparse.pyx":301
 *         output += 'Block lengths: %s' % repr(self.blengths)
 * 
 *         return output             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_output);
  __pyx_r = __pyx_v_output;
  goto __pyx_L0;

  __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_AddTraceback("pandas._sparse.BlockIndex.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_output);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":304
 * 
 *     @property
 *     def ngaps(self):             # <<<<<<<<<<<<<<
 *         return self.length - self.npoints
 * 
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_3ngaps(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_3ngaps(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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("ngaps");

  /* "pandas/src/sparse.pyx":305
 *     @property
 *     def ngaps(self):
 *         return self.length - self.npoints             # <<<<<<<<<<<<<<
 * 
 *     cpdef check_integrity(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t((((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->length - ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->npoints)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.ngaps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":307
 *         return self.length - self.npoints
 * 
 *     cpdef check_integrity(self):             # <<<<<<<<<<<<<<
 *         '''
 *         Check:
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_4check_integrity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_10BlockIndex_check_integrity(struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_v_self, int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_i;
  PyArrayObject *__pyx_v_blocs = 0;
  PyArrayObject *__pyx_v_blengths = 0;
  Py_buffer __pyx_bstruct_blengths;
  Py_ssize_t __pyx_bstride_0_blengths = 0;
  Py_ssize_t __pyx_bshape_0_blengths = 0;
  Py_buffer __pyx_bstruct_blocs;
  Py_ssize_t __pyx_bstride_0_blocs = 0;
  Py_ssize_t __pyx_bshape_0_blocs = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyArrayObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check_integrity");
  __pyx_bstruct_blocs.buf = NULL;
  __pyx_bstruct_blengths.buf = NULL;
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__check_integrity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_7_sparse_10BlockIndex_4check_integrity)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __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;
  }

  /* "pandas/src/sparse.pyx":318
 *             ndarray[int32_t, ndim=1] blocs, blengths
 * 
 *         blocs = self.blocs             # <<<<<<<<<<<<<<
 *         blengths = self.blengths
 * 
 */
  __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->blocs);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_blocs);
    __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_blocs, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_4 < 0)) {
      PyErr_Fetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_blocs, (PyObject*)__pyx_v_blocs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      }
    }
    __pyx_bstride_0_blocs = __pyx_bstruct_blocs.strides[0];
    __pyx_bshape_0_blocs = __pyx_bstruct_blocs.shape[0];
    if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_3 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_self->blocs));
  __pyx_v_blocs = ((PyArrayObject *)__pyx_v_self->blocs);

  /* "pandas/src/sparse.pyx":319
 * 
 *         blocs = self.blocs
 *         blengths = self.blengths             # <<<<<<<<<<<<<<
 * 
 *         if len(blocs) != len(blengths):
 */
  __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->blengths);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_blengths);
    __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_blengths, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_4 < 0)) {
      PyErr_Fetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_blengths, (PyObject*)__pyx_v_blengths, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_7, __pyx_t_6, __pyx_t_5);
      }
    }
    __pyx_bstride_0_blengths = __pyx_bstruct_blengths.strides[0];
    __pyx_bshape_0_blengths = __pyx_bstruct_blengths.shape[0];
    if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_3 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_self->blengths));
  __pyx_v_blengths = ((PyArrayObject *)__pyx_v_self->blengths);

  /* "pandas/src/sparse.pyx":321
 *         blengths = self.blengths
 * 
 *         if len(blocs) != len(blengths):             # <<<<<<<<<<<<<<
 *             raise ValueError('block bound arrays must be same length')
 * 
 */
  __pyx_t_8 = PyObject_Length(((PyObject *)__pyx_v_blocs)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_9 = PyObject_Length(((PyObject *)__pyx_v_blengths)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = (__pyx_t_8 != __pyx_t_9);
  if (__pyx_t_10) {

    /* "pandas/src/sparse.pyx":322
 * 
 *         if len(blocs) != len(blengths):
 *             raise ValueError('block bound arrays must be same length')             # <<<<<<<<<<<<<<
 * 
 *         for i from 0 <= i < self.nblocks:
 */
    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __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 = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/sparse.pyx":324
 *             raise ValueError('block bound arrays must be same length')
 * 
 *         for i from 0 <= i < self.nblocks:             # <<<<<<<<<<<<<<
 *             if i > 0:
 *                 if blocs[i] <= blocs[i-1]:
 */
  __pyx_t_9 = __pyx_v_self->nblocks;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_9; __pyx_v_i++) {

    /* "pandas/src/sparse.pyx":325
 * 
 *         for i from 0 <= i < self.nblocks:
 *             if i > 0:             # <<<<<<<<<<<<<<
 *                 if blocs[i] <= blocs[i-1]:
 *                     raise ValueError('Locations not in ascending order')
 */
    __pyx_t_10 = (__pyx_v_i > 0);
    if (__pyx_t_10) {

      /* "pandas/src/sparse.pyx":326
 *         for i from 0 <= i < self.nblocks:
 *             if i > 0:
 *                 if blocs[i] <= blocs[i-1]:             # <<<<<<<<<<<<<<
 *                     raise ValueError('Locations not in ascending order')
 * 
 */
      __pyx_t_8 = __pyx_v_i;
      __pyx_t_4 = -1;
      if (__pyx_t_8 < 0) {
        __pyx_t_8 += __pyx_bshape_0_blocs;
        if (unlikely(__pyx_t_8 < 0)) __pyx_t_4 = 0;
      } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_blocs)) __pyx_t_4 = 0;
      if (unlikely(__pyx_t_4 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_4);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_11 = (__pyx_v_i - 1);
      __pyx_t_4 = -1;
      if (__pyx_t_11 < 0) {
        __pyx_t_11 += __pyx_bshape_0_blocs;
        if (unlikely(__pyx_t_11 < 0)) __pyx_t_4 = 0;
      } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_blocs)) __pyx_t_4 = 0;
      if (unlikely(__pyx_t_4 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_4);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_10 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_blocs.buf, __pyx_t_8, __pyx_bstride_0_blocs)) <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_blocs.buf, __pyx_t_11, __pyx_bstride_0_blocs)));
      if (__pyx_t_10) {

        /* "pandas/src/sparse.pyx":327
 *             if i > 0:
 *                 if blocs[i] <= blocs[i-1]:
 *                     raise ValueError('Locations not in ascending order')             # <<<<<<<<<<<<<<
 * 
 *             if i < self.nblocks - 1:
 */
        __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __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 = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L7;
      }
      __pyx_L7:;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/sparse.pyx":329
 *                     raise ValueError('Locations not in ascending order')
 * 
 *             if i < self.nblocks - 1:             # <<<<<<<<<<<<<<
 *                 if blocs[i] + blengths[i] > blocs[i + 1]:
 *                     raise ValueError('Block %d overlaps' % i)
 */
    __pyx_t_10 = (__pyx_v_i < (__pyx_v_self->nblocks - 1));
    if (__pyx_t_10) {

      /* "pandas/src/sparse.pyx":330
 * 
 *             if i < self.nblocks - 1:
 *                 if blocs[i] + blengths[i] > blocs[i + 1]:             # <<<<<<<<<<<<<<
 *                     raise ValueError('Block %d overlaps' % i)
 *             else:
 */
      __pyx_t_12 = __pyx_v_i;
      __pyx_t_4 = -1;
      if (__pyx_t_12 < 0) {
        __pyx_t_12 += __pyx_bshape_0_blocs;
        if (unlikely(__pyx_t_12 < 0)) __pyx_t_4 = 0;
      } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_blocs)) __pyx_t_4 = 0;
      if (unlikely(__pyx_t_4 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_4);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_13 = __pyx_v_i;
      __pyx_t_4 = -1;
      if (__pyx_t_13 < 0) {
        __pyx_t_13 += __pyx_bshape_0_blengths;
        if (unlikely(__pyx_t_13 < 0)) __pyx_t_4 = 0;
      } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_blengths)) __pyx_t_4 = 0;
      if (unlikely(__pyx_t_4 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_4);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_14 = (__pyx_v_i + 1);
      __pyx_t_4 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_14 += __pyx_bshape_0_blocs;
        if (unlikely(__pyx_t_14 < 0)) __pyx_t_4 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_blocs)) __pyx_t_4 = 0;
      if (unlikely(__pyx_t_4 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_4);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_10 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_blocs.buf, __pyx_t_12, __pyx_bstride_0_blocs)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_blengths.buf, __pyx_t_13, __pyx_bstride_0_blengths))) > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_blocs.buf, __pyx_t_14, __pyx_bstride_0_blocs)));
      if (__pyx_t_10) {

        /* "pandas/src/sparse.pyx":331
 *             if i < self.nblocks - 1:
 *                 if blocs[i] + blengths[i] > blocs[i + 1]:
 *                     raise ValueError('Block %d overlaps' % i)             # <<<<<<<<<<<<<<
 *             else:
 *                 if blocs[i] + blengths[i] > self.length:
 */
        __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
        __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __Pyx_Raise(__pyx_t_2, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L9;
      }
      __pyx_L9:;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "pandas/src/sparse.pyx":333
 *                     raise ValueError('Block %d overlaps' % i)
 *             else:
 *                 if blocs[i] + blengths[i] > self.length:             # <<<<<<<<<<<<<<
 *                     raise ValueError('Block %d extends beyond end' % i)
 * 
 */
      __pyx_t_15 = __pyx_v_i;
      __pyx_t_4 = -1;
      if (__pyx_t_15 < 0) {
        __pyx_t_15 += __pyx_bshape_0_blocs;
        if (unlikely(__pyx_t_15 < 0)) __pyx_t_4 = 0;
      } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_blocs)) __pyx_t_4 = 0;
      if (unlikely(__pyx_t_4 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_4);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_16 = __pyx_v_i;
      __pyx_t_4 = -1;
      if (__pyx_t_16 < 0) {
        __pyx_t_16 += __pyx_bshape_0_blengths;
        if (unlikely(__pyx_t_16 < 0)) __pyx_t_4 = 0;
      } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_blengths)) __pyx_t_4 = 0;
      if (unlikely(__pyx_t_4 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_4);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_10 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_blocs.buf, __pyx_t_15, __pyx_bstride_0_blocs)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_blengths.buf, __pyx_t_16, __pyx_bstride_0_blengths))) > __pyx_v_self->length);
      if (__pyx_t_10) {

        /* "pandas/src/sparse.pyx":334
 *             else:
 *                 if blocs[i] + blengths[i] > self.length:
 *                     raise ValueError('Block %d extends beyond end' % i)             # <<<<<<<<<<<<<<
 * 
 *             # no zero-length blocks
 */
        __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
        PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
        __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L10;
      }
      __pyx_L10:;
    }
    __pyx_L8:;

    /* "pandas/src/sparse.pyx":337
 * 
 *             # no zero-length blocks
 *             if blengths[i] == 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError('Zero-length block %d' % i)
 * 
 */
    __pyx_t_17 = __pyx_v_i;
    __pyx_t_4 = -1;
    if (__pyx_t_17 < 0) {
      __pyx_t_17 += __pyx_bshape_0_blengths;
      if (unlikely(__pyx_t_17 < 0)) __pyx_t_4 = 0;
    } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_blengths)) __pyx_t_4 = 0;
    if (unlikely(__pyx_t_4 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_4);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_10 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_blengths.buf, __pyx_t_17, __pyx_bstride_0_blengths)) == 0);
    if (__pyx_t_10) {

      /* "pandas/src/sparse.pyx":338
 *             # no zero-length blocks
 *             if blengths[i] == 0:
 *                 raise ValueError('Zero-length block %d' % i)             # <<<<<<<<<<<<<<
 * 
 *     def equals(self, other):
 */
      __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L11;
    }
    __pyx_L11:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_blengths);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_blocs);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.check_integrity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_blengths);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_blocs);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_blocs);
  __Pyx_XDECREF((PyObject *)__pyx_v_blengths);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":307
 *         return self.length - self.npoints
 * 
 *     cpdef check_integrity(self):             # <<<<<<<<<<<<<<
 *         '''
 *         Check:
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_4check_integrity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pandas_7_sparse_10BlockIndex_4check_integrity[] = "\n        Check:\n        - Locations are in ascending order\n        - No overlapping blocks\n        - Blocks to not start after end of index, nor extend beyond end\n        ";
static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_4check_integrity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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("check_integrity");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pandas_7_sparse_BlockIndex *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->__pyx_vtab)->check_integrity(((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.check_integrity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":340
 *                 raise ValueError('Zero-length block %d' % i)
 * 
 *     def equals(self, other):             # <<<<<<<<<<<<<<
 *         if not isinstance(other, BlockIndex):
 *             return False
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_5equals(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_5equals(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_v_same_length = NULL;
  PyObject *__pyx_v_same_blocks = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  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("equals");

  /* "pandas/src/sparse.pyx":341
 * 
 *     def equals(self, other):
 *         if not isinstance(other, BlockIndex):             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_6pandas_7_sparse_BlockIndex));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "pandas/src/sparse.pyx":342
 *     def equals(self, other):
 *         if not isinstance(other, BlockIndex):
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         if self is other:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pandas/src/sparse.pyx":344
 *             return False
 * 
 *         if self is other:             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  __pyx_t_3 = (__pyx_v_self == __pyx_v_other);
  if (__pyx_t_3) {

    /* "pandas/src/sparse.pyx":345
 * 
 *         if self is other:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         same_length = self.length == other.length
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pandas/src/sparse.pyx":347
 *             return True
 * 
 *         same_length = self.length == other.length             # <<<<<<<<<<<<<<
 *         same_blocks = (np.array_equal(self.blocs, other.blocs) and
 *                        np.array_equal(self.blengths, other.blengths))
 */
  __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_same_length = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pandas/src/sparse.pyx":348
 * 
 *         same_length = self.length == other.length
 *         same_blocks = (np.array_equal(self.blocs, other.blocs) and             # <<<<<<<<<<<<<<
 *                        np.array_equal(self.blengths, other.blengths))
 *         return same_length and same_blocks
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__array_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__blocs); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blocs));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blocs));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blocs));
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pandas/src/sparse.pyx":349
 *         same_length = self.length == other.length
 *         same_blocks = (np.array_equal(self.blocs, other.blocs) and
 *                        np.array_equal(self.blengths, other.blengths))             # <<<<<<<<<<<<<<
 *         return same_length and same_blocks
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__array_equal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__blengths); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blengths));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blengths));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blengths));
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __pyx_t_6 = __pyx_t_1;
    __pyx_t_1 = 0;
  } else {
    __pyx_t_6 = __pyx_t_5;
    __pyx_t_5 = 0;
  }
  __pyx_v_same_blocks = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "pandas/src/sparse.pyx":350
 *         same_blocks = (np.array_equal(self.blocs, other.blocs) and
 *                        np.array_equal(self.blengths, other.blengths))
 *         return same_length and same_blocks             # <<<<<<<<<<<<<<
 * 
 *     def to_block_index(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_same_length); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {
    __Pyx_INCREF(__pyx_v_same_blocks);
    __pyx_t_6 = __pyx_v_same_blocks;
  } else {
    __Pyx_INCREF(__pyx_v_same_length);
    __pyx_t_6 = __pyx_v_same_length;
  }
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.equals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_same_length);
  __Pyx_XDECREF(__pyx_v_same_blocks);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":352
 *         return same_length and same_blocks
 * 
 *     def to_block_index(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_6to_block_index(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_6to_block_index(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_block_index");

  /* "pandas/src/sparse.pyx":353
 * 
 *     def to_block_index(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def to_int_index(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":355
 *         return self
 * 
 *     def to_int_index(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             Py_ssize_t i = 0, j, b
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_7to_int_index(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_7to_int_index(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_b;
  __pyx_t_5numpy_int32_t __pyx_v_offset;
  PyArrayObject *__pyx_v_indices = 0;
  Py_buffer __pyx_bstruct_indices;
  Py_ssize_t __pyx_bstride_0_indices = 0;
  Py_ssize_t __pyx_bshape_0_indices = 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;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  __pyx_t_5numpy_int32_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_int_index");
  __pyx_bstruct_indices.buf = NULL;

  /* "pandas/src/sparse.pyx":357
 *     def to_int_index(self):
 *         cdef:
 *             Py_ssize_t i = 0, j, b             # <<<<<<<<<<<<<<
 *             int32_t offset
 *             ndarray[int32_t, ndim=1] indices
 */
  __pyx_v_i = 0;

  /* "pandas/src/sparse.pyx":361
 *             ndarray[int32_t, ndim=1] indices
 * 
 *         indices = np.empty(self.npoints, dtype=np.int32)             # <<<<<<<<<<<<<<
 * 
 *         for b from 0 <= b < self.nblocks:
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->npoints); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0];
    __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_indices = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/src/sparse.pyx":363
 *         indices = np.empty(self.npoints, dtype=np.int32)
 * 
 *         for b from 0 <= b < self.nblocks:             # <<<<<<<<<<<<<<
 *             offset = self.locbuf[b]
 * 
 */
  __pyx_t_11 = ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->nblocks;
  for (__pyx_v_b = 0; __pyx_v_b < __pyx_t_11; __pyx_v_b++) {

    /* "pandas/src/sparse.pyx":364
 * 
 *         for b from 0 <= b < self.nblocks:
 *             offset = self.locbuf[b]             # <<<<<<<<<<<<<<
 * 
 *             for j from 0 <= j < self.lenbuf[b]:
 */
    __pyx_v_offset = (((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->locbuf[__pyx_v_b]);

    /* "pandas/src/sparse.pyx":366
 *             offset = self.locbuf[b]
 * 
 *             for j from 0 <= j < self.lenbuf[b]:             # <<<<<<<<<<<<<<
 *                 indices[i] = offset + j
 *                 i += 1
 */
    __pyx_t_12 = (((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->lenbuf[__pyx_v_b]);
    for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_12; __pyx_v_j++) {

      /* "pandas/src/sparse.pyx":367
 * 
 *             for j from 0 <= j < self.lenbuf[b]:
 *                 indices[i] = offset + j             # <<<<<<<<<<<<<<
 *                 i += 1
 * 
 */
      __pyx_t_13 = __pyx_v_i;
      __pyx_t_7 = -1;
      if (__pyx_t_13 < 0) {
        __pyx_t_13 += __pyx_bshape_0_indices;
        if (unlikely(__pyx_t_13 < 0)) __pyx_t_7 = 0;
      } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_indices)) __pyx_t_7 = 0;
      if (unlikely(__pyx_t_7 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_7);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_indices.buf, __pyx_t_13, __pyx_bstride_0_indices) = (__pyx_v_offset + __pyx_v_j);

      /* "pandas/src/sparse.pyx":368
 *             for j from 0 <= j < self.lenbuf[b]:
 *                 indices[i] = offset + j
 *                 i += 1             # <<<<<<<<<<<<<<
 * 
 *         return IntIndex(self.length, indices)
 */
      __pyx_v_i = (__pyx_v_i + 1);
    }
  }

  /* "pandas/src/sparse.pyx":370
 *                 i += 1
 * 
 *         return IntIndex(self.length, indices)             # <<<<<<<<<<<<<<
 * 
 *     cpdef BlockIndex intersect(self, SparseIndex other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->length); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_indices));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_indices));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_indices));
  __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pandas_7_sparse_IntIndex)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.to_int_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":372
 *         return IntIndex(self.length, indices)
 * 
 *     cpdef BlockIndex intersect(self, SparseIndex other):             # <<<<<<<<<<<<<<
 *         '''
 *         Intersect two BlockIndex objects
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_8intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_f_6pandas_7_sparse_10BlockIndex_intersect(struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_v_self, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_other, int __pyx_skip_dispatch) {
  struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_v_y = 0;
  PyArrayObject *__pyx_v_xloc = 0;
  PyArrayObject *__pyx_v_xlen = 0;
  PyArrayObject *__pyx_v_yloc = 0;
  PyArrayObject *__pyx_v_ylen = 0;
  PyObject *__pyx_v_out_blocs = 0;
  PyObject *__pyx_v_out_blengths = 0;
  Py_ssize_t __pyx_v_xi;
  Py_ssize_t __pyx_v_yi;
  __pyx_t_5numpy_int32_t __pyx_v_cur_loc;
  __pyx_t_5numpy_int32_t __pyx_v_cur_length;
  __pyx_t_5numpy_int32_t __pyx_v_diff;
  Py_buffer __pyx_bstruct_yloc;
  Py_ssize_t __pyx_bstride_0_yloc = 0;
  Py_ssize_t __pyx_bshape_0_yloc = 0;
  Py_buffer __pyx_bstruct_xloc;
  Py_ssize_t __pyx_bstride_0_xloc = 0;
  Py_ssize_t __pyx_bshape_0_xloc = 0;
  Py_buffer __pyx_bstruct_xlen;
  Py_ssize_t __pyx_bstride_0_xlen = 0;
  Py_ssize_t __pyx_bshape_0_xlen = 0;
  Py_buffer __pyx_bstruct_ylen;
  Py_ssize_t __pyx_bstride_0_ylen = 0;
  Py_ssize_t __pyx_bshape_0_ylen = 0;
  struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyArrayObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  int __pyx_t_30;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("intersect");
  __pyx_bstruct_xloc.buf = NULL;
  __pyx_bstruct_xlen.buf = NULL;
  __pyx_bstruct_yloc.buf = NULL;
  __pyx_bstruct_ylen.buf = NULL;
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__intersect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_7_sparse_10BlockIndex_8intersect)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_v_other));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_other));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_other));
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pandas_7_sparse_BlockIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/sparse.pyx":387
 *             ndarray[int32_t, ndim=1] xloc, xlen, yloc, ylen
 * 
 *             list out_blocs = []             # <<<<<<<<<<<<<<
 *             list out_blengths = []
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_out_blocs = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/src/sparse.pyx":388
 * 
 *             list out_blocs = []
 *             list out_blengths = []             # <<<<<<<<<<<<<<
 * 
 *             Py_ssize_t xi = 0, yi = 0
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_out_blengths = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/src/sparse.pyx":390
 *             list out_blengths = []
 * 
 *             Py_ssize_t xi = 0, yi = 0             # <<<<<<<<<<<<<<
 *             int32_t cur_loc, cur_length, diff
 * 
 */
  __pyx_v_xi = 0;
  __pyx_v_yi = 0;

  /* "pandas/src/sparse.pyx":393
 *             int32_t cur_loc, cur_length, diff
 * 
 *         y = other.to_block_index()             # <<<<<<<<<<<<<<
 * 
 *         if self.length != y.length:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_other), __pyx_n_s__to_block_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pandas_7_sparse_BlockIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_y = ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/src/sparse.pyx":395
 *         y = other.to_block_index()
 * 
 *         if self.length != y.length:             # <<<<<<<<<<<<<<
 *             raise Exception('Indices must reference same underlying length')
 * 
 */
  __pyx_t_4 = (__pyx_v_self->length != __pyx_v_y->length);
  if (__pyx_t_4) {

    /* "pandas/src/sparse.pyx":396
 * 
 *         if self.length != y.length:
 *             raise Exception('Indices must reference same underlying length')             # <<<<<<<<<<<<<<
 * 
 *         xloc = self.blocs
 */
    __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __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[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/sparse.pyx":398
 *             raise Exception('Indices must reference same underlying length')
 * 
 *         xloc = self.blocs             # <<<<<<<<<<<<<<
 *         xlen = self.blengths
 *         yloc = y.blocs
 */
  __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->blocs);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xloc);
    __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xloc, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_6 < 0)) {
      PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xloc, (PyObject*)__pyx_v_xloc, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      }
    }
    __pyx_bstride_0_xloc = __pyx_bstruct_xloc.strides[0];
    __pyx_bshape_0_xloc = __pyx_bstruct_xloc.shape[0];
    if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_self->blocs));
  __pyx_v_xloc = ((PyArrayObject *)__pyx_v_self->blocs);

  /* "pandas/src/sparse.pyx":399
 * 
 *         xloc = self.blocs
 *         xlen = self.blengths             # <<<<<<<<<<<<<<
 *         yloc = y.blocs
 *         ylen = y.blengths
 */
  __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->blengths);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xlen);
    __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xlen, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_6 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xlen, (PyObject*)__pyx_v_xlen, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7);
      }
    }
    __pyx_bstride_0_xlen = __pyx_bstruct_xlen.strides[0];
    __pyx_bshape_0_xlen = __pyx_bstruct_xlen.shape[0];
    if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_self->blengths));
  __pyx_v_xlen = ((PyArrayObject *)__pyx_v_self->blengths);

  /* "pandas/src/sparse.pyx":400
 *         xloc = self.blocs
 *         xlen = self.blengths
 *         yloc = y.blocs             # <<<<<<<<<<<<<<
 *         ylen = y.blengths
 * 
 */
  __pyx_t_5 = ((PyArrayObject *)__pyx_v_y->blocs);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yloc);
    __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_yloc, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_6 < 0)) {
      PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_yloc, (PyObject*)__pyx_v_yloc, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      }
    }
    __pyx_bstride_0_yloc = __pyx_bstruct_yloc.strides[0];
    __pyx_bshape_0_yloc = __pyx_bstruct_yloc.shape[0];
    if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_y->blocs));
  __pyx_v_yloc = ((PyArrayObject *)__pyx_v_y->blocs);

  /* "pandas/src/sparse.pyx":401
 *         xlen = self.blengths
 *         yloc = y.blocs
 *         ylen = y.blengths             # <<<<<<<<<<<<<<
 * 
 *         while True:
 */
  __pyx_t_5 = ((PyArrayObject *)__pyx_v_y->blengths);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ylen);
    __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_ylen, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_6 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_ylen, (PyObject*)__pyx_v_ylen, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7);
      }
    }
    __pyx_bstride_0_ylen = __pyx_bstruct_ylen.strides[0];
    __pyx_bshape_0_ylen = __pyx_bstruct_ylen.shape[0];
    if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_y->blengths));
  __pyx_v_ylen = ((PyArrayObject *)__pyx_v_y->blengths);

  /* "pandas/src/sparse.pyx":403
 *         ylen = y.blengths
 * 
 *         while True:             # <<<<<<<<<<<<<<
 *             # we are done (or possibly never began)
 *             if xi >= self.nblocks or yi >= y.nblocks:
 */
  while (1) {
    if (!1) break;

    /* "pandas/src/sparse.pyx":405
 *         while True:
 *             # we are done (or possibly never began)
 *             if xi >= self.nblocks or yi >= y.nblocks:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
    __pyx_t_4 = (__pyx_v_xi >= __pyx_v_self->nblocks);
    if (!__pyx_t_4) {
      __pyx_t_10 = (__pyx_v_yi >= __pyx_v_y->nblocks);
      __pyx_t_11 = __pyx_t_10;
    } else {
      __pyx_t_11 = __pyx_t_4;
    }
    if (__pyx_t_11) {

      /* "pandas/src/sparse.pyx":406
 *             # we are done (or possibly never began)
 *             if xi >= self.nblocks or yi >= y.nblocks:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             # completely symmetric...would like to avoid code dup but oh well
 */
      goto __pyx_L5_break;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/sparse.pyx":409
 * 
 *             # completely symmetric...would like to avoid code dup but oh well
 *             if xloc[xi] >= yloc[yi]:             # <<<<<<<<<<<<<<
 *                 cur_loc = xloc[xi]
 *                 diff = xloc[xi] - yloc[yi]
 */
    __pyx_t_12 = __pyx_v_xi;
    __pyx_t_6 = -1;
    if (__pyx_t_12 < 0) {
      __pyx_t_12 += __pyx_bshape_0_xloc;
      if (unlikely(__pyx_t_12 < 0)) __pyx_t_6 = 0;
    } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_xloc)) __pyx_t_6 = 0;
    if (unlikely(__pyx_t_6 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_6);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_13 = __pyx_v_yi;
    __pyx_t_6 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_bshape_0_yloc;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_6 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_yloc)) __pyx_t_6 = 0;
    if (unlikely(__pyx_t_6 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_6);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_11 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xloc.buf, __pyx_t_12, __pyx_bstride_0_xloc)) >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yloc.buf, __pyx_t_13, __pyx_bstride_0_yloc)));
    if (__pyx_t_11) {

      /* "pandas/src/sparse.pyx":410
 *             # completely symmetric...would like to avoid code dup but oh well
 *             if xloc[xi] >= yloc[yi]:
 *                 cur_loc = xloc[xi]             # <<<<<<<<<<<<<<
 *                 diff = xloc[xi] - yloc[yi]
 * 
 */
      __pyx_t_14 = __pyx_v_xi;
      __pyx_t_6 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_14 += __pyx_bshape_0_xloc;
        if (unlikely(__pyx_t_14 < 0)) __pyx_t_6 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_xloc)) __pyx_t_6 = 0;
      if (unlikely(__pyx_t_6 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_6);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_cur_loc = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xloc.buf, __pyx_t_14, __pyx_bstride_0_xloc));

      /* "pandas/src/sparse.pyx":411
 *             if xloc[xi] >= yloc[yi]:
 *                 cur_loc = xloc[xi]
 *                 diff = xloc[xi] - yloc[yi]             # <<<<<<<<<<<<<<
 * 
 *                 if ylen[yi] <= diff:
 */
      __pyx_t_15 = __pyx_v_xi;
      __pyx_t_6 = -1;
      if (__pyx_t_15 < 0) {
        __pyx_t_15 += __pyx_bshape_0_xloc;
        if (unlikely(__pyx_t_15 < 0)) __pyx_t_6 = 0;
      } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_xloc)) __pyx_t_6 = 0;
      if (unlikely(__pyx_t_6 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_6);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_16 = __pyx_v_yi;
      __pyx_t_6 = -1;
      if (__pyx_t_16 < 0) {
        __pyx_t_16 += __pyx_bshape_0_yloc;
        if (unlikely(__pyx_t_16 < 0)) __pyx_t_6 = 0;
      } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_yloc)) __pyx_t_6 = 0;
      if (unlikely(__pyx_t_6 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_6);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_diff = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xloc.buf, __pyx_t_15, __pyx_bstride_0_xloc)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yloc.buf, __pyx_t_16, __pyx_bstride_0_yloc)));

      /* "pandas/src/sparse.pyx":413
 *                 diff = xloc[xi] - yloc[yi]
 * 
 *                 if ylen[yi] <= diff:             # <<<<<<<<<<<<<<
 *                     # have to skip this block
 *                     yi += 1
 */
      __pyx_t_17 = __pyx_v_yi;
      __pyx_t_6 = -1;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_bshape_0_ylen;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_6 = 0;
      } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_ylen)) __pyx_t_6 = 0;
      if (unlikely(__pyx_t_6 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_6);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_11 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_ylen.buf, __pyx_t_17, __pyx_bstride_0_ylen)) <= __pyx_v_diff);
      if (__pyx_t_11) {

        /* "pandas/src/sparse.pyx":415
 *                 if ylen[yi] <= diff:
 *                     # have to skip this block
 *                     yi += 1             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
        __pyx_v_yi = (__pyx_v_yi + 1);

        /* "pandas/src/sparse.pyx":416
 *                     # have to skip this block
 *                     yi += 1
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 if ylen[yi] - diff < xlen[xi]:
 */
        goto __pyx_L4_continue;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "pandas/src/sparse.pyx":418
 *                     continue
 * 
 *                 if ylen[yi] - diff < xlen[xi]:             # <<<<<<<<<<<<<<
 *                     # take end of y block, move onward
 *                     cur_length = ylen[yi] - diff
 */
      __pyx_t_18 = __pyx_v_yi;
      __pyx_t_6 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_18 += __pyx_bshape_0_ylen;
        if (unlikely(__pyx_t_18 < 0)) __pyx_t_6 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_ylen)) __pyx_t_6 = 0;
      if (unlikely(__pyx_t_6 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_6);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_19 = __pyx_v_xi;
      __pyx_t_6 = -1;
      if (__pyx_t_19 < 0) {
        __pyx_t_19 += __pyx_bshape_0_xlen;
        if (unlikely(__pyx_t_19 < 0)) __pyx_t_6 = 0;
      } else if (unlikely(__pyx_t_19 >= __pyx_bshape_0_xlen)) __pyx_t_6 = 0;
      if (unlikely(__pyx_t_6 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_6);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_11 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_ylen.buf, __pyx_t_18, __pyx_bstride_0_ylen)) - __pyx_v_diff) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xlen.buf, __pyx_t_19, __pyx_bstride_0_xlen)));
      if (__pyx_t_11) {

        /* "pandas/src/sparse.pyx":420
 *                 if ylen[yi] - diff < xlen[xi]:
 *                     # take end of y block, move onward
 *                     cur_length = ylen[yi] - diff             # <<<<<<<<<<<<<<
 *                     yi += 1
 *                 else:
 */
        __pyx_t_20 = __pyx_v_yi;
        __pyx_t_6 = -1;
        if (__pyx_t_20 < 0) {
          __pyx_t_20 += __pyx_bshape_0_ylen;
          if (unlikely(__pyx_t_20 < 0)) __pyx_t_6 = 0;
        } else if (unlikely(__pyx_t_20 >= __pyx_bshape_0_ylen)) __pyx_t_6 = 0;
        if (unlikely(__pyx_t_6 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_6);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_cur_length = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_ylen.buf, __pyx_t_20, __pyx_bstride_0_ylen)) - __pyx_v_diff);

        /* "pandas/src/sparse.pyx":421
 *                     # take end of y block, move onward
 *                     cur_length = ylen[yi] - diff
 *                     yi += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # take end of x block
 */
        __pyx_v_yi = (__pyx_v_yi + 1);
        goto __pyx_L9;
      }
      /*else*/ {

        /* "pandas/src/sparse.pyx":424
 *                 else:
 *                     # take end of x block
 *                     cur_length = xlen[xi]             # <<<<<<<<<<<<<<
 *                     xi += 1
 * 
 */
        __pyx_t_21 = __pyx_v_xi;
        __pyx_t_6 = -1;
        if (__pyx_t_21 < 0) {
          __pyx_t_21 += __pyx_bshape_0_xlen;
          if (unlikely(__pyx_t_21 < 0)) __pyx_t_6 = 0;
        } else if (unlikely(__pyx_t_21 >= __pyx_bshape_0_xlen)) __pyx_t_6 = 0;
        if (unlikely(__pyx_t_6 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_6);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_cur_length = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xlen.buf, __pyx_t_21, __pyx_bstride_0_xlen));

        /* "pandas/src/sparse.pyx":425
 *                     # take end of x block
 *                     cur_length = xlen[xi]
 *                     xi += 1             # <<<<<<<<<<<<<<
 * 
 *             else: # xloc[xi] < yloc[yi]
 */
        __pyx_v_xi = (__pyx_v_xi + 1);
      }
      __pyx_L9:;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "pandas/src/sparse.pyx":428
 * 
 *             else: # xloc[xi] < yloc[yi]
 *                 cur_loc = yloc[yi]             # <<<<<<<<<<<<<<
 *                 diff = yloc[yi] - xloc[xi]
 * 
 */
      __pyx_t_22 = __pyx_v_yi;
      __pyx_t_6 = -1;
      if (__pyx_t_22 < 0) {
        __pyx_t_22 += __pyx_bshape_0_yloc;
        if (unlikely(__pyx_t_22 < 0)) __pyx_t_6 = 0;
      } else if (unlikely(__pyx_t_22 >= __pyx_bshape_0_yloc)) __pyx_t_6 = 0;
      if (unlikely(__pyx_t_6 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_6);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_cur_loc = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yloc.buf, __pyx_t_22, __pyx_bstride_0_yloc));

      /* "pandas/src/sparse.pyx":429
 *             else: # xloc[xi] < yloc[yi]
 *                 cur_loc = yloc[yi]
 *                 diff = yloc[yi] - xloc[xi]             # <<<<<<<<<<<<<<
 * 
 *                 if xlen[xi] <= diff:
 */
      __pyx_t_23 = __pyx_v_yi;
      __pyx_t_6 = -1;
      if (__pyx_t_23 < 0) {
        __pyx_t_23 += __pyx_bshape_0_yloc;
        if (unlikely(__pyx_t_23 < 0)) __pyx_t_6 = 0;
      } else if (unlikely(__pyx_t_23 >= __pyx_bshape_0_yloc)) __pyx_t_6 = 0;
      if (unlikely(__pyx_t_6 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_6);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_24 = __pyx_v_xi;
      __pyx_t_6 = -1;
      if (__pyx_t_24 < 0) {
        __pyx_t_24 += __pyx_bshape_0_xloc;
        if (unlikely(__pyx_t_24 < 0)) __pyx_t_6 = 0;
      } else if (unlikely(__pyx_t_24 >= __pyx_bshape_0_xloc)) __pyx_t_6 = 0;
      if (unlikely(__pyx_t_6 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_6);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_diff = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yloc.buf, __pyx_t_23, __pyx_bstride_0_yloc)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xloc.buf, __pyx_t_24, __pyx_bstride_0_xloc)));

      /* "pandas/src/sparse.pyx":431
 *                 diff = yloc[yi] - xloc[xi]
 * 
 *                 if xlen[xi] <= diff:             # <<<<<<<<<<<<<<
 *                     # have to skip this block
 *                     xi += 1
 */
      __pyx_t_25 = __pyx_v_xi;
      __pyx_t_6 = -1;
      if (__pyx_t_25 < 0) {
        __pyx_t_25 += __pyx_bshape_0_xlen;
        if (unlikely(__pyx_t_25 < 0)) __pyx_t_6 = 0;
      } else if (unlikely(__pyx_t_25 >= __pyx_bshape_0_xlen)) __pyx_t_6 = 0;
      if (unlikely(__pyx_t_6 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_6);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_11 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xlen.buf, __pyx_t_25, __pyx_bstride_0_xlen)) <= __pyx_v_diff);
      if (__pyx_t_11) {

        /* "pandas/src/sparse.pyx":433
 *                 if xlen[xi] <= diff:
 *                     # have to skip this block
 *                     xi += 1             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
        __pyx_v_xi = (__pyx_v_xi + 1);

        /* "pandas/src/sparse.pyx":434
 *                     # have to skip this block
 *                     xi += 1
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 if xlen[xi] - diff < ylen[yi]:
 */
        goto __pyx_L4_continue;
        goto __pyx_L10;
      }
      __pyx_L10:;

      /* "pandas/src/sparse.pyx":436
 *                     continue
 * 
 *                 if xlen[xi] - diff < ylen[yi]:             # <<<<<<<<<<<<<<
 *                     # take end of x block, move onward
 *                     cur_length = xlen[xi] - diff
 */
      __pyx_t_26 = __pyx_v_xi;
      __pyx_t_6 = -1;
      if (__pyx_t_26 < 0) {
        __pyx_t_26 += __pyx_bshape_0_xlen;
        if (unlikely(__pyx_t_26 < 0)) __pyx_t_6 = 0;
      } else if (unlikely(__pyx_t_26 >= __pyx_bshape_0_xlen)) __pyx_t_6 = 0;
      if (unlikely(__pyx_t_6 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_6);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_27 = __pyx_v_yi;
      __pyx_t_6 = -1;
      if (__pyx_t_27 < 0) {
        __pyx_t_27 += __pyx_bshape_0_ylen;
        if (unlikely(__pyx_t_27 < 0)) __pyx_t_6 = 0;
      } else if (unlikely(__pyx_t_27 >= __pyx_bshape_0_ylen)) __pyx_t_6 = 0;
      if (unlikely(__pyx_t_6 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_6);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_11 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xlen.buf, __pyx_t_26, __pyx_bstride_0_xlen)) - __pyx_v_diff) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_ylen.buf, __pyx_t_27, __pyx_bstride_0_ylen)));
      if (__pyx_t_11) {

        /* "pandas/src/sparse.pyx":438
 *                 if xlen[xi] - diff < ylen[yi]:
 *                     # take end of x block, move onward
 *                     cur_length = xlen[xi] - diff             # <<<<<<<<<<<<<<
 *                     xi += 1
 *                 else:
 */
        __pyx_t_28 = __pyx_v_xi;
        __pyx_t_6 = -1;
        if (__pyx_t_28 < 0) {
          __pyx_t_28 += __pyx_bshape_0_xlen;
          if (unlikely(__pyx_t_28 < 0)) __pyx_t_6 = 0;
        } else if (unlikely(__pyx_t_28 >= __pyx_bshape_0_xlen)) __pyx_t_6 = 0;
        if (unlikely(__pyx_t_6 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_6);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_cur_length = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xlen.buf, __pyx_t_28, __pyx_bstride_0_xlen)) - __pyx_v_diff);

        /* "pandas/src/sparse.pyx":439
 *                     # take end of x block, move onward
 *                     cur_length = xlen[xi] - diff
 *                     xi += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # take end of y block
 */
        __pyx_v_xi = (__pyx_v_xi + 1);
        goto __pyx_L11;
      }
      /*else*/ {

        /* "pandas/src/sparse.pyx":442
 *                 else:
 *                     # take end of y block
 *                     cur_length = ylen[yi]             # <<<<<<<<<<<<<<
 *                     yi += 1
 * 
 */
        __pyx_t_29 = __pyx_v_yi;
        __pyx_t_6 = -1;
        if (__pyx_t_29 < 0) {
          __pyx_t_29 += __pyx_bshape_0_ylen;
          if (unlikely(__pyx_t_29 < 0)) __pyx_t_6 = 0;
        } else if (unlikely(__pyx_t_29 >= __pyx_bshape_0_ylen)) __pyx_t_6 = 0;
        if (unlikely(__pyx_t_6 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_6);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_cur_length = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_ylen.buf, __pyx_t_29, __pyx_bstride_0_ylen));

        /* "pandas/src/sparse.pyx":443
 *                     # take end of y block
 *                     cur_length = ylen[yi]
 *                     yi += 1             # <<<<<<<<<<<<<<
 * 
 *             out_blocs.append(cur_loc)
 */
        __pyx_v_yi = (__pyx_v_yi + 1);
      }
      __pyx_L11:;
    }
    __pyx_L7:;

    /* "pandas/src/sparse.pyx":445
 *                     yi += 1
 * 
 *             out_blocs.append(cur_loc)             # <<<<<<<<<<<<<<
 *             out_blengths.append(cur_length)
 * 
 */
    if (unlikely(((PyObject *)__pyx_v_out_blocs) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_3 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_cur_loc); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_30 = PyList_Append(__pyx_v_out_blocs, __pyx_t_3); if (unlikely(__pyx_t_30 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pandas/src/sparse.pyx":446
 * 
 *             out_blocs.append(cur_loc)
 *             out_blengths.append(cur_length)             # <<<<<<<<<<<<<<
 * 
 *         return BlockIndex(self.length, out_blocs, out_blengths)
 */
    if (unlikely(((PyObject *)__pyx_v_out_blengths) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_3 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_cur_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_30 = PyList_Append(__pyx_v_out_blengths, __pyx_t_3); if (unlikely(__pyx_t_30 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_L4_continue:;
  }
  __pyx_L5_break:;

  /* "pandas/src/sparse.pyx":448
 *             out_blengths.append(cur_length)
 * 
 *         return BlockIndex(self.length, out_blocs, out_blengths)             # <<<<<<<<<<<<<<
 * 
 *     cpdef BlockIndex make_union(self, SparseIndex y):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_out_blocs));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_out_blocs));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out_blocs));
  __Pyx_INCREF(((PyObject *)__pyx_v_out_blengths));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_out_blengths));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out_blengths));
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pandas_7_sparse_BlockIndex)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yloc);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xloc);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xlen);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ylen);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yloc);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xloc);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xlen);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ylen);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_y);
  __Pyx_XDECREF((PyObject *)__pyx_v_xloc);
  __Pyx_XDECREF((PyObject *)__pyx_v_xlen);
  __Pyx_XDECREF((PyObject *)__pyx_v_yloc);
  __Pyx_XDECREF((PyObject *)__pyx_v_ylen);
  __Pyx_XDECREF(__pyx_v_out_blocs);
  __Pyx_XDECREF(__pyx_v_out_blengths);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":372
 *         return IntIndex(self.length, indices)
 * 
 *     cpdef BlockIndex intersect(self, SparseIndex other):             # <<<<<<<<<<<<<<
 *         '''
 *         Intersect two BlockIndex objects
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_8intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_6pandas_7_sparse_10BlockIndex_8intersect[] = "\n        Intersect two BlockIndex objects\n\n        Parameters\n        ----------\n\n        Returns\n        -------\n        intersection : BlockIndex\n        ";
static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_8intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  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("intersect");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6pandas_7_sparse_BlockIndex *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->__pyx_vtab)->intersect(((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self), ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)__pyx_v_other), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":450
 *         return BlockIndex(self.length, out_blocs, out_blengths)
 * 
 *     cpdef BlockIndex make_union(self, SparseIndex y):             # <<<<<<<<<<<<<<
 *         '''
 *         Combine together two BlockIndex objects, accepting indices if contained
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_9make_union(PyObject *__pyx_v_self, PyObject *__pyx_v_y); /*proto*/
static struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_f_6pandas_7_sparse_10BlockIndex_make_union(struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_v_self, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_y, int __pyx_skip_dispatch) {
  struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  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_RefNannySetupContext("make_union");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__make_union); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_7_sparse_10BlockIndex_9make_union)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_v_y));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_y));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_y));
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pandas_7_sparse_BlockIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/sparse.pyx":467
 *         union : BlockIndex
 *         '''
 *         return BlockUnion(self, y.to_block_index()).result             # <<<<<<<<<<<<<<
 * 
 *     cpdef lookup(self, Py_ssize_t index):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_y), __pyx_n_s__to_block_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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));
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pandas_7_sparse_BlockUnion)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockUnion *)__pyx_t_3)->__pyx_base.result));
  __pyx_r = ((struct __pyx_obj_6pandas_7_sparse_BlockUnion *)__pyx_t_3)->__pyx_base.result;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)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_AddTraceback("pandas._sparse.BlockIndex.make_union", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":450
 *         return BlockIndex(self.length, out_blocs, out_blengths)
 * 
 *     cpdef BlockIndex make_union(self, SparseIndex y):             # <<<<<<<<<<<<<<
 *         '''
 *         Combine together two BlockIndex objects, accepting indices if contained
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_9make_union(PyObject *__pyx_v_self, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6pandas_7_sparse_10BlockIndex_9make_union[] = "\n        Combine together two BlockIndex objects, accepting indices if contained\n        in one or the other\n\n        Parameters\n        ----------\n        other : SparseIndex\n\n        Notes\n        -----\n        union is a protected keyword in Cython, hence make_union\n\n        Returns\n        -------\n        union : BlockIndex\n        ";
static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_9make_union(PyObject *__pyx_v_self, PyObject *__pyx_v_y) {
  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("make_union");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6pandas_7_sparse_BlockIndex *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->__pyx_vtab)->make_union(((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self), ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)__pyx_v_y), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.make_union", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":469
 *         return BlockUnion(self, y.to_block_index()).result
 * 
 *     cpdef lookup(self, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *         '''
 * 
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_10lookup(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_10BlockIndex_lookup(struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_v_self, Py_ssize_t __pyx_v_index, int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_cum_len;
  PyArrayObject *__pyx_v_locs = 0;
  PyArrayObject *__pyx_v_lens = 0;
  Py_buffer __pyx_bstruct_lens;
  Py_ssize_t __pyx_bstride_0_lens = 0;
  Py_ssize_t __pyx_bshape_0_lens = 0;
  Py_buffer __pyx_bstruct_locs;
  Py_ssize_t __pyx_bstride_0_locs = 0;
  Py_ssize_t __pyx_bshape_0_locs = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyArrayObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  long __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lookup");
  __pyx_bstruct_locs.buf = NULL;
  __pyx_bstruct_lens.buf = NULL;
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__lookup); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_7_sparse_10BlockIndex_10lookup)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__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;
  }

  /* "pandas/src/sparse.pyx":478
 *             ndarray[int32_t, ndim=1] locs, lens
 * 
 *         locs = self.blocs             # <<<<<<<<<<<<<<
 *         lens = self.blengths
 * 
 */
  __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->blocs);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_locs);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_locs, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_locs, (PyObject*)__pyx_v_locs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_bstride_0_locs = __pyx_bstruct_locs.strides[0];
    __pyx_bshape_0_locs = __pyx_bstruct_locs.shape[0];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_self->blocs));
  __pyx_v_locs = ((PyArrayObject *)__pyx_v_self->blocs);

  /* "pandas/src/sparse.pyx":479
 * 
 *         locs = self.blocs
 *         lens = self.blengths             # <<<<<<<<<<<<<<
 * 
 *         if self.nblocks == 0:
 */
  __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->blengths);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_lens);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_lens, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_lens, (PyObject*)__pyx_v_lens, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_bstride_0_lens = __pyx_bstruct_lens.strides[0];
    __pyx_bshape_0_lens = __pyx_bstruct_lens.shape[0];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_self->blengths));
  __pyx_v_lens = ((PyArrayObject *)__pyx_v_self->blengths);

  /* "pandas/src/sparse.pyx":481
 *         lens = self.blengths
 * 
 *         if self.nblocks == 0:             # <<<<<<<<<<<<<<
 *             return -1
 *         elif index < locs[0]:
 */
  __pyx_t_9 = (__pyx_v_self->nblocks == 0);
  if (__pyx_t_9) {

    /* "pandas/src/sparse.pyx":482
 * 
 *         if self.nblocks == 0:
 *             return -1             # <<<<<<<<<<<<<<
 *         elif index < locs[0]:
 *             return -1
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_neg_1);
    __pyx_r = __pyx_int_neg_1;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "pandas/src/sparse.pyx":483
 *         if self.nblocks == 0:
 *             return -1
 *         elif index < locs[0]:             # <<<<<<<<<<<<<<
 *             return -1
 * 
 */
  __pyx_t_10 = 0;
  __pyx_t_5 = -1;
  if (__pyx_t_10 < 0) {
    __pyx_t_10 += __pyx_bshape_0_locs;
    if (unlikely(__pyx_t_10 < 0)) __pyx_t_5 = 0;
  } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_locs)) __pyx_t_5 = 0;
  if (unlikely(__pyx_t_5 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_5);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_9 = (__pyx_v_index < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_locs.buf, __pyx_t_10, __pyx_bstride_0_locs)));
  if (__pyx_t_9) {

    /* "pandas/src/sparse.pyx":484
 *             return -1
 *         elif index < locs[0]:
 *             return -1             # <<<<<<<<<<<<<<
 * 
 *         cum_len = 0
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_neg_1);
    __pyx_r = __pyx_int_neg_1;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/sparse.pyx":486
 *             return -1
 * 
 *         cum_len = 0             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < self.nblocks:
 *             if index >= locs[i] and index < locs[i] + lens[i]:
 */
  __pyx_v_cum_len = 0;

  /* "pandas/src/sparse.pyx":487
 * 
 *         cum_len = 0
 *         for i from 0 <= i < self.nblocks:             # <<<<<<<<<<<<<<
 *             if index >= locs[i] and index < locs[i] + lens[i]:
 *                 return cum_len + index - locs[i]
 */
  __pyx_t_11 = __pyx_v_self->nblocks;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_11; __pyx_v_i++) {

    /* "pandas/src/sparse.pyx":488
 *         cum_len = 0
 *         for i from 0 <= i < self.nblocks:
 *             if index >= locs[i] and index < locs[i] + lens[i]:             # <<<<<<<<<<<<<<
 *                 return cum_len + index - locs[i]
 *             cum_len += lens[i]
 */
    __pyx_t_12 = __pyx_v_i;
    __pyx_t_5 = -1;
    if (__pyx_t_12 < 0) {
      __pyx_t_12 += __pyx_bshape_0_locs;
      if (unlikely(__pyx_t_12 < 0)) __pyx_t_5 = 0;
    } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_locs)) __pyx_t_5 = 0;
    if (unlikely(__pyx_t_5 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_5);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_9 = (__pyx_v_index >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_locs.buf, __pyx_t_12, __pyx_bstride_0_locs)));
    if (__pyx_t_9) {
      __pyx_t_13 = __pyx_v_i;
      __pyx_t_5 = -1;
      if (__pyx_t_13 < 0) {
        __pyx_t_13 += __pyx_bshape_0_locs;
        if (unlikely(__pyx_t_13 < 0)) __pyx_t_5 = 0;
      } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_locs)) __pyx_t_5 = 0;
      if (unlikely(__pyx_t_5 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_5);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_5 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_14 += __pyx_bshape_0_lens;
        if (unlikely(__pyx_t_14 < 0)) __pyx_t_5 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_lens)) __pyx_t_5 = 0;
      if (unlikely(__pyx_t_5 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_5);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_15 = (__pyx_v_index < ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_locs.buf, __pyx_t_13, __pyx_bstride_0_locs)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_lens.buf, __pyx_t_14, __pyx_bstride_0_lens))));
      __pyx_t_16 = __pyx_t_15;
    } else {
      __pyx_t_16 = __pyx_t_9;
    }
    if (__pyx_t_16) {

      /* "pandas/src/sparse.pyx":489
 *         for i from 0 <= i < self.nblocks:
 *             if index >= locs[i] and index < locs[i] + lens[i]:
 *                 return cum_len + index - locs[i]             # <<<<<<<<<<<<<<
 *             cum_len += lens[i]
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_17 = __pyx_v_i;
      __pyx_t_5 = -1;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_bshape_0_locs;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_5 = 0;
      } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_locs)) __pyx_t_5 = 0;
      if (unlikely(__pyx_t_5 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_5);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyInt_FromSsize_t(((__pyx_v_cum_len + __pyx_v_index) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_locs.buf, __pyx_t_17, __pyx_bstride_0_locs)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/sparse.pyx":490
 *             if index >= locs[i] and index < locs[i] + lens[i]:
 *                 return cum_len + index - locs[i]
 *             cum_len += lens[i]             # <<<<<<<<<<<<<<
 * 
 *         return -1
 */
    __pyx_t_18 = __pyx_v_i;
    __pyx_t_5 = -1;
    if (__pyx_t_18 < 0) {
      __pyx_t_18 += __pyx_bshape_0_lens;
      if (unlikely(__pyx_t_18 < 0)) __pyx_t_5 = 0;
    } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_lens)) __pyx_t_5 = 0;
    if (unlikely(__pyx_t_5 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_5);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_cum_len = (__pyx_v_cum_len + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_lens.buf, __pyx_t_18, __pyx_bstride_0_lens)));
  }

  /* "pandas/src/sparse.pyx":492
 *             cum_len += lens[i]
 * 
 *         return -1             # <<<<<<<<<<<<<<
 * 
 *     cpdef ndarray reindex(self, ndarray[float64_t, ndim=1] values,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_int_neg_1);
  __pyx_r = __pyx_int_neg_1;
  goto __pyx_L0;

  __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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_lens);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_locs);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_lens);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_locs);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_locs);
  __Pyx_XDECREF((PyObject *)__pyx_v_lens);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":469
 *         return BlockUnion(self, y.to_block_index()).result
 * 
 *     cpdef lookup(self, Py_ssize_t index):             # <<<<<<<<<<<<<<
 *         '''
 * 
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_10lookup(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
static char __pyx_doc_6pandas_7_sparse_10BlockIndex_10lookup[] = "\n\n        Returns -1 if not found\n        ";
static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_10lookup(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) {
  Py_ssize_t __pyx_v_index;
  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("lookup");
  assert(__pyx_arg_index); {
    __pyx_v_index = __Pyx_PyIndex_AsSsize_t(__pyx_arg_index); if (unlikely((__pyx_v_index == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pandas_7_sparse_BlockIndex *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->__pyx_vtab)->lookup(((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self), __pyx_v_index, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":494
 *         return -1
 * 
 *     cpdef ndarray reindex(self, ndarray[float64_t, ndim=1] values,             # <<<<<<<<<<<<<<
 *                           float64_t fill_value, SparseIndex other_):
 *         cdef:
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_11reindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyArrayObject *__pyx_f_6pandas_7_sparse_10BlockIndex_reindex(struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_v_self, PyArrayObject *__pyx_v_values, __pyx_t_5numpy_float64_t __pyx_v_fill_value, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_other_, int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_ocur;
  Py_ssize_t __pyx_v_ocurlen;
  struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_v_other = 0;
  PyArrayObject *__pyx_v_result = 0;
  PyArrayObject *__pyx_v_slocs = 0;
  PyArrayObject *__pyx_v_slens = 0;
  PyArrayObject *__pyx_v_olocs = 0;
  PyArrayObject *__pyx_v_olens = 0;
  Py_buffer __pyx_bstruct_olens;
  Py_ssize_t __pyx_bstride_0_olens = 0;
  Py_ssize_t __pyx_bshape_0_olens = 0;
  Py_buffer __pyx_bstruct_olocs;
  Py_ssize_t __pyx_bstride_0_olocs = 0;
  Py_ssize_t __pyx_bshape_0_olocs = 0;
  Py_buffer __pyx_bstruct_slocs;
  Py_ssize_t __pyx_bstride_0_slocs = 0;
  Py_ssize_t __pyx_bshape_0_slocs = 0;
  Py_buffer __pyx_bstruct_values;
  Py_ssize_t __pyx_bstride_0_values = 0;
  Py_ssize_t __pyx_bshape_0_values = 0;
  Py_buffer __pyx_bstruct_result;
  Py_ssize_t __pyx_bstride_0_result = 0;
  Py_ssize_t __pyx_bshape_0_result = 0;
  Py_buffer __pyx_bstruct_slens;
  Py_ssize_t __pyx_bstride_0_slens = 0;
  Py_ssize_t __pyx_bshape_0_slens = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyArrayObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyArrayObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  int __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reindex");
  __pyx_bstruct_result.buf = NULL;
  __pyx_bstruct_slocs.buf = NULL;
  __pyx_bstruct_slens.buf = NULL;
  __pyx_bstruct_olocs.buf = NULL;
  __pyx_bstruct_olens.buf = NULL;
  __pyx_bstruct_values.buf = NULL;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_values = __pyx_bstruct_values.strides[0];
  __pyx_bshape_0_values = __pyx_bstruct_values.shape[0];
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__reindex); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_7_sparse_10BlockIndex_11reindex)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_fill_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_INCREF(((PyObject *)__pyx_v_values));
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_values));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_values));
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_other_));
      PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_other_));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_other_));
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__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 = 494; __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;
  }

  /* "pandas/src/sparse.pyx":497
 *                           float64_t fill_value, SparseIndex other_):
 *         cdef:
 *             Py_ssize_t i = 0, j = 0, ocur, ocurlen             # <<<<<<<<<<<<<<
 *             BlockIndex other
 *             ndarray[float64_t, ndim=1] result
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "pandas/src/sparse.pyx":502
 *             ndarray[int32_t, ndim=1] slocs, slens, olocs, olens
 * 
 *         other = other_.to_block_index()             # <<<<<<<<<<<<<<
 * 
 *         olocs = other.blocs
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_other_), __pyx_n_s__to_block_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6pandas_7_sparse_BlockIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_other = ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/src/sparse.pyx":504
 *         other = other_.to_block_index()
 * 
 *         olocs = other.blocs             # <<<<<<<<<<<<<<
 *         olens = other.blengths
 *         slocs = self.blocs
 */
  __pyx_t_4 = ((PyArrayObject *)__pyx_v_other->blocs);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_olocs);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_olocs, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_olocs, (PyObject*)__pyx_v_olocs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_bstride_0_olocs = __pyx_bstruct_olocs.strides[0];
    __pyx_bshape_0_olocs = __pyx_bstruct_olocs.shape[0];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_other->blocs));
  __pyx_v_olocs = ((PyArrayObject *)__pyx_v_other->blocs);

  /* "pandas/src/sparse.pyx":505
 * 
 *         olocs = other.blocs
 *         olens = other.blengths             # <<<<<<<<<<<<<<
 *         slocs = self.blocs
 *         slens = self.blengths
 */
  __pyx_t_4 = ((PyArrayObject *)__pyx_v_other->blengths);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_olens);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_olens, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_olens, (PyObject*)__pyx_v_olens, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_bstride_0_olens = __pyx_bstruct_olens.strides[0];
    __pyx_bshape_0_olens = __pyx_bstruct_olens.shape[0];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_other->blengths));
  __pyx_v_olens = ((PyArrayObject *)__pyx_v_other->blengths);

  /* "pandas/src/sparse.pyx":506
 *         olocs = other.blocs
 *         olens = other.blengths
 *         slocs = self.blocs             # <<<<<<<<<<<<<<
 *         slens = self.blengths
 * 
 */
  __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->blocs);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_slocs);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_slocs, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_slocs, (PyObject*)__pyx_v_slocs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_bstride_0_slocs = __pyx_bstruct_slocs.strides[0];
    __pyx_bshape_0_slocs = __pyx_bstruct_slocs.shape[0];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_self->blocs));
  __pyx_v_slocs = ((PyArrayObject *)__pyx_v_self->blocs);

  /* "pandas/src/sparse.pyx":507
 *         olens = other.blengths
 *         slocs = self.blocs
 *         slens = self.blengths             # <<<<<<<<<<<<<<
 * 
 *         result = np.empty(other.npoints, dtype=np.float64)
 */
  __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->blengths);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_slens);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_slens, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_slens, (PyObject*)__pyx_v_slens, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_bstride_0_slens = __pyx_bstruct_slens.strides[0];
    __pyx_bshape_0_slens = __pyx_bstruct_slens.shape[0];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_self->blengths));
  __pyx_v_slens = ((PyArrayObject *)__pyx_v_self->blengths);

  /* "pandas/src/sparse.pyx":509
 *         slens = self.blengths
 * 
 *         result = np.empty(other.npoints, dtype=np.float64)             # <<<<<<<<<<<<<<
 * 
 *         for 0 <= i < other.nblocks:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_other->npoints); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float64); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_10);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_bstride_0_result = __pyx_bstruct_result.strides[0];
    __pyx_bshape_0_result = __pyx_bstruct_result.shape[0];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_11 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "pandas/src/sparse.pyx":511
 *         result = np.empty(other.npoints, dtype=np.float64)
 * 
 *         for 0 <= i < other.nblocks:             # <<<<<<<<<<<<<<
 *             ocur = olocs[i]
 *             ocurlen = olens[i]
 */
  __pyx_t_12 = __pyx_v_other->nblocks;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_12; __pyx_v_i++) {

    /* "pandas/src/sparse.pyx":512
 * 
 *         for 0 <= i < other.nblocks:
 *             ocur = olocs[i]             # <<<<<<<<<<<<<<
 *             ocurlen = olens[i]
 * 
 */
    __pyx_t_13 = __pyx_v_i;
    __pyx_t_5 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_bshape_0_olocs;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_5 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_olocs)) __pyx_t_5 = 0;
    if (unlikely(__pyx_t_5 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_5);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_ocur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_olocs.buf, __pyx_t_13, __pyx_bstride_0_olocs));

    /* "pandas/src/sparse.pyx":513
 *         for 0 <= i < other.nblocks:
 *             ocur = olocs[i]
 *             ocurlen = olens[i]             # <<<<<<<<<<<<<<
 * 
 *             while slocs[j] + slens[j] < ocur:
 */
    __pyx_t_14 = __pyx_v_i;
    __pyx_t_5 = -1;
    if (__pyx_t_14 < 0) {
      __pyx_t_14 += __pyx_bshape_0_olens;
      if (unlikely(__pyx_t_14 < 0)) __pyx_t_5 = 0;
    } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_olens)) __pyx_t_5 = 0;
    if (unlikely(__pyx_t_5 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_5);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_ocurlen = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_olens.buf, __pyx_t_14, __pyx_bstride_0_olens));

    /* "pandas/src/sparse.pyx":515
 *             ocurlen = olens[i]
 * 
 *             while slocs[j] + slens[j] < ocur:             # <<<<<<<<<<<<<<
 *                 j += 1
 * 
 */
    while (1) {
      __pyx_t_15 = __pyx_v_j;
      __pyx_t_5 = -1;
      if (__pyx_t_15 < 0) {
        __pyx_t_15 += __pyx_bshape_0_slocs;
        if (unlikely(__pyx_t_15 < 0)) __pyx_t_5 = 0;
      } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_slocs)) __pyx_t_5 = 0;
      if (unlikely(__pyx_t_5 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_5);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_16 = __pyx_v_j;
      __pyx_t_5 = -1;
      if (__pyx_t_16 < 0) {
        __pyx_t_16 += __pyx_bshape_0_slens;
        if (unlikely(__pyx_t_16 < 0)) __pyx_t_5 = 0;
      } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_slens)) __pyx_t_5 = 0;
      if (unlikely(__pyx_t_5 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_5);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_17 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_slocs.buf, __pyx_t_15, __pyx_bstride_0_slocs)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_slens.buf, __pyx_t_16, __pyx_bstride_0_slens))) < __pyx_v_ocur);
      if (!__pyx_t_17) break;

      /* "pandas/src/sparse.pyx":516
 * 
 *             while slocs[j] + slens[j] < ocur:
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     cpdef put(self, ndarray[float64_t, ndim=1] values,
 */
      __pyx_v_j = (__pyx_v_j + 1);
    }
  }

  __pyx_r = ((PyArrayObject *)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_9);
  __Pyx_XDECREF(__pyx_t_10);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_olens);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_olocs);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_slocs);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_slens);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.reindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_olens);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_olocs);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_slocs);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_slens);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_other);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF((PyObject *)__pyx_v_slocs);
  __Pyx_XDECREF((PyObject *)__pyx_v_slens);
  __Pyx_XDECREF((PyObject *)__pyx_v_olocs);
  __Pyx_XDECREF((PyObject *)__pyx_v_olens);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":494
 *         return -1
 * 
 *     cpdef ndarray reindex(self, ndarray[float64_t, ndim=1] values,             # <<<<<<<<<<<<<<
 *                           float64_t fill_value, SparseIndex other_):
 *         cdef:
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_11reindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_11reindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  __pyx_t_5numpy_float64_t __pyx_v_fill_value;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_other_ = 0;
  Py_buffer __pyx_bstruct_values;
  Py_ssize_t __pyx_bstride_0_values = 0;
  Py_ssize_t __pyx_bshape_0_values = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__fill_value,&__pyx_n_s__other_,0};
  __Pyx_RefNannySetupContext("reindex");
  {
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("reindex", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other_);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("reindex", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "reindex") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __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_values = ((PyArrayObject *)values[0]);
    __pyx_v_fill_value = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fill_value == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_other_ = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("reindex", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.reindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_bstruct_values.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other_), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "other_", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_values = __pyx_bstruct_values.strides[0];
  __pyx_bshape_0_values = __pyx_bstruct_values.shape[0];
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6pandas_7_sparse_BlockIndex *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->__pyx_vtab)->reindex(((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self), __pyx_v_values, __pyx_v_fill_value, __pyx_v_other_, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.reindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":518
 *                 j += 1
 * 
 *     cpdef put(self, ndarray[float64_t, ndim=1] values,             # <<<<<<<<<<<<<<
 *               ndarray[int32_t, ndim=1] indices, object to_put):
 *         pass
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_12put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_10BlockIndex_put(struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_v_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indices, PyObject *__pyx_v_to_put, int __pyx_skip_dispatch) {
  Py_buffer __pyx_bstruct_indices;
  Py_ssize_t __pyx_bstride_0_indices = 0;
  Py_ssize_t __pyx_bshape_0_indices = 0;
  Py_buffer __pyx_bstruct_values;
  Py_ssize_t __pyx_bstride_0_values = 0;
  Py_ssize_t __pyx_bshape_0_values = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  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_RefNannySetupContext("put");
  __pyx_bstruct_values.buf = NULL;
  __pyx_bstruct_indices.buf = NULL;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_values = __pyx_bstruct_values.strides[0];
  __pyx_bshape_0_values = __pyx_bstruct_values.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0];
  __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0];
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__put); 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) != (void *)&__pyx_pf_6pandas_7_sparse_10BlockIndex_12put)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_v_values));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_values));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_values));
      __Pyx_INCREF(((PyObject *)__pyx_v_indices));
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_indices));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_indices));
      __Pyx_INCREF(__pyx_v_to_put);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_to_put);
      __Pyx_GIVEREF(__pyx_v_to_put);
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/sparse.pyx":520
 *     cpdef put(self, ndarray[float64_t, ndim=1] values,
 *               ndarray[int32_t, ndim=1] indices, object to_put):
 *         pass             # <<<<<<<<<<<<<<
 * 
 *     cpdef take(self, ndarray[float64_t, ndim=1] values,
 */

  __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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":518
 *                 j += 1
 * 
 *     cpdef put(self, ndarray[float64_t, ndim=1] values,             # <<<<<<<<<<<<<<
 *               ndarray[int32_t, ndim=1] indices, object to_put):
 *         pass
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_12put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_12put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_indices = 0;
  PyObject *__pyx_v_to_put = 0;
  Py_buffer __pyx_bstruct_indices;
  Py_ssize_t __pyx_bstride_0_indices = 0;
  Py_ssize_t __pyx_bshape_0_indices = 0;
  Py_buffer __pyx_bstruct_values;
  Py_ssize_t __pyx_bstride_0_values = 0;
  Py_ssize_t __pyx_bshape_0_values = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indices,&__pyx_n_s__to_put,0};
  __Pyx_RefNannySetupContext("put");
  {
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indices);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("put", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__to_put);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("put", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "put") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __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_values = ((PyArrayObject *)values[0]);
    __pyx_v_indices = ((PyArrayObject *)values[1]);
    __pyx_v_to_put = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("put", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_bstruct_values.buf = NULL;
  __pyx_bstruct_indices.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_5numpy_ndarray, 1, "indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_values = __pyx_bstruct_values.strides[0];
  __pyx_bshape_0_values = __pyx_bstruct_values.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0];
  __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0];
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pandas_7_sparse_BlockIndex *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->__pyx_vtab)->put(((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self), __pyx_v_values, __pyx_v_indices, __pyx_v_to_put, 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;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":522
 *         pass
 * 
 *     cpdef take(self, ndarray[float64_t, ndim=1] values,             # <<<<<<<<<<<<<<
 *                ndarray[int32_t, ndim=1] indices):
 *         pass
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_13take(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_10BlockIndex_take(struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_v_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indices, int __pyx_skip_dispatch) {
  Py_buffer __pyx_bstruct_indices;
  Py_ssize_t __pyx_bstride_0_indices = 0;
  Py_ssize_t __pyx_bshape_0_indices = 0;
  Py_buffer __pyx_bstruct_values;
  Py_ssize_t __pyx_bstride_0_values = 0;
  Py_ssize_t __pyx_bshape_0_values = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  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_RefNannySetupContext("take");
  __pyx_bstruct_values.buf = NULL;
  __pyx_bstruct_indices.buf = NULL;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_values = __pyx_bstruct_values.strides[0];
  __pyx_bshape_0_values = __pyx_bstruct_values.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0];
  __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0];
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__take); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_7_sparse_10BlockIndex_13take)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_v_values));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_values));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_values));
      __Pyx_INCREF(((PyObject *)__pyx_v_indices));
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_indices));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_indices));
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/sparse.pyx":524
 *     cpdef take(self, ndarray[float64_t, ndim=1] values,
 *                ndarray[int32_t, ndim=1] indices):
 *         pass             # <<<<<<<<<<<<<<
 * 
 * 
 */

  __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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.take", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":522
 *         pass
 * 
 *     cpdef take(self, ndarray[float64_t, ndim=1] values,             # <<<<<<<<<<<<<<
 *                ndarray[int32_t, ndim=1] indices):
 *         pass
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_13take(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_13take(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_indices = 0;
  Py_buffer __pyx_bstruct_indices;
  Py_ssize_t __pyx_bstride_0_indices = 0;
  Py_ssize_t __pyx_bshape_0_indices = 0;
  Py_buffer __pyx_bstruct_values;
  Py_ssize_t __pyx_bstride_0_values = 0;
  Py_ssize_t __pyx_bshape_0_values = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indices,0};
  __Pyx_RefNannySetupContext("take");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indices);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "take") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __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_values = ((PyArrayObject *)values[0]);
    __pyx_v_indices = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.take", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_bstruct_values.buf = NULL;
  __pyx_bstruct_indices.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_5numpy_ndarray, 1, "indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_values = __pyx_bstruct_values.strides[0];
  __pyx_bshape_0_values = __pyx_bstruct_values.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0];
  __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0];
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pandas_7_sparse_BlockIndex *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->__pyx_vtab)->take(((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self), __pyx_v_values, __pyx_v_indices, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.take", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":267
 *     '''
 *     cdef readonly:
 *         Py_ssize_t nblocks, npoints, length             # <<<<<<<<<<<<<<
 *         ndarray blocs, blengths
 * 
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_7nblocks___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_7nblocks___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->nblocks); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.nblocks.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_7npoints___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_7npoints___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->npoints); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.npoints.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_6length___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_6length___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.BlockIndex.length.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":268
 *     cdef readonly:
 *         Py_ssize_t nblocks, npoints, length
 *         ndarray blocs, blengths             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_5blocs___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_5blocs___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blocs));
  __pyx_r = ((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blocs);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_8blengths___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_10BlockIndex_8blengths___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blengths));
  __pyx_r = ((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_v_self)->blengths);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":537
 *         int32_t xi, yi # block indices
 * 
 *     def __init__(self, BlockIndex x, BlockIndex y):             # <<<<<<<<<<<<<<
 *         self.x = x
 *         self.y = y
 */

static int __pyx_pf_6pandas_7_sparse_10BlockMerge___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_6pandas_7_sparse_10BlockMerge___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_v_y = 0;
  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;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,0};
  __Pyx_RefNannySetupContext("__init__");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __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_x = ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)values[0]);
    __pyx_v_y = ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.BlockMerge.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_6pandas_7_sparse_BlockIndex, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_6pandas_7_sparse_BlockIndex, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/sparse.pyx":538
 * 
 *     def __init__(self, BlockIndex x, BlockIndex y):
 *         self.x = x             # <<<<<<<<<<<<<<
 *         self.y = y
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_x));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_x));
  __Pyx_GOTREF(((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->x);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->x));
  ((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->x = __pyx_v_x;

  /* "pandas/src/sparse.pyx":539
 *     def __init__(self, BlockIndex x, BlockIndex y):
 *         self.x = x
 *         self.y = y             # <<<<<<<<<<<<<<
 * 
 *         if x.length != y.length:
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_y));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_y));
  __Pyx_GOTREF(((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->y);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->y));
  ((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->y = __pyx_v_y;

  /* "pandas/src/sparse.pyx":541
 *         self.y = y
 * 
 *         if x.length != y.length:             # <<<<<<<<<<<<<<
 *             raise Exception('Indices must reference same underlying length')
 * 
 */
  __pyx_t_1 = (__pyx_v_x->length != __pyx_v_y->length);
  if (__pyx_t_1) {

    /* "pandas/src/sparse.pyx":542
 * 
 *         if x.length != y.length:
 *             raise Exception('Indices must reference same underlying length')             # <<<<<<<<<<<<<<
 * 
 *         self.xstart = self.x.blocs
 */
    __pyx_t_2 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pandas/src/sparse.pyx":544
 *             raise Exception('Indices must reference same underlying length')
 * 
 *         self.xstart = self.x.blocs             # <<<<<<<<<<<<<<
 *         self.ystart = self.y.blocs
 * 
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->x->blocs));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->x->blocs));
  __Pyx_GOTREF(((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->xstart);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->xstart));
  ((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->xstart = ((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->x->blocs;

  /* "pandas/src/sparse.pyx":545
 * 
 *         self.xstart = self.x.blocs
 *         self.ystart = self.y.blocs             # <<<<<<<<<<<<<<
 * 
 *         self.xend = self.x.blocs + self.x.blengths
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->y->blocs));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->y->blocs));
  __Pyx_GOTREF(((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->ystart);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->ystart));
  ((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->ystart = ((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->y->blocs;

  /* "pandas/src/sparse.pyx":547
 *         self.ystart = self.y.blocs
 * 
 *         self.xend = self.x.blocs + self.x.blengths             # <<<<<<<<<<<<<<
 *         self.yend = self.y.blocs + self.y.blengths
 * 
 */
  __pyx_t_2 = PyNumber_Add(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->x->blocs), ((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->x->blengths)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->xend);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->xend));
  ((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->xend = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/src/sparse.pyx":548
 * 
 *         self.xend = self.x.blocs + self.x.blengths
 *         self.yend = self.y.blocs + self.y.blengths             # <<<<<<<<<<<<<<
 * 
 *         # self.xlen = self.x.blengths
 */
  __pyx_t_2 = PyNumber_Add(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->y->blocs), ((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->y->blengths)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->yend);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->yend));
  ((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->yend = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/src/sparse.pyx":553
 *         # self.ylen = self.y.blengths
 * 
 *         self.xi = 0             # <<<<<<<<<<<<<<
 *         self.yi = 0
 * 
 */
  ((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->xi = 0;

  /* "pandas/src/sparse.pyx":554
 * 
 *         self.xi = 0
 *         self.yi = 0             # <<<<<<<<<<<<<<
 * 
 *         self.result = self._make_merged_blocks()
 */
  ((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->yi = 0;

  /* "pandas/src/sparse.pyx":556
 *         self.yi = 0
 * 
 *         self.result = self._make_merged_blocks()             # <<<<<<<<<<<<<<
 * 
 *     cdef _make_merged_blocks(self):
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_6pandas_7_sparse_BlockMerge *)((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->__pyx_vtab)->_make_merged_blocks(((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6pandas_7_sparse_BlockIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->result);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->result));
  ((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self)->result = ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_t_2);
  __pyx_t_2 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pandas._sparse.BlockMerge.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":558
 *         self.result = self._make_merged_blocks()
 * 
 *     cdef _make_merged_blocks(self):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

static PyObject *__pyx_f_6pandas_7_sparse_10BlockMerge__make_merged_blocks(struct __pyx_obj_6pandas_7_sparse_BlockMerge *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_make_merged_blocks");

  /* "pandas/src/sparse.pyx":559
 * 
 *     cdef _make_merged_blocks(self):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     cdef _set_current_indices(self, int32_t xi, int32_t yi, bint mode):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pandas._sparse.BlockMerge._make_merged_blocks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":561
 *         raise NotImplementedError
 * 
 *     cdef _set_current_indices(self, int32_t xi, int32_t yi, bint mode):             # <<<<<<<<<<<<<<
 *         if mode == 0:
 *             self.xi = xi
 */

static PyObject *__pyx_f_6pandas_7_sparse_10BlockMerge__set_current_indices(struct __pyx_obj_6pandas_7_sparse_BlockMerge *__pyx_v_self, __pyx_t_5numpy_int32_t __pyx_v_xi, __pyx_t_5numpy_int32_t __pyx_v_yi, int __pyx_v_mode) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_set_current_indices");

  /* "pandas/src/sparse.pyx":562
 * 
 *     cdef _set_current_indices(self, int32_t xi, int32_t yi, bint mode):
 *         if mode == 0:             # <<<<<<<<<<<<<<
 *             self.xi = xi
 *             self.yi = yi
 */
  __pyx_t_1 = (__pyx_v_mode == 0);
  if (__pyx_t_1) {

    /* "pandas/src/sparse.pyx":563
 *     cdef _set_current_indices(self, int32_t xi, int32_t yi, bint mode):
 *         if mode == 0:
 *             self.xi = xi             # <<<<<<<<<<<<<<
 *             self.yi = yi
 *         else:
 */
    __pyx_v_self->xi = __pyx_v_xi;

    /* "pandas/src/sparse.pyx":564
 *         if mode == 0:
 *             self.xi = xi
 *             self.yi = yi             # <<<<<<<<<<<<<<
 *         else:
 *             self.xi = yi
 */
    __pyx_v_self->yi = __pyx_v_yi;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/sparse.pyx":566
 *             self.yi = yi
 *         else:
 *             self.xi = yi             # <<<<<<<<<<<<<<
 *             self.yi = xi
 * 
 */
    __pyx_v_self->xi = __pyx_v_yi;

    /* "pandas/src/sparse.pyx":567
 *         else:
 *             self.xi = yi
 *             self.yi = xi             # <<<<<<<<<<<<<<
 * 
 * cdef class BlockIntersection(BlockMerge):
 */
    __pyx_v_self->yi = __pyx_v_xi;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":581
 *     '''
 * 
 *     cdef _make_merged_blocks(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             ndarray[int32_t, ndim=1] xstart, xend, ystart, yend
 */

static PyObject *__pyx_f_6pandas_7_sparse_10BlockUnion__make_merged_blocks(struct __pyx_obj_6pandas_7_sparse_BlockUnion *__pyx_v_self) {
  PyArrayObject *__pyx_v_xstart = 0;
  PyArrayObject *__pyx_v_xend = 0;
  PyArrayObject *__pyx_v_ystart = 0;
  PyArrayObject *__pyx_v_yend = 0;
  __pyx_t_5numpy_int32_t __pyx_v_nstart;
  __pyx_t_5numpy_int32_t __pyx_v_nend;
  PyObject *__pyx_v_out_blocs = 0;
  PyObject *__pyx_v_out_blengths = 0;
  Py_buffer __pyx_bstruct_yend;
  Py_ssize_t __pyx_bstride_0_yend = 0;
  Py_ssize_t __pyx_bshape_0_yend = 0;
  Py_buffer __pyx_bstruct_ystart;
  Py_ssize_t __pyx_bstride_0_ystart = 0;
  Py_ssize_t __pyx_bshape_0_ystart = 0;
  Py_buffer __pyx_bstruct_xstart;
  Py_ssize_t __pyx_bstride_0_xstart = 0;
  Py_ssize_t __pyx_bshape_0_xstart = 0;
  Py_buffer __pyx_bstruct_xend;
  Py_ssize_t __pyx_bstride_0_xend = 0;
  Py_ssize_t __pyx_bshape_0_xend = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyArrayObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  __pyx_t_5numpy_int32_t __pyx_t_10;
  __pyx_t_5numpy_int32_t __pyx_t_11;
  __pyx_t_5numpy_int32_t __pyx_t_12;
  __pyx_t_5numpy_int32_t __pyx_t_13;
  __pyx_t_5numpy_int32_t __pyx_t_14;
  __pyx_t_5numpy_int32_t __pyx_t_15;
  __pyx_t_5numpy_int32_t __pyx_t_16;
  __pyx_t_5numpy_int32_t __pyx_t_17;
  __pyx_t_5numpy_int32_t __pyx_t_18;
  int __pyx_t_19;
  PyObject *__pyx_t_20 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_make_merged_blocks");
  __pyx_bstruct_xstart.buf = NULL;
  __pyx_bstruct_xend.buf = NULL;
  __pyx_bstruct_ystart.buf = NULL;
  __pyx_bstruct_yend.buf = NULL;

  /* "pandas/src/sparse.pyx":585
 *             ndarray[int32_t, ndim=1] xstart, xend, ystart, yend
 *             int32_t nstart, nend, diff
 *             list out_blocs = [], out_blengths = []             # <<<<<<<<<<<<<<
 * 
 *         xstart = self.xstart
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_out_blocs = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_out_blengths = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/src/sparse.pyx":587
 *             list out_blocs = [], out_blengths = []
 * 
 *         xstart = self.xstart             # <<<<<<<<<<<<<<
 *         xend = self.xend
 *         ystart = self.ystart
 */
  __pyx_t_2 = ((PyArrayObject *)__pyx_v_self->__pyx_base.xstart);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xstart);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xstart, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xstart, (PyObject*)__pyx_v_xstart, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      }
    }
    __pyx_bstride_0_xstart = __pyx_bstruct_xstart.strides[0];
    __pyx_bshape_0_xstart = __pyx_bstruct_xstart.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.xstart));
  __pyx_v_xstart = ((PyArrayObject *)__pyx_v_self->__pyx_base.xstart);

  /* "pandas/src/sparse.pyx":588
 * 
 *         xstart = self.xstart
 *         xend = self.xend             # <<<<<<<<<<<<<<
 *         ystart = self.ystart
 *         yend = self.yend
 */
  __pyx_t_2 = ((PyArrayObject *)__pyx_v_self->__pyx_base.xend);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xend);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xend, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xend, (PyObject*)__pyx_v_xend, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_5, __pyx_t_4);
      }
    }
    __pyx_bstride_0_xend = __pyx_bstruct_xend.strides[0];
    __pyx_bshape_0_xend = __pyx_bstruct_xend.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.xend));
  __pyx_v_xend = ((PyArrayObject *)__pyx_v_self->__pyx_base.xend);

  /* "pandas/src/sparse.pyx":589
 *         xstart = self.xstart
 *         xend = self.xend
 *         ystart = self.ystart             # <<<<<<<<<<<<<<
 *         yend = self.yend
 * 
 */
  __pyx_t_2 = ((PyArrayObject *)__pyx_v_self->__pyx_base.ystart);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ystart);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_ystart, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_ystart, (PyObject*)__pyx_v_ystart, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      }
    }
    __pyx_bstride_0_ystart = __pyx_bstruct_ystart.strides[0];
    __pyx_bshape_0_ystart = __pyx_bstruct_ystart.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.ystart));
  __pyx_v_ystart = ((PyArrayObject *)__pyx_v_self->__pyx_base.ystart);

  /* "pandas/src/sparse.pyx":590
 *         xend = self.xend
 *         ystart = self.ystart
 *         yend = self.yend             # <<<<<<<<<<<<<<
 * 
 *         while True:
 */
  __pyx_t_2 = ((PyArrayObject *)__pyx_v_self->__pyx_base.yend);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yend);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_yend, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_yend, (PyObject*)__pyx_v_yend, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_5, __pyx_t_4);
      }
    }
    __pyx_bstride_0_yend = __pyx_bstruct_yend.strides[0];
    __pyx_bshape_0_yend = __pyx_bstruct_yend.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.yend));
  __pyx_v_yend = ((PyArrayObject *)__pyx_v_self->__pyx_base.yend);

  /* "pandas/src/sparse.pyx":592
 *         yend = self.yend
 * 
 *         while True:             # <<<<<<<<<<<<<<
 *             # we are done (or possibly never began)
 *             if self.xi >= self.x.nblocks and self.yi >= self.y.nblocks:
 */
  while (1) {
    if (!1) break;

    /* "pandas/src/sparse.pyx":594
 *         while True:
 *             # we are done (or possibly never began)
 *             if self.xi >= self.x.nblocks and self.yi >= self.y.nblocks:             # <<<<<<<<<<<<<<
 *                 break
 *             elif self.yi >= self.y.nblocks:
 */
    __pyx_t_7 = (__pyx_v_self->__pyx_base.xi >= __pyx_v_self->__pyx_base.x->nblocks);
    if (__pyx_t_7) {
      __pyx_t_8 = (__pyx_v_self->__pyx_base.yi >= __pyx_v_self->__pyx_base.y->nblocks);
      __pyx_t_9 = __pyx_t_8;
    } else {
      __pyx_t_9 = __pyx_t_7;
    }
    if (__pyx_t_9) {

      /* "pandas/src/sparse.pyx":595
 *             # we are done (or possibly never began)
 *             if self.xi >= self.x.nblocks and self.yi >= self.y.nblocks:
 *                 break             # <<<<<<<<<<<<<<
 *             elif self.yi >= self.y.nblocks:
 *                 # through with y, just pass through x blocks
 */
      goto __pyx_L4_break;
      goto __pyx_L5;
    }

    /* "pandas/src/sparse.pyx":596
 *             if self.xi >= self.x.nblocks and self.yi >= self.y.nblocks:
 *                 break
 *             elif self.yi >= self.y.nblocks:             # <<<<<<<<<<<<<<
 *                 # through with y, just pass through x blocks
 *                 nstart = xstart[self.xi]
 */
    __pyx_t_9 = (__pyx_v_self->__pyx_base.yi >= __pyx_v_self->__pyx_base.y->nblocks);
    if (__pyx_t_9) {

      /* "pandas/src/sparse.pyx":598
 *             elif self.yi >= self.y.nblocks:
 *                 # through with y, just pass through x blocks
 *                 nstart = xstart[self.xi]             # <<<<<<<<<<<<<<
 *                 nend = xend[self.xi]
 *                 self.xi += 1
 */
      __pyx_t_10 = __pyx_v_self->__pyx_base.xi;
      __pyx_t_3 = -1;
      if (__pyx_t_10 < 0) {
        __pyx_t_10 += __pyx_bshape_0_xstart;
        if (unlikely(__pyx_t_10 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_xstart)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_nstart = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xstart.buf, __pyx_t_10, __pyx_bstride_0_xstart));

      /* "pandas/src/sparse.pyx":599
 *                 # through with y, just pass through x blocks
 *                 nstart = xstart[self.xi]
 *                 nend = xend[self.xi]             # <<<<<<<<<<<<<<
 *                 self.xi += 1
 *             elif self.xi >= self.x.nblocks:
 */
      __pyx_t_11 = __pyx_v_self->__pyx_base.xi;
      __pyx_t_3 = -1;
      if (__pyx_t_11 < 0) {
        __pyx_t_11 += __pyx_bshape_0_xend;
        if (unlikely(__pyx_t_11 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_xend)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_nend = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xend.buf, __pyx_t_11, __pyx_bstride_0_xend));

      /* "pandas/src/sparse.pyx":600
 *                 nstart = xstart[self.xi]
 *                 nend = xend[self.xi]
 *                 self.xi += 1             # <<<<<<<<<<<<<<
 *             elif self.xi >= self.x.nblocks:
 *                 # through with x, just pass through y blocks
 */
      __pyx_v_self->__pyx_base.xi = (__pyx_v_self->__pyx_base.xi + 1);
      goto __pyx_L5;
    }

    /* "pandas/src/sparse.pyx":601
 *                 nend = xend[self.xi]
 *                 self.xi += 1
 *             elif self.xi >= self.x.nblocks:             # <<<<<<<<<<<<<<
 *                 # through with x, just pass through y blocks
 *                 nstart = ystart[self.yi]
 */
    __pyx_t_9 = (__pyx_v_self->__pyx_base.xi >= __pyx_v_self->__pyx_base.x->nblocks);
    if (__pyx_t_9) {

      /* "pandas/src/sparse.pyx":603
 *             elif self.xi >= self.x.nblocks:
 *                 # through with x, just pass through y blocks
 *                 nstart = ystart[self.yi]             # <<<<<<<<<<<<<<
 *                 nend = yend[self.yi]
 *                 self.yi += 1
 */
      __pyx_t_12 = __pyx_v_self->__pyx_base.yi;
      __pyx_t_3 = -1;
      if (__pyx_t_12 < 0) {
        __pyx_t_12 += __pyx_bshape_0_ystart;
        if (unlikely(__pyx_t_12 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_ystart)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_nstart = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_ystart.buf, __pyx_t_12, __pyx_bstride_0_ystart));

      /* "pandas/src/sparse.pyx":604
 *                 # through with x, just pass through y blocks
 *                 nstart = ystart[self.yi]
 *                 nend = yend[self.yi]             # <<<<<<<<<<<<<<
 *                 self.yi += 1
 *             else:
 */
      __pyx_t_13 = __pyx_v_self->__pyx_base.yi;
      __pyx_t_3 = -1;
      if (__pyx_t_13 < 0) {
        __pyx_t_13 += __pyx_bshape_0_yend;
        if (unlikely(__pyx_t_13 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_yend)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_nend = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yend.buf, __pyx_t_13, __pyx_bstride_0_yend));

      /* "pandas/src/sparse.pyx":605
 *                 nstart = ystart[self.yi]
 *                 nend = yend[self.yi]
 *                 self.yi += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 # find end of new block
 */
      __pyx_v_self->__pyx_base.yi = (__pyx_v_self->__pyx_base.yi + 1);
      goto __pyx_L5;
    }
    /*else*/ {

      /* "pandas/src/sparse.pyx":608
 *             else:
 *                 # find end of new block
 *                 if xstart[self.xi] < ystart[self.yi]:             # <<<<<<<<<<<<<<
 *                     nstart = xstart[self.xi]
 *                     nend = self._find_next_block_end(0)
 */
      __pyx_t_14 = __pyx_v_self->__pyx_base.xi;
      __pyx_t_3 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_14 += __pyx_bshape_0_xstart;
        if (unlikely(__pyx_t_14 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_xstart)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_15 = __pyx_v_self->__pyx_base.yi;
      __pyx_t_3 = -1;
      if (__pyx_t_15 < 0) {
        __pyx_t_15 += __pyx_bshape_0_ystart;
        if (unlikely(__pyx_t_15 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_ystart)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_9 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xstart.buf, __pyx_t_14, __pyx_bstride_0_xstart)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_ystart.buf, __pyx_t_15, __pyx_bstride_0_ystart)));
      if (__pyx_t_9) {

        /* "pandas/src/sparse.pyx":609
 *                 # find end of new block
 *                 if xstart[self.xi] < ystart[self.yi]:
 *                     nstart = xstart[self.xi]             # <<<<<<<<<<<<<<
 *                     nend = self._find_next_block_end(0)
 *                 else:
 */
        __pyx_t_16 = __pyx_v_self->__pyx_base.xi;
        __pyx_t_3 = -1;
        if (__pyx_t_16 < 0) {
          __pyx_t_16 += __pyx_bshape_0_xstart;
          if (unlikely(__pyx_t_16 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_xstart)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_nstart = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xstart.buf, __pyx_t_16, __pyx_bstride_0_xstart));

        /* "pandas/src/sparse.pyx":610
 *                 if xstart[self.xi] < ystart[self.yi]:
 *                     nstart = xstart[self.xi]
 *                     nend = self._find_next_block_end(0)             # <<<<<<<<<<<<<<
 *                 else:
 *                     nstart = ystart[self.yi]
 */
        __pyx_t_17 = ((struct __pyx_vtabstruct_6pandas_7_sparse_BlockUnion *)__pyx_v_self->__pyx_base.__pyx_vtab)->_find_next_block_end(__pyx_v_self, 0); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_v_nend = __pyx_t_17;
        goto __pyx_L6;
      }
      /*else*/ {

        /* "pandas/src/sparse.pyx":612
 *                     nend = self._find_next_block_end(0)
 *                 else:
 *                     nstart = ystart[self.yi]             # <<<<<<<<<<<<<<
 *                     nend = self._find_next_block_end(1)
 * 
 */
        __pyx_t_17 = __pyx_v_self->__pyx_base.yi;
        __pyx_t_3 = -1;
        if (__pyx_t_17 < 0) {
          __pyx_t_17 += __pyx_bshape_0_ystart;
          if (unlikely(__pyx_t_17 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_ystart)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_nstart = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_ystart.buf, __pyx_t_17, __pyx_bstride_0_ystart));

        /* "pandas/src/sparse.pyx":613
 *                 else:
 *                     nstart = ystart[self.yi]
 *                     nend = self._find_next_block_end(1)             # <<<<<<<<<<<<<<
 * 
 *             out_blocs.append(nstart)
 */
        __pyx_t_18 = ((struct __pyx_vtabstruct_6pandas_7_sparse_BlockUnion *)__pyx_v_self->__pyx_base.__pyx_vtab)->_find_next_block_end(__pyx_v_self, 1); if (unlikely(__pyx_t_18 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_v_nend = __pyx_t_18;
      }
      __pyx_L6:;
    }
    __pyx_L5:;

    /* "pandas/src/sparse.pyx":615
 *                     nend = self._find_next_block_end(1)
 * 
 *             out_blocs.append(nstart)             # <<<<<<<<<<<<<<
 *             out_blengths.append(nend - nstart)
 * 
 */
    if (unlikely(((PyObject *)__pyx_v_out_blocs) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_1 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_nstart); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_19 = PyList_Append(__pyx_v_out_blocs, __pyx_t_1); if (unlikely(__pyx_t_19 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pandas/src/sparse.pyx":616
 * 
 *             out_blocs.append(nstart)
 *             out_blengths.append(nend - nstart)             # <<<<<<<<<<<<<<
 * 
 *         return BlockIndex(self.x.length, out_blocs, out_blengths)
 */
    if (unlikely(((PyObject *)__pyx_v_out_blengths) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_1 = PyInt_FromLong((__pyx_v_nend - __pyx_v_nstart)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_19 = PyList_Append(__pyx_v_out_blengths, __pyx_t_1); if (unlikely(__pyx_t_19 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L4_break:;

  /* "pandas/src/sparse.pyx":618
 *             out_blengths.append(nend - nstart)
 * 
 *         return BlockIndex(self.x.length, out_blocs, out_blengths)             # <<<<<<<<<<<<<<
 * 
 *     cdef int32_t _find_next_block_end(self, bint mode) except -1:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.x->length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_20 = PyTuple_New(3); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_20));
  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_out_blocs));
  PyTuple_SET_ITEM(__pyx_t_20, 1, ((PyObject *)__pyx_v_out_blocs));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out_blocs));
  __Pyx_INCREF(((PyObject *)__pyx_v_out_blengths));
  PyTuple_SET_ITEM(__pyx_t_20, 2, ((PyObject *)__pyx_v_out_blengths));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out_blengths));
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pandas_7_sparse_BlockIndex)), ((PyObject *)__pyx_t_20), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_20);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yend);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ystart);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xstart);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xend);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.BlockUnion._make_merged_blocks", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yend);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ystart);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xstart);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xend);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_xstart);
  __Pyx_XDECREF((PyObject *)__pyx_v_xend);
  __Pyx_XDECREF((PyObject *)__pyx_v_ystart);
  __Pyx_XDECREF((PyObject *)__pyx_v_yend);
  __Pyx_XDECREF(__pyx_v_out_blocs);
  __Pyx_XDECREF(__pyx_v_out_blengths);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":620
 *         return BlockIndex(self.x.length, out_blocs, out_blengths)
 * 
 *     cdef int32_t _find_next_block_end(self, bint mode) except -1:             # <<<<<<<<<<<<<<
 *         '''
 *         Wow, this got complicated in a hurry
 */

static __pyx_t_5numpy_int32_t __pyx_f_6pandas_7_sparse_10BlockUnion__find_next_block_end(struct __pyx_obj_6pandas_7_sparse_BlockUnion *__pyx_v_self, int __pyx_v_mode) {
  PyArrayObject *__pyx_v_xstart = 0;
  PyArrayObject *__pyx_v_xend = 0;
  PyArrayObject *__pyx_v_ystart = 0;
  PyArrayObject *__pyx_v_yend = 0;
  __pyx_t_5numpy_int32_t __pyx_v_xi;
  __pyx_t_5numpy_int32_t __pyx_v_yi;
  __pyx_t_5numpy_int32_t __pyx_v_ynblocks;
  __pyx_t_5numpy_int32_t __pyx_v_nend;
  Py_buffer __pyx_bstruct_yend;
  Py_ssize_t __pyx_bstride_0_yend = 0;
  Py_ssize_t __pyx_bshape_0_yend = 0;
  Py_buffer __pyx_bstruct_xstart;
  Py_ssize_t __pyx_bstride_0_xstart = 0;
  Py_ssize_t __pyx_bshape_0_xstart = 0;
  Py_buffer __pyx_bstruct_xend;
  Py_ssize_t __pyx_bstride_0_xend = 0;
  Py_ssize_t __pyx_bshape_0_xend = 0;
  Py_buffer __pyx_bstruct_ystart;
  Py_ssize_t __pyx_bstride_0_ystart = 0;
  Py_ssize_t __pyx_bshape_0_ystart = 0;
  __pyx_t_5numpy_int32_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyArrayObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __pyx_t_5numpy_int32_t __pyx_t_8;
  __pyx_t_5numpy_int32_t __pyx_t_9;
  __pyx_t_5numpy_int32_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  __pyx_t_5numpy_int32_t __pyx_t_13;
  __pyx_t_5numpy_int32_t __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_find_next_block_end");
  __pyx_bstruct_xstart.buf = NULL;
  __pyx_bstruct_xend.buf = NULL;
  __pyx_bstruct_ystart.buf = NULL;
  __pyx_bstruct_yend.buf = NULL;

  /* "pandas/src/sparse.pyx":631
 *             int32_t xi, yi, xnblocks, ynblocks, nend
 * 
 *         if mode != 0 and mode != 1:             # <<<<<<<<<<<<<<
 *             raise Exception('Mode must be 0 or 1')
 * 
 */
  switch (__pyx_v_mode) {
    case 0:
    case 1:
    __pyx_t_1 = 0;
    break;
    default:
    __pyx_t_1 = 1;
    break;
  }
  if (__pyx_t_1) {

    /* "pandas/src/sparse.pyx":632
 * 
 *         if mode != 0 and mode != 1:
 *             raise Exception('Mode must be 0 or 1')             # <<<<<<<<<<<<<<
 * 
 *         # so symmetric code will work
 */
    __pyx_t_2 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/sparse.pyx":635
 * 
 *         # so symmetric code will work
 *         if mode == 0:             # <<<<<<<<<<<<<<
 *             xstart = self.xstart
 *             xend = self.xend
 */
  __pyx_t_1 = (__pyx_v_mode == 0);
  if (__pyx_t_1) {

    /* "pandas/src/sparse.pyx":636
 *         # so symmetric code will work
 *         if mode == 0:
 *             xstart = self.xstart             # <<<<<<<<<<<<<<
 *             xend = self.xend
 *             xi = self.xi
 */
    __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->__pyx_base.xstart);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xstart);
      __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xstart, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_4 < 0)) {
        PyErr_Fetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xstart, (PyObject*)__pyx_v_xstart, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        }
      }
      __pyx_bstride_0_xstart = __pyx_bstruct_xstart.strides[0];
      __pyx_bshape_0_xstart = __pyx_bstruct_xstart.shape[0];
      if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = 0;
    __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.xstart));
    __pyx_v_xstart = ((PyArrayObject *)__pyx_v_self->__pyx_base.xstart);

    /* "pandas/src/sparse.pyx":637
 *         if mode == 0:
 *             xstart = self.xstart
 *             xend = self.xend             # <<<<<<<<<<<<<<
 *             xi = self.xi
 * 
 */
    __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->__pyx_base.xend);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xend);
      __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xend, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_4 < 0)) {
        PyErr_Fetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xend, (PyObject*)__pyx_v_xend, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_7, __pyx_t_6, __pyx_t_5);
        }
      }
      __pyx_bstride_0_xend = __pyx_bstruct_xend.strides[0];
      __pyx_bshape_0_xend = __pyx_bstruct_xend.shape[0];
      if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = 0;
    __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.xend));
    __pyx_v_xend = ((PyArrayObject *)__pyx_v_self->__pyx_base.xend);

    /* "pandas/src/sparse.pyx":638
 *             xstart = self.xstart
 *             xend = self.xend
 *             xi = self.xi             # <<<<<<<<<<<<<<
 * 
 *             ystart = self.ystart
 */
    __pyx_v_xi = __pyx_v_self->__pyx_base.xi;

    /* "pandas/src/sparse.pyx":640
 *             xi = self.xi
 * 
 *             ystart = self.ystart             # <<<<<<<<<<<<<<
 *             yend = self.yend
 *             yi = self.yi
 */
    __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->__pyx_base.ystart);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ystart);
      __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_ystart, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_4 < 0)) {
        PyErr_Fetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_ystart, (PyObject*)__pyx_v_ystart, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        }
      }
      __pyx_bstride_0_ystart = __pyx_bstruct_ystart.strides[0];
      __pyx_bshape_0_ystart = __pyx_bstruct_ystart.shape[0];
      if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = 0;
    __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.ystart));
    __pyx_v_ystart = ((PyArrayObject *)__pyx_v_self->__pyx_base.ystart);

    /* "pandas/src/sparse.pyx":641
 * 
 *             ystart = self.ystart
 *             yend = self.yend             # <<<<<<<<<<<<<<
 *             yi = self.yi
 *             ynblocks = self.y.nblocks
 */
    __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->__pyx_base.yend);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yend);
      __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_yend, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_4 < 0)) {
        PyErr_Fetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_yend, (PyObject*)__pyx_v_yend, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_7, __pyx_t_6, __pyx_t_5);
        }
      }
      __pyx_bstride_0_yend = __pyx_bstruct_yend.strides[0];
      __pyx_bshape_0_yend = __pyx_bstruct_yend.shape[0];
      if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = 0;
    __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.yend));
    __pyx_v_yend = ((PyArrayObject *)__pyx_v_self->__pyx_base.yend);

    /* "pandas/src/sparse.pyx":642
 *             ystart = self.ystart
 *             yend = self.yend
 *             yi = self.yi             # <<<<<<<<<<<<<<
 *             ynblocks = self.y.nblocks
 *         else:
 */
    __pyx_v_yi = __pyx_v_self->__pyx_base.yi;

    /* "pandas/src/sparse.pyx":643
 *             yend = self.yend
 *             yi = self.yi
 *             ynblocks = self.y.nblocks             # <<<<<<<<<<<<<<
 *         else:
 *             xstart = self.ystart
 */
    __pyx_v_ynblocks = __pyx_v_self->__pyx_base.y->nblocks;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/sparse.pyx":645
 *             ynblocks = self.y.nblocks
 *         else:
 *             xstart = self.ystart             # <<<<<<<<<<<<<<
 *             xend = self.yend
 *             xi = self.yi
 */
    __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->__pyx_base.ystart);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xstart);
      __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xstart, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_4 < 0)) {
        PyErr_Fetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xstart, (PyObject*)__pyx_v_xstart, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        }
      }
      __pyx_bstride_0_xstart = __pyx_bstruct_xstart.strides[0];
      __pyx_bshape_0_xstart = __pyx_bstruct_xstart.shape[0];
      if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = 0;
    __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.ystart));
    __pyx_v_xstart = ((PyArrayObject *)__pyx_v_self->__pyx_base.ystart);

    /* "pandas/src/sparse.pyx":646
 *         else:
 *             xstart = self.ystart
 *             xend = self.yend             # <<<<<<<<<<<<<<
 *             xi = self.yi
 * 
 */
    __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->__pyx_base.yend);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xend);
      __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xend, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_4 < 0)) {
        PyErr_Fetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xend, (PyObject*)__pyx_v_xend, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_7, __pyx_t_6, __pyx_t_5);
        }
      }
      __pyx_bstride_0_xend = __pyx_bstruct_xend.strides[0];
      __pyx_bshape_0_xend = __pyx_bstruct_xend.shape[0];
      if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = 0;
    __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.yend));
    __pyx_v_xend = ((PyArrayObject *)__pyx_v_self->__pyx_base.yend);

    /* "pandas/src/sparse.pyx":647
 *             xstart = self.ystart
 *             xend = self.yend
 *             xi = self.yi             # <<<<<<<<<<<<<<
 * 
 *             ystart = self.xstart
 */
    __pyx_v_xi = __pyx_v_self->__pyx_base.yi;

    /* "pandas/src/sparse.pyx":649
 *             xi = self.yi
 * 
 *             ystart = self.xstart             # <<<<<<<<<<<<<<
 *             yend = self.xend
 *             yi = self.xi
 */
    __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->__pyx_base.xstart);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ystart);
      __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_ystart, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_4 < 0)) {
        PyErr_Fetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_ystart, (PyObject*)__pyx_v_ystart, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        }
      }
      __pyx_bstride_0_ystart = __pyx_bstruct_ystart.strides[0];
      __pyx_bshape_0_ystart = __pyx_bstruct_ystart.shape[0];
      if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = 0;
    __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.xstart));
    __pyx_v_ystart = ((PyArrayObject *)__pyx_v_self->__pyx_base.xstart);

    /* "pandas/src/sparse.pyx":650
 * 
 *             ystart = self.xstart
 *             yend = self.xend             # <<<<<<<<<<<<<<
 *             yi = self.xi
 *             ynblocks = self.x.nblocks
 */
    __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->__pyx_base.xend);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yend);
      __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_yend, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_4 < 0)) {
        PyErr_Fetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_yend, (PyObject*)__pyx_v_yend, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_7, __pyx_t_6, __pyx_t_5);
        }
      }
      __pyx_bstride_0_yend = __pyx_bstruct_yend.strides[0];
      __pyx_bshape_0_yend = __pyx_bstruct_yend.shape[0];
      if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = 0;
    __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.xend));
    __pyx_v_yend = ((PyArrayObject *)__pyx_v_self->__pyx_base.xend);

    /* "pandas/src/sparse.pyx":651
 *             ystart = self.xstart
 *             yend = self.xend
 *             yi = self.xi             # <<<<<<<<<<<<<<
 *             ynblocks = self.x.nblocks
 * 
 */
    __pyx_v_yi = __pyx_v_self->__pyx_base.xi;

    /* "pandas/src/sparse.pyx":652
 *             yend = self.xend
 *             yi = self.xi
 *             ynblocks = self.x.nblocks             # <<<<<<<<<<<<<<
 * 
 *         nend = xend[xi]
 */
    __pyx_v_ynblocks = __pyx_v_self->__pyx_base.x->nblocks;
  }
  __pyx_L4:;

  /* "pandas/src/sparse.pyx":654
 *             ynblocks = self.x.nblocks
 * 
 *         nend = xend[xi]             # <<<<<<<<<<<<<<
 * 
 *         # print 'here xi=%d, yi=%d, mode=%d, nend=%d' % (self.xi, self.yi,
 */
  __pyx_t_8 = __pyx_v_xi;
  __pyx_t_4 = -1;
  if (__pyx_t_8 < 0) {
    __pyx_t_8 += __pyx_bshape_0_xend;
    if (unlikely(__pyx_t_8 < 0)) __pyx_t_4 = 0;
  } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_xend)) __pyx_t_4 = 0;
  if (unlikely(__pyx_t_4 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_4);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_nend = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xend.buf, __pyx_t_8, __pyx_bstride_0_xend));

  /* "pandas/src/sparse.pyx":660
 * 
 *         # done with y?
 *         if yi == ynblocks:             # <<<<<<<<<<<<<<
 *             self._set_current_indices(xi + 1, yi, mode)
 *             return nend
 */
  __pyx_t_1 = (__pyx_v_yi == __pyx_v_ynblocks);
  if (__pyx_t_1) {

    /* "pandas/src/sparse.pyx":661
 *         # done with y?
 *         if yi == ynblocks:
 *             self._set_current_indices(xi + 1, yi, mode)             # <<<<<<<<<<<<<<
 *             return nend
 *         elif nend < ystart[yi]:
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_6pandas_7_sparse_BlockUnion *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_current_indices(((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self), (__pyx_v_xi + 1), __pyx_v_yi, __pyx_v_mode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pandas/src/sparse.pyx":662
 *         if yi == ynblocks:
 *             self._set_current_indices(xi + 1, yi, mode)
 *             return nend             # <<<<<<<<<<<<<<
 *         elif nend < ystart[yi]:
 *             # block ends before y block
 */
    __pyx_r = __pyx_v_nend;
    goto __pyx_L0;
    goto __pyx_L5;
  }

  /* "pandas/src/sparse.pyx":663
 *             self._set_current_indices(xi + 1, yi, mode)
 *             return nend
 *         elif nend < ystart[yi]:             # <<<<<<<<<<<<<<
 *             # block ends before y block
 *             self._set_current_indices(xi + 1, yi, mode)
 */
  __pyx_t_9 = __pyx_v_yi;
  __pyx_t_4 = -1;
  if (__pyx_t_9 < 0) {
    __pyx_t_9 += __pyx_bshape_0_ystart;
    if (unlikely(__pyx_t_9 < 0)) __pyx_t_4 = 0;
  } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_ystart)) __pyx_t_4 = 0;
  if (unlikely(__pyx_t_4 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_4);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = (__pyx_v_nend < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_ystart.buf, __pyx_t_9, __pyx_bstride_0_ystart)));
  if (__pyx_t_1) {

    /* "pandas/src/sparse.pyx":665
 *         elif nend < ystart[yi]:
 *             # block ends before y block
 *             self._set_current_indices(xi + 1, yi, mode)             # <<<<<<<<<<<<<<
 *             return nend
 *         else:
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_6pandas_7_sparse_BlockUnion *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_current_indices(((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self), (__pyx_v_xi + 1), __pyx_v_yi, __pyx_v_mode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pandas/src/sparse.pyx":666
 *             # block ends before y block
 *             self._set_current_indices(xi + 1, yi, mode)
 *             return nend             # <<<<<<<<<<<<<<
 *         else:
 *             while yi < ynblocks and nend > yend[yi]:
 */
    __pyx_r = __pyx_v_nend;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/src/sparse.pyx":668
 *             return nend
 *         else:
 *             while yi < ynblocks and nend > yend[yi]:             # <<<<<<<<<<<<<<
 *                 yi += 1
 * 
 */
    while (1) {
      __pyx_t_1 = (__pyx_v_yi < __pyx_v_ynblocks);
      if (__pyx_t_1) {
        __pyx_t_10 = __pyx_v_yi;
        __pyx_t_4 = -1;
        if (__pyx_t_10 < 0) {
          __pyx_t_10 += __pyx_bshape_0_yend;
          if (unlikely(__pyx_t_10 < 0)) __pyx_t_4 = 0;
        } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_yend)) __pyx_t_4 = 0;
        if (unlikely(__pyx_t_4 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_4);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_11 = (__pyx_v_nend > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yend.buf, __pyx_t_10, __pyx_bstride_0_yend)));
        __pyx_t_12 = __pyx_t_11;
      } else {
        __pyx_t_12 = __pyx_t_1;
      }
      if (!__pyx_t_12) break;

      /* "pandas/src/sparse.pyx":669
 *         else:
 *             while yi < ynblocks and nend > yend[yi]:
 *                 yi += 1             # <<<<<<<<<<<<<<
 * 
 *             self._set_current_indices(xi + 1, yi, mode)
 */
      __pyx_v_yi = (__pyx_v_yi + 1);
    }

    /* "pandas/src/sparse.pyx":671
 *                 yi += 1
 * 
 *             self._set_current_indices(xi + 1, yi, mode)             # <<<<<<<<<<<<<<
 * 
 *             if yi == ynblocks:
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_6pandas_7_sparse_BlockUnion *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_current_indices(((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)__pyx_v_self), (__pyx_v_xi + 1), __pyx_v_yi, __pyx_v_mode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pandas/src/sparse.pyx":673
 *             self._set_current_indices(xi + 1, yi, mode)
 * 
 *             if yi == ynblocks:             # <<<<<<<<<<<<<<
 *                 return nend
 * 
 */
    __pyx_t_12 = (__pyx_v_yi == __pyx_v_ynblocks);
    if (__pyx_t_12) {

      /* "pandas/src/sparse.pyx":674
 * 
 *             if yi == ynblocks:
 *                 return nend             # <<<<<<<<<<<<<<
 * 
 *             if nend < ystart[yi]:
 */
      __pyx_r = __pyx_v_nend;
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "pandas/src/sparse.pyx":676
 *                 return nend
 * 
 *             if nend < ystart[yi]:             # <<<<<<<<<<<<<<
 *                 # we're done, return the block end
 *                 return nend
 */
    __pyx_t_13 = __pyx_v_yi;
    __pyx_t_4 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_bshape_0_ystart;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_4 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_ystart)) __pyx_t_4 = 0;
    if (unlikely(__pyx_t_4 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_4);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_12 = (__pyx_v_nend < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_ystart.buf, __pyx_t_13, __pyx_bstride_0_ystart)));
    if (__pyx_t_12) {

      /* "pandas/src/sparse.pyx":678
 *             if nend < ystart[yi]:
 *                 # we're done, return the block end
 *                 return nend             # <<<<<<<<<<<<<<
 *             else:
 *                 # merge blocks, continue searching
 */
      __pyx_r = __pyx_v_nend;
      goto __pyx_L0;
      goto __pyx_L9;
    }
    /*else*/ {

      /* "pandas/src/sparse.pyx":682
 *                 # merge blocks, continue searching
 *                 # this also catches the case where blocks
 *                 return self._find_next_block_end(1 - mode)             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_14 = ((struct __pyx_vtabstruct_6pandas_7_sparse_BlockUnion *)__pyx_v_self->__pyx_base.__pyx_vtab)->_find_next_block_end(__pyx_v_self, (1 - __pyx_v_mode)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = __pyx_t_14;
      goto __pyx_L0;
    }
    __pyx_L9:;
  }
  __pyx_L5:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yend);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xstart);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xend);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ystart);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.BlockUnion._find_next_block_end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yend);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xstart);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xend);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ystart);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_xstart);
  __Pyx_XDECREF((PyObject *)__pyx_v_xend);
  __Pyx_XDECREF((PyObject *)__pyx_v_ystart);
  __Pyx_XDECREF((PyObject *)__pyx_v_yend);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":690
 * ctypedef float64_t (* double_func)(float64_t a, float64_t b)
 * 
 * cdef inline tuple sparse_nancombine(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                                     ndarray y, SparseIndex yindex,
 *                                     double_func op):
 */

static CYTHON_INLINE PyObject *__pyx_f_6pandas_7_sparse_sparse_nancombine(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, __pyx_t_6pandas_7_sparse_double_func __pyx_v_op) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  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_RefNannySetupContext("sparse_nancombine");

  /* "pandas/src/sparse.pyx":694
 *                                     double_func op):
 *     # faster to convert to IntIndex
 *     return int_nanop(x, xindex.to_int_index(),             # <<<<<<<<<<<<<<
 *                      y, yindex.to_int_index(), op)
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_xindex), __pyx_n_s__to_int_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); 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);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6pandas_7_sparse_IntIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/sparse.pyx":695
 *     # faster to convert to IntIndex
 *     return int_nanop(x, xindex.to_int_index(),
 *                      y, yindex.to_int_index(), op)             # <<<<<<<<<<<<<<
 * 
 *     # if isinstance(xindex, BlockIndex):
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_yindex), __pyx_n_s__to_int_index); 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_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pandas_7_sparse_IntIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_int_nanop(__pyx_v_x, ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_t_2), __pyx_v_y, ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_t_3), __pyx_v_op)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __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_3); __pyx_t_3 = 0;
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)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_AddTraceback("pandas._sparse.sparse_nancombine", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":705
 * 
 * 
 * cdef inline tuple sparse_combine(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                                  ndarray y, SparseIndex yindex, float64_t yfill,
 *                                  double_func op):
 */

static CYTHON_INLINE PyObject *__pyx_f_6pandas_7_sparse_sparse_combine(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, __pyx_t_6pandas_7_sparse_double_func __pyx_v_op) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sparse_combine");

  /* "pandas/src/sparse.pyx":708
 *                                  ndarray y, SparseIndex yindex, float64_t yfill,
 *                                  double_func op):
 *     if isinstance(xindex, BlockIndex):             # <<<<<<<<<<<<<<
 *         return block_op(x, xindex.to_block_index(), xfill,
 *                         y, yindex.to_block_index(), yfill, op)
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_6pandas_7_sparse_BlockIndex));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_xindex), __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pandas/src/sparse.pyx":709
 *                                  double_func op):
 *     if isinstance(xindex, BlockIndex):
 *         return block_op(x, xindex.to_block_index(), xfill,             # <<<<<<<<<<<<<<
 *                         y, yindex.to_block_index(), yfill, op)
 *     elif isinstance(xindex, IntIndex):
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_xindex), __pyx_n_s__to_block_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pandas_7_sparse_BlockIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pandas/src/sparse.pyx":710
 *     if isinstance(xindex, BlockIndex):
 *         return block_op(x, xindex.to_block_index(), xfill,
 *                         y, yindex.to_block_index(), yfill, op)             # <<<<<<<<<<<<<<
 *     elif isinstance(xindex, IntIndex):
 *         return int_op(x, xindex.to_int_index(), xfill,
 */
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_yindex), __pyx_n_s__to_block_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6pandas_7_sparse_BlockIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_block_op(__pyx_v_x, ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_t_3), __pyx_v_xfill, __pyx_v_y, ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_t_4), __pyx_v_yfill, __pyx_v_op)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "pandas/src/sparse.pyx":711
 *         return block_op(x, xindex.to_block_index(), xfill,
 *                         y, yindex.to_block_index(), yfill, op)
 *     elif isinstance(xindex, IntIndex):             # <<<<<<<<<<<<<<
 *         return int_op(x, xindex.to_int_index(), xfill,
 *                       y, yindex.to_int_index(), yfill, op)
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_6pandas_7_sparse_IntIndex));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_xindex), __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pandas/src/sparse.pyx":712
 *                         y, yindex.to_block_index(), yfill, op)
 *     elif isinstance(xindex, IntIndex):
 *         return int_op(x, xindex.to_int_index(), xfill,             # <<<<<<<<<<<<<<
 *                       y, yindex.to_int_index(), yfill, op)
 * 
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_xindex), __pyx_n_s__to_int_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6pandas_7_sparse_IntIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pandas/src/sparse.pyx":713
 *     elif isinstance(xindex, IntIndex):
 *         return int_op(x, xindex.to_int_index(), xfill,
 *                       y, yindex.to_int_index(), yfill, op)             # <<<<<<<<<<<<<<
 * 
 * # NaN-based arithmetic operation-- no handling of fill values
 */
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_yindex), __pyx_n_s__to_int_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pandas_7_sparse_IntIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_int_op(__pyx_v_x, ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_t_4), __pyx_v_xfill, __pyx_v_y, ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_t_3), __pyx_v_yfill, __pyx_v_op)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pandas._sparse.sparse_combine", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":719
 * 
 * @cython.boundscheck(False)
 * cdef inline tuple block_nanop(ndarray x_, BlockIndex xindex,             # <<<<<<<<<<<<<<
 *                               ndarray y_, BlockIndex yindex,
 *                               double_func op):
 */

static CYTHON_INLINE PyObject *__pyx_f_6pandas_7_sparse_block_nanop(PyArrayObject *__pyx_v_x_, struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y_, struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_v_yindex, __pyx_t_6pandas_7_sparse_double_func __pyx_v_op) {
  struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_v_out_index = 0;
  Py_ssize_t __pyx_v_xi;
  Py_ssize_t __pyx_v_yi;
  Py_ssize_t __pyx_v_out_i;
  Py_ssize_t __pyx_v_xbp;
  Py_ssize_t __pyx_v_ybp;
  Py_ssize_t __pyx_v_obp;
  Py_ssize_t __pyx_v_xblock;
  Py_ssize_t __pyx_v_yblock;
  Py_ssize_t __pyx_v_outblock;
  PyArrayObject *__pyx_v_x = 0;
  PyArrayObject *__pyx_v_y = 0;
  PyArrayObject *__pyx_v_out = 0;
  Py_buffer __pyx_bstruct_y;
  Py_ssize_t __pyx_bstride_0_y = 0;
  Py_ssize_t __pyx_bshape_0_y = 0;
  Py_buffer __pyx_bstruct_x;
  Py_ssize_t __pyx_bstride_0_x = 0;
  Py_ssize_t __pyx_bshape_0_x = 0;
  Py_buffer __pyx_bstruct_out;
  Py_ssize_t __pyx_bstride_0_out = 0;
  Py_ssize_t __pyx_bshape_0_out = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyArrayObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("block_nanop");
  __pyx_bstruct_x.buf = NULL;
  __pyx_bstruct_y.buf = NULL;
  __pyx_bstruct_out.buf = NULL;

  /* "pandas/src/sparse.pyx":724
 *     cdef:
 *         BlockIndex out_index
 *         Py_ssize_t xi = 0, yi = 0, out_i = 0 # fp buf indices             # <<<<<<<<<<<<<<
 *         Py_ssize_t xbp = 0, ybp = 0, obp = 0 # block positions
 *         Py_ssize_t xblock = 0, yblock = 0, outblock = 0 # block numbers
 */
  __pyx_v_xi = 0;
  __pyx_v_yi = 0;
  __pyx_v_out_i = 0;

  /* "pandas/src/sparse.pyx":725
 *         BlockIndex out_index
 *         Py_ssize_t xi = 0, yi = 0, out_i = 0 # fp buf indices
 *         Py_ssize_t xbp = 0, ybp = 0, obp = 0 # block positions             # <<<<<<<<<<<<<<
 *         Py_ssize_t xblock = 0, yblock = 0, outblock = 0 # block numbers
 * 
 */
  __pyx_v_xbp = 0;
  __pyx_v_ybp = 0;
  __pyx_v_obp = 0;

  /* "pandas/src/sparse.pyx":726
 *         Py_ssize_t xi = 0, yi = 0, out_i = 0 # fp buf indices
 *         Py_ssize_t xbp = 0, ybp = 0, obp = 0 # block positions
 *         Py_ssize_t xblock = 0, yblock = 0, outblock = 0 # block numbers             # <<<<<<<<<<<<<<
 * 
 *         ndarray[float64_t, ndim=1] x, y
 */
  __pyx_v_xblock = 0;
  __pyx_v_yblock = 0;
  __pyx_v_outblock = 0;

  /* "pandas/src/sparse.pyx":732
 * 
 *     # suppress Cython compiler warnings due to inlining
 *     x = x_             # <<<<<<<<<<<<<<
 *     y = y_
 * 
 */
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x);
    __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)((PyArrayObject *)__pyx_v_x_), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_1 < 0)) {
      PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      }
    }
    __pyx_bstride_0_x = __pyx_bstruct_x.strides[0];
    __pyx_bshape_0_x = __pyx_bstruct_x.shape[0];
    if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_INCREF(((PyObject *)__pyx_v_x_));
  __pyx_v_x = ((PyArrayObject *)__pyx_v_x_);

  /* "pandas/src/sparse.pyx":733
 *     # suppress Cython compiler warnings due to inlining
 *     x = x_
 *     y = y_             # <<<<<<<<<<<<<<
 * 
 *     out_index = xindex.intersect(yindex)
 */
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y);
    __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)((PyArrayObject *)__pyx_v_y_), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_1 < 0)) {
      PyErr_Fetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_4, __pyx_t_3, __pyx_t_2);
      }
    }
    __pyx_bstride_0_y = __pyx_bstruct_y.strides[0];
    __pyx_bshape_0_y = __pyx_bstruct_y.shape[0];
    if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_INCREF(((PyObject *)__pyx_v_y_));
  __pyx_v_y = ((PyArrayObject *)__pyx_v_y_);

  /* "pandas/src/sparse.pyx":735
 *     y = y_
 * 
 *     out_index = xindex.intersect(yindex)             # <<<<<<<<<<<<<<
 *     out = np.empty(out_index.npoints, dtype=np.float64)
 * 
 */
  __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_6pandas_7_sparse_BlockIndex *)__pyx_v_xindex->__pyx_vtab)->intersect(__pyx_v_xindex, ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)__pyx_v_yindex), 0)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_out_index = ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/src/sparse.pyx":736
 * 
 *     out_index = xindex.intersect(yindex)
 *     out = np.empty(out_index.npoints, dtype=np.float64)             # <<<<<<<<<<<<<<
 * 
 *     # walk the two SparseVectors, adding matched locations...
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_out_index->npoints); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__float64); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_6, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_9);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out);
    __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_1 < 0)) {
      PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      }
    }
    __pyx_bstride_0_out = __pyx_bstruct_out.strides[0];
    __pyx_bshape_0_out = __pyx_bstruct_out.shape[0];
    if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_10 = 0;
  __pyx_v_out = ((PyArrayObject *)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "pandas/src/sparse.pyx":739
 * 
 *     # walk the two SparseVectors, adding matched locations...
 *     for out_i from 0 <= out_i < out_index.npoints:             # <<<<<<<<<<<<<<
 * 
 *         # I have a feeling this is inefficient
 */
  __pyx_t_11 = __pyx_v_out_index->npoints;
  for (__pyx_v_out_i = 0; __pyx_v_out_i < __pyx_t_11; __pyx_v_out_i++) {

    /* "pandas/src/sparse.pyx":744
 * 
 *         # walk x
 *         while xindex.locbuf[xblock] + xbp < out_index.locbuf[outblock] + obp:             # <<<<<<<<<<<<<<
 *             xbp += 1
 *             xi += 1
 */
    while (1) {
      __pyx_t_12 = (((__pyx_v_xindex->locbuf[__pyx_v_xblock]) + __pyx_v_xbp) < ((__pyx_v_out_index->locbuf[__pyx_v_outblock]) + __pyx_v_obp));
      if (!__pyx_t_12) break;

      /* "pandas/src/sparse.pyx":745
 *         # walk x
 *         while xindex.locbuf[xblock] + xbp < out_index.locbuf[outblock] + obp:
 *             xbp += 1             # <<<<<<<<<<<<<<
 *             xi += 1
 *             if xbp == xindex.lenbuf[xblock]:
 */
      __pyx_v_xbp = (__pyx_v_xbp + 1);

      /* "pandas/src/sparse.pyx":746
 *         while xindex.locbuf[xblock] + xbp < out_index.locbuf[outblock] + obp:
 *             xbp += 1
 *             xi += 1             # <<<<<<<<<<<<<<
 *             if xbp == xindex.lenbuf[xblock]:
 *                 xblock += 1
 */
      __pyx_v_xi = (__pyx_v_xi + 1);

      /* "pandas/src/sparse.pyx":747
 *             xbp += 1
 *             xi += 1
 *             if xbp == xindex.lenbuf[xblock]:             # <<<<<<<<<<<<<<
 *                 xblock += 1
 *                 xbp = 0
 */
      __pyx_t_12 = (__pyx_v_xbp == (__pyx_v_xindex->lenbuf[__pyx_v_xblock]));
      if (__pyx_t_12) {

        /* "pandas/src/sparse.pyx":748
 *             xi += 1
 *             if xbp == xindex.lenbuf[xblock]:
 *                 xblock += 1             # <<<<<<<<<<<<<<
 *                 xbp = 0
 * 
 */
        __pyx_v_xblock = (__pyx_v_xblock + 1);

        /* "pandas/src/sparse.pyx":749
 *             if xbp == xindex.lenbuf[xblock]:
 *                 xblock += 1
 *                 xbp = 0             # <<<<<<<<<<<<<<
 * 
 *         # walk y
 */
        __pyx_v_xbp = 0;
        goto __pyx_L7;
      }
      __pyx_L7:;
    }

    /* "pandas/src/sparse.pyx":752
 * 
 *         # walk y
 *         while yindex.locbuf[yblock] + ybp < out_index.locbuf[outblock] + obp:             # <<<<<<<<<<<<<<
 *             ybp += 1
 *             yi += 1
 */
    while (1) {
      __pyx_t_12 = (((__pyx_v_yindex->locbuf[__pyx_v_yblock]) + __pyx_v_ybp) < ((__pyx_v_out_index->locbuf[__pyx_v_outblock]) + __pyx_v_obp));
      if (!__pyx_t_12) break;

      /* "pandas/src/sparse.pyx":753
 *         # walk y
 *         while yindex.locbuf[yblock] + ybp < out_index.locbuf[outblock] + obp:
 *             ybp += 1             # <<<<<<<<<<<<<<
 *             yi += 1
 *             if ybp == yindex.lenbuf[yblock]:
 */
      __pyx_v_ybp = (__pyx_v_ybp + 1);

      /* "pandas/src/sparse.pyx":754
 *         while yindex.locbuf[yblock] + ybp < out_index.locbuf[outblock] + obp:
 *             ybp += 1
 *             yi += 1             # <<<<<<<<<<<<<<
 *             if ybp == yindex.lenbuf[yblock]:
 *                 yblock += 1
 */
      __pyx_v_yi = (__pyx_v_yi + 1);

      /* "pandas/src/sparse.pyx":755
 *             ybp += 1
 *             yi += 1
 *             if ybp == yindex.lenbuf[yblock]:             # <<<<<<<<<<<<<<
 *                 yblock += 1
 *                 ybp = 0
 */
      __pyx_t_12 = (__pyx_v_ybp == (__pyx_v_yindex->lenbuf[__pyx_v_yblock]));
      if (__pyx_t_12) {

        /* "pandas/src/sparse.pyx":756
 *             yi += 1
 *             if ybp == yindex.lenbuf[yblock]:
 *                 yblock += 1             # <<<<<<<<<<<<<<
 *                 ybp = 0
 * 
 */
        __pyx_v_yblock = (__pyx_v_yblock + 1);

        /* "pandas/src/sparse.pyx":757
 *             if ybp == yindex.lenbuf[yblock]:
 *                 yblock += 1
 *                 ybp = 0             # <<<<<<<<<<<<<<
 * 
 *         out[out_i] = op(x[xi], y[yi])
 */
        __pyx_v_ybp = 0;
        goto __pyx_L10;
      }
      __pyx_L10:;
    }

    /* "pandas/src/sparse.pyx":759
 *                 ybp = 0
 * 
 *         out[out_i] = op(x[xi], y[yi])             # <<<<<<<<<<<<<<
 * 
 *         # advance. strikes me as too complicated
 */
    __pyx_t_13 = __pyx_v_xi;
    if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_x;
    __pyx_t_14 = __pyx_v_yi;
    if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_y;
    __pyx_t_15 = __pyx_v_out_i;
    if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_out;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_15, __pyx_bstride_0_out) = __pyx_v_op((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_13, __pyx_bstride_0_x)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_14, __pyx_bstride_0_y)));

    /* "pandas/src/sparse.pyx":762
 * 
 *         # advance. strikes me as too complicated
 *         xi += 1             # <<<<<<<<<<<<<<
 *         yi += 1
 * 
 */
    __pyx_v_xi = (__pyx_v_xi + 1);

    /* "pandas/src/sparse.pyx":763
 *         # advance. strikes me as too complicated
 *         xi += 1
 *         yi += 1             # <<<<<<<<<<<<<<
 * 
 *         xbp += 1
 */
    __pyx_v_yi = (__pyx_v_yi + 1);

    /* "pandas/src/sparse.pyx":765
 *         yi += 1
 * 
 *         xbp += 1             # <<<<<<<<<<<<<<
 *         if xbp == xindex.lenbuf[xblock]:
 *             xblock += 1
 */
    __pyx_v_xbp = (__pyx_v_xbp + 1);

    /* "pandas/src/sparse.pyx":766
 * 
 *         xbp += 1
 *         if xbp == xindex.lenbuf[xblock]:             # <<<<<<<<<<<<<<
 *             xblock += 1
 *             xbp = 0
 */
    __pyx_t_12 = (__pyx_v_xbp == (__pyx_v_xindex->lenbuf[__pyx_v_xblock]));
    if (__pyx_t_12) {

      /* "pandas/src/sparse.pyx":767
 *         xbp += 1
 *         if xbp == xindex.lenbuf[xblock]:
 *             xblock += 1             # <<<<<<<<<<<<<<
 *             xbp = 0
 * 
 */
      __pyx_v_xblock = (__pyx_v_xblock + 1);

      /* "pandas/src/sparse.pyx":768
 *         if xbp == xindex.lenbuf[xblock]:
 *             xblock += 1
 *             xbp = 0             # <<<<<<<<<<<<<<
 * 
 *         ybp += 1
 */
      __pyx_v_xbp = 0;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "pandas/src/sparse.pyx":770
 *             xbp = 0
 * 
 *         ybp += 1             # <<<<<<<<<<<<<<
 *         if ybp == yindex.lenbuf[yblock]:
 *             yblock += 1
 */
    __pyx_v_ybp = (__pyx_v_ybp + 1);

    /* "pandas/src/sparse.pyx":771
 * 
 *         ybp += 1
 *         if ybp == yindex.lenbuf[yblock]:             # <<<<<<<<<<<<<<
 *             yblock += 1
 *             ybp = 0
 */
    __pyx_t_12 = (__pyx_v_ybp == (__pyx_v_yindex->lenbuf[__pyx_v_yblock]));
    if (__pyx_t_12) {

      /* "pandas/src/sparse.pyx":772
 *         ybp += 1
 *         if ybp == yindex.lenbuf[yblock]:
 *             yblock += 1             # <<<<<<<<<<<<<<
 *             ybp = 0
 * 
 */
      __pyx_v_yblock = (__pyx_v_yblock + 1);

      /* "pandas/src/sparse.pyx":773
 *         if ybp == yindex.lenbuf[yblock]:
 *             yblock += 1
 *             ybp = 0             # <<<<<<<<<<<<<<
 * 
 *         obp += 1
 */
      __pyx_v_ybp = 0;
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "pandas/src/sparse.pyx":775
 *             ybp = 0
 * 
 *         obp += 1             # <<<<<<<<<<<<<<
 *         if obp == out_index.lenbuf[outblock]:
 *             outblock += 1
 */
    __pyx_v_obp = (__pyx_v_obp + 1);

    /* "pandas/src/sparse.pyx":776
 * 
 *         obp += 1
 *         if obp == out_index.lenbuf[outblock]:             # <<<<<<<<<<<<<<
 *             outblock += 1
 *             obp = 0
 */
    __pyx_t_12 = (__pyx_v_obp == (__pyx_v_out_index->lenbuf[__pyx_v_outblock]));
    if (__pyx_t_12) {

      /* "pandas/src/sparse.pyx":777
 *         obp += 1
 *         if obp == out_index.lenbuf[outblock]:
 *             outblock += 1             # <<<<<<<<<<<<<<
 *             obp = 0
 * 
 */
      __pyx_v_outblock = (__pyx_v_outblock + 1);

      /* "pandas/src/sparse.pyx":778
 *         if obp == out_index.lenbuf[outblock]:
 *             outblock += 1
 *             obp = 0             # <<<<<<<<<<<<<<
 * 
 *     return out, out_index
 */
      __pyx_v_obp = 0;
      goto __pyx_L13;
    }
    __pyx_L13:;
  }

  /* "pandas/src/sparse.pyx":780
 *             obp = 0
 * 
 *     return out, out_index             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __Pyx_INCREF(((PyObject *)__pyx_v_out_index));
  PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_v_out_index));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out_index));
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.block_nanop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out_index);
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XDECREF((PyObject *)__pyx_v_y);
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":783
 * 
 * @cython.boundscheck(False)
 * cdef inline tuple int_nanop(ndarray x_, IntIndex xindex,             # <<<<<<<<<<<<<<
 *                             ndarray y_, IntIndex yindex,
 *                             double_func op):
 */

static CYTHON_INLINE PyObject *__pyx_f_6pandas_7_sparse_int_nanop(PyArrayObject *__pyx_v_x_, struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y_, struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_v_yindex, __pyx_t_6pandas_7_sparse_double_func __pyx_v_op) {
  struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_v_out_index = 0;
  Py_ssize_t __pyx_v_xi;
  Py_ssize_t __pyx_v_yi;
  Py_ssize_t __pyx_v_out_i;
  PyArrayObject *__pyx_v_xindices = 0;
  PyArrayObject *__pyx_v_yindices = 0;
  PyArrayObject *__pyx_v_out_indices = 0;
  PyArrayObject *__pyx_v_x = 0;
  PyArrayObject *__pyx_v_y = 0;
  PyArrayObject *__pyx_v_out = 0;
  Py_buffer __pyx_bstruct_out_indices;
  Py_ssize_t __pyx_bstride_0_out_indices = 0;
  Py_ssize_t __pyx_bshape_0_out_indices = 0;
  Py_buffer __pyx_bstruct_yindices;
  Py_ssize_t __pyx_bstride_0_yindices = 0;
  Py_ssize_t __pyx_bshape_0_yindices = 0;
  Py_buffer __pyx_bstruct_y;
  Py_ssize_t __pyx_bstride_0_y = 0;
  Py_ssize_t __pyx_bshape_0_y = 0;
  Py_buffer __pyx_bstruct_x;
  Py_ssize_t __pyx_bstride_0_x = 0;
  Py_ssize_t __pyx_bshape_0_x = 0;
  Py_buffer __pyx_bstruct_xindices;
  Py_ssize_t __pyx_bstride_0_xindices = 0;
  Py_ssize_t __pyx_bshape_0_xindices = 0;
  Py_buffer __pyx_bstruct_out;
  Py_ssize_t __pyx_bstride_0_out = 0;
  Py_ssize_t __pyx_bshape_0_out = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyArrayObject *__pyx_t_10 = NULL;
  PyArrayObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("int_nanop");
  __pyx_bstruct_xindices.buf = NULL;
  __pyx_bstruct_yindices.buf = NULL;
  __pyx_bstruct_out_indices.buf = NULL;
  __pyx_bstruct_x.buf = NULL;
  __pyx_bstruct_y.buf = NULL;
  __pyx_bstruct_out.buf = NULL;

  /* "pandas/src/sparse.pyx":788
 *     cdef:
 *         IntIndex out_index
 *         Py_ssize_t xi = 0, yi = 0, out_i = 0 # fp buf indices             # <<<<<<<<<<<<<<
 *         ndarray[int32_t, ndim=1] xindices, yindices, out_indices
 *         ndarray[float64_t, ndim=1] x, y
 */
  __pyx_v_xi = 0;
  __pyx_v_yi = 0;
  __pyx_v_out_i = 0;

  /* "pandas/src/sparse.pyx":794
 * 
 *     # suppress Cython compiler warnings due to inlining
 *     x = x_             # <<<<<<<<<<<<<<
 *     y = y_
 * 
 */
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x);
    __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)((PyArrayObject *)__pyx_v_x_), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_1 < 0)) {
      PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      }
    }
    __pyx_bstride_0_x = __pyx_bstruct_x.strides[0];
    __pyx_bshape_0_x = __pyx_bstruct_x.shape[0];
    if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_INCREF(((PyObject *)__pyx_v_x_));
  __pyx_v_x = ((PyArrayObject *)__pyx_v_x_);

  /* "pandas/src/sparse.pyx":795
 *     # suppress Cython compiler warnings due to inlining
 *     x = x_
 *     y = y_             # <<<<<<<<<<<<<<
 * 
 *     # need to do this first to know size of result array
 */
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y);
    __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)((PyArrayObject *)__pyx_v_y_), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_1 < 0)) {
      PyErr_Fetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_4, __pyx_t_3, __pyx_t_2);
      }
    }
    __pyx_bstride_0_y = __pyx_bstruct_y.strides[0];
    __pyx_bshape_0_y = __pyx_bstruct_y.shape[0];
    if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_INCREF(((PyObject *)__pyx_v_y_));
  __pyx_v_y = ((PyArrayObject *)__pyx_v_y_);

  /* "pandas/src/sparse.pyx":798
 * 
 *     # need to do this first to know size of result array
 *     out_index = xindex.intersect(yindex)             # <<<<<<<<<<<<<<
 *     out = np.empty(out_index.npoints, dtype=np.float64)
 * 
 */
  __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_6pandas_7_sparse_IntIndex *)__pyx_v_xindex->__pyx_vtab)->intersect(__pyx_v_xindex, ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)__pyx_v_yindex), 0)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_out_index = ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/src/sparse.pyx":799
 *     # need to do this first to know size of result array
 *     out_index = xindex.intersect(yindex)
 *     out = np.empty(out_index.npoints, dtype=np.float64)             # <<<<<<<<<<<<<<
 * 
 *     xindices = xindex.indices
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_out_index->npoints); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__float64); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_6, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_9);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out);
    __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_1 < 0)) {
      PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      }
    }
    __pyx_bstride_0_out = __pyx_bstruct_out.strides[0];
    __pyx_bshape_0_out = __pyx_bstruct_out.shape[0];
    if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_10 = 0;
  __pyx_v_out = ((PyArrayObject *)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "pandas/src/sparse.pyx":801
 *     out = np.empty(out_index.npoints, dtype=np.float64)
 * 
 *     xindices = xindex.indices             # <<<<<<<<<<<<<<
 *     yindices = yindex.indices
 *     out_indices = out_index.indices
 */
  __pyx_t_11 = ((PyArrayObject *)__pyx_v_xindex->indices);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices);
    __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xindices, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_1 < 0)) {
      PyErr_Fetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xindices, (PyObject*)__pyx_v_xindices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_4, __pyx_t_3, __pyx_t_2);
      }
    }
    __pyx_bstride_0_xindices = __pyx_bstruct_xindices.strides[0];
    __pyx_bshape_0_xindices = __pyx_bstruct_xindices.shape[0];
    if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_11 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_xindex->indices));
  __pyx_v_xindices = ((PyArrayObject *)__pyx_v_xindex->indices);

  /* "pandas/src/sparse.pyx":802
 * 
 *     xindices = xindex.indices
 *     yindices = yindex.indices             # <<<<<<<<<<<<<<
 *     out_indices = out_index.indices
 * 
 */
  __pyx_t_11 = ((PyArrayObject *)__pyx_v_yindex->indices);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices);
    __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_yindices, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_1 < 0)) {
      PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_yindices, (PyObject*)__pyx_v_yindices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      }
    }
    __pyx_bstride_0_yindices = __pyx_bstruct_yindices.strides[0];
    __pyx_bshape_0_yindices = __pyx_bstruct_yindices.shape[0];
    if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_11 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_yindex->indices));
  __pyx_v_yindices = ((PyArrayObject *)__pyx_v_yindex->indices);

  /* "pandas/src/sparse.pyx":803
 *     xindices = xindex.indices
 *     yindices = yindex.indices
 *     out_indices = out_index.indices             # <<<<<<<<<<<<<<
 * 
 *     # walk the two SparseVectors, adding matched locations...
 */
  __pyx_t_11 = ((PyArrayObject *)__pyx_v_out_index->indices);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out_indices);
    __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_out_indices, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_1 < 0)) {
      PyErr_Fetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_out_indices, (PyObject*)__pyx_v_out_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_4, __pyx_t_3, __pyx_t_2);
      }
    }
    __pyx_bstride_0_out_indices = __pyx_bstruct_out_indices.strides[0];
    __pyx_bshape_0_out_indices = __pyx_bstruct_out_indices.shape[0];
    if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_11 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_out_index->indices));
  __pyx_v_out_indices = ((PyArrayObject *)__pyx_v_out_index->indices);

  /* "pandas/src/sparse.pyx":806
 * 
 *     # walk the two SparseVectors, adding matched locations...
 *     for out_i from 0 <= out_i < out_index.npoints:             # <<<<<<<<<<<<<<
 * 
 *         # walk x
 */
  __pyx_t_12 = __pyx_v_out_index->npoints;
  for (__pyx_v_out_i = 0; __pyx_v_out_i < __pyx_t_12; __pyx_v_out_i++) {

    /* "pandas/src/sparse.pyx":809
 * 
 *         # walk x
 *         while xindices[xi] < out_indices[out_i]:             # <<<<<<<<<<<<<<
 *             xi += 1
 * 
 */
    while (1) {
      __pyx_t_13 = __pyx_v_xi;
      if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_xindices;
      __pyx_t_14 = __pyx_v_out_i;
      if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_out_indices;
      __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xindices.buf, __pyx_t_13, __pyx_bstride_0_xindices)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_out_indices.buf, __pyx_t_14, __pyx_bstride_0_out_indices)));
      if (!__pyx_t_15) break;

      /* "pandas/src/sparse.pyx":810
 *         # walk x
 *         while xindices[xi] < out_indices[out_i]:
 *             xi += 1             # <<<<<<<<<<<<<<
 * 
 *         # walk y
 */
      __pyx_v_xi = (__pyx_v_xi + 1);
    }

    /* "pandas/src/sparse.pyx":813
 * 
 *         # walk y
 *         while yindices[yi] < out_indices[out_i]:             # <<<<<<<<<<<<<<
 *             yi += 1
 * 
 */
    while (1) {
      __pyx_t_16 = __pyx_v_yi;
      if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_yindices;
      __pyx_t_17 = __pyx_v_out_i;
      if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_0_out_indices;
      __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yindices.buf, __pyx_t_16, __pyx_bstride_0_yindices)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_out_indices.buf, __pyx_t_17, __pyx_bstride_0_out_indices)));
      if (!__pyx_t_15) break;

      /* "pandas/src/sparse.pyx":814
 *         # walk y
 *         while yindices[yi] < out_indices[out_i]:
 *             yi += 1             # <<<<<<<<<<<<<<
 * 
 *         out[out_i] = op(x[xi], y[yi])
 */
      __pyx_v_yi = (__pyx_v_yi + 1);
    }

    /* "pandas/src/sparse.pyx":816
 *             yi += 1
 * 
 *         out[out_i] = op(x[xi], y[yi])             # <<<<<<<<<<<<<<
 * 
 *         # advance
 */
    __pyx_t_18 = __pyx_v_xi;
    if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_0_x;
    __pyx_t_19 = __pyx_v_yi;
    if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_y;
    __pyx_t_20 = __pyx_v_out_i;
    if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_0_out;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_20, __pyx_bstride_0_out) = __pyx_v_op((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_18, __pyx_bstride_0_x)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_19, __pyx_bstride_0_y)));

    /* "pandas/src/sparse.pyx":819
 * 
 *         # advance
 *         xi += 1             # <<<<<<<<<<<<<<
 *         yi += 1
 * 
 */
    __pyx_v_xi = (__pyx_v_xi + 1);

    /* "pandas/src/sparse.pyx":820
 *         # advance
 *         xi += 1
 *         yi += 1             # <<<<<<<<<<<<<<
 * 
 *     return out, out_index
 */
    __pyx_v_yi = (__pyx_v_yi + 1);
  }

  /* "pandas/src/sparse.pyx":822
 *         yi += 1
 * 
 *     return out, out_index             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __Pyx_INCREF(((PyObject *)__pyx_v_out_index));
  PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_v_out_index));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out_index));
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out_indices);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.int_nanop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out_indices);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out_index);
  __Pyx_XDECREF((PyObject *)__pyx_v_xindices);
  __Pyx_XDECREF((PyObject *)__pyx_v_yindices);
  __Pyx_XDECREF((PyObject *)__pyx_v_out_indices);
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XDECREF((PyObject *)__pyx_v_y);
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":826
 * 
 * @cython.boundscheck(False)
 * cdef inline tuple block_op(ndarray x_, BlockIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                            ndarray y_, BlockIndex yindex, float64_t yfill,
 *                            double_func op):
 */

static CYTHON_INLINE PyObject *__pyx_f_6pandas_7_sparse_block_op(PyArrayObject *__pyx_v_x_, struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y_, struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, __pyx_t_6pandas_7_sparse_double_func __pyx_v_op) {
  struct __pyx_obj_6pandas_7_sparse_BlockIndex *__pyx_v_out_index = 0;
  Py_ssize_t __pyx_v_xi;
  Py_ssize_t __pyx_v_yi;
  Py_ssize_t __pyx_v_out_i;
  Py_ssize_t __pyx_v_xbp;
  Py_ssize_t __pyx_v_ybp;
  __pyx_t_5numpy_int32_t __pyx_v_xloc;
  __pyx_t_5numpy_int32_t __pyx_v_yloc;
  Py_ssize_t __pyx_v_xblock;
  Py_ssize_t __pyx_v_yblock;
  PyArrayObject *__pyx_v_x = 0;
  PyArrayObject *__pyx_v_y = 0;
  PyArrayObject *__pyx_v_out = 0;
  Py_buffer __pyx_bstruct_y;
  Py_ssize_t __pyx_bstride_0_y = 0;
  Py_ssize_t __pyx_bshape_0_y = 0;
  Py_buffer __pyx_bstruct_x;
  Py_ssize_t __pyx_bstride_0_x = 0;
  Py_ssize_t __pyx_bshape_0_x = 0;
  Py_buffer __pyx_bstruct_out;
  Py_ssize_t __pyx_bstride_0_out = 0;
  Py_ssize_t __pyx_bshape_0_out = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyArrayObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("block_op");
  __pyx_bstruct_x.buf = NULL;
  __pyx_bstruct_y.buf = NULL;
  __pyx_bstruct_out.buf = NULL;

  /* "pandas/src/sparse.pyx":835
 *     cdef:
 *         BlockIndex out_index
 *         Py_ssize_t xi = 0, yi = 0, out_i = 0 # fp buf indices             # <<<<<<<<<<<<<<
 *         Py_ssize_t xbp = 0, ybp = 0 # block positions
 *         int32_t xloc, yloc
 */
  __pyx_v_xi = 0;
  __pyx_v_yi = 0;
  __pyx_v_out_i = 0;

  /* "pandas/src/sparse.pyx":836
 *         BlockIndex out_index
 *         Py_ssize_t xi = 0, yi = 0, out_i = 0 # fp buf indices
 *         Py_ssize_t xbp = 0, ybp = 0 # block positions             # <<<<<<<<<<<<<<
 *         int32_t xloc, yloc
 *         Py_ssize_t xblock = 0, yblock = 0 # block numbers
 */
  __pyx_v_xbp = 0;
  __pyx_v_ybp = 0;

  /* "pandas/src/sparse.pyx":838
 *         Py_ssize_t xbp = 0, ybp = 0 # block positions
 *         int32_t xloc, yloc
 *         Py_ssize_t xblock = 0, yblock = 0 # block numbers             # <<<<<<<<<<<<<<
 * 
 *         ndarray[float64_t, ndim=1] x, y
 */
  __pyx_v_xblock = 0;
  __pyx_v_yblock = 0;

  /* "pandas/src/sparse.pyx":844
 * 
 *     # to suppress Cython warning
 *     x = x_             # <<<<<<<<<<<<<<
 *     y = y_
 * 
 */
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x);
    __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)((PyArrayObject *)__pyx_v_x_), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_1 < 0)) {
      PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      }
    }
    __pyx_bstride_0_x = __pyx_bstruct_x.strides[0];
    __pyx_bshape_0_x = __pyx_bstruct_x.shape[0];
    if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_INCREF(((PyObject *)__pyx_v_x_));
  __pyx_v_x = ((PyArrayObject *)__pyx_v_x_);

  /* "pandas/src/sparse.pyx":845
 *     # to suppress Cython warning
 *     x = x_
 *     y = y_             # <<<<<<<<<<<<<<
 * 
 *     out_index = xindex.make_union(yindex)
 */
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y);
    __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)((PyArrayObject *)__pyx_v_y_), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_1 < 0)) {
      PyErr_Fetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_4, __pyx_t_3, __pyx_t_2);
      }
    }
    __pyx_bstride_0_y = __pyx_bstruct_y.strides[0];
    __pyx_bshape_0_y = __pyx_bstruct_y.shape[0];
    if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_INCREF(((PyObject *)__pyx_v_y_));
  __pyx_v_y = ((PyArrayObject *)__pyx_v_y_);

  /* "pandas/src/sparse.pyx":847
 *     y = y_
 * 
 *     out_index = xindex.make_union(yindex)             # <<<<<<<<<<<<<<
 *     out = np.empty(out_index.npoints, dtype=np.float64)
 * 
 */
  __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_6pandas_7_sparse_BlockIndex *)__pyx_v_xindex->__pyx_vtab)->make_union(__pyx_v_xindex, ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)__pyx_v_yindex), 0)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_out_index = ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/src/sparse.pyx":848
 * 
 *     out_index = xindex.make_union(yindex)
 *     out = np.empty(out_index.npoints, dtype=np.float64)             # <<<<<<<<<<<<<<
 * 
 *     # Wow, what a hack job. Need to do something about this
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_out_index->npoints); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__float64); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_6, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_9);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out);
    __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_1 < 0)) {
      PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      }
    }
    __pyx_bstride_0_out = __pyx_bstruct_out.strides[0];
    __pyx_bshape_0_out = __pyx_bstruct_out.shape[0];
    if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_10 = 0;
  __pyx_v_out = ((PyArrayObject *)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "pandas/src/sparse.pyx":853
 * 
 *     # walk the two SparseVectors, adding matched locations...
 *     for out_i from 0 <= out_i < out_index.npoints:             # <<<<<<<<<<<<<<
 *         if yblock == yindex.nblocks:
 *             # use y fill value
 */
  __pyx_t_11 = __pyx_v_out_index->npoints;
  for (__pyx_v_out_i = 0; __pyx_v_out_i < __pyx_t_11; __pyx_v_out_i++) {

    /* "pandas/src/sparse.pyx":854
 *     # walk the two SparseVectors, adding matched locations...
 *     for out_i from 0 <= out_i < out_index.npoints:
 *         if yblock == yindex.nblocks:             # <<<<<<<<<<<<<<
 *             # use y fill value
 *             out[out_i] = op(x[xi], yfill)
 */
    __pyx_t_12 = (__pyx_v_yblock == __pyx_v_yindex->nblocks);
    if (__pyx_t_12) {

      /* "pandas/src/sparse.pyx":856
 *         if yblock == yindex.nblocks:
 *             # use y fill value
 *             out[out_i] = op(x[xi], yfill)             # <<<<<<<<<<<<<<
 *             xi += 1
 * 
 */
      __pyx_t_13 = __pyx_v_xi;
      if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_x;
      __pyx_t_14 = __pyx_v_out_i;
      if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_out;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_14, __pyx_bstride_0_out) = __pyx_v_op((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_13, __pyx_bstride_0_x)), __pyx_v_yfill);

      /* "pandas/src/sparse.pyx":857
 *             # use y fill value
 *             out[out_i] = op(x[xi], yfill)
 *             xi += 1             # <<<<<<<<<<<<<<
 * 
 *             # advance x location
 */
      __pyx_v_xi = (__pyx_v_xi + 1);

      /* "pandas/src/sparse.pyx":860
 * 
 *             # advance x location
 *             xbp += 1             # <<<<<<<<<<<<<<
 *             if xbp == xindex.lenbuf[xblock]:
 *                 xblock += 1
 */
      __pyx_v_xbp = (__pyx_v_xbp + 1);

      /* "pandas/src/sparse.pyx":861
 *             # advance x location
 *             xbp += 1
 *             if xbp == xindex.lenbuf[xblock]:             # <<<<<<<<<<<<<<
 *                 xblock += 1
 *                 xbp = 0
 */
      __pyx_t_12 = (__pyx_v_xbp == (__pyx_v_xindex->lenbuf[__pyx_v_xblock]));
      if (__pyx_t_12) {

        /* "pandas/src/sparse.pyx":862
 *             xbp += 1
 *             if xbp == xindex.lenbuf[xblock]:
 *                 xblock += 1             # <<<<<<<<<<<<<<
 *                 xbp = 0
 *             continue
 */
        __pyx_v_xblock = (__pyx_v_xblock + 1);

        /* "pandas/src/sparse.pyx":863
 *             if xbp == xindex.lenbuf[xblock]:
 *                 xblock += 1
 *                 xbp = 0             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
        __pyx_v_xbp = 0;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "pandas/src/sparse.pyx":864
 *                 xblock += 1
 *                 xbp = 0
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         if xblock == xindex.nblocks:
 */
      goto __pyx_L3_continue;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pandas/src/sparse.pyx":866
 *             continue
 * 
 *         if xblock == xindex.nblocks:             # <<<<<<<<<<<<<<
 *             # use x fill value
 *             out[out_i] = op(xfill, y[yi])
 */
    __pyx_t_12 = (__pyx_v_xblock == __pyx_v_xindex->nblocks);
    if (__pyx_t_12) {

      /* "pandas/src/sparse.pyx":868
 *         if xblock == xindex.nblocks:
 *             # use x fill value
 *             out[out_i] = op(xfill, y[yi])             # <<<<<<<<<<<<<<
 *             yi += 1
 * 
 */
      __pyx_t_15 = __pyx_v_yi;
      if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_y;
      __pyx_t_16 = __pyx_v_out_i;
      if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_out;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_16, __pyx_bstride_0_out) = __pyx_v_op(__pyx_v_xfill, (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_15, __pyx_bstride_0_y)));

      /* "pandas/src/sparse.pyx":869
 *             # use x fill value
 *             out[out_i] = op(xfill, y[yi])
 *             yi += 1             # <<<<<<<<<<<<<<
 * 
 *             # advance y location
 */
      __pyx_v_yi = (__pyx_v_yi + 1);

      /* "pandas/src/sparse.pyx":872
 * 
 *             # advance y location
 *             ybp += 1             # <<<<<<<<<<<<<<
 *             if ybp == yindex.lenbuf[yblock]:
 *                 yblock += 1
 */
      __pyx_v_ybp = (__pyx_v_ybp + 1);

      /* "pandas/src/sparse.pyx":873
 *             # advance y location
 *             ybp += 1
 *             if ybp == yindex.lenbuf[yblock]:             # <<<<<<<<<<<<<<
 *                 yblock += 1
 *                 ybp = 0
 */
      __pyx_t_12 = (__pyx_v_ybp == (__pyx_v_yindex->lenbuf[__pyx_v_yblock]));
      if (__pyx_t_12) {

        /* "pandas/src/sparse.pyx":874
 *             ybp += 1
 *             if ybp == yindex.lenbuf[yblock]:
 *                 yblock += 1             # <<<<<<<<<<<<<<
 *                 ybp = 0
 *             continue
 */
        __pyx_v_yblock = (__pyx_v_yblock + 1);

        /* "pandas/src/sparse.pyx":875
 *             if ybp == yindex.lenbuf[yblock]:
 *                 yblock += 1
 *                 ybp = 0             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
        __pyx_v_ybp = 0;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "pandas/src/sparse.pyx":876
 *                 yblock += 1
 *                 ybp = 0
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         yloc = yindex.locbuf[yblock] + ybp
 */
      goto __pyx_L3_continue;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "pandas/src/sparse.pyx":878
 *             continue
 * 
 *         yloc = yindex.locbuf[yblock] + ybp             # <<<<<<<<<<<<<<
 *         xloc = xindex.locbuf[xblock] + xbp
 * 
 */
    __pyx_v_yloc = ((__pyx_v_yindex->locbuf[__pyx_v_yblock]) + __pyx_v_ybp);

    /* "pandas/src/sparse.pyx":879
 * 
 *         yloc = yindex.locbuf[yblock] + ybp
 *         xloc = xindex.locbuf[xblock] + xbp             # <<<<<<<<<<<<<<
 * 
 *         # each index in the out_index had to come from either x, y, or both
 */
    __pyx_v_xloc = ((__pyx_v_xindex->locbuf[__pyx_v_xblock]) + __pyx_v_xbp);

    /* "pandas/src/sparse.pyx":882
 * 
 *         # each index in the out_index had to come from either x, y, or both
 *         if xloc == yloc:             # <<<<<<<<<<<<<<
 *             out[out_i] = op(x[xi], y[yi])
 *             xi += 1
 */
    __pyx_t_12 = (__pyx_v_xloc == __pyx_v_yloc);
    if (__pyx_t_12) {

      /* "pandas/src/sparse.pyx":883
 *         # each index in the out_index had to come from either x, y, or both
 *         if xloc == yloc:
 *             out[out_i] = op(x[xi], y[yi])             # <<<<<<<<<<<<<<
 *             xi += 1
 *             yi += 1
 */
      __pyx_t_17 = __pyx_v_xi;
      if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_0_x;
      __pyx_t_18 = __pyx_v_yi;
      if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_0_y;
      __pyx_t_19 = __pyx_v_out_i;
      if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_out;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_19, __pyx_bstride_0_out) = __pyx_v_op((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_17, __pyx_bstride_0_x)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_18, __pyx_bstride_0_y)));

      /* "pandas/src/sparse.pyx":884
 *         if xloc == yloc:
 *             out[out_i] = op(x[xi], y[yi])
 *             xi += 1             # <<<<<<<<<<<<<<
 *             yi += 1
 * 
 */
      __pyx_v_xi = (__pyx_v_xi + 1);

      /* "pandas/src/sparse.pyx":885
 *             out[out_i] = op(x[xi], y[yi])
 *             xi += 1
 *             yi += 1             # <<<<<<<<<<<<<<
 * 
 *             # advance both locations
 */
      __pyx_v_yi = (__pyx_v_yi + 1);

      /* "pandas/src/sparse.pyx":888
 * 
 *             # advance both locations
 *             xbp += 1             # <<<<<<<<<<<<<<
 *             if xbp == xindex.lenbuf[xblock]:
 *                 xblock += 1
 */
      __pyx_v_xbp = (__pyx_v_xbp + 1);

      /* "pandas/src/sparse.pyx":889
 *             # advance both locations
 *             xbp += 1
 *             if xbp == xindex.lenbuf[xblock]:             # <<<<<<<<<<<<<<
 *                 xblock += 1
 *                 xbp = 0
 */
      __pyx_t_12 = (__pyx_v_xbp == (__pyx_v_xindex->lenbuf[__pyx_v_xblock]));
      if (__pyx_t_12) {

        /* "pandas/src/sparse.pyx":890
 *             xbp += 1
 *             if xbp == xindex.lenbuf[xblock]:
 *                 xblock += 1             # <<<<<<<<<<<<<<
 *                 xbp = 0
 * 
 */
        __pyx_v_xblock = (__pyx_v_xblock + 1);

        /* "pandas/src/sparse.pyx":891
 *             if xbp == xindex.lenbuf[xblock]:
 *                 xblock += 1
 *                 xbp = 0             # <<<<<<<<<<<<<<
 * 
 *             ybp += 1
 */
        __pyx_v_xbp = 0;
        goto __pyx_L10;
      }
      __pyx_L10:;

      /* "pandas/src/sparse.pyx":893
 *                 xbp = 0
 * 
 *             ybp += 1             # <<<<<<<<<<<<<<
 *             if ybp == yindex.lenbuf[yblock]:
 *                 yblock += 1
 */
      __pyx_v_ybp = (__pyx_v_ybp + 1);

      /* "pandas/src/sparse.pyx":894
 * 
 *             ybp += 1
 *             if ybp == yindex.lenbuf[yblock]:             # <<<<<<<<<<<<<<
 *                 yblock += 1
 *                 ybp = 0
 */
      __pyx_t_12 = (__pyx_v_ybp == (__pyx_v_yindex->lenbuf[__pyx_v_yblock]));
      if (__pyx_t_12) {

        /* "pandas/src/sparse.pyx":895
 *             ybp += 1
 *             if ybp == yindex.lenbuf[yblock]:
 *                 yblock += 1             # <<<<<<<<<<<<<<
 *                 ybp = 0
 * 
 */
        __pyx_v_yblock = (__pyx_v_yblock + 1);

        /* "pandas/src/sparse.pyx":896
 *             if ybp == yindex.lenbuf[yblock]:
 *                 yblock += 1
 *                 ybp = 0             # <<<<<<<<<<<<<<
 * 
 *         elif xloc < yloc:
 */
        __pyx_v_ybp = 0;
        goto __pyx_L11;
      }
      __pyx_L11:;
      goto __pyx_L9;
    }

    /* "pandas/src/sparse.pyx":898
 *                 ybp = 0
 * 
 *         elif xloc < yloc:             # <<<<<<<<<<<<<<
 *             # use y fill value
 *             out[out_i] = op(x[xi], yfill)
 */
    __pyx_t_12 = (__pyx_v_xloc < __pyx_v_yloc);
    if (__pyx_t_12) {

      /* "pandas/src/sparse.pyx":900
 *         elif xloc < yloc:
 *             # use y fill value
 *             out[out_i] = op(x[xi], yfill)             # <<<<<<<<<<<<<<
 *             xi += 1
 * 
 */
      __pyx_t_20 = __pyx_v_xi;
      if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_0_x;
      __pyx_t_21 = __pyx_v_out_i;
      if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_0_out;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_21, __pyx_bstride_0_out) = __pyx_v_op((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_20, __pyx_bstride_0_x)), __pyx_v_yfill);

      /* "pandas/src/sparse.pyx":901
 *             # use y fill value
 *             out[out_i] = op(x[xi], yfill)
 *             xi += 1             # <<<<<<<<<<<<<<
 * 
 *             # advance x location
 */
      __pyx_v_xi = (__pyx_v_xi + 1);

      /* "pandas/src/sparse.pyx":904
 * 
 *             # advance x location
 *             xbp += 1             # <<<<<<<<<<<<<<
 *             if xbp == xindex.lenbuf[xblock]:
 *                 xblock += 1
 */
      __pyx_v_xbp = (__pyx_v_xbp + 1);

      /* "pandas/src/sparse.pyx":905
 *             # advance x location
 *             xbp += 1
 *             if xbp == xindex.lenbuf[xblock]:             # <<<<<<<<<<<<<<
 *                 xblock += 1
 *                 xbp = 0
 */
      __pyx_t_12 = (__pyx_v_xbp == (__pyx_v_xindex->lenbuf[__pyx_v_xblock]));
      if (__pyx_t_12) {

        /* "pandas/src/sparse.pyx":906
 *             xbp += 1
 *             if xbp == xindex.lenbuf[xblock]:
 *                 xblock += 1             # <<<<<<<<<<<<<<
 *                 xbp = 0
 *         else:
 */
        __pyx_v_xblock = (__pyx_v_xblock + 1);

        /* "pandas/src/sparse.pyx":907
 *             if xbp == xindex.lenbuf[xblock]:
 *                 xblock += 1
 *                 xbp = 0             # <<<<<<<<<<<<<<
 *         else:
 *             # use x fill value
 */
        __pyx_v_xbp = 0;
        goto __pyx_L12;
      }
      __pyx_L12:;
      goto __pyx_L9;
    }
    /*else*/ {

      /* "pandas/src/sparse.pyx":910
 *         else:
 *             # use x fill value
 *             out[out_i] = op(xfill, y[yi])             # <<<<<<<<<<<<<<
 *             yi += 1
 * 
 */
      __pyx_t_22 = __pyx_v_yi;
      if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_y;
      __pyx_t_23 = __pyx_v_out_i;
      if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_0_out;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_23, __pyx_bstride_0_out) = __pyx_v_op(__pyx_v_xfill, (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_22, __pyx_bstride_0_y)));

      /* "pandas/src/sparse.pyx":911
 *             # use x fill value
 *             out[out_i] = op(xfill, y[yi])
 *             yi += 1             # <<<<<<<<<<<<<<
 * 
 *             # advance y location
 */
      __pyx_v_yi = (__pyx_v_yi + 1);

      /* "pandas/src/sparse.pyx":914
 * 
 *             # advance y location
 *             ybp += 1             # <<<<<<<<<<<<<<
 *             if ybp == yindex.lenbuf[yblock]:
 *                 yblock += 1
 */
      __pyx_v_ybp = (__pyx_v_ybp + 1);

      /* "pandas/src/sparse.pyx":915
 *             # advance y location
 *             ybp += 1
 *             if ybp == yindex.lenbuf[yblock]:             # <<<<<<<<<<<<<<
 *                 yblock += 1
 *                 ybp = 0
 */
      __pyx_t_12 = (__pyx_v_ybp == (__pyx_v_yindex->lenbuf[__pyx_v_yblock]));
      if (__pyx_t_12) {

        /* "pandas/src/sparse.pyx":916
 *             ybp += 1
 *             if ybp == yindex.lenbuf[yblock]:
 *                 yblock += 1             # <<<<<<<<<<<<<<
 *                 ybp = 0
 * 
 */
        __pyx_v_yblock = (__pyx_v_yblock + 1);

        /* "pandas/src/sparse.pyx":917
 *             if ybp == yindex.lenbuf[yblock]:
 *                 yblock += 1
 *                 ybp = 0             # <<<<<<<<<<<<<<
 * 
 *     return out, out_index
 */
        __pyx_v_ybp = 0;
        goto __pyx_L13;
      }
      __pyx_L13:;
    }
    __pyx_L9:;
    __pyx_L3_continue:;
  }

  /* "pandas/src/sparse.pyx":919
 *                 ybp = 0
 * 
 *     return out, out_index             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __Pyx_INCREF(((PyObject *)__pyx_v_out_index));
  PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_v_out_index));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out_index));
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.block_op", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out_index);
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XDECREF((PyObject *)__pyx_v_y);
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":923
 * 
 * @cython.boundscheck(False)
 * cdef inline tuple int_op(ndarray x_, IntIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                          ndarray y_, IntIndex yindex, float64_t yfill,
 *                          double_func op):
 */

static CYTHON_INLINE PyObject *__pyx_f_6pandas_7_sparse_int_op(PyArrayObject *__pyx_v_x_, struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y_, struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, __pyx_t_6pandas_7_sparse_double_func __pyx_v_op) {
  struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_v_out_index = 0;
  Py_ssize_t __pyx_v_xi;
  Py_ssize_t __pyx_v_yi;
  Py_ssize_t __pyx_v_out_i;
  __pyx_t_5numpy_int32_t __pyx_v_xloc;
  __pyx_t_5numpy_int32_t __pyx_v_yloc;
  PyArrayObject *__pyx_v_xindices = 0;
  PyArrayObject *__pyx_v_yindices = 0;
  PyArrayObject *__pyx_v_out_indices = 0;
  PyArrayObject *__pyx_v_x = 0;
  PyArrayObject *__pyx_v_y = 0;
  PyArrayObject *__pyx_v_out = 0;
  Py_buffer __pyx_bstruct_out_indices;
  Py_ssize_t __pyx_bstride_0_out_indices = 0;
  Py_ssize_t __pyx_bshape_0_out_indices = 0;
  Py_buffer __pyx_bstruct_xindices;
  Py_ssize_t __pyx_bstride_0_xindices = 0;
  Py_ssize_t __pyx_bshape_0_xindices = 0;
  Py_buffer __pyx_bstruct_yindices;
  Py_ssize_t __pyx_bstride_0_yindices = 0;
  Py_ssize_t __pyx_bshape_0_yindices = 0;
  Py_buffer __pyx_bstruct_y;
  Py_ssize_t __pyx_bstride_0_y = 0;
  Py_ssize_t __pyx_bshape_0_y = 0;
  Py_buffer __pyx_bstruct_x;
  Py_ssize_t __pyx_bstride_0_x = 0;
  Py_ssize_t __pyx_bshape_0_x = 0;
  Py_buffer __pyx_bstruct_out;
  Py_ssize_t __pyx_bstride_0_out = 0;
  Py_ssize_t __pyx_bshape_0_out = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyArrayObject *__pyx_t_10 = NULL;
  PyArrayObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("int_op");
  __pyx_bstruct_xindices.buf = NULL;
  __pyx_bstruct_yindices.buf = NULL;
  __pyx_bstruct_out_indices.buf = NULL;
  __pyx_bstruct_x.buf = NULL;
  __pyx_bstruct_y.buf = NULL;
  __pyx_bstruct_out.buf = NULL;

  /* "pandas/src/sparse.pyx":928
 *     cdef:
 *         IntIndex out_index
 *         Py_ssize_t xi = 0, yi = 0, out_i = 0 # fp buf indices             # <<<<<<<<<<<<<<
 *         int32_t xloc, yloc
 *         ndarray[int32_t, ndim=1] xindices, yindices, out_indices
 */
  __pyx_v_xi = 0;
  __pyx_v_yi = 0;
  __pyx_v_out_i = 0;

  /* "pandas/src/sparse.pyx":935
 * 
 *     # suppress Cython compiler warnings due to inlining
 *     x = x_             # <<<<<<<<<<<<<<
 *     y = y_
 * 
 */
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x);
    __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)((PyArrayObject *)__pyx_v_x_), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_1 < 0)) {
      PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      }
    }
    __pyx_bstride_0_x = __pyx_bstruct_x.strides[0];
    __pyx_bshape_0_x = __pyx_bstruct_x.shape[0];
    if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_INCREF(((PyObject *)__pyx_v_x_));
  __pyx_v_x = ((PyArrayObject *)__pyx_v_x_);

  /* "pandas/src/sparse.pyx":936
 *     # suppress Cython compiler warnings due to inlining
 *     x = x_
 *     y = y_             # <<<<<<<<<<<<<<
 * 
 *     # need to do this first to know size of result array
 */
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y);
    __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)((PyArrayObject *)__pyx_v_y_), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_1 < 0)) {
      PyErr_Fetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_4, __pyx_t_3, __pyx_t_2);
      }
    }
    __pyx_bstride_0_y = __pyx_bstruct_y.strides[0];
    __pyx_bshape_0_y = __pyx_bstruct_y.shape[0];
    if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_INCREF(((PyObject *)__pyx_v_y_));
  __pyx_v_y = ((PyArrayObject *)__pyx_v_y_);

  /* "pandas/src/sparse.pyx":939
 * 
 *     # need to do this first to know size of result array
 *     out_index = xindex.make_union(yindex)             # <<<<<<<<<<<<<<
 *     out = np.empty(out_index.npoints, dtype=np.float64)
 * 
 */
  __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_6pandas_7_sparse_IntIndex *)__pyx_v_xindex->__pyx_vtab)->make_union(__pyx_v_xindex, ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)__pyx_v_yindex), 0)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_out_index = ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/src/sparse.pyx":940
 *     # need to do this first to know size of result array
 *     out_index = xindex.make_union(yindex)
 *     out = np.empty(out_index.npoints, dtype=np.float64)             # <<<<<<<<<<<<<<
 * 
 *     xindices = xindex.indices
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_out_index->npoints); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__float64); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_6, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_9);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out);
    __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_1 < 0)) {
      PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      }
    }
    __pyx_bstride_0_out = __pyx_bstruct_out.strides[0];
    __pyx_bshape_0_out = __pyx_bstruct_out.shape[0];
    if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_10 = 0;
  __pyx_v_out = ((PyArrayObject *)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "pandas/src/sparse.pyx":942
 *     out = np.empty(out_index.npoints, dtype=np.float64)
 * 
 *     xindices = xindex.indices             # <<<<<<<<<<<<<<
 *     yindices = yindex.indices
 *     out_indices = out_index.indices
 */
  __pyx_t_11 = ((PyArrayObject *)__pyx_v_xindex->indices);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices);
    __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xindices, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_1 < 0)) {
      PyErr_Fetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xindices, (PyObject*)__pyx_v_xindices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_4, __pyx_t_3, __pyx_t_2);
      }
    }
    __pyx_bstride_0_xindices = __pyx_bstruct_xindices.strides[0];
    __pyx_bshape_0_xindices = __pyx_bstruct_xindices.shape[0];
    if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_11 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_xindex->indices));
  __pyx_v_xindices = ((PyArrayObject *)__pyx_v_xindex->indices);

  /* "pandas/src/sparse.pyx":943
 * 
 *     xindices = xindex.indices
 *     yindices = yindex.indices             # <<<<<<<<<<<<<<
 *     out_indices = out_index.indices
 * 
 */
  __pyx_t_11 = ((PyArrayObject *)__pyx_v_yindex->indices);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices);
    __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_yindices, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_1 < 0)) {
      PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_yindices, (PyObject*)__pyx_v_yindices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      }
    }
    __pyx_bstride_0_yindices = __pyx_bstruct_yindices.strides[0];
    __pyx_bshape_0_yindices = __pyx_bstruct_yindices.shape[0];
    if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_11 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_yindex->indices));
  __pyx_v_yindices = ((PyArrayObject *)__pyx_v_yindex->indices);

  /* "pandas/src/sparse.pyx":944
 *     xindices = xindex.indices
 *     yindices = yindex.indices
 *     out_indices = out_index.indices             # <<<<<<<<<<<<<<
 * 
 *     # walk the two SparseVectors, adding matched locations...
 */
  __pyx_t_11 = ((PyArrayObject *)__pyx_v_out_index->indices);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out_indices);
    __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_out_indices, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_1 < 0)) {
      PyErr_Fetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_out_indices, (PyObject*)__pyx_v_out_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_4, __pyx_t_3, __pyx_t_2);
      }
    }
    __pyx_bstride_0_out_indices = __pyx_bstruct_out_indices.strides[0];
    __pyx_bshape_0_out_indices = __pyx_bstruct_out_indices.shape[0];
    if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_11 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_v_out_index->indices));
  __pyx_v_out_indices = ((PyArrayObject *)__pyx_v_out_index->indices);

  /* "pandas/src/sparse.pyx":947
 * 
 *     # walk the two SparseVectors, adding matched locations...
 *     for out_i from 0 <= out_i < out_index.npoints:             # <<<<<<<<<<<<<<
 *         if xi == xindex.npoints:
 *             # use x fill value
 */
  __pyx_t_12 = __pyx_v_out_index->npoints;
  for (__pyx_v_out_i = 0; __pyx_v_out_i < __pyx_t_12; __pyx_v_out_i++) {

    /* "pandas/src/sparse.pyx":948
 *     # walk the two SparseVectors, adding matched locations...
 *     for out_i from 0 <= out_i < out_index.npoints:
 *         if xi == xindex.npoints:             # <<<<<<<<<<<<<<
 *             # use x fill value
 *             out[out_i] = op(xfill, y[yi])
 */
    __pyx_t_13 = (__pyx_v_xi == __pyx_v_xindex->npoints);
    if (__pyx_t_13) {

      /* "pandas/src/sparse.pyx":950
 *         if xi == xindex.npoints:
 *             # use x fill value
 *             out[out_i] = op(xfill, y[yi])             # <<<<<<<<<<<<<<
 *             yi += 1
 *             continue
 */
      __pyx_t_14 = __pyx_v_yi;
      if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_y;
      __pyx_t_15 = __pyx_v_out_i;
      if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_out;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_15, __pyx_bstride_0_out) = __pyx_v_op(__pyx_v_xfill, (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_14, __pyx_bstride_0_y)));

      /* "pandas/src/sparse.pyx":951
 *             # use x fill value
 *             out[out_i] = op(xfill, y[yi])
 *             yi += 1             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
      __pyx_v_yi = (__pyx_v_yi + 1);

      /* "pandas/src/sparse.pyx":952
 *             out[out_i] = op(xfill, y[yi])
 *             yi += 1
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         if yi == yindex.npoints:
 */
      goto __pyx_L3_continue;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pandas/src/sparse.pyx":954
 *             continue
 * 
 *         if yi == yindex.npoints:             # <<<<<<<<<<<<<<
 *             # use y fill value
 *             out[out_i] = op(x[xi], yfill)
 */
    __pyx_t_13 = (__pyx_v_yi == __pyx_v_yindex->npoints);
    if (__pyx_t_13) {

      /* "pandas/src/sparse.pyx":956
 *         if yi == yindex.npoints:
 *             # use y fill value
 *             out[out_i] = op(x[xi], yfill)             # <<<<<<<<<<<<<<
 *             xi += 1
 *             continue
 */
      __pyx_t_16 = __pyx_v_xi;
      if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_x;
      __pyx_t_17 = __pyx_v_out_i;
      if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_0_out;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_17, __pyx_bstride_0_out) = __pyx_v_op((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_16, __pyx_bstride_0_x)), __pyx_v_yfill);

      /* "pandas/src/sparse.pyx":957
 *             # use y fill value
 *             out[out_i] = op(x[xi], yfill)
 *             xi += 1             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
      __pyx_v_xi = (__pyx_v_xi + 1);

      /* "pandas/src/sparse.pyx":958
 *             out[out_i] = op(x[xi], yfill)
 *             xi += 1
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         xloc = xindices[xi]
 */
      goto __pyx_L3_continue;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/sparse.pyx":960
 *             continue
 * 
 *         xloc = xindices[xi]             # <<<<<<<<<<<<<<
 *         yloc = yindices[yi]
 * 
 */
    __pyx_t_18 = __pyx_v_xi;
    if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_0_xindices;
    __pyx_v_xloc = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xindices.buf, __pyx_t_18, __pyx_bstride_0_xindices));

    /* "pandas/src/sparse.pyx":961
 * 
 *         xloc = xindices[xi]
 *         yloc = yindices[yi]             # <<<<<<<<<<<<<<
 * 
 *         # each index in the out_index had to come from either x, y, or both
 */
    __pyx_t_19 = __pyx_v_yi;
    if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_yindices;
    __pyx_v_yloc = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yindices.buf, __pyx_t_19, __pyx_bstride_0_yindices));

    /* "pandas/src/sparse.pyx":964
 * 
 *         # each index in the out_index had to come from either x, y, or both
 *         if xloc == yloc:             # <<<<<<<<<<<<<<
 *             out[out_i] = op(x[xi], y[yi])
 *             xi += 1
 */
    __pyx_t_13 = (__pyx_v_xloc == __pyx_v_yloc);
    if (__pyx_t_13) {

      /* "pandas/src/sparse.pyx":965
 *         # each index in the out_index had to come from either x, y, or both
 *         if xloc == yloc:
 *             out[out_i] = op(x[xi], y[yi])             # <<<<<<<<<<<<<<
 *             xi += 1
 *             yi += 1
 */
      __pyx_t_20 = __pyx_v_xi;
      if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_0_x;
      __pyx_t_21 = __pyx_v_yi;
      if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_0_y;
      __pyx_t_22 = __pyx_v_out_i;
      if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_out;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_22, __pyx_bstride_0_out) = __pyx_v_op((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_20, __pyx_bstride_0_x)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_21, __pyx_bstride_0_y)));

      /* "pandas/src/sparse.pyx":966
 *         if xloc == yloc:
 *             out[out_i] = op(x[xi], y[yi])
 *             xi += 1             # <<<<<<<<<<<<<<
 *             yi += 1
 *         elif xloc < yloc:
 */
      __pyx_v_xi = (__pyx_v_xi + 1);

      /* "pandas/src/sparse.pyx":967
 *             out[out_i] = op(x[xi], y[yi])
 *             xi += 1
 *             yi += 1             # <<<<<<<<<<<<<<
 *         elif xloc < yloc:
 *             # use y fill value
 */
      __pyx_v_yi = (__pyx_v_yi + 1);
      goto __pyx_L7;
    }

    /* "pandas/src/sparse.pyx":968
 *             xi += 1
 *             yi += 1
 *         elif xloc < yloc:             # <<<<<<<<<<<<<<
 *             # use y fill value
 *             out[out_i] = op(x[xi], yfill)
 */
    __pyx_t_13 = (__pyx_v_xloc < __pyx_v_yloc);
    if (__pyx_t_13) {

      /* "pandas/src/sparse.pyx":970
 *         elif xloc < yloc:
 *             # use y fill value
 *             out[out_i] = op(x[xi], yfill)             # <<<<<<<<<<<<<<
 *             xi += 1
 *         else:
 */
      __pyx_t_23 = __pyx_v_xi;
      if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_0_x;
      __pyx_t_24 = __pyx_v_out_i;
      if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_0_out;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_24, __pyx_bstride_0_out) = __pyx_v_op((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_23, __pyx_bstride_0_x)), __pyx_v_yfill);

      /* "pandas/src/sparse.pyx":971
 *             # use y fill value
 *             out[out_i] = op(x[xi], yfill)
 *             xi += 1             # <<<<<<<<<<<<<<
 *         else:
 *             # use x fill value
 */
      __pyx_v_xi = (__pyx_v_xi + 1);
      goto __pyx_L7;
    }
    /*else*/ {

      /* "pandas/src/sparse.pyx":974
 *         else:
 *             # use x fill value
 *             out[out_i] = op(xfill, y[yi])             # <<<<<<<<<<<<<<
 *             yi += 1
 * 
 */
      __pyx_t_25 = __pyx_v_yi;
      if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_0_y;
      __pyx_t_26 = __pyx_v_out_i;
      if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_bshape_0_out;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_26, __pyx_bstride_0_out) = __pyx_v_op(__pyx_v_xfill, (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_25, __pyx_bstride_0_y)));

      /* "pandas/src/sparse.pyx":975
 *             # use x fill value
 *             out[out_i] = op(xfill, y[yi])
 *             yi += 1             # <<<<<<<<<<<<<<
 * 
 *     return out, out_index
 */
      __pyx_v_yi = (__pyx_v_yi + 1);
    }
    __pyx_L7:;
    __pyx_L3_continue:;
  }

  /* "pandas/src/sparse.pyx":977
 *             yi += 1
 * 
 *     return out, out_index             # <<<<<<<<<<<<<<
 * 
 * cdef inline float64_t __add(float64_t a, float64_t b):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __Pyx_INCREF(((PyObject *)__pyx_v_out_index));
  PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_v_out_index));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out_index));
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out_indices);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.int_op", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out_indices);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out_index);
  __Pyx_XDECREF((PyObject *)__pyx_v_xindices);
  __Pyx_XDECREF((PyObject *)__pyx_v_yindices);
  __Pyx_XDECREF((PyObject *)__pyx_v_out_indices);
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XDECREF((PyObject *)__pyx_v_y);
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":979
 *     return out, out_index
 * 
 * cdef inline float64_t __add(float64_t a, float64_t b):             # <<<<<<<<<<<<<<
 *     return a + b
 * 
 */

static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___add(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) {
  __pyx_t_5numpy_float64_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__add");

  /* "pandas/src/sparse.pyx":980
 * 
 * cdef inline float64_t __add(float64_t a, float64_t b):
 *     return a + b             # <<<<<<<<<<<<<<
 * 
 * cdef inline float64_t __sub(float64_t a, float64_t b):
 */
  __pyx_r = (__pyx_v_a + __pyx_v_b);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":982
 *     return a + b
 * 
 * cdef inline float64_t __sub(float64_t a, float64_t b):             # <<<<<<<<<<<<<<
 *     return a - b
 * 
 */

static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___sub(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) {
  __pyx_t_5numpy_float64_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__sub");

  /* "pandas/src/sparse.pyx":983
 * 
 * cdef inline float64_t __sub(float64_t a, float64_t b):
 *     return a - b             # <<<<<<<<<<<<<<
 * 
 * cdef inline float64_t __rsub(float64_t a, float64_t b):
 */
  __pyx_r = (__pyx_v_a - __pyx_v_b);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":985
 *     return a - b
 * 
 * cdef inline float64_t __rsub(float64_t a, float64_t b):             # <<<<<<<<<<<<<<
 *     return b - a
 * 
 */

static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___rsub(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) {
  __pyx_t_5numpy_float64_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__rsub");

  /* "pandas/src/sparse.pyx":986
 * 
 * cdef inline float64_t __rsub(float64_t a, float64_t b):
 *     return b - a             # <<<<<<<<<<<<<<
 * 
 * cdef inline float64_t __div(float64_t a, float64_t b):
 */
  __pyx_r = (__pyx_v_b - __pyx_v_a);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":988
 *     return b - a
 * 
 * cdef inline float64_t __div(float64_t a, float64_t b):             # <<<<<<<<<<<<<<
 *     if b == 0:
 *         if a >= 0:
 */

static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___div(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) {
  __pyx_t_5numpy_float64_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__div");

  /* "pandas/src/sparse.pyx":989
 * 
 * cdef inline float64_t __div(float64_t a, float64_t b):
 *     if b == 0:             # <<<<<<<<<<<<<<
 *         if a >= 0:
 *             return INF
 */
  __pyx_t_1 = (__pyx_v_b == 0.0);
  if (__pyx_t_1) {

    /* "pandas/src/sparse.pyx":990
 * cdef inline float64_t __div(float64_t a, float64_t b):
 *     if b == 0:
 *         if a >= 0:             # <<<<<<<<<<<<<<
 *             return INF
 *         else:
 */
    __pyx_t_1 = (__pyx_v_a >= 0.0);
    if (__pyx_t_1) {

      /* "pandas/src/sparse.pyx":991
 *     if b == 0:
 *         if a >= 0:
 *             return INF             # <<<<<<<<<<<<<<
 *         else:
 *             return -INF
 */
      __pyx_r = __pyx_v_6pandas_7_sparse_INF;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "pandas/src/sparse.pyx":993
 *             return INF
 *         else:
 *             return -INF             # <<<<<<<<<<<<<<
 *     else:
 *         return a / b
 */
      __pyx_r = (-__pyx_v_6pandas_7_sparse_INF);
      goto __pyx_L0;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/sparse.pyx":995
 *             return -INF
 *     else:
 *         return a / b             # <<<<<<<<<<<<<<
 * 
 * cdef inline float64_t __rdiv(float64_t a, float64_t b):
 */
    if (unlikely(__pyx_v_b == 0)) {
      PyErr_Format(PyExc_ZeroDivisionError, "float division");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_r = (__pyx_v_a / __pyx_v_b);
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pandas._sparse.__div", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":997
 *         return a / b
 * 
 * cdef inline float64_t __rdiv(float64_t a, float64_t b):             # <<<<<<<<<<<<<<
 *     return __div(b, a)
 * 
 */

static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___rdiv(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) {
  __pyx_t_5numpy_float64_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__rdiv");

  /* "pandas/src/sparse.pyx":998
 * 
 * cdef inline float64_t __rdiv(float64_t a, float64_t b):
 *     return __div(b, a)             # <<<<<<<<<<<<<<
 * 
 * cdef inline float64_t __floordiv(float64_t a, float64_t b):
 */
  __pyx_r = __pyx_f_6pandas_7_sparse___div(__pyx_v_b, __pyx_v_a);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1000
 *     return __div(b, a)
 * 
 * cdef inline float64_t __floordiv(float64_t a, float64_t b):             # <<<<<<<<<<<<<<
 *     if b == 0:
 *         if a >= 0:
 */

static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___floordiv(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) {
  __pyx_t_5numpy_float64_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__floordiv");

  /* "pandas/src/sparse.pyx":1001
 * 
 * cdef inline float64_t __floordiv(float64_t a, float64_t b):
 *     if b == 0:             # <<<<<<<<<<<<<<
 *         if a >= 0:
 *             return INF
 */
  __pyx_t_1 = (__pyx_v_b == 0.0);
  if (__pyx_t_1) {

    /* "pandas/src/sparse.pyx":1002
 * cdef inline float64_t __floordiv(float64_t a, float64_t b):
 *     if b == 0:
 *         if a >= 0:             # <<<<<<<<<<<<<<
 *             return INF
 *         else:
 */
    __pyx_t_1 = (__pyx_v_a >= 0.0);
    if (__pyx_t_1) {

      /* "pandas/src/sparse.pyx":1003
 *     if b == 0:
 *         if a >= 0:
 *             return INF             # <<<<<<<<<<<<<<
 *         else:
 *             return -INF
 */
      __pyx_r = __pyx_v_6pandas_7_sparse_INF;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "pandas/src/sparse.pyx":1005
 *             return INF
 *         else:
 *             return -INF             # <<<<<<<<<<<<<<
 *     else:
 *         return a // b
 */
      __pyx_r = (-__pyx_v_6pandas_7_sparse_INF);
      goto __pyx_L0;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/sparse.pyx":1007
 *             return -INF
 *     else:
 *         return a // b             # <<<<<<<<<<<<<<
 * 
 * cdef inline float64_t __rfloordiv(float64_t a, float64_t b):
 */
    if (unlikely(__pyx_v_b == 0)) {
      PyErr_Format(PyExc_ZeroDivisionError, "float division");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_r = floor(__pyx_v_a / __pyx_v_b);
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pandas._sparse.__floordiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1009
 *         return a // b
 * 
 * cdef inline float64_t __rfloordiv(float64_t a, float64_t b):             # <<<<<<<<<<<<<<
 *     return __floordiv(b, a)
 * 
 */

static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___rfloordiv(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) {
  __pyx_t_5numpy_float64_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__rfloordiv");

  /* "pandas/src/sparse.pyx":1010
 * 
 * cdef inline float64_t __rfloordiv(float64_t a, float64_t b):
 *     return __floordiv(b, a)             # <<<<<<<<<<<<<<
 * 
 * cdef inline float64_t __mul(float64_t a, float64_t b):
 */
  __pyx_r = __pyx_f_6pandas_7_sparse___floordiv(__pyx_v_b, __pyx_v_a);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1012
 *     return __floordiv(b, a)
 * 
 * cdef inline float64_t __mul(float64_t a, float64_t b):             # <<<<<<<<<<<<<<
 *     return a * b
 * cdef inline float64_t __eq(float64_t a, float64_t b):
 */

static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___mul(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) {
  __pyx_t_5numpy_float64_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__mul");

  /* "pandas/src/sparse.pyx":1013
 * 
 * cdef inline float64_t __mul(float64_t a, float64_t b):
 *     return a * b             # <<<<<<<<<<<<<<
 * cdef inline float64_t __eq(float64_t a, float64_t b):
 *     return a == b
 */
  __pyx_r = (__pyx_v_a * __pyx_v_b);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1014
 * cdef inline float64_t __mul(float64_t a, float64_t b):
 *     return a * b
 * cdef inline float64_t __eq(float64_t a, float64_t b):             # <<<<<<<<<<<<<<
 *     return a == b
 * cdef inline float64_t __ne(float64_t a, float64_t b):
 */

static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___eq(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) {
  __pyx_t_5numpy_float64_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__eq");

  /* "pandas/src/sparse.pyx":1015
 *     return a * b
 * cdef inline float64_t __eq(float64_t a, float64_t b):
 *     return a == b             # <<<<<<<<<<<<<<
 * cdef inline float64_t __ne(float64_t a, float64_t b):
 *     return a != b
 */
  __pyx_r = (__pyx_v_a == __pyx_v_b);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1016
 * cdef inline float64_t __eq(float64_t a, float64_t b):
 *     return a == b
 * cdef inline float64_t __ne(float64_t a, float64_t b):             # <<<<<<<<<<<<<<
 *     return a != b
 * cdef inline float64_t __lt(float64_t a, float64_t b):
 */

static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___ne(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) {
  __pyx_t_5numpy_float64_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__ne");

  /* "pandas/src/sparse.pyx":1017
 *     return a == b
 * cdef inline float64_t __ne(float64_t a, float64_t b):
 *     return a != b             # <<<<<<<<<<<<<<
 * cdef inline float64_t __lt(float64_t a, float64_t b):
 *     return a < b
 */
  __pyx_r = (__pyx_v_a != __pyx_v_b);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1018
 * cdef inline float64_t __ne(float64_t a, float64_t b):
 *     return a != b
 * cdef inline float64_t __lt(float64_t a, float64_t b):             # <<<<<<<<<<<<<<
 *     return a < b
 * cdef inline float64_t __gt(float64_t a, float64_t b):
 */

static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___lt(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) {
  __pyx_t_5numpy_float64_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__lt");

  /* "pandas/src/sparse.pyx":1019
 *     return a != b
 * cdef inline float64_t __lt(float64_t a, float64_t b):
 *     return a < b             # <<<<<<<<<<<<<<
 * cdef inline float64_t __gt(float64_t a, float64_t b):
 *     return a > b
 */
  __pyx_r = (__pyx_v_a < __pyx_v_b);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1020
 * cdef inline float64_t __lt(float64_t a, float64_t b):
 *     return a < b
 * cdef inline float64_t __gt(float64_t a, float64_t b):             # <<<<<<<<<<<<<<
 *     return a > b
 * 
 */

static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___gt(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) {
  __pyx_t_5numpy_float64_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__gt");

  /* "pandas/src/sparse.pyx":1021
 *     return a < b
 * cdef inline float64_t __gt(float64_t a, float64_t b):
 *     return a > b             # <<<<<<<<<<<<<<
 * 
 * cdef inline float64_t __pow(float64_t a, float64_t b):
 */
  __pyx_r = (__pyx_v_a > __pyx_v_b);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1023
 *     return a > b
 * 
 * cdef inline float64_t __pow(float64_t a, float64_t b):             # <<<<<<<<<<<<<<
 *     # NaN
 *     if a != a or b != b:
 */

static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___pow(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) {
  __pyx_t_5numpy_float64_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__pow");

  /* "pandas/src/sparse.pyx":1025
 * cdef inline float64_t __pow(float64_t a, float64_t b):
 *     # NaN
 *     if a != a or b != b:             # <<<<<<<<<<<<<<
 *         return NaN
 *     return a ** b
 */
  __pyx_t_1 = (__pyx_v_a != __pyx_v_a);
  if (!__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_b != __pyx_v_b);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "pandas/src/sparse.pyx":1026
 *     # NaN
 *     if a != a or b != b:
 *         return NaN             # <<<<<<<<<<<<<<
 *     return a ** b
 * 
 */
    __pyx_r = __pyx_v_6pandas_7_sparse_NaN;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/sparse.pyx":1027
 *     if a != a or b != b:
 *         return NaN
 *     return a ** b             # <<<<<<<<<<<<<<
 * 
 * cdef inline float64_t __rpow(float64_t a, float64_t b):
 */
  __pyx_r = pow(__pyx_v_a, __pyx_v_b);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1029
 *     return a ** b
 * 
 * cdef inline float64_t __rpow(float64_t a, float64_t b):             # <<<<<<<<<<<<<<
 *     return __pow(b, a)
 * 
 */

static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_7_sparse___rpow(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) {
  __pyx_t_5numpy_float64_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__rpow");

  /* "pandas/src/sparse.pyx":1030
 * 
 * cdef inline float64_t __rpow(float64_t a, float64_t b):
 *     return __pow(b, a)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_f_6pandas_7_sparse___pow(__pyx_v_b, __pyx_v_a);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1036
 * # TODO: quantify performance boost to "templating"
 * 
 * cpdef sparse_nanadd(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __add)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_1sparse_nanadd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_nanadd(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, int __pyx_skip_dispatch) {
  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("sparse_nanadd");

  /* "pandas/src/sparse.pyx":1038
 * cpdef sparse_nanadd(ndarray x, SparseIndex xindex,
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __add)             # <<<<<<<<<<<<<<
 * 
 * cpdef sparse_nansub(ndarray x, SparseIndex xindex,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_sparse_nancombine(__pyx_v_x, __pyx_v_xindex, __pyx_v_y, __pyx_v_yindex, __pyx_f_6pandas_7_sparse___add)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_nanadd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1036
 * # TODO: quantify performance boost to "templating"
 * 
 * cpdef sparse_nanadd(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __add)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_1sparse_nanadd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_1sparse_nanadd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex = 0;
  PyArrayObject *__pyx_v_y = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__y,&__pyx_n_s__yindex,0};
  __Pyx_RefNannySetupContext("sparse_nanadd");
  __pyx_self = __pyx_self;
  {
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanadd", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanadd", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanadd", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_nanadd") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_x = ((PyArrayObject *)values[0]);
    __pyx_v_xindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[1]);
    __pyx_v_y = ((PyArrayObject *)values[2]);
    __pyx_v_yindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sparse_nanadd", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.sparse_nanadd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_sparse_nanadd(__pyx_v_x, __pyx_v_xindex, __pyx_v_y, __pyx_v_yindex, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_nanadd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1040
 *     return sparse_nancombine(x, xindex, y, yindex, __add)
 * 
 * cpdef sparse_nansub(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __sub)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_2sparse_nansub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_nansub(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, int __pyx_skip_dispatch) {
  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("sparse_nansub");

  /* "pandas/src/sparse.pyx":1042
 * cpdef sparse_nansub(ndarray x, SparseIndex xindex,
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __sub)             # <<<<<<<<<<<<<<
 * 
 * cpdef sparse_nanrsub(ndarray x, SparseIndex xindex,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_sparse_nancombine(__pyx_v_x, __pyx_v_xindex, __pyx_v_y, __pyx_v_yindex, __pyx_f_6pandas_7_sparse___sub)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_nansub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1040
 *     return sparse_nancombine(x, xindex, y, yindex, __add)
 * 
 * cpdef sparse_nansub(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __sub)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_2sparse_nansub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_2sparse_nansub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex = 0;
  PyArrayObject *__pyx_v_y = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__y,&__pyx_n_s__yindex,0};
  __Pyx_RefNannySetupContext("sparse_nansub");
  __pyx_self = __pyx_self;
  {
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nansub", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nansub", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nansub", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_nansub") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_x = ((PyArrayObject *)values[0]);
    __pyx_v_xindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[1]);
    __pyx_v_y = ((PyArrayObject *)values[2]);
    __pyx_v_yindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sparse_nansub", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.sparse_nansub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_sparse_nansub(__pyx_v_x, __pyx_v_xindex, __pyx_v_y, __pyx_v_yindex, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_nansub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1044
 *     return sparse_nancombine(x, xindex, y, yindex, __sub)
 * 
 * cpdef sparse_nanrsub(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __rsub)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_3sparse_nanrsub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_nanrsub(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, int __pyx_skip_dispatch) {
  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("sparse_nanrsub");

  /* "pandas/src/sparse.pyx":1046
 * cpdef sparse_nanrsub(ndarray x, SparseIndex xindex,
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __rsub)             # <<<<<<<<<<<<<<
 * 
 * cpdef sparse_nanmul(ndarray x, SparseIndex xindex,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_sparse_nancombine(__pyx_v_x, __pyx_v_xindex, __pyx_v_y, __pyx_v_yindex, __pyx_f_6pandas_7_sparse___rsub)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_nanrsub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1044
 *     return sparse_nancombine(x, xindex, y, yindex, __sub)
 * 
 * cpdef sparse_nanrsub(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __rsub)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_3sparse_nanrsub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_3sparse_nanrsub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex = 0;
  PyArrayObject *__pyx_v_y = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__y,&__pyx_n_s__yindex,0};
  __Pyx_RefNannySetupContext("sparse_nanrsub");
  __pyx_self = __pyx_self;
  {
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanrsub", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanrsub", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanrsub", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_nanrsub") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_x = ((PyArrayObject *)values[0]);
    __pyx_v_xindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[1]);
    __pyx_v_y = ((PyArrayObject *)values[2]);
    __pyx_v_yindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sparse_nanrsub", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.sparse_nanrsub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_sparse_nanrsub(__pyx_v_x, __pyx_v_xindex, __pyx_v_y, __pyx_v_yindex, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_nanrsub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1048
 *     return sparse_nancombine(x, xindex, y, yindex, __rsub)
 * 
 * cpdef sparse_nanmul(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __mul)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_4sparse_nanmul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_nanmul(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, int __pyx_skip_dispatch) {
  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("sparse_nanmul");

  /* "pandas/src/sparse.pyx":1050
 * cpdef sparse_nanmul(ndarray x, SparseIndex xindex,
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __mul)             # <<<<<<<<<<<<<<
 * 
 * cpdef sparse_nandiv(ndarray x, SparseIndex xindex,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_sparse_nancombine(__pyx_v_x, __pyx_v_xindex, __pyx_v_y, __pyx_v_yindex, __pyx_f_6pandas_7_sparse___mul)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_nanmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1048
 *     return sparse_nancombine(x, xindex, y, yindex, __rsub)
 * 
 * cpdef sparse_nanmul(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __mul)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_4sparse_nanmul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_4sparse_nanmul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex = 0;
  PyArrayObject *__pyx_v_y = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__y,&__pyx_n_s__yindex,0};
  __Pyx_RefNannySetupContext("sparse_nanmul");
  __pyx_self = __pyx_self;
  {
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanmul", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanmul", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanmul", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_nanmul") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_x = ((PyArrayObject *)values[0]);
    __pyx_v_xindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[1]);
    __pyx_v_y = ((PyArrayObject *)values[2]);
    __pyx_v_yindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sparse_nanmul", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.sparse_nanmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_sparse_nanmul(__pyx_v_x, __pyx_v_xindex, __pyx_v_y, __pyx_v_yindex, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_nanmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1052
 *     return sparse_nancombine(x, xindex, y, yindex, __mul)
 * 
 * cpdef sparse_nandiv(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __div)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_5sparse_nandiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_nandiv(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, int __pyx_skip_dispatch) {
  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("sparse_nandiv");

  /* "pandas/src/sparse.pyx":1054
 * cpdef sparse_nandiv(ndarray x, SparseIndex xindex,
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __div)             # <<<<<<<<<<<<<<
 * 
 * cpdef sparse_nanrdiv(ndarray x, SparseIndex xindex,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_sparse_nancombine(__pyx_v_x, __pyx_v_xindex, __pyx_v_y, __pyx_v_yindex, __pyx_f_6pandas_7_sparse___div)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_nandiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1052
 *     return sparse_nancombine(x, xindex, y, yindex, __mul)
 * 
 * cpdef sparse_nandiv(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __div)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_5sparse_nandiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_5sparse_nandiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex = 0;
  PyArrayObject *__pyx_v_y = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__y,&__pyx_n_s__yindex,0};
  __Pyx_RefNannySetupContext("sparse_nandiv");
  __pyx_self = __pyx_self;
  {
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nandiv", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nandiv", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nandiv", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_nandiv") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_x = ((PyArrayObject *)values[0]);
    __pyx_v_xindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[1]);
    __pyx_v_y = ((PyArrayObject *)values[2]);
    __pyx_v_yindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sparse_nandiv", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.sparse_nandiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_sparse_nandiv(__pyx_v_x, __pyx_v_xindex, __pyx_v_y, __pyx_v_yindex, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_nandiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1056
 *     return sparse_nancombine(x, xindex, y, yindex, __div)
 * 
 * cpdef sparse_nanrdiv(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __rdiv)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_6sparse_nanrdiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_nanrdiv(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, int __pyx_skip_dispatch) {
  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("sparse_nanrdiv");

  /* "pandas/src/sparse.pyx":1058
 * cpdef sparse_nanrdiv(ndarray x, SparseIndex xindex,
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __rdiv)             # <<<<<<<<<<<<<<
 * 
 * sparse_nantruediv = sparse_nandiv
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_sparse_nancombine(__pyx_v_x, __pyx_v_xindex, __pyx_v_y, __pyx_v_yindex, __pyx_f_6pandas_7_sparse___rdiv)); 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_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_nanrdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1056
 *     return sparse_nancombine(x, xindex, y, yindex, __div)
 * 
 * cpdef sparse_nanrdiv(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __rdiv)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_6sparse_nanrdiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_6sparse_nanrdiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex = 0;
  PyArrayObject *__pyx_v_y = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__y,&__pyx_n_s__yindex,0};
  __Pyx_RefNannySetupContext("sparse_nanrdiv");
  __pyx_self = __pyx_self;
  {
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanrdiv", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanrdiv", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanrdiv", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_nanrdiv") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_x = ((PyArrayObject *)values[0]);
    __pyx_v_xindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[1]);
    __pyx_v_y = ((PyArrayObject *)values[2]);
    __pyx_v_yindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sparse_nanrdiv", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.sparse_nanrdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_sparse_nanrdiv(__pyx_v_x, __pyx_v_xindex, __pyx_v_y, __pyx_v_yindex, 0); 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_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_nanrdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1063
 * sparse_nanrtruediv = sparse_nanrdiv
 * 
 * cpdef sparse_nanfloordiv(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __floordiv)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_7sparse_nanfloordiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_nanfloordiv(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, int __pyx_skip_dispatch) {
  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("sparse_nanfloordiv");

  /* "pandas/src/sparse.pyx":1065
 * cpdef sparse_nanfloordiv(ndarray x, SparseIndex xindex,
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __floordiv)             # <<<<<<<<<<<<<<
 * 
 * cpdef sparse_nanrfloordiv(ndarray x, SparseIndex xindex,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_sparse_nancombine(__pyx_v_x, __pyx_v_xindex, __pyx_v_y, __pyx_v_yindex, __pyx_f_6pandas_7_sparse___floordiv)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_nanfloordiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1063
 * sparse_nanrtruediv = sparse_nanrdiv
 * 
 * cpdef sparse_nanfloordiv(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __floordiv)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_7sparse_nanfloordiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_7sparse_nanfloordiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex = 0;
  PyArrayObject *__pyx_v_y = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__y,&__pyx_n_s__yindex,0};
  __Pyx_RefNannySetupContext("sparse_nanfloordiv");
  __pyx_self = __pyx_self;
  {
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanfloordiv", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanfloordiv", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanfloordiv", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_nanfloordiv") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_x = ((PyArrayObject *)values[0]);
    __pyx_v_xindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[1]);
    __pyx_v_y = ((PyArrayObject *)values[2]);
    __pyx_v_yindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sparse_nanfloordiv", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.sparse_nanfloordiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_sparse_nanfloordiv(__pyx_v_x, __pyx_v_xindex, __pyx_v_y, __pyx_v_yindex, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_nanfloordiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1067
 *     return sparse_nancombine(x, xindex, y, yindex, __floordiv)
 * 
 * cpdef sparse_nanrfloordiv(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __rfloordiv)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8sparse_nanrfloordiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_nanrfloordiv(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, int __pyx_skip_dispatch) {
  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("sparse_nanrfloordiv");

  /* "pandas/src/sparse.pyx":1069
 * cpdef sparse_nanrfloordiv(ndarray x, SparseIndex xindex,
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __rfloordiv)             # <<<<<<<<<<<<<<
 * 
 * cpdef sparse_nanpow(ndarray x, SparseIndex xindex,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_sparse_nancombine(__pyx_v_x, __pyx_v_xindex, __pyx_v_y, __pyx_v_yindex, __pyx_f_6pandas_7_sparse___rfloordiv)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_nanrfloordiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1067
 *     return sparse_nancombine(x, xindex, y, yindex, __floordiv)
 * 
 * cpdef sparse_nanrfloordiv(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __rfloordiv)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_8sparse_nanrfloordiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_8sparse_nanrfloordiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex = 0;
  PyArrayObject *__pyx_v_y = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__y,&__pyx_n_s__yindex,0};
  __Pyx_RefNannySetupContext("sparse_nanrfloordiv");
  __pyx_self = __pyx_self;
  {
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanrfloordiv", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanrfloordiv", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanrfloordiv", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_nanrfloordiv") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_x = ((PyArrayObject *)values[0]);
    __pyx_v_xindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[1]);
    __pyx_v_y = ((PyArrayObject *)values[2]);
    __pyx_v_yindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sparse_nanrfloordiv", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.sparse_nanrfloordiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_sparse_nanrfloordiv(__pyx_v_x, __pyx_v_xindex, __pyx_v_y, __pyx_v_yindex, 0); 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_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_nanrfloordiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1071
 *     return sparse_nancombine(x, xindex, y, yindex, __rfloordiv)
 * 
 * cpdef sparse_nanpow(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __pow)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_9sparse_nanpow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_nanpow(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, int __pyx_skip_dispatch) {
  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("sparse_nanpow");

  /* "pandas/src/sparse.pyx":1073
 * cpdef sparse_nanpow(ndarray x, SparseIndex xindex,
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __pow)             # <<<<<<<<<<<<<<
 * 
 * cpdef sparse_nanrpow(ndarray x, SparseIndex xindex,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_sparse_nancombine(__pyx_v_x, __pyx_v_xindex, __pyx_v_y, __pyx_v_yindex, __pyx_f_6pandas_7_sparse___pow)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_nanpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1071
 *     return sparse_nancombine(x, xindex, y, yindex, __rfloordiv)
 * 
 * cpdef sparse_nanpow(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __pow)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_9sparse_nanpow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_9sparse_nanpow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex = 0;
  PyArrayObject *__pyx_v_y = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__y,&__pyx_n_s__yindex,0};
  __Pyx_RefNannySetupContext("sparse_nanpow");
  __pyx_self = __pyx_self;
  {
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanpow", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanpow", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanpow", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_nanpow") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_x = ((PyArrayObject *)values[0]);
    __pyx_v_xindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[1]);
    __pyx_v_y = ((PyArrayObject *)values[2]);
    __pyx_v_yindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sparse_nanpow", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.sparse_nanpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_sparse_nanpow(__pyx_v_x, __pyx_v_xindex, __pyx_v_y, __pyx_v_yindex, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_nanpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1075
 *     return sparse_nancombine(x, xindex, y, yindex, __pow)
 * 
 * cpdef sparse_nanrpow(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __rpow)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10sparse_nanrpow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_nanrpow(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, int __pyx_skip_dispatch) {
  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("sparse_nanrpow");

  /* "pandas/src/sparse.pyx":1077
 * cpdef sparse_nanrpow(ndarray x, SparseIndex xindex,
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __rpow)             # <<<<<<<<<<<<<<
 * 
 * cpdef sparse_add(ndarray x, SparseIndex xindex, float64_t xfill,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_sparse_nancombine(__pyx_v_x, __pyx_v_xindex, __pyx_v_y, __pyx_v_yindex, __pyx_f_6pandas_7_sparse___rpow)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_nanrpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1075
 *     return sparse_nancombine(x, xindex, y, yindex, __pow)
 * 
 * cpdef sparse_nanrpow(ndarray x, SparseIndex xindex,             # <<<<<<<<<<<<<<
 *                     ndarray y, SparseIndex yindex):
 *     return sparse_nancombine(x, xindex, y, yindex, __rpow)
 */

static PyObject *__pyx_pf_6pandas_7_sparse_10sparse_nanrpow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_10sparse_nanrpow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex = 0;
  PyArrayObject *__pyx_v_y = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__y,&__pyx_n_s__yindex,0};
  __Pyx_RefNannySetupContext("sparse_nanrpow");
  __pyx_self = __pyx_self;
  {
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanrpow", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanrpow", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_nanrpow", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_nanrpow") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_x = ((PyArrayObject *)values[0]);
    __pyx_v_xindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[1]);
    __pyx_v_y = ((PyArrayObject *)values[2]);
    __pyx_v_yindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sparse_nanrpow", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.sparse_nanrpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_sparse_nanrpow(__pyx_v_x, __pyx_v_xindex, __pyx_v_y, __pyx_v_yindex, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_nanrpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1079
 *     return sparse_nancombine(x, xindex, y, yindex, __rpow)
 * 
 * cpdef sparse_add(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 */

static PyObject *__pyx_pf_6pandas_7_sparse_11sparse_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_add(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, int __pyx_skip_dispatch) {
  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("sparse_add");

  /* "pandas/src/sparse.pyx":1081
 * cpdef sparse_add(ndarray x, SparseIndex xindex, float64_t xfill,
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,             # <<<<<<<<<<<<<<
 *                              y, yindex, yfill, __add)
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "pandas/src/sparse.pyx":1082
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 *                              y, yindex, yfill, __add)             # <<<<<<<<<<<<<<
 * 
 * cpdef sparse_sub(ndarray x, SparseIndex xindex, float64_t xfill,
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_sparse_combine(__pyx_v_x, __pyx_v_xindex, __pyx_v_xfill, __pyx_v_y, __pyx_v_yindex, __pyx_v_yfill, __pyx_f_6pandas_7_sparse___add)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1079
 *     return sparse_nancombine(x, xindex, y, yindex, __rpow)
 * 
 * cpdef sparse_add(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 */

static PyObject *__pyx_pf_6pandas_7_sparse_11sparse_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_11sparse_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex = 0;
  __pyx_t_5numpy_float64_t __pyx_v_xfill;
  PyArrayObject *__pyx_v_y = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex = 0;
  __pyx_t_5numpy_float64_t __pyx_v_yfill;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__xfill,&__pyx_n_s__y,&__pyx_n_s__yindex,&__pyx_n_s__yfill,0};
  __Pyx_RefNannySetupContext("sparse_add");
  __pyx_self = __pyx_self;
  {
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_add", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xfill);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_add", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_add", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex);
        if (likely(values[4])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_add", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yfill);
        if (likely(values[5])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_add", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_x = ((PyArrayObject *)values[0]);
    __pyx_v_xindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[1]);
    __pyx_v_xfill = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_xfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_y = ((PyArrayObject *)values[3]);
    __pyx_v_yindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[4]);
    __pyx_v_yfill = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sparse_add", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.sparse_add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_sparse_add(__pyx_v_x, __pyx_v_xindex, __pyx_v_xfill, __pyx_v_y, __pyx_v_yindex, __pyx_v_yfill, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1084
 *                              y, yindex, yfill, __add)
 * 
 * cpdef sparse_sub(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 */

static PyObject *__pyx_pf_6pandas_7_sparse_12sparse_sub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_sub(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, int __pyx_skip_dispatch) {
  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("sparse_sub");

  /* "pandas/src/sparse.pyx":1086
 * cpdef sparse_sub(ndarray x, SparseIndex xindex, float64_t xfill,
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,             # <<<<<<<<<<<<<<
 *                              y, yindex, yfill, __sub)
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "pandas/src/sparse.pyx":1087
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 *                              y, yindex, yfill, __sub)             # <<<<<<<<<<<<<<
 * 
 * cpdef sparse_rsub(ndarray x, SparseIndex xindex, float64_t xfill,
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_sparse_combine(__pyx_v_x, __pyx_v_xindex, __pyx_v_xfill, __pyx_v_y, __pyx_v_yindex, __pyx_v_yfill, __pyx_f_6pandas_7_sparse___sub)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_sub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1084
 *                              y, yindex, yfill, __add)
 * 
 * cpdef sparse_sub(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 */

static PyObject *__pyx_pf_6pandas_7_sparse_12sparse_sub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_12sparse_sub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex = 0;
  __pyx_t_5numpy_float64_t __pyx_v_xfill;
  PyArrayObject *__pyx_v_y = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex = 0;
  __pyx_t_5numpy_float64_t __pyx_v_yfill;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__xfill,&__pyx_n_s__y,&__pyx_n_s__yindex,&__pyx_n_s__yfill,0};
  __Pyx_RefNannySetupContext("sparse_sub");
  __pyx_self = __pyx_self;
  {
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_sub", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xfill);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_sub", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_sub", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex);
        if (likely(values[4])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_sub", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yfill);
        if (likely(values[5])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_sub", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_sub") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_x = ((PyArrayObject *)values[0]);
    __pyx_v_xindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[1]);
    __pyx_v_xfill = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_xfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_y = ((PyArrayObject *)values[3]);
    __pyx_v_yindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[4]);
    __pyx_v_yfill = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sparse_sub", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.sparse_sub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_sparse_sub(__pyx_v_x, __pyx_v_xindex, __pyx_v_xfill, __pyx_v_y, __pyx_v_yindex, __pyx_v_yfill, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_sub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1089
 *                              y, yindex, yfill, __sub)
 * 
 * cpdef sparse_rsub(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 */

static PyObject *__pyx_pf_6pandas_7_sparse_13sparse_rsub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_rsub(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, int __pyx_skip_dispatch) {
  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("sparse_rsub");

  /* "pandas/src/sparse.pyx":1091
 * cpdef sparse_rsub(ndarray x, SparseIndex xindex, float64_t xfill,
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,             # <<<<<<<<<<<<<<
 *                              y, yindex, yfill, __rsub)
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "pandas/src/sparse.pyx":1092
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 *                              y, yindex, yfill, __rsub)             # <<<<<<<<<<<<<<
 * 
 * cpdef sparse_mul(ndarray x, SparseIndex xindex, float64_t xfill,
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_sparse_combine(__pyx_v_x, __pyx_v_xindex, __pyx_v_xfill, __pyx_v_y, __pyx_v_yindex, __pyx_v_yfill, __pyx_f_6pandas_7_sparse___rsub)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_rsub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1089
 *                              y, yindex, yfill, __sub)
 * 
 * cpdef sparse_rsub(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 */

static PyObject *__pyx_pf_6pandas_7_sparse_13sparse_rsub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_13sparse_rsub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex = 0;
  __pyx_t_5numpy_float64_t __pyx_v_xfill;
  PyArrayObject *__pyx_v_y = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex = 0;
  __pyx_t_5numpy_float64_t __pyx_v_yfill;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__xfill,&__pyx_n_s__y,&__pyx_n_s__yindex,&__pyx_n_s__yfill,0};
  __Pyx_RefNannySetupContext("sparse_rsub");
  __pyx_self = __pyx_self;
  {
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_rsub", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xfill);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_rsub", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_rsub", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex);
        if (likely(values[4])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_rsub", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yfill);
        if (likely(values[5])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_rsub", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_rsub") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_x = ((PyArrayObject *)values[0]);
    __pyx_v_xindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[1]);
    __pyx_v_xfill = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_xfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_y = ((PyArrayObject *)values[3]);
    __pyx_v_yindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[4]);
    __pyx_v_yfill = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sparse_rsub", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.sparse_rsub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_sparse_rsub(__pyx_v_x, __pyx_v_xindex, __pyx_v_xfill, __pyx_v_y, __pyx_v_yindex, __pyx_v_yfill, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_rsub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1094
 *                              y, yindex, yfill, __rsub)
 * 
 * cpdef sparse_mul(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 */

static PyObject *__pyx_pf_6pandas_7_sparse_14sparse_mul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_mul(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, int __pyx_skip_dispatch) {
  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("sparse_mul");

  /* "pandas/src/sparse.pyx":1096
 * cpdef sparse_mul(ndarray x, SparseIndex xindex, float64_t xfill,
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,             # <<<<<<<<<<<<<<
 *                              y, yindex, yfill, __mul)
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "pandas/src/sparse.pyx":1097
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 *                              y, yindex, yfill, __mul)             # <<<<<<<<<<<<<<
 * 
 * cpdef sparse_div(ndarray x, SparseIndex xindex, float64_t xfill,
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_sparse_combine(__pyx_v_x, __pyx_v_xindex, __pyx_v_xfill, __pyx_v_y, __pyx_v_yindex, __pyx_v_yfill, __pyx_f_6pandas_7_sparse___mul)); 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_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_mul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1094
 *                              y, yindex, yfill, __rsub)
 * 
 * cpdef sparse_mul(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 */

static PyObject *__pyx_pf_6pandas_7_sparse_14sparse_mul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_14sparse_mul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex = 0;
  __pyx_t_5numpy_float64_t __pyx_v_xfill;
  PyArrayObject *__pyx_v_y = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex = 0;
  __pyx_t_5numpy_float64_t __pyx_v_yfill;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__xfill,&__pyx_n_s__y,&__pyx_n_s__yindex,&__pyx_n_s__yfill,0};
  __Pyx_RefNannySetupContext("sparse_mul");
  __pyx_self = __pyx_self;
  {
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_mul", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xfill);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_mul", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_mul", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex);
        if (likely(values[4])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_mul", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yfill);
        if (likely(values[5])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_mul", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_mul") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_x = ((PyArrayObject *)values[0]);
    __pyx_v_xindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[1]);
    __pyx_v_xfill = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_xfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_y = ((PyArrayObject *)values[3]);
    __pyx_v_yindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[4]);
    __pyx_v_yfill = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sparse_mul", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.sparse_mul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_sparse_mul(__pyx_v_x, __pyx_v_xindex, __pyx_v_xfill, __pyx_v_y, __pyx_v_yindex, __pyx_v_yfill, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_mul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1099
 *                              y, yindex, yfill, __mul)
 * 
 * cpdef sparse_div(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 */

static PyObject *__pyx_pf_6pandas_7_sparse_15sparse_div(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_div(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, int __pyx_skip_dispatch) {
  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("sparse_div");

  /* "pandas/src/sparse.pyx":1101
 * cpdef sparse_div(ndarray x, SparseIndex xindex, float64_t xfill,
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,             # <<<<<<<<<<<<<<
 *                              y, yindex, yfill, __div)
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "pandas/src/sparse.pyx":1102
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 *                              y, yindex, yfill, __div)             # <<<<<<<<<<<<<<
 * 
 * cpdef sparse_rdiv(ndarray x, SparseIndex xindex, float64_t xfill,
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_sparse_combine(__pyx_v_x, __pyx_v_xindex, __pyx_v_xfill, __pyx_v_y, __pyx_v_yindex, __pyx_v_yfill, __pyx_f_6pandas_7_sparse___div)); 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;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_div", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1099
 *                              y, yindex, yfill, __mul)
 * 
 * cpdef sparse_div(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 */

static PyObject *__pyx_pf_6pandas_7_sparse_15sparse_div(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_15sparse_div(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex = 0;
  __pyx_t_5numpy_float64_t __pyx_v_xfill;
  PyArrayObject *__pyx_v_y = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex = 0;
  __pyx_t_5numpy_float64_t __pyx_v_yfill;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__xfill,&__pyx_n_s__y,&__pyx_n_s__yindex,&__pyx_n_s__yfill,0};
  __Pyx_RefNannySetupContext("sparse_div");
  __pyx_self = __pyx_self;
  {
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_div", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xfill);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_div", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_div", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex);
        if (likely(values[4])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_div", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yfill);
        if (likely(values[5])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_div", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_div") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_x = ((PyArrayObject *)values[0]);
    __pyx_v_xindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[1]);
    __pyx_v_xfill = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_xfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_y = ((PyArrayObject *)values[3]);
    __pyx_v_yindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[4]);
    __pyx_v_yfill = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sparse_div", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.sparse_div", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_sparse_div(__pyx_v_x, __pyx_v_xindex, __pyx_v_xfill, __pyx_v_y, __pyx_v_yindex, __pyx_v_yfill, 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_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_div", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1104
 *                              y, yindex, yfill, __div)
 * 
 * cpdef sparse_rdiv(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 */

static PyObject *__pyx_pf_6pandas_7_sparse_16sparse_rdiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_rdiv(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, int __pyx_skip_dispatch) {
  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("sparse_rdiv");

  /* "pandas/src/sparse.pyx":1106
 * cpdef sparse_rdiv(ndarray x, SparseIndex xindex, float64_t xfill,
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,             # <<<<<<<<<<<<<<
 *                              y, yindex, yfill, __rdiv)
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "pandas/src/sparse.pyx":1107
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 *                              y, yindex, yfill, __rdiv)             # <<<<<<<<<<<<<<
 * 
 * sparse_truediv = sparse_div
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_sparse_combine(__pyx_v_x, __pyx_v_xindex, __pyx_v_xfill, __pyx_v_y, __pyx_v_yindex, __pyx_v_yfill, __pyx_f_6pandas_7_sparse___rdiv)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_rdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1104
 *                              y, yindex, yfill, __div)
 * 
 * cpdef sparse_rdiv(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 */

static PyObject *__pyx_pf_6pandas_7_sparse_16sparse_rdiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_16sparse_rdiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex = 0;
  __pyx_t_5numpy_float64_t __pyx_v_xfill;
  PyArrayObject *__pyx_v_y = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex = 0;
  __pyx_t_5numpy_float64_t __pyx_v_yfill;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__xfill,&__pyx_n_s__y,&__pyx_n_s__yindex,&__pyx_n_s__yfill,0};
  __Pyx_RefNannySetupContext("sparse_rdiv");
  __pyx_self = __pyx_self;
  {
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_rdiv", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xfill);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_rdiv", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_rdiv", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex);
        if (likely(values[4])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_rdiv", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yfill);
        if (likely(values[5])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_rdiv", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_rdiv") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_x = ((PyArrayObject *)values[0]);
    __pyx_v_xindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[1]);
    __pyx_v_xfill = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_xfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_y = ((PyArrayObject *)values[3]);
    __pyx_v_yindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[4]);
    __pyx_v_yfill = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sparse_rdiv", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.sparse_rdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_sparse_rdiv(__pyx_v_x, __pyx_v_xindex, __pyx_v_xfill, __pyx_v_y, __pyx_v_yindex, __pyx_v_yfill, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_rdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1112
 * sparse_rtruediv = sparse_rdiv
 * 
 * cpdef sparse_floordiv(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 */

static PyObject *__pyx_pf_6pandas_7_sparse_17sparse_floordiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_floordiv(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, int __pyx_skip_dispatch) {
  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("sparse_floordiv");

  /* "pandas/src/sparse.pyx":1114
 * cpdef sparse_floordiv(ndarray x, SparseIndex xindex, float64_t xfill,
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,             # <<<<<<<<<<<<<<
 *                              y, yindex, yfill, __floordiv)
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "pandas/src/sparse.pyx":1115
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 *                              y, yindex, yfill, __floordiv)             # <<<<<<<<<<<<<<
 * 
 * cpdef sparse_rfloordiv(ndarray x, SparseIndex xindex, float64_t xfill,
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_sparse_combine(__pyx_v_x, __pyx_v_xindex, __pyx_v_xfill, __pyx_v_y, __pyx_v_yindex, __pyx_v_yfill, __pyx_f_6pandas_7_sparse___floordiv)); 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;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_floordiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1112
 * sparse_rtruediv = sparse_rdiv
 * 
 * cpdef sparse_floordiv(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 */

static PyObject *__pyx_pf_6pandas_7_sparse_17sparse_floordiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_17sparse_floordiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex = 0;
  __pyx_t_5numpy_float64_t __pyx_v_xfill;
  PyArrayObject *__pyx_v_y = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex = 0;
  __pyx_t_5numpy_float64_t __pyx_v_yfill;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__xfill,&__pyx_n_s__y,&__pyx_n_s__yindex,&__pyx_n_s__yfill,0};
  __Pyx_RefNannySetupContext("sparse_floordiv");
  __pyx_self = __pyx_self;
  {
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_floordiv", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xfill);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_floordiv", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_floordiv", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex);
        if (likely(values[4])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_floordiv", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yfill);
        if (likely(values[5])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_floordiv", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_floordiv") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_x = ((PyArrayObject *)values[0]);
    __pyx_v_xindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[1]);
    __pyx_v_xfill = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_xfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_y = ((PyArrayObject *)values[3]);
    __pyx_v_yindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[4]);
    __pyx_v_yfill = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sparse_floordiv", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.sparse_floordiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_sparse_floordiv(__pyx_v_x, __pyx_v_xindex, __pyx_v_xfill, __pyx_v_y, __pyx_v_yindex, __pyx_v_yfill, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_floordiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1117
 *                              y, yindex, yfill, __floordiv)
 * 
 * cpdef sparse_rfloordiv(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 */

static PyObject *__pyx_pf_6pandas_7_sparse_18sparse_rfloordiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_rfloordiv(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, int __pyx_skip_dispatch) {
  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("sparse_rfloordiv");

  /* "pandas/src/sparse.pyx":1119
 * cpdef sparse_rfloordiv(ndarray x, SparseIndex xindex, float64_t xfill,
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,             # <<<<<<<<<<<<<<
 *                              y, yindex, yfill, __rfloordiv)
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "pandas/src/sparse.pyx":1120
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 *                              y, yindex, yfill, __rfloordiv)             # <<<<<<<<<<<<<<
 * 
 * cpdef sparse_pow(ndarray x, SparseIndex xindex, float64_t xfill,
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_sparse_combine(__pyx_v_x, __pyx_v_xindex, __pyx_v_xfill, __pyx_v_y, __pyx_v_yindex, __pyx_v_yfill, __pyx_f_6pandas_7_sparse___rfloordiv)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_rfloordiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1117
 *                              y, yindex, yfill, __floordiv)
 * 
 * cpdef sparse_rfloordiv(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 */

static PyObject *__pyx_pf_6pandas_7_sparse_18sparse_rfloordiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_18sparse_rfloordiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex = 0;
  __pyx_t_5numpy_float64_t __pyx_v_xfill;
  PyArrayObject *__pyx_v_y = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex = 0;
  __pyx_t_5numpy_float64_t __pyx_v_yfill;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__xfill,&__pyx_n_s__y,&__pyx_n_s__yindex,&__pyx_n_s__yfill,0};
  __Pyx_RefNannySetupContext("sparse_rfloordiv");
  __pyx_self = __pyx_self;
  {
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_rfloordiv", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xfill);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_rfloordiv", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_rfloordiv", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex);
        if (likely(values[4])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_rfloordiv", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yfill);
        if (likely(values[5])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_rfloordiv", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_rfloordiv") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_x = ((PyArrayObject *)values[0]);
    __pyx_v_xindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[1]);
    __pyx_v_xfill = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_xfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_y = ((PyArrayObject *)values[3]);
    __pyx_v_yindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[4]);
    __pyx_v_yfill = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sparse_rfloordiv", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.sparse_rfloordiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_sparse_rfloordiv(__pyx_v_x, __pyx_v_xindex, __pyx_v_xfill, __pyx_v_y, __pyx_v_yindex, __pyx_v_yfill, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_rfloordiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1122
 *                              y, yindex, yfill, __rfloordiv)
 * 
 * cpdef sparse_pow(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 */

static PyObject *__pyx_pf_6pandas_7_sparse_19sparse_pow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_pow(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, int __pyx_skip_dispatch) {
  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("sparse_pow");

  /* "pandas/src/sparse.pyx":1124
 * cpdef sparse_pow(ndarray x, SparseIndex xindex, float64_t xfill,
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,             # <<<<<<<<<<<<<<
 *                              y, yindex, yfill, __pow)
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "pandas/src/sparse.pyx":1125
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 *                              y, yindex, yfill, __pow)             # <<<<<<<<<<<<<<
 * 
 * cpdef sparse_rpow(ndarray x, SparseIndex xindex, float64_t xfill,
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_sparse_combine(__pyx_v_x, __pyx_v_xindex, __pyx_v_xfill, __pyx_v_y, __pyx_v_yindex, __pyx_v_yfill, __pyx_f_6pandas_7_sparse___pow)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_pow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1122
 *                              y, yindex, yfill, __rfloordiv)
 * 
 * cpdef sparse_pow(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 */

static PyObject *__pyx_pf_6pandas_7_sparse_19sparse_pow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_19sparse_pow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex = 0;
  __pyx_t_5numpy_float64_t __pyx_v_xfill;
  PyArrayObject *__pyx_v_y = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex = 0;
  __pyx_t_5numpy_float64_t __pyx_v_yfill;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__xfill,&__pyx_n_s__y,&__pyx_n_s__yindex,&__pyx_n_s__yfill,0};
  __Pyx_RefNannySetupContext("sparse_pow");
  __pyx_self = __pyx_self;
  {
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_pow", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xfill);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_pow", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_pow", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex);
        if (likely(values[4])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_pow", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yfill);
        if (likely(values[5])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_pow", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_pow") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_x = ((PyArrayObject *)values[0]);
    __pyx_v_xindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[1]);
    __pyx_v_xfill = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_xfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_y = ((PyArrayObject *)values[3]);
    __pyx_v_yindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[4]);
    __pyx_v_yfill = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sparse_pow", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.sparse_pow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_sparse_pow(__pyx_v_x, __pyx_v_xindex, __pyx_v_xfill, __pyx_v_y, __pyx_v_yindex, __pyx_v_yfill, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_pow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1127
 *                              y, yindex, yfill, __pow)
 * 
 * cpdef sparse_rpow(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 */

static PyObject *__pyx_pf_6pandas_7_sparse_20sparse_rpow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6pandas_7_sparse_sparse_rpow(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, int __pyx_skip_dispatch) {
  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("sparse_rpow");

  /* "pandas/src/sparse.pyx":1129
 * cpdef sparse_rpow(ndarray x, SparseIndex xindex, float64_t xfill,
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,             # <<<<<<<<<<<<<<
 *                              y, yindex, yfill, __rpow)
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "pandas/src/sparse.pyx":1130
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 *                              y, yindex, yfill, __rpow)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6pandas_7_sparse_sparse_combine(__pyx_v_x, __pyx_v_xindex, __pyx_v_xfill, __pyx_v_y, __pyx_v_yindex, __pyx_v_yfill, __pyx_f_6pandas_7_sparse___rpow)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_rpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1127
 *                              y, yindex, yfill, __pow)
 * 
 * cpdef sparse_rpow(ndarray x, SparseIndex xindex, float64_t xfill,             # <<<<<<<<<<<<<<
 *                  ndarray y, SparseIndex yindex, float64_t yfill):
 *     return sparse_combine(x, xindex, xfill,
 */

static PyObject *__pyx_pf_6pandas_7_sparse_20sparse_rpow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_6pandas_7_sparse_20sparse_rpow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_x = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_xindex = 0;
  __pyx_t_5numpy_float64_t __pyx_v_xfill;
  PyArrayObject *__pyx_v_y = 0;
  struct __pyx_obj_6pandas_7_sparse_SparseIndex *__pyx_v_yindex = 0;
  __pyx_t_5numpy_float64_t __pyx_v_yfill;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__xfill,&__pyx_n_s__y,&__pyx_n_s__yindex,&__pyx_n_s__yfill,0};
  __Pyx_RefNannySetupContext("sparse_rpow");
  __pyx_self = __pyx_self;
  {
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_rpow", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xfill);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_rpow", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_rpow", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex);
        if (likely(values[4])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_rpow", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yfill);
        if (likely(values[5])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sparse_rpow", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_rpow") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_x = ((PyArrayObject *)values[0]);
    __pyx_v_xindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[1]);
    __pyx_v_xfill = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_xfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_y = ((PyArrayObject *)values[3]);
    __pyx_v_yindex = ((struct __pyx_obj_6pandas_7_sparse_SparseIndex *)values[4]);
    __pyx_v_yfill = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sparse_rpow", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.sparse_rpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_7_sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_7_sparse_sparse_rpow(__pyx_v_x, __pyx_v_xindex, __pyx_v_xfill, __pyx_v_y, __pyx_v_yindex, __pyx_v_yfill, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas._sparse.sparse_rpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1136
 * # Indexing operations
 * 
 * def get_reindexer(ndarray[object, ndim=1] values, dict index_map):             # <<<<<<<<<<<<<<
 *     cdef object idx
 *     cdef Py_ssize_t i
 */

static PyObject *__pyx_pf_6pandas_7_sparse_21get_reindexer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_7_sparse_21get_reindexer = {__Pyx_NAMESTR("get_reindexer"), (PyCFunction)__pyx_pf_6pandas_7_sparse_21get_reindexer, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_6pandas_7_sparse_21get_reindexer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyObject *__pyx_v_index_map = 0;
  PyObject *__pyx_v_idx = 0;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_new_length;
  PyArrayObject *__pyx_v_indexer = 0;
  Py_buffer __pyx_bstruct_values;
  Py_ssize_t __pyx_bstride_0_values = 0;
  Py_ssize_t __pyx_bshape_0_values = 0;
  Py_buffer __pyx_bstruct_indexer;
  Py_ssize_t __pyx_bstride_0_indexer = 0;
  Py_ssize_t __pyx_bshape_0_indexer = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  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;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  int __pyx_t_14;
  __pyx_t_5numpy_int32_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__index_map,0};
  __Pyx_RefNannySetupContext("get_reindexer");
  __pyx_self = __pyx_self;
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index_map);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_reindexer", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_reindexer") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __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_values = ((PyArrayObject *)values[0]);
    __pyx_v_index_map = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_reindexer", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.get_reindexer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_bstruct_indexer.buf = NULL;
  __pyx_bstruct_values.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index_map), (&PyDict_Type), 1, "index_map", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_values = __pyx_bstruct_values.strides[0];
  __pyx_bshape_0_values = __pyx_bstruct_values.shape[0];

  /* "pandas/src/sparse.pyx":1139
 *     cdef object idx
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t new_length = len(values)             # <<<<<<<<<<<<<<
 *     cdef ndarray[int32_t, ndim=1] indexer
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_new_length = __pyx_t_1;

  /* "pandas/src/sparse.pyx":1142
 *     cdef ndarray[int32_t, ndim=1] indexer
 * 
 *     indexer = np.empty(new_length, dtype=np.int32)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(new_length):
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_new_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indexer);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_indexer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_8 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indexer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
    }
    __pyx_bstride_0_indexer = __pyx_bstruct_indexer.strides[0];
    __pyx_bshape_0_indexer = __pyx_bstruct_indexer.shape[0];
    if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __pyx_v_indexer = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pandas/src/sparse.pyx":1144
 *     indexer = np.empty(new_length, dtype=np.int32)
 * 
 *     for i in range(new_length):             # <<<<<<<<<<<<<<
 *         idx = values[i]
 *         if idx in index_map:
 */
  __pyx_t_1 = __pyx_v_new_length;
  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_1; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "pandas/src/sparse.pyx":1145
 * 
 *     for i in range(new_length):
 *         idx = values[i]             # <<<<<<<<<<<<<<
 *         if idx in index_map:
 *             indexer[i] = index_map[idx]
 */
    __pyx_t_13 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_bshape_0_values;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_values)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_values.buf, __pyx_t_13, __pyx_bstride_0_values);
    __Pyx_INCREF((PyObject*)__pyx_t_6);
    __Pyx_XDECREF(__pyx_v_idx);
    __pyx_v_idx = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "pandas/src/sparse.pyx":1146
 *     for i in range(new_length):
 *         idx = values[i]
 *         if idx in index_map:             # <<<<<<<<<<<<<<
 *             indexer[i] = index_map[idx]
 *         else:
 */
    if (unlikely(((PyObject *)__pyx_v_index_map) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_14 = ((PyDict_Contains(((PyObject *)__pyx_v_index_map), __pyx_v_idx))); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_14) {

      /* "pandas/src/sparse.pyx":1147
 *         idx = values[i]
 *         if idx in index_map:
 *             indexer[i] = index_map[idx]             # <<<<<<<<<<<<<<
 *         else:
 *             indexer[i] = -1
 */
      __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_index_map), __pyx_v_idx); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_15 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_6); if (unlikely((__pyx_t_15 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_16 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_16 < 0) {
        __pyx_t_16 += __pyx_bshape_0_indexer;
        if (unlikely(__pyx_t_16 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_indexer)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_indexer.buf, __pyx_t_16, __pyx_bstride_0_indexer) = __pyx_t_15;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "pandas/src/sparse.pyx":1149
 *             indexer[i] = index_map[idx]
 *         else:
 *             indexer[i] = -1             # <<<<<<<<<<<<<<
 * 
 *     return indexer
 */
      __pyx_t_17 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_bshape_0_indexer;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_indexer)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_indexer.buf, __pyx_t_17, __pyx_bstride_0_indexer) = -1;
    }
    __pyx_L8:;
  }

  /* "pandas/src/sparse.pyx":1151
 *             indexer[i] = -1
 * 
 *     return indexer             # <<<<<<<<<<<<<<
 * 
 * # def reindex_block(ndarray[float64_t, ndim=1] values,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
  __pyx_r = ((PyObject *)__pyx_v_indexer);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indexer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.get_reindexer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indexer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_XDECREF((PyObject *)__pyx_v_indexer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/sparse.pyx":1183
 * 
 * 
 * def reindex_integer(ndarray[float64_t, ndim=1] values,             # <<<<<<<<<<<<<<
 *                     IntIndex sparse_index,
 *                     ndarray[int32_t, ndim=1] indexer):
 */

static PyObject *__pyx_pf_6pandas_7_sparse_22reindex_integer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_7_sparse_22reindex_integer = {__Pyx_NAMESTR("reindex_integer"), (PyCFunction)__pyx_pf_6pandas_7_sparse_22reindex_integer, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_6pandas_7_sparse_22reindex_integer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  struct __pyx_obj_6pandas_7_sparse_IntIndex *__pyx_v_sparse_index = 0;
  PyArrayObject *__pyx_v_indexer = 0;
  Py_buffer __pyx_bstruct_values;
  Py_ssize_t __pyx_bstride_0_values = 0;
  Py_ssize_t __pyx_bshape_0_values = 0;
  Py_buffer __pyx_bstruct_indexer;
  Py_ssize_t __pyx_bstride_0_indexer = 0;
  Py_ssize_t __pyx_bshape_0_indexer = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__sparse_index,&__pyx_n_s__indexer,0};
  __Pyx_RefNannySetupContext("reindex_integer");
  __pyx_self = __pyx_self;
  {
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sparse_index);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("reindex_integer", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("reindex_integer", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "reindex_integer") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __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_values = ((PyArrayObject *)values[0]);
    __pyx_v_sparse_index = ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)values[1]);
    __pyx_v_indexer = ((PyArrayObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("reindex_integer", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas._sparse.reindex_integer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_bstruct_values.buf = NULL;
  __pyx_bstruct_indexer.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sparse_index), __pyx_ptype_6pandas_7_sparse_IntIndex, 1, "sparse_index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_values = __pyx_bstruct_values.strides[0];
  __pyx_bshape_0_values = __pyx_bstruct_values.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indexer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_indexer = __pyx_bstruct_indexer.strides[0];
  __pyx_bshape_0_indexer = __pyx_bstruct_indexer.shape[0];

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indexer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas._sparse.reindex_integer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indexer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":195
 *         # 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.
 */

static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__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;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  char *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getbuffer__");
  if (__pyx_v_info != NULL) {
    __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_info->obj);
  }

  /* "numpy.pxd":201
 *             # of flags
 * 
 *             if info == NULL: return             # <<<<<<<<<<<<<<
 * 
 *             cdef int copy_shape, i, ndim
 */
  __pyx_t_1 = (__pyx_v_info == NULL);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "numpy.pxd":204
 * 
 *             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;

  /* "numpy.pxd":205
 *             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);

  /* "numpy.pxd":207
 *             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(((PyArrayObject *)__pyx_v_self));

  /* "numpy.pxd":209
 *             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)));
  if (__pyx_t_1) {

    /* "numpy.pxd":210
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 copy_shape = 1             # <<<<<<<<<<<<<<
 *             else:
 *                 copy_shape = 0
 */
    __pyx_v_copy_shape = 1;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "numpy.pxd":212
 *                 copy_shape = 1
 *             else:
 *                 copy_shape = 0             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 */
    __pyx_v_copy_shape = 0;
  }
  __pyx_L6:;

  /* "numpy.pxd":214
 *                 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_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
  if (__pyx_t_1) {

    /* "numpy.pxd":215
 * 
 *             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(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS));
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "numpy.pxd":216
 *             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_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 216; __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[1]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "numpy.pxd":218
 *                 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_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
  if (__pyx_t_3) {

    /* "numpy.pxd":219
 * 
 *             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_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS));
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "numpy.pxd":220
 *             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_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 220; __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[1]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "numpy.pxd":222
 *                 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(((PyArrayObject *)__pyx_v_self));

  /* "numpy.pxd":223
 * 
 *             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;

  /* "numpy.pxd":224
 *             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.
 */
  if (__pyx_v_copy_shape) {

    /* "numpy.pxd":227
 *                 # 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)));

    /* "numpy.pxd":228
 *                 # 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);

    /* "numpy.pxd":229
 *                 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_5 = __pyx_v_ndim;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_i = __pyx_t_6;

      /* "numpy.pxd":230
 *                 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(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]);

      /* "numpy.pxd":231
 *                 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(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]);
    }
    goto __pyx_L9;
  }
  /*else*/ {

    /* "numpy.pxd":233
 *                     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(((PyArrayObject *)__pyx_v_self)));

    /* "numpy.pxd":234
 *             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(((PyArrayObject *)__pyx_v_self)));
  }
  __pyx_L9:;

  /* "numpy.pxd":235
 *                 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;

  /* "numpy.pxd":236
 *                 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(((PyArrayObject *)__pyx_v_self));

  /* "numpy.pxd":237
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
 * 
 *             cdef int t
 */
  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self)));

  /* "numpy.pxd":240
 * 
 *             cdef int t
 *             cdef char* f = NULL             # <<<<<<<<<<<<<<
 *             cdef dtype descr = self.descr
 *             cdef list stack
 */
  __pyx_v_f = NULL;

  /* "numpy.pxd":241
 *             cdef int t
 *             cdef char* f = NULL
 *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
 *             cdef list stack
 *             cdef int offset
 */
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr));
  __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr;

  /* "numpy.pxd":245
 *             cdef int offset
 * 
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields and not copy_shape:
 */
  __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);

  /* "numpy.pxd":247
 *             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);
  if (__pyx_t_2) {
    __pyx_t_3 = (!__pyx_v_copy_shape);
    __pyx_t_1 = __pyx_t_3;
  } else {
    __pyx_t_1 = __pyx_t_2;
  }
  if (__pyx_t_1) {

    /* "numpy.pxd":249
 *             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_L12;
  }
  /*else*/ {

    /* "numpy.pxd":252
 *             else:
 *                 # need to call releasebuffer
 *                 info.obj = self             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields:
 */
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = __pyx_v_self;
  }
  __pyx_L12:;

  /* "numpy.pxd":254
 *                 info.obj = self
 * 
 *             if not hasfields:             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or
 */
  __pyx_t_1 = (!__pyx_v_hasfields);
  if (__pyx_t_1) {

    /* "numpy.pxd":255
 * 
 *             if not hasfields:
 *                 t = descr.type_num             # <<<<<<<<<<<<<<
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' and not little_endian)):
 */
    __pyx_v_t = __pyx_v_descr->type_num;

    /* "numpy.pxd":256
 *             if not hasfields:
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == '<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_1 = (__pyx_v_descr->byteorder == '>');
    if (__pyx_t_1) {
      __pyx_t_2 = __pyx_v_little_endian;
    } else {
      __pyx_t_2 = __pyx_t_1;
    }
    if (!__pyx_t_2) {

      /* "numpy.pxd":257
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' and not little_endian)):             # <<<<<<<<<<<<<<
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 */
      __pyx_t_1 = (__pyx_v_descr->byteorder == '<');
      if (__pyx_t_1) {
        __pyx_t_3 = (!__pyx_v_little_endian);
        __pyx_t_7 = __pyx_t_3;
      } else {
        __pyx_t_7 = __pyx_t_1;
      }
      __pyx_t_1 = __pyx_t_7;
    } else {
      __pyx_t_1 = __pyx_t_2;
    }
    if (__pyx_t_1) {

      /* "numpy.pxd":258
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' 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_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 258; __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[1]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "numpy.pxd":259
 *                     (descr.byteorder == '<' 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_BYTE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__b;
      goto __pyx_L15;
    }

    /* "numpy.pxd":260
 *                     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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_UBYTE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__B;
      goto __pyx_L15;
    }

    /* "numpy.pxd":261
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_SHORT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__h;
      goto __pyx_L15;
    }

    /* "numpy.pxd":262
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_USHORT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__H;
      goto __pyx_L15;
    }

    /* "numpy.pxd":263
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_INT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__i;
      goto __pyx_L15;
    }

    /* "numpy.pxd":264
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_UINT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__I;
      goto __pyx_L15;
    }

    /* "numpy.pxd":265
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_LONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__l;
      goto __pyx_L15;
    }

    /* "numpy.pxd":266
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_ULONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__L;
      goto __pyx_L15;
    }

    /* "numpy.pxd":267
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__q;
      goto __pyx_L15;
    }

    /* "numpy.pxd":268
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Q;
      goto __pyx_L15;
    }

    /* "numpy.pxd":269
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_FLOAT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__f;
      goto __pyx_L15;
    }

    /* "numpy.pxd":270
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__d;
      goto __pyx_L15;
    }

    /* "numpy.pxd":271
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__g;
      goto __pyx_L15;
    }

    /* "numpy.pxd":272
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Zf;
      goto __pyx_L15;
    }

    /* "numpy.pxd":273
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Zd;
      goto __pyx_L15;
    }

    /* "numpy.pxd":274
 *                 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:
 */
    __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Zg;
      goto __pyx_L15;
    }

    /* "numpy.pxd":275
 *                 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)
 */
    __pyx_t_1 = (__pyx_v_t == NPY_OBJECT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__O;
      goto __pyx_L15;
    }
    /*else*/ {

      /* "numpy.pxd":277
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *                 info.format = f
 *                 return
 */
      __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_26), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
      __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L15:;

    /* "numpy.pxd":278
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f             # <<<<<<<<<<<<<<
 *                 return
 *             else:
 */
    __pyx_v_info->format = __pyx_v_f;

    /* "numpy.pxd":279
 *                     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;
    goto __pyx_L13;
  }
  /*else*/ {

    /* "numpy.pxd":281
 *                 return
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
 *                 info.format[0] = '^' # Native data types, manual alignment
 *                 offset = 0
 */
    __pyx_v_info->format = ((char *)malloc(255));

    /* "numpy.pxd":282
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 *                 info.format[0] = '^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
 *                 offset = 0
 *                 f = _util_dtypestring(descr, info.format + 1,
 */
    (__pyx_v_info->format[0]) = '^';

    /* "numpy.pxd":283
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 *                 info.format[0] = '^' # Native data types, manual alignment
 *                 offset = 0             # <<<<<<<<<<<<<<
 *                 f = _util_dtypestring(descr, info.format + 1,
 *                                       info.format + _buffer_format_string_len,
 */
    __pyx_v_offset = 0;

    /* "numpy.pxd":286
 *                 f = _util_dtypestring(descr, info.format + 1,
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)             # <<<<<<<<<<<<<<
 *                 f[0] = 0 # Terminate format string
 * 
 */
    __pyx_t_9 = __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_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_f = __pyx_t_9;

    /* "numpy.pxd":287
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)
 *                 f[0] = 0 # Terminate format string             # <<<<<<<<<<<<<<
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 */
    (__pyx_v_f[0]) = 0;
  }
  __pyx_L13:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __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;
}

/* "numpy.pxd":289
 *                 f[0] = 0 # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 */

static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__releasebuffer__");

  /* "numpy.pxd":290
 * 
 *         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(((PyArrayObject *)__pyx_v_self));
  if (__pyx_t_1) {

    /* "numpy.pxd":291
 *         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_L5;
  }
  __pyx_L5:;

  /* "numpy.pxd":292
 *             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)));
  if (__pyx_t_1) {

    /* "numpy.pxd":293
 *                 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_L6;
  }
  __pyx_L6:;

  __Pyx_RefNannyFinishContext();
}

/* "numpy.pxd":769
 * 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");

  /* "numpy.pxd":770
 * 
 * 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[1]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __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;
}

/* "numpy.pxd":772
 *     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");

  /* "numpy.pxd":773
 * 
 * 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[1]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __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;
}

/* "numpy.pxd":775
 *     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");

  /* "numpy.pxd":776
 * 
 * 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[1]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __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;
}

/* "numpy.pxd":778
 *     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");

  /* "numpy.pxd":779
 * 
 * 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[1]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __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;
}

/* "numpy.pxd":781
 *     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");

  /* "numpy.pxd":782
 * 
 * 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[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __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;
}

/* "numpy.pxd":784
 *     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;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  long __pyx_t_10;
  char *__pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_util_dtypestring");

  /* "numpy.pxd":791
 *     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;

  /* "numpy.pxd":792
 *     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);

  /* "numpy.pxd":795
 *     cdef tuple fields
 * 
 *     for childname in descr.names:             # <<<<<<<<<<<<<<
 *         fields = descr.fields[childname]
 *         child, new_offset = fields
 */
  if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = ((PyObject *)__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;
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
    __Pyx_XDECREF(__pyx_v_childname);
    __pyx_v_childname = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "numpy.pxd":796
 * 
 *     for childname in descr.names:
 *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
 *         child, new_offset = fields
 * 
 */
    __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __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 tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_fields));
    __pyx_v_fields = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "numpy.pxd":797
 *     for childname in descr.names:
 *         fields = descr.fields[childname]
 *         child, new_offset = fields             # <<<<<<<<<<<<<<
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 */
    if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) {
      PyObject* sequence = ((PyObject *)__pyx_v_fields);
      if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
        if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __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_UnpackTupleError(((PyObject *)__pyx_v_fields), 2);
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __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[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_child));
    __pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_v_new_offset);
    __pyx_v_new_offset = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "numpy.pxd":799
 *         child, new_offset = fields
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 */
    __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_6) {

      /* "numpy.pxd":800
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == '>' and little_endian) or
 */
      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "numpy.pxd":802
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == '>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == '<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_6 = (__pyx_v_child->byteorder == '>');
    if (__pyx_t_6) {
      __pyx_t_7 = __pyx_v_little_endian;
    } else {
      __pyx_t_7 = __pyx_t_6;
    }
    if (!__pyx_t_7) {

      /* "numpy.pxd":803
 * 
 *         if ((child.byteorder == '>' and little_endian) or
 *             (child.byteorder == '<' 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_6 = (__pyx_v_child->byteorder == '<');
      if (__pyx_t_6) {
        __pyx_t_8 = (!__pyx_v_little_endian);
        __pyx_t_9 = __pyx_t_8;
      } else {
        __pyx_t_9 = __pyx_t_6;
      }
      __pyx_t_6 = __pyx_t_9;
    } else {
      __pyx_t_6 = __pyx_t_7;
    }
    if (__pyx_t_6) {

      /* "numpy.pxd":804
 *         if ((child.byteorder == '>' and little_endian) or
 *             (child.byteorder == '<' 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_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "numpy.pxd":814
 * 
 *         # Output padding bytes
 *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 */
    while (1) {
      __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_6) break;

      /* "numpy.pxd":815
 *         # Output padding bytes
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
 *             f += 1
 *             offset[0] += 1
 */
      (__pyx_v_f[0]) = 120;

      /* "numpy.pxd":816
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte
 *             f += 1             # <<<<<<<<<<<<<<
 *             offset[0] += 1
 * 
 */
      __pyx_v_f = (__pyx_v_f + 1);

      /* "numpy.pxd":817
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 *             offset[0] += 1             # <<<<<<<<<<<<<<
 * 
 *         offset[0] += child.itemsize
 */
      __pyx_t_10 = 0;
      (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1);
    }

    /* "numpy.pxd":819
 *             offset[0] += 1
 * 
 *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not PyDataType_HASFIELDS(child):
 */
    __pyx_t_10 = 0;
    (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize);

    /* "numpy.pxd":821
 *         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));
    if (__pyx_t_6) {

      /* "numpy.pxd":822
 * 
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num             # <<<<<<<<<<<<<<
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")
 */
      __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_v_t);
      __pyx_v_t = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "numpy.pxd":823
 *         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);
      if (__pyx_t_6) {

        /* "numpy.pxd":824
 *             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_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __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[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L10;
      }
      __pyx_L10:;

      /* "numpy.pxd":827
 * 
 *             # 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_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 98;
        goto __pyx_L11;
      }

      /* "numpy.pxd":828
 *             # 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_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 66;
        goto __pyx_L11;
      }

      /* "numpy.pxd":829
 *             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_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 104;
        goto __pyx_L11;
      }

      /* "numpy.pxd":830
 *             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_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 72;
        goto __pyx_L11;
      }

      /* "numpy.pxd":831
 *             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_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 105;
        goto __pyx_L11;
      }

      /* "numpy.pxd":832
 *             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_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 73;
        goto __pyx_L11;
      }

      /* "numpy.pxd":833
 *             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_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 108;
        goto __pyx_L11;
      }

      /* "numpy.pxd":834
 *             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_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 76;
        goto __pyx_L11;
      }

      /* "numpy.pxd":835
 *             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_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 113;
        goto __pyx_L11;
      }

      /* "numpy.pxd":836
 *             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_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 81;
        goto __pyx_L11;
      }

      /* "numpy.pxd":837
 *             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_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 102;
        goto __pyx_L11;
      }

      /* "numpy.pxd":838
 *             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_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 100;
        goto __pyx_L11;
      }

      /* "numpy.pxd":839
 *             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_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 103;
        goto __pyx_L11;
      }

      /* "numpy.pxd":840
 *             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_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __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]) = 102;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L11;
      }

      /* "numpy.pxd":841
 *             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_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 100;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L11;
      }

      /* "numpy.pxd":842
 *             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_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __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]) = 103;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L11;
      }

      /* "numpy.pxd":843
 *             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_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 79;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "numpy.pxd":845
 *             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_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_26), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_3));
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
        __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_t_5, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L11:;

      /* "numpy.pxd":846
 *             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_L9;
    }
    /*else*/ {

      /* "numpy.pxd":850
 *             # Cython ignores struct boundary information ("T{...}"),
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
 *     return f
 * 
 */
      __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_f = __pyx_t_11;
    }
    __pyx_L9:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "numpy.pxd":851
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)
 *     return f             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_f;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __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;
}

/* "numpy.pxd":966
 * 
 * 
 * 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;
  __Pyx_RefNannySetupContext("set_array_base");

  /* "numpy.pxd":968
 * 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);
  if (__pyx_t_1) {

    /* "numpy.pxd":969
 *      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*/ {

    /* "numpy.pxd":971
 *          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);

    /* "numpy.pxd":972
 *      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:;

  /* "numpy.pxd":973
 *          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);

  /* "numpy.pxd":974
 *          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;

  __Pyx_RefNannyFinishContext();
}

/* "numpy.pxd":976
 *      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");

  /* "numpy.pxd":977
 * 
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  __pyx_t_1 = (__pyx_v_arr->base == NULL);
  if (__pyx_t_1) {

    /* "numpy.pxd":978
 * 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;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "numpy.pxd":980
 *         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;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_tp_new_6pandas_7_sparse_SparseIndex(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  return o;
}

static void __pyx_tp_dealloc_6pandas_7_sparse_SparseIndex(PyObject *o) {
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_6pandas_7_sparse_SparseIndex[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_SparseIndex = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_SparseIndex = {
  0, /*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_SparseIndex = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_SparseIndex = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_6pandas_7_sparse_SparseIndex = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("pandas._sparse.SparseIndex"), /*tp_name*/
  sizeof(struct __pyx_obj_6pandas_7_sparse_SparseIndex), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pandas_7_sparse_SparseIndex, /*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*/
  &__pyx_tp_as_number_SparseIndex, /*tp_as_number*/
  &__pyx_tp_as_sequence_SparseIndex, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_SparseIndex, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_SparseIndex, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  __Pyx_DOCSTR("\n    Abstract superclass for sparse index types\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pandas_7_sparse_SparseIndex, /*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_pf_6pandas_7_sparse_11SparseIndex___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pandas_7_sparse_SparseIndex, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_6pandas_7_sparse_IntIndex __pyx_vtable_6pandas_7_sparse_IntIndex;

static PyObject *__pyx_tp_new_6pandas_7_sparse_IntIndex(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pandas_7_sparse_IntIndex *p;
  PyObject *o = __pyx_tp_new_6pandas_7_sparse_SparseIndex(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_6pandas_7_sparse_IntIndex *)o);
  p->__pyx_vtab = __pyx_vtabptr_6pandas_7_sparse_IntIndex;
  p->indices = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pandas_7_sparse_IntIndex(PyObject *o) {
  struct __pyx_obj_6pandas_7_sparse_IntIndex *p = (struct __pyx_obj_6pandas_7_sparse_IntIndex *)o;
  Py_XDECREF(((PyObject *)p->indices));
  __pyx_tp_dealloc_6pandas_7_sparse_SparseIndex(o);
}

static int __pyx_tp_traverse_6pandas_7_sparse_IntIndex(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pandas_7_sparse_IntIndex *p = (struct __pyx_obj_6pandas_7_sparse_IntIndex *)o;
  if (__pyx_ptype_6pandas_7_sparse_SparseIndex->tp_traverse) {
    e = __pyx_ptype_6pandas_7_sparse_SparseIndex->tp_traverse(o, v, a); if (e) return e;
  }
  if (p->indices) {
    e = (*v)(((PyObject*)p->indices), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pandas_7_sparse_IntIndex(PyObject *o) {
  struct __pyx_obj_6pandas_7_sparse_IntIndex *p = (struct __pyx_obj_6pandas_7_sparse_IntIndex *)o;
  PyObject* tmp;
  if (__pyx_ptype_6pandas_7_sparse_SparseIndex->tp_clear) {
    __pyx_ptype_6pandas_7_sparse_SparseIndex->tp_clear(o);
  }
  tmp = ((PyObject*)p->indices);
  p->indices = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6pandas_7_sparse_8IntIndex_length(PyObject *o, void *x) {
  return __pyx_pf_6pandas_7_sparse_8IntIndex_6length___get__(o);
}

static PyObject *__pyx_getprop_6pandas_7_sparse_8IntIndex_npoints(PyObject *o, void *x) {
  return __pyx_pf_6pandas_7_sparse_8IntIndex_7npoints___get__(o);
}

static PyObject *__pyx_getprop_6pandas_7_sparse_8IntIndex_indices(PyObject *o, void *x) {
  return __pyx_pf_6pandas_7_sparse_8IntIndex_7indices___get__(o);
}

static PyMethodDef __pyx_methods_6pandas_7_sparse_IntIndex[] = {
  {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_6pandas_7_sparse_8IntIndex_1__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("check_integrity"), (PyCFunction)__pyx_pf_6pandas_7_sparse_8IntIndex_3check_integrity, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pandas_7_sparse_8IntIndex_3check_integrity)},
  {__Pyx_NAMESTR("equals"), (PyCFunction)__pyx_pf_6pandas_7_sparse_8IntIndex_4equals, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("ngaps"), (PyCFunction)__pyx_pf_6pandas_7_sparse_8IntIndex_5ngaps, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("to_int_index"), (PyCFunction)__pyx_pf_6pandas_7_sparse_8IntIndex_6to_int_index, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("to_block_index"), (PyCFunction)__pyx_pf_6pandas_7_sparse_8IntIndex_7to_block_index, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("intersect"), (PyCFunction)__pyx_pf_6pandas_7_sparse_8IntIndex_8intersect, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("make_union"), (PyCFunction)__pyx_pf_6pandas_7_sparse_8IntIndex_9make_union, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("lookup"), (PyCFunction)__pyx_pf_6pandas_7_sparse_8IntIndex_10lookup, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("reindex"), (PyCFunction)__pyx_pf_6pandas_7_sparse_8IntIndex_11reindex, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("put"), (PyCFunction)__pyx_pf_6pandas_7_sparse_8IntIndex_12put, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("take"), (PyCFunction)__pyx_pf_6pandas_7_sparse_8IntIndex_13take, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pandas_7_sparse_IntIndex[] = {
  {(char *)"length", __pyx_getprop_6pandas_7_sparse_8IntIndex_length, 0, 0, 0},
  {(char *)"npoints", __pyx_getprop_6pandas_7_sparse_8IntIndex_npoints, 0, 0, 0},
  {(char *)"indices", __pyx_getprop_6pandas_7_sparse_8IntIndex_indices, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_IntIndex = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_IntIndex = {
  0, /*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_IntIndex = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_IntIndex = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_6pandas_7_sparse_IntIndex = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("pandas._sparse.IntIndex"), /*tp_name*/
  sizeof(struct __pyx_obj_6pandas_7_sparse_IntIndex), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pandas_7_sparse_IntIndex, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_6pandas_7_sparse_8IntIndex_2__repr__, /*tp_repr*/
  &__pyx_tp_as_number_IntIndex, /*tp_as_number*/
  &__pyx_tp_as_sequence_IntIndex, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_IntIndex, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_IntIndex, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("\n    Object for holding exact integer sparse indexing information\n\n    Parameters\n    ----------\n    length : integer\n    indices : array-like\n        Contains integers corresponding to\n    "), /*tp_doc*/
  __pyx_tp_traverse_6pandas_7_sparse_IntIndex, /*tp_traverse*/
  __pyx_tp_clear_6pandas_7_sparse_IntIndex, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pandas_7_sparse_IntIndex, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pandas_7_sparse_IntIndex, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_6pandas_7_sparse_8IntIndex___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pandas_7_sparse_IntIndex, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_6pandas_7_sparse_BlockIndex __pyx_vtable_6pandas_7_sparse_BlockIndex;

static PyObject *__pyx_tp_new_6pandas_7_sparse_BlockIndex(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pandas_7_sparse_BlockIndex *p;
  PyObject *o = __pyx_tp_new_6pandas_7_sparse_SparseIndex(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)o);
  p->__pyx_vtab = __pyx_vtabptr_6pandas_7_sparse_BlockIndex;
  p->blocs = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->blengths = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->__weakref__ = 0;
  return o;
}

static void __pyx_tp_dealloc_6pandas_7_sparse_BlockIndex(PyObject *o) {
  struct __pyx_obj_6pandas_7_sparse_BlockIndex *p = (struct __pyx_obj_6pandas_7_sparse_BlockIndex *)o;
  if (p->__weakref__) PyObject_ClearWeakRefs(o);
  Py_XDECREF(((PyObject *)p->blocs));
  Py_XDECREF(((PyObject *)p->blengths));
  __pyx_tp_dealloc_6pandas_7_sparse_SparseIndex(o);
}

static int __pyx_tp_traverse_6pandas_7_sparse_BlockIndex(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pandas_7_sparse_BlockIndex *p = (struct __pyx_obj_6pandas_7_sparse_BlockIndex *)o;
  if (__pyx_ptype_6pandas_7_sparse_SparseIndex->tp_traverse) {
    e = __pyx_ptype_6pandas_7_sparse_SparseIndex->tp_traverse(o, v, a); if (e) return e;
  }
  if (p->blocs) {
    e = (*v)(((PyObject*)p->blocs), a); if (e) return e;
  }
  if (p->blengths) {
    e = (*v)(((PyObject*)p->blengths), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pandas_7_sparse_BlockIndex(PyObject *o) {
  struct __pyx_obj_6pandas_7_sparse_BlockIndex *p = (struct __pyx_obj_6pandas_7_sparse_BlockIndex *)o;
  PyObject* tmp;
  if (__pyx_ptype_6pandas_7_sparse_SparseIndex->tp_clear) {
    __pyx_ptype_6pandas_7_sparse_SparseIndex->tp_clear(o);
  }
  tmp = ((PyObject*)p->blocs);
  p->blocs = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->blengths);
  p->blengths = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6pandas_7_sparse_10BlockIndex_nblocks(PyObject *o, void *x) {
  return __pyx_pf_6pandas_7_sparse_10BlockIndex_7nblocks___get__(o);
}

static PyObject *__pyx_getprop_6pandas_7_sparse_10BlockIndex_npoints(PyObject *o, void *x) {
  return __pyx_pf_6pandas_7_sparse_10BlockIndex_7npoints___get__(o);
}

static PyObject *__pyx_getprop_6pandas_7_sparse_10BlockIndex_length(PyObject *o, void *x) {
  return __pyx_pf_6pandas_7_sparse_10BlockIndex_6length___get__(o);
}

static PyObject *__pyx_getprop_6pandas_7_sparse_10BlockIndex_blocs(PyObject *o, void *x) {
  return __pyx_pf_6pandas_7_sparse_10BlockIndex_5blocs___get__(o);
}

static PyObject *__pyx_getprop_6pandas_7_sparse_10BlockIndex_blengths(PyObject *o, void *x) {
  return __pyx_pf_6pandas_7_sparse_10BlockIndex_8blengths___get__(o);
}

static PyMethodDef __pyx_methods_6pandas_7_sparse_BlockIndex[] = {
  {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_6pandas_7_sparse_10BlockIndex_1__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("ngaps"), (PyCFunction)__pyx_pf_6pandas_7_sparse_10BlockIndex_3ngaps, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("check_integrity"), (PyCFunction)__pyx_pf_6pandas_7_sparse_10BlockIndex_4check_integrity, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pandas_7_sparse_10BlockIndex_4check_integrity)},
  {__Pyx_NAMESTR("equals"), (PyCFunction)__pyx_pf_6pandas_7_sparse_10BlockIndex_5equals, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("to_block_index"), (PyCFunction)__pyx_pf_6pandas_7_sparse_10BlockIndex_6to_block_index, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("to_int_index"), (PyCFunction)__pyx_pf_6pandas_7_sparse_10BlockIndex_7to_int_index, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("intersect"), (PyCFunction)__pyx_pf_6pandas_7_sparse_10BlockIndex_8intersect, METH_O, __Pyx_DOCSTR(__pyx_doc_6pandas_7_sparse_10BlockIndex_8intersect)},
  {__Pyx_NAMESTR("make_union"), (PyCFunction)__pyx_pf_6pandas_7_sparse_10BlockIndex_9make_union, METH_O, __Pyx_DOCSTR(__pyx_doc_6pandas_7_sparse_10BlockIndex_9make_union)},
  {__Pyx_NAMESTR("lookup"), (PyCFunction)__pyx_pf_6pandas_7_sparse_10BlockIndex_10lookup, METH_O, __Pyx_DOCSTR(__pyx_doc_6pandas_7_sparse_10BlockIndex_10lookup)},
  {__Pyx_NAMESTR("reindex"), (PyCFunction)__pyx_pf_6pandas_7_sparse_10BlockIndex_11reindex, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("put"), (PyCFunction)__pyx_pf_6pandas_7_sparse_10BlockIndex_12put, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("take"), (PyCFunction)__pyx_pf_6pandas_7_sparse_10BlockIndex_13take, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pandas_7_sparse_BlockIndex[] = {
  {(char *)"nblocks", __pyx_getprop_6pandas_7_sparse_10BlockIndex_nblocks, 0, 0, 0},
  {(char *)"npoints", __pyx_getprop_6pandas_7_sparse_10BlockIndex_npoints, 0, 0, 0},
  {(char *)"length", __pyx_getprop_6pandas_7_sparse_10BlockIndex_length, 0, 0, 0},
  {(char *)"blocs", __pyx_getprop_6pandas_7_sparse_10BlockIndex_blocs, 0, 0, 0},
  {(char *)"blengths", __pyx_getprop_6pandas_7_sparse_10BlockIndex_blengths, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_BlockIndex = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_BlockIndex = {
  0, /*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_BlockIndex = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_BlockIndex = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_6pandas_7_sparse_BlockIndex = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("pandas._sparse.BlockIndex"), /*tp_name*/
  sizeof(struct __pyx_obj_6pandas_7_sparse_BlockIndex), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pandas_7_sparse_BlockIndex, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_6pandas_7_sparse_10BlockIndex_2__repr__, /*tp_repr*/
  &__pyx_tp_as_number_BlockIndex, /*tp_as_number*/
  &__pyx_tp_as_sequence_BlockIndex, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_BlockIndex, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_BlockIndex, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("\n    Object for holding block-based sparse indexing information\n\n    Parameters\n    ----------\n    "), /*tp_doc*/
  __pyx_tp_traverse_6pandas_7_sparse_BlockIndex, /*tp_traverse*/
  __pyx_tp_clear_6pandas_7_sparse_BlockIndex, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pandas_7_sparse_BlockIndex, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pandas_7_sparse_BlockIndex, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_6pandas_7_sparse_10BlockIndex___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pandas_7_sparse_BlockIndex, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_6pandas_7_sparse_BlockMerge __pyx_vtable_6pandas_7_sparse_BlockMerge;

static PyObject *__pyx_tp_new_6pandas_7_sparse_BlockMerge(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pandas_7_sparse_BlockMerge *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_6pandas_7_sparse_BlockMerge *)o);
  p->__pyx_vtab = __pyx_vtabptr_6pandas_7_sparse_BlockMerge;
  p->x = ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)Py_None); Py_INCREF(Py_None);
  p->y = ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)Py_None); Py_INCREF(Py_None);
  p->result = ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)Py_None); Py_INCREF(Py_None);
  p->xstart = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->xlen = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->xend = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->ystart = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->ylen = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  p->yend = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pandas_7_sparse_BlockMerge(PyObject *o) {
  struct __pyx_obj_6pandas_7_sparse_BlockMerge *p = (struct __pyx_obj_6pandas_7_sparse_BlockMerge *)o;
  Py_XDECREF(((PyObject *)p->x));
  Py_XDECREF(((PyObject *)p->y));
  Py_XDECREF(((PyObject *)p->result));
  Py_XDECREF(((PyObject *)p->xstart));
  Py_XDECREF(((PyObject *)p->xlen));
  Py_XDECREF(((PyObject *)p->xend));
  Py_XDECREF(((PyObject *)p->ystart));
  Py_XDECREF(((PyObject *)p->ylen));
  Py_XDECREF(((PyObject *)p->yend));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_6pandas_7_sparse_BlockMerge(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pandas_7_sparse_BlockMerge *p = (struct __pyx_obj_6pandas_7_sparse_BlockMerge *)o;
  if (p->x) {
    e = (*v)(((PyObject*)p->x), a); if (e) return e;
  }
  if (p->y) {
    e = (*v)(((PyObject*)p->y), a); if (e) return e;
  }
  if (p->result) {
    e = (*v)(((PyObject*)p->result), a); if (e) return e;
  }
  if (p->xstart) {
    e = (*v)(((PyObject*)p->xstart), a); if (e) return e;
  }
  if (p->xlen) {
    e = (*v)(((PyObject*)p->xlen), a); if (e) return e;
  }
  if (p->xend) {
    e = (*v)(((PyObject*)p->xend), a); if (e) return e;
  }
  if (p->ystart) {
    e = (*v)(((PyObject*)p->ystart), a); if (e) return e;
  }
  if (p->ylen) {
    e = (*v)(((PyObject*)p->ylen), a); if (e) return e;
  }
  if (p->yend) {
    e = (*v)(((PyObject*)p->yend), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pandas_7_sparse_BlockMerge(PyObject *o) {
  struct __pyx_obj_6pandas_7_sparse_BlockMerge *p = (struct __pyx_obj_6pandas_7_sparse_BlockMerge *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->x);
  p->x = ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->y);
  p->y = ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->result);
  p->result = ((struct __pyx_obj_6pandas_7_sparse_BlockIndex *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->xstart);
  p->xstart = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->xlen);
  p->xlen = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->xend);
  p->xend = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->ystart);
  p->ystart = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->ylen);
  p->ylen = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->yend);
  p->yend = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_6pandas_7_sparse_BlockMerge[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_BlockMerge = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_BlockMerge = {
  0, /*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_BlockMerge = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_BlockMerge = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_6pandas_7_sparse_BlockMerge = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("pandas._sparse.BlockMerge"), /*tp_name*/
  sizeof(struct __pyx_obj_6pandas_7_sparse_BlockMerge), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pandas_7_sparse_BlockMerge, /*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*/
  &__pyx_tp_as_number_BlockMerge, /*tp_as_number*/
  &__pyx_tp_as_sequence_BlockMerge, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_BlockMerge, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_BlockMerge, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("\n    Object-oriented approach makes sharing state between recursive functions a\n    lot easier and reduces code duplication\n    "), /*tp_doc*/
  __pyx_tp_traverse_6pandas_7_sparse_BlockMerge, /*tp_traverse*/
  __pyx_tp_clear_6pandas_7_sparse_BlockMerge, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pandas_7_sparse_BlockMerge, /*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_pf_6pandas_7_sparse_10BlockMerge___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pandas_7_sparse_BlockMerge, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_6pandas_7_sparse_BlockIntersection __pyx_vtable_6pandas_7_sparse_BlockIntersection;

static PyObject *__pyx_tp_new_6pandas_7_sparse_BlockIntersection(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pandas_7_sparse_BlockIntersection *p;
  PyObject *o = __pyx_tp_new_6pandas_7_sparse_BlockMerge(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_6pandas_7_sparse_BlockIntersection *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6pandas_7_sparse_BlockMerge*)__pyx_vtabptr_6pandas_7_sparse_BlockIntersection;
  return o;
}

static PyMethodDef __pyx_methods_6pandas_7_sparse_BlockIntersection[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_BlockIntersection = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_BlockIntersection = {
  0, /*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_BlockIntersection = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_BlockIntersection = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_6pandas_7_sparse_BlockIntersection = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("pandas._sparse.BlockIntersection"), /*tp_name*/
  sizeof(struct __pyx_obj_6pandas_7_sparse_BlockIntersection), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pandas_7_sparse_BlockMerge, /*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*/
  &__pyx_tp_as_number_BlockIntersection, /*tp_as_number*/
  &__pyx_tp_as_sequence_BlockIntersection, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_BlockIntersection, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_BlockIntersection, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("\n    not done yet\n    "), /*tp_doc*/
  __pyx_tp_traverse_6pandas_7_sparse_BlockMerge, /*tp_traverse*/
  __pyx_tp_clear_6pandas_7_sparse_BlockMerge, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pandas_7_sparse_BlockIntersection, /*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*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pandas_7_sparse_BlockIntersection, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_6pandas_7_sparse_BlockUnion __pyx_vtable_6pandas_7_sparse_BlockUnion;

static PyObject *__pyx_tp_new_6pandas_7_sparse_BlockUnion(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pandas_7_sparse_BlockUnion *p;
  PyObject *o = __pyx_tp_new_6pandas_7_sparse_BlockMerge(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_6pandas_7_sparse_BlockUnion *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6pandas_7_sparse_BlockMerge*)__pyx_vtabptr_6pandas_7_sparse_BlockUnion;
  return o;
}

static PyMethodDef __pyx_methods_6pandas_7_sparse_BlockUnion[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_BlockUnion = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_BlockUnion = {
  0, /*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_BlockUnion = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_BlockUnion = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_6pandas_7_sparse_BlockUnion = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("pandas._sparse.BlockUnion"), /*tp_name*/
  sizeof(struct __pyx_obj_6pandas_7_sparse_BlockUnion), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pandas_7_sparse_BlockMerge, /*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*/
  &__pyx_tp_as_number_BlockUnion, /*tp_as_number*/
  &__pyx_tp_as_sequence_BlockUnion, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_BlockUnion, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_BlockUnion, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("\n    Object-oriented approach makes sharing state between recursive functions a\n    lot easier and reduces code duplication\n    "), /*tp_doc*/
  __pyx_tp_traverse_6pandas_7_sparse_BlockMerge, /*tp_traverse*/
  __pyx_tp_clear_6pandas_7_sparse_BlockMerge, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pandas_7_sparse_BlockUnion, /*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*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pandas_7_sparse_BlockUnion, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {__Pyx_NAMESTR("get_blocks"), (PyCFunction)__pyx_pf_6pandas_7_sparse_get_blocks, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("sparse_nanadd"), (PyCFunction)__pyx_pf_6pandas_7_sparse_1sparse_nanadd, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("sparse_nansub"), (PyCFunction)__pyx_pf_6pandas_7_sparse_2sparse_nansub, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("sparse_nanrsub"), (PyCFunction)__pyx_pf_6pandas_7_sparse_3sparse_nanrsub, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("sparse_nanmul"), (PyCFunction)__pyx_pf_6pandas_7_sparse_4sparse_nanmul, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("sparse_nandiv"), (PyCFunction)__pyx_pf_6pandas_7_sparse_5sparse_nandiv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("sparse_nanrdiv"), (PyCFunction)__pyx_pf_6pandas_7_sparse_6sparse_nanrdiv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("sparse_nanfloordiv"), (PyCFunction)__pyx_pf_6pandas_7_sparse_7sparse_nanfloordiv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("sparse_nanrfloordiv"), (PyCFunction)__pyx_pf_6pandas_7_sparse_8sparse_nanrfloordiv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("sparse_nanpow"), (PyCFunction)__pyx_pf_6pandas_7_sparse_9sparse_nanpow, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("sparse_nanrpow"), (PyCFunction)__pyx_pf_6pandas_7_sparse_10sparse_nanrpow, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("sparse_add"), (PyCFunction)__pyx_pf_6pandas_7_sparse_11sparse_add, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("sparse_sub"), (PyCFunction)__pyx_pf_6pandas_7_sparse_12sparse_sub, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("sparse_rsub"), (PyCFunction)__pyx_pf_6pandas_7_sparse_13sparse_rsub, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("sparse_mul"), (PyCFunction)__pyx_pf_6pandas_7_sparse_14sparse_mul, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("sparse_div"), (PyCFunction)__pyx_pf_6pandas_7_sparse_15sparse_div, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("sparse_rdiv"), (PyCFunction)__pyx_pf_6pandas_7_sparse_16sparse_rdiv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("sparse_floordiv"), (PyCFunction)__pyx_pf_6pandas_7_sparse_17sparse_floordiv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("sparse_rfloordiv"), (PyCFunction)__pyx_pf_6pandas_7_sparse_18sparse_rfloordiv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("sparse_pow"), (PyCFunction)__pyx_pf_6pandas_7_sparse_19sparse_pow, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("sparse_rpow"), (PyCFunction)__pyx_pf_6pandas_7_sparse_20sparse_rpow, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("_sparse"),
    0, /* 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_n_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 1},
  {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
  {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
  {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
  {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
  {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
  {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
  {&__pyx_kp_u_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 1, 0, 0},
  {&__pyx_kp_u_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 1, 0, 0},
  {&__pyx_kp_u_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 1, 0, 0},
  {&__pyx_kp_u_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 1, 0, 0},
  {&__pyx_kp_u_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 1, 0, 0},
  {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
  {&__pyx_kp_u_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 1, 0, 0},
  {&__pyx_n_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 1},
  {&__pyx_n_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 1},
  {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
  {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
  {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
  {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
  {&__pyx_n_s__NaN, __pyx_k__NaN, sizeof(__pyx_k__NaN), 0, 0, 1, 1},
  {&__pyx_n_s__NotImplementedError, __pyx_k__NotImplementedError, sizeof(__pyx_k__NotImplementedError), 0, 0, 1, 1},
  {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__pyx_n_s__array_equal, __pyx_k__array_equal, sizeof(__pyx_k__array_equal), 0, 0, 1, 1},
  {&__pyx_n_s__ascontiguousarray, __pyx_k__ascontiguousarray, sizeof(__pyx_k__ascontiguousarray), 0, 0, 1, 1},
  {&__pyx_n_s__blengths, __pyx_k__blengths, sizeof(__pyx_k__blengths), 0, 0, 1, 1},
  {&__pyx_n_s__blocs, __pyx_k__blocs, sizeof(__pyx_k__blocs), 0, 0, 1, 1},
  {&__pyx_n_s__check_integrity, __pyx_k__check_integrity, sizeof(__pyx_k__check_integrity), 0, 0, 1, 1},
  {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1},
  {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1},
  {&__pyx_n_s__fill, __pyx_k__fill, sizeof(__pyx_k__fill), 0, 0, 1, 1},
  {&__pyx_n_s__fill_value, __pyx_k__fill_value, sizeof(__pyx_k__fill_value), 0, 0, 1, 1},
  {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1},
  {&__pyx_n_s__get_reindexer, __pyx_k__get_reindexer, sizeof(__pyx_k__get_reindexer), 0, 0, 1, 1},
  {&__pyx_n_s__index_map, __pyx_k__index_map, sizeof(__pyx_k__index_map), 0, 0, 1, 1},
  {&__pyx_n_s__indexer, __pyx_k__indexer, sizeof(__pyx_k__indexer), 0, 0, 1, 1},
  {&__pyx_n_s__indices, __pyx_k__indices, sizeof(__pyx_k__indices), 0, 0, 1, 1},
  {&__pyx_n_s__inf, __pyx_k__inf, sizeof(__pyx_k__inf), 0, 0, 1, 1},
  {&__pyx_n_s__int32, __pyx_k__int32, sizeof(__pyx_k__int32), 0, 0, 1, 1},
  {&__pyx_n_s__intersect, __pyx_k__intersect, sizeof(__pyx_k__intersect), 0, 0, 1, 1},
  {&__pyx_n_s__length, __pyx_k__length, sizeof(__pyx_k__length), 0, 0, 1, 1},
  {&__pyx_n_s__lookup, __pyx_k__lookup, sizeof(__pyx_k__lookup), 0, 0, 1, 1},
  {&__pyx_n_s__make_union, __pyx_k__make_union, sizeof(__pyx_k__make_union), 0, 0, 1, 1},
  {&__pyx_n_s__ngaps, __pyx_k__ngaps, sizeof(__pyx_k__ngaps), 0, 0, 1, 1},
  {&__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__operator, __pyx_k__operator, sizeof(__pyx_k__operator), 0, 0, 1, 1},
  {&__pyx_n_s__other_, __pyx_k__other_, sizeof(__pyx_k__other_), 0, 0, 1, 1},
  {&__pyx_n_s__property, __pyx_k__property, sizeof(__pyx_k__property), 0, 0, 1, 1},
  {&__pyx_n_s__put, __pyx_k__put, sizeof(__pyx_k__put), 0, 0, 1, 1},
  {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
  {&__pyx_n_s__reindex, __pyx_k__reindex, sizeof(__pyx_k__reindex), 0, 0, 1, 1},
  {&__pyx_n_s__reindex_integer, __pyx_k__reindex_integer, sizeof(__pyx_k__reindex_integer), 0, 0, 1, 1},
  {&__pyx_n_s__searchsorted, __pyx_k__searchsorted, sizeof(__pyx_k__searchsorted), 0, 0, 1, 1},
  {&__pyx_n_s__sparse_div, __pyx_k__sparse_div, sizeof(__pyx_k__sparse_div), 0, 0, 1, 1},
  {&__pyx_n_s__sparse_index, __pyx_k__sparse_index, sizeof(__pyx_k__sparse_index), 0, 0, 1, 1},
  {&__pyx_n_s__sparse_nandiv, __pyx_k__sparse_nandiv, sizeof(__pyx_k__sparse_nandiv), 0, 0, 1, 1},
  {&__pyx_n_s__sparse_nanrdiv, __pyx_k__sparse_nanrdiv, sizeof(__pyx_k__sparse_nanrdiv), 0, 0, 1, 1},
  {&__pyx_n_s__sparse_nanrtruediv, __pyx_k__sparse_nanrtruediv, sizeof(__pyx_k__sparse_nanrtruediv), 0, 0, 1, 1},
  {&__pyx_n_s__sparse_nantruediv, __pyx_k__sparse_nantruediv, sizeof(__pyx_k__sparse_nantruediv), 0, 0, 1, 1},
  {&__pyx_n_s__sparse_rdiv, __pyx_k__sparse_rdiv, sizeof(__pyx_k__sparse_rdiv), 0, 0, 1, 1},
  {&__pyx_n_s__sparse_rtruediv, __pyx_k__sparse_rtruediv, sizeof(__pyx_k__sparse_rtruediv), 0, 0, 1, 1},
  {&__pyx_n_s__sparse_truediv, __pyx_k__sparse_truediv, sizeof(__pyx_k__sparse_truediv), 0, 0, 1, 1},
  {&__pyx_n_s__sum, __pyx_k__sum, sizeof(__pyx_k__sum), 0, 0, 1, 1},
  {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1},
  {&__pyx_n_s__take, __pyx_k__take, sizeof(__pyx_k__take), 0, 0, 1, 1},
  {&__pyx_n_s__to_block_index, __pyx_k__to_block_index, sizeof(__pyx_k__to_block_index), 0, 0, 1, 1},
  {&__pyx_n_s__to_int_index, __pyx_k__to_int_index, sizeof(__pyx_k__to_int_index), 0, 0, 1, 1},
  {&__pyx_n_s__to_put, __pyx_k__to_put, sizeof(__pyx_k__to_put), 0, 0, 1, 1},
  {&__pyx_n_s__values, __pyx_k__values, sizeof(__pyx_k__values), 0, 0, 1, 1},
  {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1},
  {&__pyx_n_s__xfill, __pyx_k__xfill, sizeof(__pyx_k__xfill), 0, 0, 1, 1},
  {&__pyx_n_s__xindex, __pyx_k__xindex, sizeof(__pyx_k__xindex), 0, 0, 1, 1},
  {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1},
  {&__pyx_n_s__yfill, __pyx_k__yfill, sizeof(__pyx_k__yfill), 0, 0, 1, 1},
  {&__pyx_n_s__yindex, __pyx_k__yindex, sizeof(__pyx_k__yindex), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_property = __Pyx_GetName(__pyx_b, __pyx_n_s__property); if (!__pyx_builtin_property) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __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");

  /* "pandas/src/sparse.pyx":102
 * 
 *         if self.length != y.length:
 *             raise Exception('Indices must reference same underlying length')             # <<<<<<<<<<<<<<
 * 
 *         xindices = self.indices
 */
  __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
  PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));

  /* "pandas/src/sparse.pyx":136
 * 
 *         if self.length != y.length:
 *             raise Exception('Indices must reference same underlying length')             # <<<<<<<<<<<<<<
 * 
 *         xindices = self.indices
 */
  __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
  PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));

  /* "pandas/src/sparse.pyx":322
 * 
 *         if len(blocs) != len(blengths):
 *             raise ValueError('block bound arrays must be same length')             # <<<<<<<<<<<<<<
 * 
 *         for i from 0 <= i < self.nblocks:
 */
  __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_s_9));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));

  /* "pandas/src/sparse.pyx":327
 *             if i > 0:
 *                 if blocs[i] <= blocs[i-1]:
 *                     raise ValueError('Locations not in ascending order')             # <<<<<<<<<<<<<<
 * 
 *             if i < self.nblocks - 1:
 */
  __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
  PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_11));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));

  /* "pandas/src/sparse.pyx":396
 * 
 *         if self.length != y.length:
 *             raise Exception('Indices must reference same underlying length')             # <<<<<<<<<<<<<<
 * 
 *         xloc = self.blocs
 */
  __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
  PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_s_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));

  /* "pandas/src/sparse.pyx":542
 * 
 *         if x.length != y.length:
 *             raise Exception('Indices must reference same underlying length')             # <<<<<<<<<<<<<<
 * 
 *         self.xstart = self.x.blocs
 */
  __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
  PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_s_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));

  /* "pandas/src/sparse.pyx":632
 * 
 *         if mode != 0 and mode != 1:
 *             raise Exception('Mode must be 0 or 1')             # <<<<<<<<<<<<<<
 * 
 *         # so symmetric code will work
 */
  __pyx_k_tuple_19 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_19));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_18));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_kp_s_18));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));

  /* "numpy.pxd":216
 *             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_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_21));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_20));
  PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_kp_u_20));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_20));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));

  /* "numpy.pxd":220
 *             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_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_23));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_22));
  PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_kp_u_22));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_22));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));

  /* "numpy.pxd":258
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' 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_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_25));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_24));
  PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_kp_u_24));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_24));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));

  /* "numpy.pxd":800
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == '>' and little_endian) or
 */
  __pyx_k_tuple_28 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_28));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_27));
  PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_kp_u_27));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_27));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));

  /* "numpy.pxd":804
 *         if ((child.byteorder == '>' and little_endian) or
 *             (child.byteorder == '<' 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_k_tuple_29 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_29));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_24));
  PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_kp_u_24));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_24));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));

  /* "numpy.pxd":824
 *             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_k_tuple_31 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_31));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_30));
  PyTuple_SET_ITEM(__pyx_k_tuple_31, 0, ((PyObject *)__pyx_kp_u_30));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_30));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31));
  __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;};
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__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 init_sparse(void); /*proto*/
PyMODINIT_FUNC init_sparse(void)
#else
PyMODINIT_FUNC PyInit__sparse(void); /*proto*/
PyMODINIT_FUNC PyInit__sparse(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __pyx_t_5numpy_float64_t __pyx_t_3;
  __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__sparse(void)");
  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_binding_PyCFunctionType_USED
  if (__pyx_binding_PyCFunctionType_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(__Pyx_NAMESTR("_sparse"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  #if PY_MAJOR_VERSION < 3
  Py_INCREF(__pyx_m);
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__Pyx_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 (__pyx_module_is_main_pandas___sparse) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- 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 ---*/
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_6pandas_7_sparse_SparseIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "SparseIndex", (PyObject *)&__pyx_type_6pandas_7_sparse_SparseIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6pandas_7_sparse_SparseIndex = &__pyx_type_6pandas_7_sparse_SparseIndex;
  __pyx_vtabptr_6pandas_7_sparse_IntIndex = &__pyx_vtable_6pandas_7_sparse_IntIndex;
  __pyx_vtable_6pandas_7_sparse_IntIndex.intersect = (struct __pyx_obj_6pandas_7_sparse_IntIndex *(*)(struct __pyx_obj_6pandas_7_sparse_IntIndex *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch))__pyx_f_6pandas_7_sparse_8IntIndex_intersect;
  __pyx_vtable_6pandas_7_sparse_IntIndex.make_union = (struct __pyx_obj_6pandas_7_sparse_IntIndex *(*)(struct __pyx_obj_6pandas_7_sparse_IntIndex *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch))__pyx_f_6pandas_7_sparse_8IntIndex_make_union;
  __pyx_vtable_6pandas_7_sparse_IntIndex.lookup = (PyObject *(*)(struct __pyx_obj_6pandas_7_sparse_IntIndex *, Py_ssize_t, int __pyx_skip_dispatch))__pyx_f_6pandas_7_sparse_8IntIndex_lookup;
  __pyx_vtable_6pandas_7_sparse_IntIndex.reindex = (PyArrayObject *(*)(struct __pyx_obj_6pandas_7_sparse_IntIndex *, PyArrayObject *, __pyx_t_5numpy_float64_t, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch))__pyx_f_6pandas_7_sparse_8IntIndex_reindex;
  __pyx_vtable_6pandas_7_sparse_IntIndex.put = (PyObject *(*)(struct __pyx_obj_6pandas_7_sparse_IntIndex *, PyArrayObject *, PyArrayObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_6pandas_7_sparse_8IntIndex_put;
  __pyx_vtable_6pandas_7_sparse_IntIndex.take = (PyObject *(*)(struct __pyx_obj_6pandas_7_sparse_IntIndex *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_6pandas_7_sparse_8IntIndex_take;
  __pyx_type_6pandas_7_sparse_IntIndex.tp_base = __pyx_ptype_6pandas_7_sparse_SparseIndex;
  if (PyType_Ready(&__pyx_type_6pandas_7_sparse_IntIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_6pandas_7_sparse_IntIndex.tp_dict, __pyx_vtabptr_6pandas_7_sparse_IntIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "IntIndex", (PyObject *)&__pyx_type_6pandas_7_sparse_IntIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6pandas_7_sparse_IntIndex = &__pyx_type_6pandas_7_sparse_IntIndex;
  __pyx_vtabptr_6pandas_7_sparse_BlockIndex = &__pyx_vtable_6pandas_7_sparse_BlockIndex;
  __pyx_vtable_6pandas_7_sparse_BlockIndex.check_integrity = (PyObject *(*)(struct __pyx_obj_6pandas_7_sparse_BlockIndex *, int __pyx_skip_dispatch))__pyx_f_6pandas_7_sparse_10BlockIndex_check_integrity;
  __pyx_vtable_6pandas_7_sparse_BlockIndex.intersect = (struct __pyx_obj_6pandas_7_sparse_BlockIndex *(*)(struct __pyx_obj_6pandas_7_sparse_BlockIndex *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch))__pyx_f_6pandas_7_sparse_10BlockIndex_intersect;
  __pyx_vtable_6pandas_7_sparse_BlockIndex.make_union = (struct __pyx_obj_6pandas_7_sparse_BlockIndex *(*)(struct __pyx_obj_6pandas_7_sparse_BlockIndex *, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch))__pyx_f_6pandas_7_sparse_10BlockIndex_make_union;
  __pyx_vtable_6pandas_7_sparse_BlockIndex.lookup = (PyObject *(*)(struct __pyx_obj_6pandas_7_sparse_BlockIndex *, Py_ssize_t, int __pyx_skip_dispatch))__pyx_f_6pandas_7_sparse_10BlockIndex_lookup;
  __pyx_vtable_6pandas_7_sparse_BlockIndex.reindex = (PyArrayObject *(*)(struct __pyx_obj_6pandas_7_sparse_BlockIndex *, PyArrayObject *, __pyx_t_5numpy_float64_t, struct __pyx_obj_6pandas_7_sparse_SparseIndex *, int __pyx_skip_dispatch))__pyx_f_6pandas_7_sparse_10BlockIndex_reindex;
  __pyx_vtable_6pandas_7_sparse_BlockIndex.put = (PyObject *(*)(struct __pyx_obj_6pandas_7_sparse_BlockIndex *, PyArrayObject *, PyArrayObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_6pandas_7_sparse_10BlockIndex_put;
  __pyx_vtable_6pandas_7_sparse_BlockIndex.take = (PyObject *(*)(struct __pyx_obj_6pandas_7_sparse_BlockIndex *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_6pandas_7_sparse_10BlockIndex_take;
  __pyx_type_6pandas_7_sparse_BlockIndex.tp_base = __pyx_ptype_6pandas_7_sparse_SparseIndex;
  if (PyType_Ready(&__pyx_type_6pandas_7_sparse_BlockIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_6pandas_7_sparse_BlockIndex.tp_dict, __pyx_vtabptr_6pandas_7_sparse_BlockIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "BlockIndex", (PyObject *)&__pyx_type_6pandas_7_sparse_BlockIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_type_6pandas_7_sparse_BlockIndex.tp_weaklistoffset == 0) __pyx_type_6pandas_7_sparse_BlockIndex.tp_weaklistoffset = offsetof(struct __pyx_obj_6pandas_7_sparse_BlockIndex, __weakref__);
  __pyx_ptype_6pandas_7_sparse_BlockIndex = &__pyx_type_6pandas_7_sparse_BlockIndex;
  __pyx_vtabptr_6pandas_7_sparse_BlockMerge = &__pyx_vtable_6pandas_7_sparse_BlockMerge;
  __pyx_vtable_6pandas_7_sparse_BlockMerge._make_merged_blocks = (PyObject *(*)(struct __pyx_obj_6pandas_7_sparse_BlockMerge *))__pyx_f_6pandas_7_sparse_10BlockMerge__make_merged_blocks;
  __pyx_vtable_6pandas_7_sparse_BlockMerge._set_current_indices = (PyObject *(*)(struct __pyx_obj_6pandas_7_sparse_BlockMerge *, __pyx_t_5numpy_int32_t, __pyx_t_5numpy_int32_t, int))__pyx_f_6pandas_7_sparse_10BlockMerge__set_current_indices;
  if (PyType_Ready(&__pyx_type_6pandas_7_sparse_BlockMerge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_6pandas_7_sparse_BlockMerge.tp_dict, __pyx_vtabptr_6pandas_7_sparse_BlockMerge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "BlockMerge", (PyObject *)&__pyx_type_6pandas_7_sparse_BlockMerge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6pandas_7_sparse_BlockMerge = &__pyx_type_6pandas_7_sparse_BlockMerge;
  __pyx_vtabptr_6pandas_7_sparse_BlockIntersection = &__pyx_vtable_6pandas_7_sparse_BlockIntersection;
  __pyx_vtable_6pandas_7_sparse_BlockIntersection.__pyx_base = *__pyx_vtabptr_6pandas_7_sparse_BlockMerge;
  __pyx_type_6pandas_7_sparse_BlockIntersection.tp_base = __pyx_ptype_6pandas_7_sparse_BlockMerge;
  if (PyType_Ready(&__pyx_type_6pandas_7_sparse_BlockIntersection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_6pandas_7_sparse_BlockIntersection.tp_dict, __pyx_vtabptr_6pandas_7_sparse_BlockIntersection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "BlockIntersection", (PyObject *)&__pyx_type_6pandas_7_sparse_BlockIntersection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6pandas_7_sparse_BlockIntersection = &__pyx_type_6pandas_7_sparse_BlockIntersection;
  __pyx_vtabptr_6pandas_7_sparse_BlockUnion = &__pyx_vtable_6pandas_7_sparse_BlockUnion;
  __pyx_vtable_6pandas_7_sparse_BlockUnion.__pyx_base = *__pyx_vtabptr_6pandas_7_sparse_BlockMerge;
  __pyx_vtable_6pandas_7_sparse_BlockUnion.__pyx_base._make_merged_blocks = (PyObject *(*)(struct __pyx_obj_6pandas_7_sparse_BlockMerge *))__pyx_f_6pandas_7_sparse_10BlockUnion__make_merged_blocks;
  __pyx_vtable_6pandas_7_sparse_BlockUnion._find_next_block_end = (__pyx_t_5numpy_int32_t (*)(struct __pyx_obj_6pandas_7_sparse_BlockUnion *, int))__pyx_f_6pandas_7_sparse_10BlockUnion__find_next_block_end;
  __pyx_type_6pandas_7_sparse_BlockUnion.tp_base = __pyx_ptype_6pandas_7_sparse_BlockMerge;
  if (PyType_Ready(&__pyx_type_6pandas_7_sparse_BlockUnion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_6pandas_7_sparse_BlockUnion.tp_dict, __pyx_vtabptr_6pandas_7_sparse_BlockUnion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "BlockUnion", (PyObject *)&__pyx_type_6pandas_7_sparse_BlockUnion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6pandas_7_sparse_BlockUnion = &__pyx_type_6pandas_7_sparse_BlockUnion;
  /*--- Type import code ---*/
  __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 156; __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[1]; __pyx_lineno = 166; __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[1]; __pyx_lineno = 170; __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[1]; __pyx_lineno = 179; __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[1]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "pandas/src/sparse.pyx":6
 * cimport cython
 * 
 * import numpy as np             # <<<<<<<<<<<<<<
 * import operator
 * import sys
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/sparse.pyx":7
 * 
 * import numpy as np
 * import operator             # <<<<<<<<<<<<<<
 * import sys
 * 
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__operator), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__operator, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/sparse.pyx":8
 * import numpy as np
 * import operator
 * import sys             # <<<<<<<<<<<<<<
 * 
 * np.import_array()
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/sparse.pyx":10
 * import sys
 * 
 * np.import_array()             # <<<<<<<<<<<<<<
 * np.import_ufunc()
 * 
 */
  import_array();

  /* "pandas/src/sparse.pyx":11
 * 
 * np.import_array()
 * np.import_ufunc()             # <<<<<<<<<<<<<<
 * 
 * #-------------------------------------------------------------------------------
 */
  import_ufunc();

  /* "pandas/src/sparse.pyx":16
 * # Preamble stuff
 * 
 * cdef float64_t NaN = <float64_t> np.NaN             # <<<<<<<<<<<<<<
 * cdef float64_t INF = <float64_t> np.inf
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__NaN); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_6pandas_7_sparse_NaN = ((__pyx_t_5numpy_float64_t)__pyx_t_3);

  /* "pandas/src/sparse.pyx":17
 * 
 * cdef float64_t NaN = <float64_t> np.NaN
 * cdef float64_t INF = <float64_t> np.inf             # <<<<<<<<<<<<<<
 * 
 * cdef inline int int_max(int a, int b): return a if a >= b else b
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__inf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_6pandas_7_sparse_INF = ((__pyx_t_5numpy_float64_t)__pyx_t_3);

  /* "pandas/src/sparse.pyx":80
 * 
 *     @property
 *     def ngaps(self):             # <<<<<<<<<<<<<<
 *         return self.length - self.npoints
 * 
 */
  __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_6pandas_7_sparse_IntIndex, __pyx_n_s__ngaps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6pandas_7_sparse_IntIndex->tp_dict, __pyx_n_s__ngaps, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_6pandas_7_sparse_IntIndex);

  /* "pandas/src/sparse.pyx":304
 * 
 *     @property
 *     def ngaps(self):             # <<<<<<<<<<<<<<
 *         return self.length - self.npoints
 * 
 */
  __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_6pandas_7_sparse_BlockIndex, __pyx_n_s__ngaps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6pandas_7_sparse_BlockIndex->tp_dict, __pyx_n_s__ngaps, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_6pandas_7_sparse_BlockIndex);

  /* "pandas/src/sparse.pyx":1060
 *     return sparse_nancombine(x, xindex, y, yindex, __rdiv)
 * 
 * sparse_nantruediv = sparse_nandiv             # <<<<<<<<<<<<<<
 * sparse_nanrtruediv = sparse_nanrdiv
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sparse_nandiv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sparse_nantruediv, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/sparse.pyx":1061
 * 
 * sparse_nantruediv = sparse_nandiv
 * sparse_nanrtruediv = sparse_nanrdiv             # <<<<<<<<<<<<<<
 * 
 * cpdef sparse_nanfloordiv(ndarray x, SparseIndex xindex,
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sparse_nanrdiv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sparse_nanrtruediv, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/sparse.pyx":1109
 *                              y, yindex, yfill, __rdiv)
 * 
 * sparse_truediv = sparse_div             # <<<<<<<<<<<<<<
 * sparse_rtruediv = sparse_rdiv
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sparse_div); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sparse_truediv, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/sparse.pyx":1110
 * 
 * sparse_truediv = sparse_div
 * sparse_rtruediv = sparse_rdiv             # <<<<<<<<<<<<<<
 * 
 * cpdef sparse_floordiv(ndarray x, SparseIndex xindex, float64_t xfill,
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sparse_rdiv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sparse_rtruediv, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/sparse.pyx":1136
 * # Indexing operations
 * 
 * def get_reindexer(ndarray[object, ndim=1] values, dict index_map):             # <<<<<<<<<<<<<<
 *     cdef object idx
 *     cdef Py_ssize_t i
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_7_sparse_21get_reindexer, NULL, __pyx_n_s_32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_reindexer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/sparse.pyx":1183
 * 
 * 
 * def reindex_integer(ndarray[float64_t, ndim=1] values,             # <<<<<<<<<<<<<<
 *                     IntIndex sparse_index,
 *                     ndarray[int32_t, ndim=1] indexer):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_7_sparse_22reindex_integer, NULL, __pyx_n_s_32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__reindex_integer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/sparse.pyx":1
 * from numpy cimport ndarray, int32_t, float64_t             # <<<<<<<<<<<<<<
 * cimport numpy as np
 * 
 */
  __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(((PyObject *)__pyx_t_1));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  /* "numpy.pxd":976
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__pyx_m) {
    __Pyx_AddTraceback("init pandas._sparse", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init pandas._sparse");
  }
  __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 /* CYTHON_REFNANNY */

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result) {
        if (dict != __pyx_b) {
            PyErr_Clear();
            result = PyObject_GetAttr(__pyx_b, name);
        }
        if (!result) {
            PyErr_SetObject(PyExc_NameError, name);
        }
    }
    return result;
}

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,
                 "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
        #else
        if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key)))
        #endif
            goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    return 0;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
    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);
}

static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
    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;
}


#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    /* cause is unused */
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        /* Normalize to raise <class>, <instance> */
        Py_DECREF(value);
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                type = 0;
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            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;
            }
        #endif
    }

    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

#else /* Python 3+ */

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    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)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }

    if (cause) {
        PyObject *fixed_cause;
        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;
        }
        if (!value) {
            value = PyObject_CallObject(type, NULL);
        }
        PyException_SetCause(value, fixed_cause);
    }

    PyErr_SetObject(type, value);

    if (tb) {
        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);
        }
    }

bad:
    return;
}
#endif

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_AS_STRING(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;
        } else {
            #if PY_MAJOR_VERSION < 3
            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
            #else
            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
            #endif
                goto invalid_keyword_type;
            } else {
                for (name = first_kw_arg; *name; name++) {
                    #if PY_MAJOR_VERSION >= 3
                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                        PyUnicode_Compare(**name, key) == 0) break;
                    #else
                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                        _PyString_Eq(**name, key)) break;
                    #endif
                }
                if (*name) {
                    values[name-argnames] = value;
                } else {
                    /* unexpected keyword found */
                    for (name=argnames; name != first_kw_arg; name++) {
                        if (**name == key) goto arg_passed_twice;
                        #if PY_MAJOR_VERSION >= 3
                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
                        #else
                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                            _PyString_Eq(**name, key)) goto arg_passed_twice;
                        #endif
                    }
                    if (kwds2) {
                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                    } else {
                        goto invalid_keyword;
                    }
                }
            }
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_Format(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 void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected);
}

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else if (PyErr_Occurred()) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
}

static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
  unsigned int n = 1;
  return *(unsigned char*)(&n) != 0;
}

typedef struct {
  __Pyx_StructField root;
  __Pyx_BufFmt_StackElem* head;
  size_t fmt_offset;
  size_t new_count, enc_count;
  int is_complex;
  char enc_type;
  char new_packmode;
  char enc_packmode;
} __Pyx_BufFmt_Context;

static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type) {
  stack[0].field = &ctx->root;
  stack[0].parent_offset = 0;
  ctx->root.type = type;
  ctx->root.name = "buffer dtype";
  ctx->root.offset = 0;
  ctx->head = stack;
  ctx->head->field = &ctx->root;
  ctx->fmt_offset = 0;
  ctx->head->parent_offset = 0;
  ctx->new_packmode = '@';
  ctx->enc_packmode = '@';
  ctx->new_count = 1;
  ctx->enc_count = 0;
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  while (type->typegroup == 'S') {
    ++ctx->head;
    ctx->head->field = type->fields;
    ctx->head->parent_offset = 0;
    type = type->fields->type;
  }
}

static int __Pyx_BufFmt_ParseNumber(const char** ts) {
    int count;
    const char* t = *ts;
    if (*t < '0' || *t > '9') {
      return -1;
    } else {
        count = *t++ - '0';
        while (*t >= '0' && *t < '9') {
            count *= 10;
            count += *t++ - '0';
        }
    }
    *ts = t;
    return count;
}

static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  PyErr_Format(PyExc_ValueError,
               "Unexpected format string character: '%c'", ch);
}

static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  switch (ch) {
    case 'b': return "'char'";
    case 'B': return "'unsigned char'";
    case 'h': return "'short'";
    case 'H': return "'unsigned short'";
    case 'i': return "'int'";
    case 'I': return "'unsigned int'";
    case 'l': return "'long'";
    case 'L': return "'unsigned long'";
    case 'q': return "'long long'";
    case 'Q': return "'unsigned long long'";
    case 'f': return (is_complex ? "'complex float'" : "'float'");
    case 'd': return (is_complex ? "'complex double'" : "'double'");
    case 'g': return (is_complex ? "'complex long double'" : "'long double'");
    case 'T': return "a struct";
    case 'O': return "Python object";
    case 'P': return "a pointer";
    case 0: return "end";
    default: return "unparseable format string";
  }
}

static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': return 1;
    case 'h': case 'H': return 2;
    case 'i': case 'I': case 'l': case 'L': return 4;
    case 'q': case 'Q': return 8;
    case 'f': return (is_complex ? 8 : 4);
    case 'd': return (is_complex ? 16 : 8);
    case 'g': {
      PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
      return 0;
    }
    case 'O': case 'P': return sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}

static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  switch (ch) {
    case 'c': case 'b': case 'B': return 1;
    case 'h': case 'H': return sizeof(short);
    case 'i': case 'I': return sizeof(int);
    case 'l': case 'L': return sizeof(long);
    #ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
    #endif
    case 'f': return sizeof(float) * (is_complex ? 2 : 1);
    case 'd': return sizeof(double) * (is_complex ? 2 : 1);
    case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
    case 'O': case 'P': return sizeof(void*);
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}

typedef struct { char c; short x; } __Pyx_st_short;
typedef struct { char c; int x; } __Pyx_st_int;
typedef struct { char c; long x; } __Pyx_st_long;
typedef struct { char c; float x; } __Pyx_st_float;
typedef struct { char c; double x; } __Pyx_st_double;
typedef struct { char c; long double x; } __Pyx_st_longdouble;
typedef struct { char c; void *x; } __Pyx_st_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
#endif

static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': return 1;
    case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}

static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  switch (ch) {
    case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I';
    case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U';
    case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R');
    case 'O': return 'O';
    case 'P': return 'P';
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}

static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
    const char* expected;
    const char* quote;
    if (ctx->head == NULL) {
      expected = "end";
      quote = "";
    } else {
      expected = ctx->head->field->type->name;
      quote = "'";
    }
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected %s%s%s but got %s",
                 quote, expected, quote,
                 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  } else {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_StructField* parent = (ctx->head - 1)->field;
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
                 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
                 parent->type->name, field->name);
  }
}

static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  char group;
  size_t size, offset;
  if (ctx->enc_type == 0) return 0;
  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  do {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_TypeInfo* type = field->type;

    if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
    } else {
      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
    }
    if (ctx->enc_packmode == '@') {
      size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
      size_t align_mod_offset;
      if (align_at == 0) return -1;
      align_mod_offset = ctx->fmt_offset % align_at;
      if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
    }

    if (type->size != size || type->typegroup != group) {
      if (type->typegroup == 'C' && type->fields != NULL) {
        /* special case -- treat as struct rather than complex number */
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        ++ctx->head;
        ctx->head->field = type->fields;
        ctx->head->parent_offset = parent_offset;
        continue;
      }

      __Pyx_BufFmt_RaiseExpected(ctx);
      return -1;
    }

    offset = ctx->head->parent_offset + field->offset;
    if (ctx->fmt_offset != offset) {
      PyErr_Format(PyExc_ValueError,
                   "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d but %"PY_FORMAT_SIZE_T"d expected",
                   (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
      return -1;
    }

    ctx->fmt_offset += size;

    --ctx->enc_count; /* Consume from buffer string */

    /* Done checking, move to next field, pushing or popping struct stack if needed */
    while (1) {
      if (field == &ctx->root) {
        ctx->head = NULL;
        if (ctx->enc_count != 0) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
        }
        break; /* breaks both loops as ctx->enc_count == 0 */
      }
      ctx->head->field = ++field;
      if (field->type == NULL) {
        --ctx->head;
        field = ctx->head->field;
        continue;
      } else if (field->type->typegroup == 'S') {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        if (field->type->fields->type == NULL) continue; /* empty struct */
        field = field->type->fields;
        ++ctx->head;
        ctx->head->field = field;
        ctx->head->parent_offset = parent_offset;
        break;
      } else {
        break;
      }
    }
  } while (ctx->enc_count);
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  return 0;
}

static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  int got_Z = 0;
  while (1) {
    switch(*ts) {
      case 0:
        if (ctx->enc_type != 0 && ctx->head == NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        if (ctx->head != NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        return ts;
      case ' ':
      case 10:
      case 13:
        ++ts;
        break;
      case '<':
        if (!__Pyx_IsLittleEndian()) {
          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '>':
      case '!':
        if (__Pyx_IsLittleEndian()) {
          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '=':
      case '@':
      case '^':
        ctx->new_packmode = *ts++;
        break;
      case 'T': /* substruct */
        {
          const char* ts_after_sub;
          size_t i, struct_count = ctx->new_count;
          ctx->new_count = 1;
          ++ts;
          if (*ts != '{') {
            PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
            return NULL;
          }
          ++ts;
          ts_after_sub = ts;
          for (i = 0; i != struct_count; ++i) {
            ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
            if (!ts_after_sub) return NULL;
          }
          ts = ts_after_sub;
        }
        break;
      case '}': /* end of substruct; either repeat or move on */
        ++ts;
        return ts;
      case 'x':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->fmt_offset += ctx->new_count;
        ctx->new_count = 1;
        ctx->enc_count = 0;
        ctx->enc_type = 0;
        ctx->enc_packmode = ctx->new_packmode;
        ++ts;
        break;
      case 'Z':
        got_Z = 1;
        ++ts;
        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
          return NULL;
        }        /* fall through */
      case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
      case 'l': case 'L': case 'q': case 'Q':
      case 'f': case 'd': case 'g':
      case 'O':
        if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
            ctx->enc_packmode == ctx->new_packmode) {
          /* Continue pooling same type */
          ctx->enc_count += ctx->new_count;
        } else {
          /* New type */
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_count = ctx->new_count;
          ctx->enc_packmode = ctx->new_packmode;
          ctx->enc_type = *ts;
          ctx->is_complex = got_Z;
        }
        ++ts;
        ctx->new_count = 1;
        got_Z = 0;
        break;
      case ':':
        ++ts;
        while(*ts != ':') ++ts;
        ++ts;
        break;
      default:
        {
          int number = __Pyx_BufFmt_ParseNumber(&ts);
          if (number == -1) { /* First char was not a digit */
            PyErr_Format(PyExc_ValueError,
                         "Does not understand character buffer dtype format string ('%c')", *ts);
            return NULL;
          }
          ctx->new_count = (size_t)number; 
        }
    }
  }
}

static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
  buf->buf = NULL;
  buf->obj = NULL;
  buf->strides = __Pyx_zeros;
  buf->shape = __Pyx_zeros;
  buf->suboffsets = __Pyx_minusones;
}

static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) {
  if (obj == Py_None || obj == NULL) {
    __Pyx_ZeroBuffer(buf);
    return 0;
  }
  buf->buf = NULL;
  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
  if (buf->ndim != nd) {
    PyErr_Format(PyExc_ValueError,
                 "Buffer has wrong number of dimensions (expected %d, got %d)",
                 nd, buf->ndim);
    goto fail;
  }
  if (!cast) {
    __Pyx_BufFmt_Context ctx;
    __Pyx_BufFmt_Init(&ctx, stack, dtype);
    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
  }
  if ((unsigned)buf->itemsize != dtype->size) {
    PyErr_Format(PyExc_ValueError,
      "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)",
      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
    goto fail;
  }
  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
  return 0;
fail:;
  __Pyx_ZeroBuffer(buf);
  return -1;
}

static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
  if (info->buf == NULL) return;
  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
  __Pyx_ReleaseBuffer(info);
}

static void __Pyx_RaiseBufferFallbackError(void) {
  PyErr_Format(PyExc_ValueError,
     "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
}

static void __Pyx_RaiseBufferIndexError(int axis) {
  PyErr_Format(PyExc_IndexError,
     "Out of bounds on buffer access (axis %d)", axis);
}


static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (Py_TYPE(obj) == type) return 1;
    }
    else {
        if (PyObject_TypeCheck(obj, type)) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable");
}

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
  #if PY_VERSION_HEX >= 0x02060000
  if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
  #endif
  if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags);
  else {
  PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
  return -1;
    }
}

static void __Pyx_ReleaseBuffer(Py_buffer *view) {
  PyObject* obj = view->obj;
  if (obj) {
    #if PY_VERSION_HEX >= 0x02060000
    if (PyObject_CheckBuffer(obj)) {PyBuffer_Release(view); return;}
    #endif
    if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray_1__releasebuffer__(obj, view);
    Py_DECREF(obj);
    view->obj = NULL;
  }
}

#endif

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
    PyObject *py_import = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
    if (!py_import)
        goto bad;
    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_VERSION_HEX >= 0x02050000
    {
        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
    if (level>0) {
        PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
        goto bad;
    }
    module = PyObject_CallFunctionObjArgs(py_import,
        name, global_dict, empty_dict, list, NULL);
    #endif
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(py_import);
    Py_XDECREF(empty_dict);
    return module;
}

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32 val) {
    const npy_int32 neg_one = (npy_int32)-1, const_zero = (npy_int32)0;
    const int is_unsigned = const_zero < neg_one;
    if ((sizeof(npy_int32) == sizeof(char))  ||
        (sizeof(npy_int32) == sizeof(short))) {
        return PyInt_FromLong((long)val);
    } else if ((sizeof(npy_int32) == sizeof(int)) ||
               (sizeof(npy_int32) == sizeof(long))) {
        if (is_unsigned)
            return PyLong_FromUnsignedLong((unsigned long)val);
        else
            return PyInt_FromLong((long)val);
    } else if (sizeof(npy_int32) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
        else
            return PyLong_FromLongLong((PY_LONG_LONG)val);
    } else {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        return _PyLong_FromByteArray(bytes, sizeof(npy_int32),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject* x) {
    const npy_int32 neg_one = (npy_int32)-1, const_zero = (npy_int32)0;
    const int is_unsigned = const_zero < neg_one;
    if (sizeof(npy_int32) == sizeof(char)) {
        if (is_unsigned)
            return (npy_int32)__Pyx_PyInt_AsUnsignedChar(x);
        else
            return (npy_int32)__Pyx_PyInt_AsSignedChar(x);
    } else if (sizeof(npy_int32) == sizeof(short)) {
        if (is_unsigned)
            return (npy_int32)__Pyx_PyInt_AsUnsignedShort(x);
        else
            return (npy_int32)__Pyx_PyInt_AsSignedShort(x);
    } else if (sizeof(npy_int32) == sizeof(int)) {
        if (is_unsigned)
            return (npy_int32)__Pyx_PyInt_AsUnsignedInt(x);
        else
            return (npy_int32)__Pyx_PyInt_AsSignedInt(x);
    } else if (sizeof(npy_int32) == sizeof(long)) {
        if (is_unsigned)
            return (npy_int32)__Pyx_PyInt_AsUnsignedLong(x);
        else
            return (npy_int32)__Pyx_PyInt_AsSignedLong(x);
    } else if (sizeof(npy_int32) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return (npy_int32)__Pyx_PyInt_AsUnsignedLongLong(x);
        else
            return (npy_int32)__Pyx_PyInt_AsSignedLongLong(x);
    }  else {
        npy_int32 val;
        PyObject *v = __Pyx_PyNumber_Int(x);
        #if PY_VERSION_HEX < 0x03000000
        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;
        }
        return (npy_int32)-1;
    }
}

#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 CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned char" :
                    "value too large to convert to unsigned char");
            }
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned short" :
                    "value too large to convert to unsigned short");
            }
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned int" :
                    "value too large to convert to unsigned int");
            }
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    const char neg_one = (char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to char" :
                    "value too large to convert to char");
            }
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    const short neg_one = (short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to short" :
                    "value too large to convert to short");
            }
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    const signed char neg_one = (signed char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed char" :
                    "value too large to convert to signed char");
            }
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    const signed short neg_one = (signed short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed short" :
                    "value too large to convert to signed short");
            }
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    const signed int neg_one = (signed int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed int" :
                    "value too large to convert to signed int");
            }
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long)-1;
            }
            return (unsigned long)PyLong_AsUnsignedLong(x);
        } else {
            return (unsigned long)PyLong_AsLong(x);
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned PY_LONG_LONG");
                return (unsigned PY_LONG_LONG)-1;
            }
            return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
    const long neg_one = (long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to long");
            return (long)-1;
        }
        return (long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long)-1;
            }
            return (long)PyLong_AsUnsignedLong(x);
        } else {
            return (long)PyLong_AsLong(x);
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to PY_LONG_LONG");
            return (PY_LONG_LONG)-1;
        }
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to PY_LONG_LONG");
                return (PY_LONG_LONG)-1;
            }
            return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
    const signed long neg_one = (signed long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed long");
            return (signed long)-1;
        }
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed long");
                return (signed long)-1;
            }
            return (signed long)PyLong_AsUnsignedLong(x);
        } else {
            return (signed long)PyLong_AsLong(x);
        }
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed PY_LONG_LONG");
            return (signed PY_LONG_LONG)-1;
        }
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed PY_LONG_LONG");
                return (signed PY_LONG_LONG)-1;
            }
            return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    #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 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);
        #if PY_VERSION_HEX < 0x02050000
        return PyErr_Warn(NULL, message);
        #else
        return PyErr_WarnEx(NULL, message, 1);
        #endif
    }
    return 0;
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

#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_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    #if PY_MAJOR_VERSION < 3
    py_name = PyString_FromString(class_name);
    #else
    py_name = PyUnicode_FromString(class_name);
    #endif
    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,
            "%s.%s is not a type object",
            module_name, class_name);
        goto bad;
    }
    if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility",
            module_name, class_name);
        #if PY_VERSION_HEX < 0x02050000
        if (PyErr_Warn(NULL, warning) < 0) goto bad;
        #else
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
        #endif
    }
    else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) {
        PyErr_Format(PyExc_ValueError,
            "%s.%s 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

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

    #if PY_MAJOR_VERSION < 3
    py_name = PyString_FromString(name);
    #else
    py_name = PyUnicode_FromString(name);
    #endif
    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

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
                               int __pyx_lineno, const char *__pyx_filename) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;

    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(__pyx_filename);
    #else
    py_srcfile = PyUnicode_FromString(__pyx_filename);
    #endif
    if (!py_srcfile) goto bad;
    if (__pyx_clineno) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #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_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        #if PY_MAJOR_VERSION >= 3
        0,            /*int kwonlyargcount,*/
        #endif
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __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,*/
        __pyx_lineno,   /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

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  /* Python 3+ has unicode identifiers */
        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;
}

/* Type Conversion Functions */

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_VERSION_HEX < 0x03000000
  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_VERSION_HEX < 0x03000000
  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_VERSION_HEX < 0x03000000
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (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 = 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) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}

static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
       return (size_t)-1;
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
