/* Generated by Cython 0.12.1 on Mon May 10 16:11:33 2010 */

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

#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#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)   PyInt_AsLong(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 PyString_Type                PyUnicode_Type
  #define PyString_CheckExact          PyUnicode_CheckExact
#else
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_CheckExact           PyString_CheckExact
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define __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
  #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func)
#endif

#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#else
  #define _USE_MATH_DEFINES
#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
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>
#define __PYX_HAVE_API__tseries
#include "stdlib.h"
#include "stdio.h"
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#include "math.h"
#include "cobject.h"
#include "datetime.h"
#include "wirth.h"

#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #else
    #define CYTHON_INLINE 
  #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 */

#if PY_MAJOR_VERSION < 3
#define __Pyx_PyBytes_FromString          PyString_FromString
#define __Pyx_PyBytes_FromStringAndSize   PyString_FromStringAndSize
#define __Pyx_PyBytes_AsString            PyString_AsString
#else
#define __Pyx_PyBytes_FromString          PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize   PyBytes_FromStringAndSize
#define __Pyx_PyBytes_AsString            PyBytes_AsString
#endif

#define __Pyx_PyBytes_FromUString(s)      __Pyx_PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s)        ((unsigned char*) __Pyx_PyBytes_AsString(s))

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

#if !defined(T_PYSSIZET)
#if PY_VERSION_HEX < 0x02050000
#define T_PYSSIZET T_INT
#elif !defined(T_LONGLONG)
#define T_PYSSIZET \
        ((sizeof(Py_ssize_t) == sizeof(int))  ? T_INT  : \
        ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1))
#else
#define T_PYSSIZET \
        ((sizeof(Py_ssize_t) == sizeof(int))          ? T_INT      : \
        ((sizeof(Py_ssize_t) == sizeof(long))         ? T_LONG     : \
        ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))
#endif
#endif


#if !defined(T_ULONGLONG)
#define __Pyx_T_UNSIGNED_INT(x) \
        ((sizeof(x) == sizeof(unsigned char))  ? T_UBYTE : \
        ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \
        ((sizeof(x) == sizeof(unsigned int))   ? T_UINT : \
        ((sizeof(x) == sizeof(unsigned long))  ? T_ULONG : -1))))
#else
#define __Pyx_T_UNSIGNED_INT(x) \
        ((sizeof(x) == sizeof(unsigned char))  ? T_UBYTE : \
        ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \
        ((sizeof(x) == sizeof(unsigned int))   ? T_UINT : \
        ((sizeof(x) == sizeof(unsigned long))  ? T_ULONG : \
        ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))))
#endif
#if !defined(T_LONGLONG)
#define __Pyx_T_SIGNED_INT(x) \
        ((sizeof(x) == sizeof(char))  ? T_BYTE : \
        ((sizeof(x) == sizeof(short)) ? T_SHORT : \
        ((sizeof(x) == sizeof(int))   ? T_INT : \
        ((sizeof(x) == sizeof(long))  ? T_LONG : -1))))
#else
#define __Pyx_T_SIGNED_INT(x) \
        ((sizeof(x) == sizeof(char))  ? T_BYTE : \
        ((sizeof(x) == sizeof(short)) ? T_SHORT : \
        ((sizeof(x) == sizeof(int))   ? T_INT : \
        ((sizeof(x) == sizeof(long))  ? T_LONG : \
        ((sizeof(x) == sizeof(PY_LONG_LONG))   ? T_LONGLONG : -1)))))
#endif

#define __Pyx_T_FLOATING(x) \
        ((sizeof(x) == sizeof(float)) ? T_FLOAT : \
        ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1))

#if !defined(T_SIZET)
#if !defined(T_ULONGLONG)
#define T_SIZET \
        ((sizeof(size_t) == sizeof(unsigned int))  ? T_UINT  : \
        ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1))
#else
#define T_SIZET \
        ((sizeof(size_t) == sizeof(unsigned int))          ? T_UINT      : \
        ((sizeof(size_t) == sizeof(unsigned long))         ? T_ULONG     : \
        ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))
#endif
#endif

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;
static const char **__pyx_f;


#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

typedef npy_int8 __pyx_t_5numpy_int8_t;

typedef npy_int16 __pyx_t_5numpy_int16_t;

typedef npy_int32 __pyx_t_5numpy_int32_t;

typedef npy_int64 __pyx_t_5numpy_int64_t;

typedef npy_uint8 __pyx_t_5numpy_uint8_t;

typedef npy_uint16 __pyx_t_5numpy_uint16_t;

typedef npy_uint32 __pyx_t_5numpy_uint32_t;

typedef npy_uint64 __pyx_t_5numpy_uint64_t;

typedef npy_float32 __pyx_t_5numpy_float32_t;

typedef npy_float64 __pyx_t_5numpy_float64_t;

typedef npy_long __pyx_t_5numpy_int_t;

typedef npy_longlong __pyx_t_5numpy_long_t;

typedef npy_intp __pyx_t_5numpy_intp_t;

typedef npy_uintp __pyx_t_5numpy_uintp_t;

typedef npy_ulong __pyx_t_5numpy_uint_t;

typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

typedef npy_double __pyx_t_5numpy_float_t;

typedef npy_double __pyx_t_5numpy_double_t;

typedef npy_longdouble __pyx_t_5numpy_longdouble_t;

typedef unsigned char __pyx_t_7tseries_UChar;

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

typedef npy_cfloat __pyx_t_5numpy_cfloat_t;

typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;

typedef npy_cdouble __pyx_t_5numpy_complex_t;

typedef double (*__pyx_t_7tseries_double_func)(double, double);

/* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":48
 * NIL = Node(np.inf, [], np.array([])) # Singleton terminator node
 * 
 * cdef class IndexableSkiplist:             # <<<<<<<<<<<<<<
 *     '''
 *     Sorted collection supporting O(lg n) insertion, removal, and lookup by rank.
 */

struct __pyx_obj_7tseries_IndexableSkiplist {
  PyObject_HEAD
  int size;
  int maxlevels;
  struct __pyx_obj_7tseries_Node *head;
};

/* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":30
 * import_array()
 * 
 * cdef class Node:             # <<<<<<<<<<<<<<
 * 
 *     cdef public:
 */

struct __pyx_obj_7tseries_Node {
  PyObject_HEAD
  double value;
  PyObject *next;
  PyArrayObject *width_arr;
  int *width;
};

#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) {
    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;
  }
  #define __Pyx_RefNannySetupContext(name)           void *__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_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
#else
  #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_XDECREF(r) Py_XDECREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*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 void __Pyx_SafeReleaseBuffer(Py_buffer* info);
static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/
#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)

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 CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name, PyObject* kw_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 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 PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}


#define __Pyx_GetItemInt_List(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
            PyObject *r = PyList_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
}

#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
}


#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
    PyObject *r;
    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
        r = PySequence_GetItem(o, i);
    }
    else {
        r = __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
    }
    return r;
}

#define __Pyx_SetItemInt(o, i, v, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_SetItemInt_Fast(o, i, v, size <= sizeof(long)) : \
                                                    __Pyx_SetItemInt_Generic(o, to_py_func(i), v))

static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (!j) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}

static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int fits_long) {
    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        Py_INCREF(v);
        Py_DECREF(PyList_GET_ITEM(o, i));
        PyList_SET_ITEM(o, i, v);
        return 1;
    }
    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0)))
        return PySequence_SetItem(o, i, v);
    else {
        PyObject *j = fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i);
        return __Pyx_SetItemInt_Generic(o, j, v);
    }
}

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

static CYTHON_INLINE long __Pyx_NegateNonNeg(long 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_RaiseNoneNotIterableError(void);

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

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

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void);

static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
static int __Pyx_EndUnpack(PyObject *); /*proto*/

static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/

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

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*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); /*proto*/

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

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

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))
    /*#define __Pyx_c_absf(z)     (::std::abs(z))*/
  #else
    #define __Pyx_c_is_zerof(z) ((z)==0)
    #define __Pyx_c_conjf(z)    (conjf(z))
    /*#define __Pyx_c_absf(z)     (cabsf(z))*/
 #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);
    /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/
#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))
    /*#define __Pyx_c_abs(z)     (::std::abs(z))*/
  #else
    #define __Pyx_c_is_zero(z) ((z)==0)
    #define __Pyx_c_conj(z)    (conj(z))
    /*#define __Pyx_c_abs(z)     (cabs(z))*/
 #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);
    /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/
#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 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); /*proto*/

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

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

static void __Pyx_AddTraceback(const char *funcname); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
/* Module declarations from python_buffer */

/* Module declarations from python_ref */

/* Module declarations from stdlib */

/* Module declarations from stdio */

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

/* Module declarations from python_dict */

/* Module declarations from python_float */

/* Module declarations from datetime */

/* Module declarations from tseries */

static PyTypeObject *__pyx_ptype_7tseries_datetime = 0;
static PyTypeObject *__pyx_ptype_7tseries_Node = 0;
static PyTypeObject *__pyx_ptype_7tseries_IndexableSkiplist = 0;
static double __pyx_v_7tseries_NaN;
static double __pyx_v_7tseries_INF;
static double __pyx_v_7tseries_NEGINF;
static CYTHON_INLINE PyObject *__pyx_f_7tseries_trycall(PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_7tseries_int_max(int, int); /*proto*/
static CYTHON_INLINE int __pyx_f_7tseries_int_min(int, int); /*proto*/
static int __pyx_f_7tseries_is_contiguous(PyArrayObject *); /*proto*/
static int __pyx_f_7tseries__contiguous_check(PyArrayObject *); /*proto*/
static __pyx_t_5numpy_int16_t *__pyx_f_7tseries_get_int16_ptr(PyArrayObject *); /*proto*/
static __pyx_t_5numpy_int32_t *__pyx_f_7tseries_get_int32_ptr(PyArrayObject *); /*proto*/
static __pyx_t_5numpy_int64_t *__pyx_f_7tseries_get_int64_ptr(PyArrayObject *); /*proto*/
static __pyx_t_5numpy_double_t *__pyx_f_7tseries_get_double_ptr(PyArrayObject *); /*proto*/
static PyObject *__pyx_f_7tseries_map_indices(PyArrayObject *, int __pyx_skip_dispatch); /*proto*/
static double __pyx_f_7tseries_Log2(double); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_7tseries__checknull(PyObject *); /*proto*/
static PyArrayObject *__pyx_f_7tseries__isnullobj(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_7tseries__isnan(PyObject *); /*proto*/
static PyObject *__pyx_f_7tseries__backfill(PyArrayObject *, PyArrayObject *, PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_7tseries__pad(PyArrayObject *, PyArrayObject *, PyObject *, PyObject *); /*proto*/
static double __pyx_f_7tseries___add(double, double); /*proto*/
static double __pyx_f_7tseries___sub(double, double); /*proto*/
static double __pyx_f_7tseries___div(double, double); /*proto*/
static double __pyx_f_7tseries___mul(double, double); /*proto*/
static double __pyx_f_7tseries___eq(double, double); /*proto*/
static double __pyx_f_7tseries___ne(double, double); /*proto*/
static double __pyx_f_7tseries___lt(double, double); /*proto*/
static double __pyx_f_7tseries___gt(double, double); /*proto*/
static double __pyx_f_7tseries___pow(double, double); /*proto*/
static PyArrayObject *__pyx_f_7tseries__applyFunc(__pyx_t_7tseries_double_func, PyArrayObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
static __Pyx_TypeInfo __Pyx_TypeInfo_object = { "Python object", NULL, sizeof(PyObject *), 'O' };
static __Pyx_TypeInfo __Pyx_TypeInfo_nn_npy_int8 = { "numpy.npy_int8", NULL, sizeof(npy_int8), 'I' };
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t = { "numpy.int8_t", NULL, sizeof(__pyx_t_5numpy_int8_t), 'I' };
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_double_t = { "numpy.double_t", NULL, sizeof(__pyx_t_5numpy_double_t), 'R' };
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "numpy.int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), 'I' };
#define __Pyx_MODULE_NAME "tseries"
int __pyx_module_is_main_tseries = 0;

/* Implementation of tseries */
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_min;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_max;
static PyObject *__pyx_builtin_RuntimeError;
static char __pyx_k_1[] = "Error calling func on index %s";
static char __pyx_k_2[] = "Tried to use data field on non-contiguous array!";
static char __pyx_k_3[] = "Not Found";
static char __pyx_k_4[] = "Don't recognize fillMethod: %s";
static char __pyx_k_5[] = "bad funcname requested of Cython code";
static char __pyx_k_6[] = "ndarray is not C contiguous";
static char __pyx_k_7[] = "ndarray is not Fortran contiguous";
static char __pyx_k_8[] = "Non-native byte order not supported";
static char __pyx_k_9[] = "unknown dtype code in numpy.pxd (%d)";
static char __pyx_k_10[] = "Format string allocated too short, see comment in numpy.pxd";
static char __pyx_k_11[] = "Format string allocated too short.";
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__S[] = "S";
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__Zd[] = "Zd";
static char __pyx_k__Zf[] = "Zf";
static char __pyx_k__Zg[] = "Zg";
static char __pyx_k__ao[] = "ao";
static char __pyx_k__bo[] = "bo";
static char __pyx_k__np[] = "np";
static char __pyx_k__NIL[] = "NIL";
static char __pyx_k__NaN[] = "NaN";
static char __pyx_k__PAD[] = "PAD";
static char __pyx_k__any[] = "any";
static char __pyx_k__buf[] = "buf";
static char __pyx_k__com[] = "com";
static char __pyx_k__get[] = "get";
static char __pyx_k__inf[] = "inf";
static char __pyx_k__max[] = "max";
static char __pyx_k__min[] = "min";
static char __pyx_k__obj[] = "obj";
static char __pyx_k__win[] = "win";
static char __pyx_k__aMap[] = "aMap";
static char __pyx_k__bMap[] = "bMap";
static char __pyx_k__base[] = "base";
static char __pyx_k__bool[] = "bool";
static char __pyx_k__data[] = "data";
static char __pyx_k__func[] = "func";
static char __pyx_k__head[] = "head";
static char __pyx_k__int8[] = "int8";
static char __pyx_k__kind[] = "kind";
static char __pyx_k__minp[] = "minp";
static char __pyx_k__name[] = "name";
static char __pyx_k__ndim[] = "ndim";
static char __pyx_k__next[] = "next";
static char __pyx_k__ones[] = "ones";
static char __pyx_k__size[] = "size";
static char __pyx_k__sqrt[] = "sqrt";
static char __pyx_k__type[] = "type";
static char __pyx_k___ewma[] = "_ewma";
static char __pyx_k__array[] = "array";
static char __pyx_k__descr[] = "descr";
static char __pyx_k__dtype[] = "dtype";
static char __pyx_k__empty[] = "empty";
static char __pyx_k__index[] = "index";
static char __pyx_k__input[] = "input";
static char __pyx_k__int32[] = "int32";
static char __pyx_k__isnan[] = "isnan";
static char __pyx_k__names[] = "names";
static char __pyx_k__numpy[] = "numpy";
static char __pyx_k__range[] = "range";
static char __pyx_k__shape[] = "shape";
static char __pyx_k__value[] = "value";
static char __pyx_k__width[] = "width";
static char __pyx_k__zeros[] = "zeros";
static char __pyx_k____eq__[] = "__eq__";
static char __pyx_k____gt__[] = "__gt__";
static char __pyx_k____lt__[] = "__lt__";
static char __pyx_k____ne__[] = "__ne__";
static char __pyx_k__arrmap[] = "arrmap";
static char __pyx_k__astype[] = "astype";
static char __pyx_k__fields[] = "fields";
static char __pyx_k__format[] = "format";
static char __pyx_k__insert[] = "insert";
static char __pyx_k__isnull[] = "isnull";
static char __pyx_k__mapper[] = "mapper";
static char __pyx_k__newMap[] = "newMap";
static char __pyx_k__oldMap[] = "oldMap";
static char __pyx_k__output[] = "output";
static char __pyx_k__random[] = "random";
static char __pyx_k__remove[] = "remove";
static char __pyx_k__values[] = "values";
static char __pyx_k__window[] = "window";
static char __pyx_k____add__[] = "__add__";
static char __pyx_k____div__[] = "__div__";
static char __pyx_k____mul__[] = "__mul__";
static char __pyx_k____pow__[] = "__pow__";
static char __pyx_k____sub__[] = "__sub__";
static char __pyx_k__asarray[] = "asarray";
static char __pyx_k__float64[] = "float64";
static char __pyx_k__object_[] = "object_";
static char __pyx_k__strides[] = "strides";
static char __pyx_k__BACKFILL[] = "BACKFILL";
static char __pyx_k__KeyError[] = "KeyError";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k__datetime[] = "datetime";
static char __pyx_k__isfinite[] = "isfinite";
static char __pyx_k__itemsize[] = "itemsize";
static char __pyx_k__newIndex[] = "newIndex";
static char __pyx_k__oldIndex[] = "oldIndex";
static char __pyx_k__readonly[] = "readonly";
static char __pyx_k__type_num[] = "type_num";
static char __pyx_k__Exception[] = "Exception";
static char __pyx_k___roll_sum[] = "_roll_sum";
static char __pyx_k___roll_var[] = "_roll_var";
static char __pyx_k__byteorder[] = "byteorder";
static char __pyx_k__maxlevels[] = "maxlevels";
static char __pyx_k__width_arr[] = "width_arr";
static char __pyx_k__ValueError[] = "ValueError";
static char __pyx_k___roll_kurt[] = "_roll_kurt";
static char __pyx_k___roll_mean[] = "_roll_mean";
static char __pyx_k___roll_skew[] = "_roll_skew";
static char __pyx_k__pydatetime[] = "pydatetime";
static char __pyx_k__suboffsets[] = "suboffsets";
static char __pyx_k__getMergeVec[] = "getMergeVec";
static char __pyx_k__rolling_var[] = "rolling_var";
static char __pyx_k__RuntimeError[] = "RuntimeError";
static char __pyx_k___roll_median[] = "_roll_median";
static char __pyx_k__expected_size[] = "expected_size";
static PyObject *__pyx_kp_s_1;
static PyObject *__pyx_kp_u_10;
static PyObject *__pyx_kp_u_11;
static PyObject *__pyx_kp_s_2;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_kp_s_4;
static PyObject *__pyx_kp_s_5;
static PyObject *__pyx_kp_u_6;
static PyObject *__pyx_kp_u_7;
static PyObject *__pyx_kp_u_8;
static PyObject *__pyx_kp_u_9;
static PyObject *__pyx_n_s__BACKFILL;
static PyObject *__pyx_n_s__Exception;
static PyObject *__pyx_n_s__KeyError;
static PyObject *__pyx_n_s__NIL;
static PyObject *__pyx_n_s__NaN;
static PyObject *__pyx_n_s__O;
static PyObject *__pyx_n_s__PAD;
static PyObject *__pyx_n_s__RuntimeError;
static PyObject *__pyx_n_s__S;
static PyObject *__pyx_n_s__ValueError;
static PyObject *__pyx_n_s____add__;
static PyObject *__pyx_n_s____div__;
static PyObject *__pyx_n_s____eq__;
static PyObject *__pyx_n_s____gt__;
static PyObject *__pyx_n_s____lt__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____mul__;
static PyObject *__pyx_n_s____ne__;
static PyObject *__pyx_n_s____pow__;
static PyObject *__pyx_n_s____sub__;
static PyObject *__pyx_n_s___ewma;
static PyObject *__pyx_n_s___roll_kurt;
static PyObject *__pyx_n_s___roll_mean;
static PyObject *__pyx_n_s___roll_median;
static PyObject *__pyx_n_s___roll_skew;
static PyObject *__pyx_n_s___roll_sum;
static PyObject *__pyx_n_s___roll_var;
static PyObject *__pyx_n_s__aMap;
static PyObject *__pyx_n_s__any;
static PyObject *__pyx_n_s__ao;
static PyObject *__pyx_n_s__array;
static PyObject *__pyx_n_s__arrmap;
static PyObject *__pyx_n_s__asarray;
static PyObject *__pyx_n_s__astype;
static PyObject *__pyx_n_s__bMap;
static PyObject *__pyx_n_s__base;
static PyObject *__pyx_n_s__bo;
static PyObject *__pyx_n_s__bool;
static PyObject *__pyx_n_s__buf;
static PyObject *__pyx_n_s__byteorder;
static PyObject *__pyx_n_s__com;
static PyObject *__pyx_n_s__data;
static PyObject *__pyx_n_s__datetime;
static PyObject *__pyx_n_s__descr;
static PyObject *__pyx_n_s__dtype;
static PyObject *__pyx_n_s__empty;
static PyObject *__pyx_n_s__expected_size;
static PyObject *__pyx_n_s__fields;
static PyObject *__pyx_n_s__float64;
static PyObject *__pyx_n_s__format;
static PyObject *__pyx_n_s__func;
static PyObject *__pyx_n_s__get;
static PyObject *__pyx_n_s__getMergeVec;
static PyObject *__pyx_n_s__head;
static PyObject *__pyx_n_s__index;
static PyObject *__pyx_n_s__inf;
static PyObject *__pyx_n_s__input;
static PyObject *__pyx_n_s__insert;
static PyObject *__pyx_n_s__int32;
static PyObject *__pyx_n_s__int8;
static PyObject *__pyx_n_s__isfinite;
static PyObject *__pyx_n_s__isnan;
static PyObject *__pyx_n_s__isnull;
static PyObject *__pyx_n_s__itemsize;
static PyObject *__pyx_n_s__kind;
static PyObject *__pyx_n_s__mapper;
static PyObject *__pyx_n_s__max;
static PyObject *__pyx_n_s__maxlevels;
static PyObject *__pyx_n_s__min;
static PyObject *__pyx_n_s__minp;
static PyObject *__pyx_n_s__name;
static PyObject *__pyx_n_s__names;
static PyObject *__pyx_n_s__ndim;
static PyObject *__pyx_n_s__newIndex;
static PyObject *__pyx_n_s__newMap;
static PyObject *__pyx_n_s__next;
static PyObject *__pyx_n_s__np;
static PyObject *__pyx_n_s__numpy;
static PyObject *__pyx_n_s__obj;
static PyObject *__pyx_n_s__object_;
static PyObject *__pyx_n_s__oldIndex;
static PyObject *__pyx_n_s__oldMap;
static PyObject *__pyx_n_s__ones;
static PyObject *__pyx_n_s__output;
static PyObject *__pyx_n_s__pydatetime;
static PyObject *__pyx_n_s__random;
static PyObject *__pyx_n_s__range;
static PyObject *__pyx_n_s__readonly;
static PyObject *__pyx_n_s__remove;
static PyObject *__pyx_n_s__rolling_var;
static PyObject *__pyx_n_s__shape;
static PyObject *__pyx_n_s__size;
static PyObject *__pyx_n_s__sqrt;
static PyObject *__pyx_n_s__strides;
static PyObject *__pyx_n_s__suboffsets;
static PyObject *__pyx_n_s__type;
static PyObject *__pyx_n_s__type_num;
static PyObject *__pyx_n_s__value;
static PyObject *__pyx_n_s__values;
static PyObject *__pyx_n_s__width;
static PyObject *__pyx_n_s__width_arr;
static PyObject *__pyx_n_s__win;
static PyObject *__pyx_n_s__window;
static PyObject *__pyx_n_s__zeros;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_int_15;
static PyObject *__pyx_int_100;

/* "H:\workspace\pandas\pandas\lib\src\common.pyx":15
 * from datetime import datetime as pydatetime
 * 
 * cdef inline object trycall(object func, object arg):             # <<<<<<<<<<<<<<
 *     try:
 *         return func(arg)
 */

static CYTHON_INLINE PyObject *__pyx_f_7tseries_trycall(PyObject *__pyx_v_func, PyObject *__pyx_v_arg) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("trycall");
  __Pyx_INCREF(__pyx_v_func);
  __Pyx_INCREF(__pyx_v_arg);

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":16
 * 
 * cdef inline object trycall(object func, object arg):
 *     try:             # <<<<<<<<<<<<<<
 *         return func(arg)
 *     except:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "H:\workspace\pandas\pandas\lib\src\common.pyx":17
 * cdef inline object trycall(object func, object arg):
 *     try:
 *         return func(arg)             # <<<<<<<<<<<<<<
 *     except:
 *         raise Exception('Error calling func on index %s' % arg)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_arg);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_arg);
      __Pyx_GIVEREF(__pyx_v_arg);
      __pyx_t_2 = PyObject_Call(__pyx_v_func, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L7_try_return;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L10_try_end;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\common.pyx":18
 *     try:
 *         return func(arg)
 *     except:             # <<<<<<<<<<<<<<
 *         raise Exception('Error calling func on index %s' % arg)
 * 
 */
    /*except:*/ {
      __Pyx_AddTraceback("tseries.trycall");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);

      /* "H:\workspace\pandas\pandas\lib\src\common.pyx":19
 *         return func(arg)
 *     except:
 *         raise Exception('Error calling func on index %s' % arg)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int int_max(int a, int b): return a if a >= b else b
 */
      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_v_arg); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_builtin_Exception, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L10_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("tseries.trycall");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_func);
  __Pyx_DECREF(__pyx_v_arg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\common.pyx":21
 *         raise Exception('Error calling func on index %s' % arg)
 * 
 * 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_7tseries_int_max(int __pyx_v_a, int __pyx_v_b) {
  int __pyx_r;
  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;
}

/* "H:\workspace\pandas\pandas\lib\src\common.pyx":22
 * 
 * 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             # <<<<<<<<<<<<<<
 * 
 * ctypedef unsigned char UChar
 */

static CYTHON_INLINE int __pyx_f_7tseries_int_min(int __pyx_v_a, int __pyx_v_b) {
  int __pyx_r;
  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;
}

/* "H:\workspace\pandas\pandas\lib\src\common.pyx":26
 * ctypedef unsigned char UChar
 * 
 * cdef int is_contiguous(ndarray arr):             # <<<<<<<<<<<<<<
 *     return np.PyArray_CHKFLAGS(arr, np.NPY_C_CONTIGUOUS)
 * 
 */

static  int __pyx_f_7tseries_is_contiguous(PyArrayObject *__pyx_v_arr) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("is_contiguous");

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":27
 * 
 * cdef int is_contiguous(ndarray arr):
 *     return np.PyArray_CHKFLAGS(arr, np.NPY_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 * 
 * cdef int _contiguous_check(ndarray arr):
 */
  __pyx_r = PyArray_CHKFLAGS(__pyx_v_arr, NPY_C_CONTIGUOUS);
  goto __pyx_L0;

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

/* "H:\workspace\pandas\pandas\lib\src\common.pyx":29
 *     return np.PyArray_CHKFLAGS(arr, np.NPY_C_CONTIGUOUS)
 * 
 * cdef int _contiguous_check(ndarray arr):             # <<<<<<<<<<<<<<
 *     if not is_contiguous(arr):
 *         raise ValueError('Tried to use data field on non-contiguous array!')
 */

static  int __pyx_f_7tseries__contiguous_check(PyArrayObject *__pyx_v_arr) {
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_contiguous_check");
  __Pyx_INCREF((PyObject *)__pyx_v_arr);

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":30
 * 
 * cdef int _contiguous_check(ndarray arr):
 *     if not is_contiguous(arr):             # <<<<<<<<<<<<<<
 *         raise ValueError('Tried to use data field on non-contiguous array!')
 * 
 */
  __pyx_t_1 = (!__pyx_f_7tseries_is_contiguous(__pyx_v_arr));
  if (__pyx_t_1) {

    /* "H:\workspace\pandas\pandas\lib\src\common.pyx":31
 * cdef int _contiguous_check(ndarray arr):
 *     if not is_contiguous(arr):
 *         raise ValueError('Tried to use data field on non-contiguous array!')             # <<<<<<<<<<<<<<
 * 
 * cdef int16_t *get_int16_ptr(ndarray arr):
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("tseries._contiguous_check");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_arr);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\common.pyx":33
 *         raise ValueError('Tried to use data field on non-contiguous array!')
 * 
 * cdef int16_t *get_int16_ptr(ndarray arr):             # <<<<<<<<<<<<<<
 *     _contiguous_check(arr)
 * 
 */

static  __pyx_t_5numpy_int16_t *__pyx_f_7tseries_get_int16_ptr(PyArrayObject *__pyx_v_arr) {
  __pyx_t_5numpy_int16_t *__pyx_r;
  __Pyx_RefNannySetupContext("get_int16_ptr");

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":34
 * 
 * cdef int16_t *get_int16_ptr(ndarray arr):
 *     _contiguous_check(arr)             # <<<<<<<<<<<<<<
 * 
 *     return <int16_t *> arr.data
 */
  __pyx_f_7tseries__contiguous_check(__pyx_v_arr);

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":36
 *     _contiguous_check(arr)
 * 
 *     return <int16_t *> arr.data             # <<<<<<<<<<<<<<
 * 
 * cdef int32_t *get_int32_ptr(ndarray arr):
 */
  __pyx_r = ((__pyx_t_5numpy_int16_t *)__pyx_v_arr->data);
  goto __pyx_L0;

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

/* "H:\workspace\pandas\pandas\lib\src\common.pyx":38
 *     return <int16_t *> arr.data
 * 
 * cdef int32_t *get_int32_ptr(ndarray arr):             # <<<<<<<<<<<<<<
 *     _contiguous_check(arr)
 * 
 */

static  __pyx_t_5numpy_int32_t *__pyx_f_7tseries_get_int32_ptr(PyArrayObject *__pyx_v_arr) {
  __pyx_t_5numpy_int32_t *__pyx_r;
  __Pyx_RefNannySetupContext("get_int32_ptr");

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":39
 * 
 * cdef int32_t *get_int32_ptr(ndarray arr):
 *     _contiguous_check(arr)             # <<<<<<<<<<<<<<
 * 
 *     return <int32_t *> arr.data
 */
  __pyx_f_7tseries__contiguous_check(__pyx_v_arr);

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":41
 *     _contiguous_check(arr)
 * 
 *     return <int32_t *> arr.data             # <<<<<<<<<<<<<<
 * 
 * cdef int64_t *get_int64_ptr(ndarray arr):
 */
  __pyx_r = ((__pyx_t_5numpy_int32_t *)__pyx_v_arr->data);
  goto __pyx_L0;

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

/* "H:\workspace\pandas\pandas\lib\src\common.pyx":43
 *     return <int32_t *> arr.data
 * 
 * cdef int64_t *get_int64_ptr(ndarray arr):             # <<<<<<<<<<<<<<
 *     _contiguous_check(arr)
 * 
 */

static  __pyx_t_5numpy_int64_t *__pyx_f_7tseries_get_int64_ptr(PyArrayObject *__pyx_v_arr) {
  __pyx_t_5numpy_int64_t *__pyx_r;
  __Pyx_RefNannySetupContext("get_int64_ptr");

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":44
 * 
 * cdef int64_t *get_int64_ptr(ndarray arr):
 *     _contiguous_check(arr)             # <<<<<<<<<<<<<<
 * 
 *     return <int64_t *> arr.data
 */
  __pyx_f_7tseries__contiguous_check(__pyx_v_arr);

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":46
 *     _contiguous_check(arr)
 * 
 *     return <int64_t *> arr.data             # <<<<<<<<<<<<<<
 * 
 * cdef double_t *get_double_ptr(ndarray arr):
 */
  __pyx_r = ((__pyx_t_5numpy_int64_t *)__pyx_v_arr->data);
  goto __pyx_L0;

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

/* "H:\workspace\pandas\pandas\lib\src\common.pyx":48
 *     return <int64_t *> arr.data
 * 
 * cdef double_t *get_double_ptr(ndarray arr):             # <<<<<<<<<<<<<<
 *     _contiguous_check(arr)
 * 
 */

static  __pyx_t_5numpy_double_t *__pyx_f_7tseries_get_double_ptr(PyArrayObject *__pyx_v_arr) {
  __pyx_t_5numpy_double_t *__pyx_r;
  __Pyx_RefNannySetupContext("get_double_ptr");

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":49
 * 
 * cdef double_t *get_double_ptr(ndarray arr):
 *     _contiguous_check(arr)             # <<<<<<<<<<<<<<
 * 
 *     return <double_t *> arr.data
 */
  __pyx_f_7tseries__contiguous_check(__pyx_v_arr);

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":51
 *     _contiguous_check(arr)
 * 
 *     return <double_t *> arr.data             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "math.h":
 */
  __pyx_r = ((__pyx_t_5numpy_double_t *)__pyx_v_arr->data);
  goto __pyx_L0;

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

/* "H:\workspace\pandas\pandas\lib\src\common.pyx":83
 * import_array()
 * 
 * cpdef map_indices(ndarray index):             # <<<<<<<<<<<<<<
 *     '''
 *     Produce a dict mapping the values of the input array to their respective
 */

static PyObject *__pyx_pf_7tseries_map_indices(PyObject *__pyx_self, PyObject *__pyx_v_index); /*proto*/
static  PyObject *__pyx_f_7tseries_map_indices(PyArrayObject *__pyx_v_index, int __pyx_skip_dispatch) {
  int __pyx_v_i;
  int __pyx_v_length;
  PyArrayIterObject *__pyx_v_iter;
  PyObject *__pyx_v_result;
  PyObject *__pyx_v_idx;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("map_indices");
  __Pyx_INCREF((PyObject *)__pyx_v_index);
  __pyx_v_iter = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_result = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None);

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":98
 *     cdef object idx
 * 
 *     result = {}             # <<<<<<<<<<<<<<
 * 
 *     iter = <flatiter> PyArray_IterNew(index)
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
  __pyx_v_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":100
 *     result = {}
 * 
 *     iter = <flatiter> PyArray_IterNew(index)             # <<<<<<<<<<<<<<
 *     length = PyArray_SIZE(index)
 * 
 */
  __pyx_t_1 = PyArray_IterNew(((PyObject *)__pyx_v_index)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((PyArrayIterObject *)__pyx_t_1)));
  __Pyx_DECREF(((PyObject *)__pyx_v_iter));
  __pyx_v_iter = ((PyArrayIterObject *)__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":101
 * 
 *     iter = <flatiter> PyArray_IterNew(index)
 *     length = PyArray_SIZE(index)             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < length:
 */
  __pyx_v_length = PyArray_SIZE(__pyx_v_index);

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":103
 *     length = PyArray_SIZE(index)
 * 
 *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
 *         idx = PyArray_GETITEM(index, PyArray_ITER_DATA(iter))
 *         result[idx] = i
 */
  __pyx_t_2 = __pyx_v_length;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\common.pyx":104
 * 
 *     for i from 0 <= i < length:
 *         idx = PyArray_GETITEM(index, PyArray_ITER_DATA(iter))             # <<<<<<<<<<<<<<
 *         result[idx] = i
 *         PyArray_ITER_NEXT(iter)
 */
    __pyx_t_1 = PyArray_GETITEM(__pyx_v_index, PyArray_ITER_DATA(__pyx_v_iter)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_idx);
    __pyx_v_idx = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\common.pyx":105
 *     for i from 0 <= i < length:
 *         idx = PyArray_GETITEM(index, PyArray_ITER_DATA(iter))
 *         result[idx] = i             # <<<<<<<<<<<<<<
 *         PyArray_ITER_NEXT(iter)
 * 
 */
    __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_idx, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\common.pyx":106
 *         idx = PyArray_GETITEM(index, PyArray_ITER_DATA(iter))
 *         result[idx] = i
 *         PyArray_ITER_NEXT(iter)             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    PyArray_ITER_NEXT(__pyx_v_iter);
  }

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":108
 *         PyArray_ITER_NEXT(iter)
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * def isAllDates(ndarray index):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("tseries.map_indices");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_iter);
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_DECREF(__pyx_v_idx);
  __Pyx_DECREF((PyObject *)__pyx_v_index);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\common.pyx":83
 * import_array()
 * 
 * cpdef map_indices(ndarray index):             # <<<<<<<<<<<<<<
 *     '''
 *     Produce a dict mapping the values of the input array to their respective
 */

static PyObject *__pyx_pf_7tseries_map_indices(PyObject *__pyx_self, PyObject *__pyx_v_index); /*proto*/
static char __pyx_doc_7tseries_map_indices[] = "\n    Produce a dict mapping the values of the input array to their respective\n    locations.\n\n    Example:\n        array(['hi', 'there']) --> {'hi' : 0 , 'there' : 1}\n\n    Better to do this with Cython because of the enormous speed boost.\n    ";
static PyObject *__pyx_pf_7tseries_map_indices(PyObject *__pyx_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("map_indices");
  __pyx_self = __pyx_self;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7tseries_map_indices(((PyArrayObject *)__pyx_v_index), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("tseries.map_indices");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\common.pyx":110
 *     return result
 * 
 * def isAllDates(ndarray index):             # <<<<<<<<<<<<<<
 *     cdef int i, length
 *     cdef flatiter iter
 */

static PyObject *__pyx_pf_7tseries_isAllDates(PyObject *__pyx_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_pf_7tseries_isAllDates(PyObject *__pyx_self, PyObject *__pyx_v_index) {
  int __pyx_v_i;
  int __pyx_v_length;
  PyArrayIterObject *__pyx_v_iter;
  PyObject *__pyx_v_date;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("isAllDates");
  __pyx_self = __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_v_index);
  __pyx_v_iter = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_date = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":115
 *     cdef object date
 * 
 *     iter = <flatiter> PyArray_IterNew(index)             # <<<<<<<<<<<<<<
 *     length = PyArray_SIZE(index)
 * 
 */
  __pyx_t_1 = PyArray_IterNew(__pyx_v_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((PyArrayIterObject *)__pyx_t_1)));
  __Pyx_DECREF(((PyObject *)__pyx_v_iter));
  __pyx_v_iter = ((PyArrayIterObject *)__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":116
 * 
 *     iter = <flatiter> PyArray_IterNew(index)
 *     length = PyArray_SIZE(index)             # <<<<<<<<<<<<<<
 * 
 *     if length == 0:
 */
  __pyx_v_length = PyArray_SIZE(((PyArrayObject *)__pyx_v_index));

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":118
 *     length = PyArray_SIZE(index)
 * 
 *     if length == 0:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_t_2 = (__pyx_v_length == 0);
  if (__pyx_t_2) {

    /* "H:\workspace\pandas\pandas\lib\src\common.pyx":119
 * 
 *     if length == 0:
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < length:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __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:;

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":121
 *         return False
 * 
 *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
 *         date = PyArray_GETITEM(index, PyArray_ITER_DATA(iter))
 * 
 */
  __pyx_t_3 = __pyx_v_length;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\common.pyx":122
 * 
 *     for i from 0 <= i < length:
 *         date = PyArray_GETITEM(index, PyArray_ITER_DATA(iter))             # <<<<<<<<<<<<<<
 * 
 *         if not PyDateTime_Check(date):
 */
    __pyx_t_1 = PyArray_GETITEM(((PyArrayObject *)__pyx_v_index), PyArray_ITER_DATA(__pyx_v_iter)); 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_DECREF(__pyx_v_date);
    __pyx_v_date = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\common.pyx":124
 *         date = PyArray_GETITEM(index, PyArray_ITER_DATA(iter))
 * 
 *         if not PyDateTime_Check(date):             # <<<<<<<<<<<<<<
 *             return False
 *         PyArray_ITER_NEXT(iter)
 */
    __pyx_t_2 = (!PyDateTime_Check(__pyx_v_date));
    if (__pyx_t_2) {

      /* "H:\workspace\pandas\pandas\lib\src\common.pyx":125
 * 
 *         if not PyDateTime_Check(date):
 *             return False             # <<<<<<<<<<<<<<
 *         PyArray_ITER_NEXT(iter)
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __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_L8;
    }
    __pyx_L8:;

    /* "H:\workspace\pandas\pandas\lib\src\common.pyx":126
 *         if not PyDateTime_Check(date):
 *             return False
 *         PyArray_ITER_NEXT(iter)             # <<<<<<<<<<<<<<
 * 
 *     return True
 */
    PyArray_ITER_NEXT(__pyx_v_iter);
  }

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":128
 *         PyArray_ITER_NEXT(iter)
 * 
 *     return True             # <<<<<<<<<<<<<<
 * 
 * def isAllDates2(ndarray[object, ndim=1] arr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __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("tseries.isAllDates");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_iter);
  __Pyx_DECREF(__pyx_v_date);
  __Pyx_DECREF((PyObject *)__pyx_v_index);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\common.pyx":130
 *     return True
 * 
 * def isAllDates2(ndarray[object, ndim=1] arr):             # <<<<<<<<<<<<<<
 *     '''
 *     cannot use
 */

static PyObject *__pyx_pf_7tseries_isAllDates2(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
static char __pyx_doc_7tseries_isAllDates2[] = "\n    cannot use\n    ";
static PyObject *__pyx_pf_7tseries_isAllDates2(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
  int __pyx_v_i;
  int __pyx_v_size;
  PyObject *__pyx_v_date;
  Py_buffer __pyx_bstruct_arr;
  Py_ssize_t __pyx_bstride_0_arr = 0;
  Py_ssize_t __pyx_bshape_0_arr = 0;
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("isAllDates2");
  __pyx_self = __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_v_arr);
  __pyx_v_date = Py_None; __Pyx_INCREF(Py_None);
  __pyx_bstruct_arr.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_arr, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_arr = __pyx_bstruct_arr.strides[0];
  __pyx_bshape_0_arr = __pyx_bstruct_arr.shape[0];

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":135
 *     '''
 * 
 *     cdef int i, size = len(arr)             # <<<<<<<<<<<<<<
 *     cdef object date
 * 
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_size = __pyx_t_1;

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":138
 *     cdef object date
 * 
 *     if size == 0:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_t_2 = (__pyx_v_size == 0);
  if (__pyx_t_2) {

    /* "H:\workspace\pandas\pandas\lib\src\common.pyx":139
 * 
 *     if size == 0:
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < size:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":141
 *         return False
 * 
 *     for i from 0 <= i < size:             # <<<<<<<<<<<<<<
 *         date = arr[i]
 * 
 */
  __pyx_t_4 = __pyx_v_size;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\common.pyx":142
 * 
 *     for i from 0 <= i < size:
 *         date = arr[i]             # <<<<<<<<<<<<<<
 * 
 *         if not PyDateTime_Check(date):
 */
    __pyx_t_5 = __pyx_v_i;
    __pyx_t_6 = -1;
    if (__pyx_t_5 < 0) {
      __pyx_t_5 += __pyx_bshape_0_arr;
      if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
    } else if (unlikely(__pyx_t_5 >= __pyx_bshape_0_arr)) __pyx_t_6 = 0;
    if (unlikely(__pyx_t_6 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_6);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_arr.buf, __pyx_t_5, __pyx_bstride_0_arr);
    __Pyx_INCREF((PyObject*)__pyx_t_3);
    __Pyx_DECREF(__pyx_v_date);
    __pyx_v_date = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\common.pyx":144
 *         date = arr[i]
 * 
 *         if not PyDateTime_Check(date):             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    __pyx_t_2 = (!PyDateTime_Check(__pyx_v_date));
    if (__pyx_t_2) {

      /* "H:\workspace\pandas\pandas\lib\src\common.pyx":145
 * 
 *         if not PyDateTime_Check(date):
 *             return False             # <<<<<<<<<<<<<<
 * 
 *     return True
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyBool_FromLong(0); 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_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;
  }

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":147
 *             return False
 * 
 *     return True             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_arr);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tseries.isAllDates2");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_arr);
  __pyx_L2:;
  __Pyx_DECREF(__pyx_v_date);
  __Pyx_DECREF((PyObject *)__pyx_v_arr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":18
 * # MSVC does not have log2!
 * 
 * cdef double Log2(double x):             # <<<<<<<<<<<<<<
 *     return log(x) / log(2.)
 * 
 */

static  double __pyx_f_7tseries_Log2(double __pyx_v_x) {
  double __pyx_r;
  double __pyx_t_1;
  double __pyx_t_2;
  __Pyx_RefNannySetupContext("Log2");

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":19
 * 
 * cdef double Log2(double x):
 *     return log(x) / log(2.)             # <<<<<<<<<<<<<<
 * 
 * cimport numpy as np
 */
  __pyx_t_1 = log(__pyx_v_x);
  __pyx_t_2 = log(2.0);
  if (unlikely(__pyx_t_2 == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_r = (__pyx_t_1 / __pyx_t_2);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("tseries.Log2");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":34
 *     cdef public:
 *         double value
 *         list next             # <<<<<<<<<<<<<<
 *         ndarray width_arr
 * 
 */

static PyObject *__pyx_pf_7tseries_4Node_4next___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7tseries_4Node_4next___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->next));
  __pyx_r = ((PyObject *)((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->next);
  goto __pyx_L0;

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

static int __pyx_pf_7tseries_4Node_4next___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_7tseries_4Node_4next___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->next);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->next));
  ((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->next = ((PyObject *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("tseries.Node.next.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":35
 *         double value
 *         list next
 *         ndarray width_arr             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

static PyObject *__pyx_pf_7tseries_4Node_9width_arr___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7tseries_4Node_9width_arr___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->width_arr));
  __pyx_r = ((PyObject *)((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->width_arr);
  goto __pyx_L0;

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

static int __pyx_pf_7tseries_4Node_9width_arr___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_7tseries_4Node_9width_arr___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->width_arr);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->width_arr));
  ((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->width_arr = ((PyArrayObject *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("tseries.Node.width_arr.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":40
 *         int *width
 * 
 *     def __init__(self, double value, list next, ndarray width):             # <<<<<<<<<<<<<<
 *         self.value = value
 *         self.next = next
 */

static int __pyx_pf_7tseries_4Node___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_7tseries_4Node___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_value;
  PyObject *__pyx_v_next = 0;
  PyArrayObject *__pyx_v_width = 0;
  int __pyx_r;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__value,&__pyx_n_s__next,&__pyx_n_s__width,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__next);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__width);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __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[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_value = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_next = ((PyObject *)values[1]);
    __pyx_v_width = ((PyArrayObject *)values[2]);
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_value = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_next = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 1));
    __pyx_v_width = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 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[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries.Node.__init__");
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_next), &PyList_Type, 1, "next", 1))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_width), __pyx_ptype_5numpy_ndarray, 1, "width", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":41
 * 
 *     def __init__(self, double value, list next, ndarray width):
 *         self.value = value             # <<<<<<<<<<<<<<
 *         self.next = next
 *         self.width_arr = width
 */
  ((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->value = __pyx_v_value;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":42
 *     def __init__(self, double value, list next, ndarray width):
 *         self.value = value
 *         self.next = next             # <<<<<<<<<<<<<<
 *         self.width_arr = width
 *         self.width = <int *> width.data
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_next));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_next));
  __Pyx_GOTREF(((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->next);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->next));
  ((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->next = __pyx_v_next;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":43
 *         self.value = value
 *         self.next = next
 *         self.width_arr = width             # <<<<<<<<<<<<<<
 *         self.width = <int *> width.data
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_width));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_width));
  __Pyx_GOTREF(((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->width_arr);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->width_arr));
  ((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->width_arr = __pyx_v_width;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":44
 *         self.next = next
 *         self.width_arr = width
 *         self.width = <int *> width.data             # <<<<<<<<<<<<<<
 * 
 * NIL = Node(np.inf, [], np.array([])) # Singleton terminator node
 */
  ((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->width = ((int *)__pyx_v_width->data);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("tseries.Node.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":56
 *         Node head
 * 
 *     def __init__(self, expected_size=100):             # <<<<<<<<<<<<<<
 *         self.size = 0
 *         self.maxlevels = int(1 + Log2(expected_size))
 */

static int __pyx_pf_7tseries_17IndexableSkiplist___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_7tseries_17IndexableSkiplist___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_expected_size = 0;
  int __pyx_r;
  double __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;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__expected_size,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)__pyx_int_100);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__expected_size);
        if (unlikely(value)) { values[0] = value; kw_args--; }
      }
    }
    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[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_expected_size = values[0];
  } else {
    __pyx_v_expected_size = ((PyObject *)__pyx_int_100);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_expected_size = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries.IndexableSkiplist.__init__");
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":57
 * 
 *     def __init__(self, expected_size=100):
 *         self.size = 0             # <<<<<<<<<<<<<<
 *         self.maxlevels = int(1 + Log2(expected_size))
 * 
 */
  ((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->size = 0;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":58
 *     def __init__(self, expected_size=100):
 *         self.size = 0
 *         self.maxlevels = int(1 + Log2(expected_size))             # <<<<<<<<<<<<<<
 * 
 *         self.head = Node(np.NaN, [NIL] * self.maxlevels,
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_expected_size); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->maxlevels = ((int)(1 + __pyx_f_7tseries_Log2(__pyx_t_1)));

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":60
 *         self.maxlevels = int(1 + Log2(expected_size))
 * 
 *         self.head = Node(np.NaN, [NIL] * self.maxlevels,             # <<<<<<<<<<<<<<
 *                          np.ones(self.maxlevels, dtype=int))
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__NaN); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__NIL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->maxlevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyNumber_Multiply(((PyObject *)__pyx_t_4), __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":61
 * 
 *         self.head = Node(np.NaN, [NIL] * self.maxlevels,
 *                          np.ones(self.maxlevels, dtype=int))             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ones); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->maxlevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_6, 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[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)&PyInt_Type))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_4, __pyx_t_6, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_3 = 0;
  __pyx_t_5 = 0;
  __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7tseries_Node)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":60
 *         self.maxlevels = int(1 + Log2(expected_size))
 * 
 *         self.head = Node(np.NaN, [NIL] * self.maxlevels,             # <<<<<<<<<<<<<<
 *                          np.ones(self.maxlevels, dtype=int))
 * 
 */
  __Pyx_GIVEREF(__pyx_t_7);
  __Pyx_GOTREF(((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->head);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->head));
  ((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->head = ((struct __pyx_obj_7tseries_Node *)__pyx_t_7);
  __pyx_t_7 = 0;

  __pyx_r = 0;
  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);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("tseries.IndexableSkiplist.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":63
 *                          np.ones(self.maxlevels, dtype=int))
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.size
 * 
 */

static Py_ssize_t __pyx_pf_7tseries_17IndexableSkiplist___len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pf_7tseries_17IndexableSkiplist___len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannySetupContext("__len__");

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":64
 * 
 *     def __len__(self):
 *         return self.size             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, i):
 */
  __pyx_r = ((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->size;
  goto __pyx_L0;

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

/* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":66
 *         return self.size
 * 
 *     def __getitem__(self, i):             # <<<<<<<<<<<<<<
 *         return self.get(i)
 * 
 */

static PyObject *__pyx_pf_7tseries_17IndexableSkiplist___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/
static PyObject *__pyx_pf_7tseries_17IndexableSkiplist___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__getitem__");

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":67
 * 
 *     def __getitem__(self, i):
 *         return self.get(i)             # <<<<<<<<<<<<<<
 * 
 *     def get(self, int i):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __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[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_i);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_i);
  __Pyx_GIVEREF(__pyx_v_i);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 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_AddTraceback("tseries.IndexableSkiplist.__getitem__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":69
 *         return self.get(i)
 * 
 *     def get(self, int i):             # <<<<<<<<<<<<<<
 *         cdef int level
 *         cdef Node node
 */

static PyObject *__pyx_pf_7tseries_17IndexableSkiplist_get(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/
static PyObject *__pyx_pf_7tseries_17IndexableSkiplist_get(PyObject *__pyx_v_self, PyObject *__pyx_arg_i) {
  int __pyx_v_i;
  int __pyx_v_level;
  struct __pyx_obj_7tseries_Node *__pyx_v_node;
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("get");
  assert(__pyx_arg_i); {
    __pyx_v_i = __Pyx_PyInt_AsInt(__pyx_arg_i); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries.IndexableSkiplist.get");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_v_node = ((struct __pyx_obj_7tseries_Node *)Py_None); __Pyx_INCREF(Py_None);

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":73
 *         cdef Node node
 * 
 *         node = self.head             # <<<<<<<<<<<<<<
 *         i += 1
 * 
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->head));
  __Pyx_DECREF(((PyObject *)__pyx_v_node));
  __pyx_v_node = ((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->head;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":74
 * 
 *         node = self.head
 *         i += 1             # <<<<<<<<<<<<<<
 * 
 *         for level in range(self.maxlevels - 1, -1, -1):
 */
  __pyx_v_i += 1;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":76
 *         i += 1
 * 
 *         for level in range(self.maxlevels - 1, -1, -1):             # <<<<<<<<<<<<<<
 *             while node.width[level] <= i:
 *                 i -= node.width[level]
 */
  __pyx_t_2 = PyInt_FromLong((((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->maxlevels - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; __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[1]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = 0; __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3);
  } else {
    __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_3))) {
      if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
      if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++;
    } else {
      __pyx_t_2 = PyIter_Next(__pyx_t_3);
      if (!__pyx_t_2) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_level = __pyx_t_4;

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":77
 * 
 *         for level in range(self.maxlevels - 1, -1, -1):
 *             while node.width[level] <= i:             # <<<<<<<<<<<<<<
 *                 i -= node.width[level]
 *                 node = node.next[level]
 */
    while (1) {
      __pyx_t_5 = ((__pyx_v_node->width[__pyx_v_level]) <= __pyx_v_i);
      if (!__pyx_t_5) break;

      /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":78
 *         for level in range(self.maxlevels - 1, -1, -1):
 *             while node.width[level] <= i:
 *                 i -= node.width[level]             # <<<<<<<<<<<<<<
 *                 node = node.next[level]
 * 
 */
      __pyx_v_i -= (__pyx_v_node->width[__pyx_v_level]);

      /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":79
 *             while node.width[level] <= i:
 *                 i -= node.width[level]
 *                 node = node.next[level]             # <<<<<<<<<<<<<<
 * 
 *         return node.value
 */
      __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_node->next), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 79; __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_7tseries_Node))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_node));
      __pyx_v_node = ((struct __pyx_obj_7tseries_Node *)__pyx_t_2);
      __pyx_t_2 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":81
 *                 node = node.next[level]
 * 
 *         return node.value             # <<<<<<<<<<<<<<
 * 
 *     def insert(self, double value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_node->value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  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_AddTraceback("tseries.IndexableSkiplist.get");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_node);
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":83
 *         return node.value
 * 
 *     def insert(self, double value):             # <<<<<<<<<<<<<<
 *         cdef int level, steps, d
 *         cdef Node node, prevnode, newnode, next_at_level
 */

static PyObject *__pyx_pf_7tseries_17IndexableSkiplist_insert(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static PyObject *__pyx_pf_7tseries_17IndexableSkiplist_insert(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  double __pyx_v_value;
  int __pyx_v_level;
  int __pyx_v_steps;
  int __pyx_v_d;
  struct __pyx_obj_7tseries_Node *__pyx_v_node;
  struct __pyx_obj_7tseries_Node *__pyx_v_prevnode;
  struct __pyx_obj_7tseries_Node *__pyx_v_newnode;
  struct __pyx_obj_7tseries_Node *__pyx_v_next_at_level;
  PyObject *__pyx_v_chain;
  PyObject *__pyx_v_steps_at_level;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  double __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  __Pyx_RefNannySetupContext("insert");
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsDouble(__pyx_arg_value); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries.IndexableSkiplist.insert");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_v_node = ((struct __pyx_obj_7tseries_Node *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_prevnode = ((struct __pyx_obj_7tseries_Node *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_newnode = ((struct __pyx_obj_7tseries_Node *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_next_at_level = ((struct __pyx_obj_7tseries_Node *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_chain = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_steps_at_level = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":89
 * 
 *         # find first node on each level where node.next[levels].value > value
 *         chain = [None] * self.maxlevels             # <<<<<<<<<<<<<<
 *         steps_at_level = [0] * self.maxlevels
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(Py_None);
  PyList_SET_ITEM(__pyx_t_1, 0, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->maxlevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_t_1), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_chain));
  __pyx_v_chain = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":90
 *         # find first node on each level where node.next[levels].value > value
 *         chain = [None] * self.maxlevels
 *         steps_at_level = [0] * self.maxlevels             # <<<<<<<<<<<<<<
 * 
 *         node = self.head
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->maxlevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_t_3), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_steps_at_level));
  __pyx_v_steps_at_level = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":92
 *         steps_at_level = [0] * self.maxlevels
 * 
 *         node = self.head             # <<<<<<<<<<<<<<
 *         for level in range(self.maxlevels - 1, -1, -1):
 *             next_at_level = node.next[level]
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->head));
  __Pyx_DECREF(((PyObject *)__pyx_v_node));
  __pyx_v_node = ((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->head;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":93
 * 
 *         node = self.head
 *         for level in range(self.maxlevels - 1, -1, -1):             # <<<<<<<<<<<<<<
 *             next_at_level = node.next[level]
 * 
 */
  __pyx_t_1 = PyInt_FromLong((((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->maxlevels - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 93; __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[1]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_4 = 0; __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2);
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_2))) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
    } else {
      __pyx_t_1 = PyIter_Next(__pyx_t_2);
      if (!__pyx_t_1) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_level = __pyx_t_5;

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":94
 *         node = self.head
 *         for level in range(self.maxlevels - 1, -1, -1):
 *             next_at_level = node.next[level]             # <<<<<<<<<<<<<<
 * 
 *             while next_at_level.value <= value:
 */
    __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_node->next), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7tseries_Node))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_next_at_level));
    __pyx_v_next_at_level = ((struct __pyx_obj_7tseries_Node *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":96
 *             next_at_level = node.next[level]
 * 
 *             while next_at_level.value <= value:             # <<<<<<<<<<<<<<
 *                 steps_at_level[level] = (steps_at_level[level] +
 *                                          node.width[level])
 */
    while (1) {
      __pyx_t_6 = (__pyx_v_next_at_level->value <= __pyx_v_value);
      if (!__pyx_t_6) break;

      /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":97
 * 
 *             while next_at_level.value <= value:
 *                 steps_at_level[level] = (steps_at_level[level] +             # <<<<<<<<<<<<<<
 *                                          node.width[level])
 *                 node = next_at_level
 */
      __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_steps_at_level), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);

      /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":98
 *             while next_at_level.value <= value:
 *                 steps_at_level[level] = (steps_at_level[level] +
 *                                          node.width[level])             # <<<<<<<<<<<<<<
 *                 node = next_at_level
 *                 next_at_level = node.next[level]
 */
      __pyx_t_3 = PyInt_FromLong((__pyx_v_node->width[__pyx_v_level])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":97
 * 
 *             while next_at_level.value <= value:
 *                 steps_at_level[level] = (steps_at_level[level] +             # <<<<<<<<<<<<<<
 *                                          node.width[level])
 *                 node = next_at_level
 */
      if (__Pyx_SetItemInt(((PyObject *)__pyx_v_steps_at_level), __pyx_v_level, __pyx_t_7, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":99
 *                 steps_at_level[level] = (steps_at_level[level] +
 *                                          node.width[level])
 *                 node = next_at_level             # <<<<<<<<<<<<<<
 *                 next_at_level = node.next[level]
 * 
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_next_at_level));
      __Pyx_DECREF(((PyObject *)__pyx_v_node));
      __pyx_v_node = __pyx_v_next_at_level;

      /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":100
 *                                          node.width[level])
 *                 node = next_at_level
 *                 next_at_level = node.next[level]             # <<<<<<<<<<<<<<
 * 
 *             chain[level] = node
 */
      __pyx_t_7 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_node->next), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_7tseries_Node))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_next_at_level));
      __pyx_v_next_at_level = ((struct __pyx_obj_7tseries_Node *)__pyx_t_7);
      __pyx_t_7 = 0;
    }

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":102
 *                 next_at_level = node.next[level]
 * 
 *             chain[level] = node             # <<<<<<<<<<<<<<
 * 
 *         # insert a link to the newnode at each level
 */
    if (__Pyx_SetItemInt(((PyObject *)__pyx_v_chain), __pyx_v_level, ((PyObject *)__pyx_v_node), sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":105
 * 
 *         # insert a link to the newnode at each level
 *         d = min(self.maxlevels, 1 - int(Log2(random())))             # <<<<<<<<<<<<<<
 *         newnode = Node(value, [None] * d, np.empty(d, dtype=int))
 *         steps = 0
 */
  __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->maxlevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__random); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_f_7tseries_Log2(__pyx_t_8)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyNumber_Subtract(__pyx_int_1, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_2 = 0;
  __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_Call(__pyx_builtin_min, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_d = __pyx_t_5;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":106
 *         # insert a link to the newnode at each level
 *         d = min(self.maxlevels, 1 - int(Log2(random())))
 *         newnode = Node(value, [None] * d, np.empty(d, dtype=int))             # <<<<<<<<<<<<<<
 *         steps = 0
 * 
 */
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(Py_None);
  PyList_SET_ITEM(__pyx_t_3, 0, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_d); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_t_3), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __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[1]; __pyx_lineno = 106; __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_FromLong(__pyx_v_d); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_9, 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[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)&PyInt_Type))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_9, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_7 = 0;
  __pyx_t_1 = 0;
  __pyx_t_10 = 0;
  __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7tseries_Node)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_newnode));
  __pyx_v_newnode = ((struct __pyx_obj_7tseries_Node *)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":107
 *         d = min(self.maxlevels, 1 - int(Log2(random())))
 *         newnode = Node(value, [None] * d, np.empty(d, dtype=int))
 *         steps = 0             # <<<<<<<<<<<<<<
 * 
 *         for level in range(d):
 */
  __pyx_v_steps = 0;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":109
 *         steps = 0
 * 
 *         for level in range(d):             # <<<<<<<<<<<<<<
 *             prevnode = chain[level]
 * 
 */
  __pyx_t_5 = __pyx_v_d;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_5; __pyx_t_11+=1) {
    __pyx_v_level = __pyx_t_11;

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":110
 * 
 *         for level in range(d):
 *             prevnode = chain[level]             # <<<<<<<<<<<<<<
 * 
 *             newnode.next[level] = prevnode.next[level]
 */
    __pyx_t_10 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_chain), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_7tseries_Node))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_prevnode));
    __pyx_v_prevnode = ((struct __pyx_obj_7tseries_Node *)__pyx_t_10);
    __pyx_t_10 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":112
 *             prevnode = chain[level]
 * 
 *             newnode.next[level] = prevnode.next[level]             # <<<<<<<<<<<<<<
 *             prevnode.next[level] = newnode
 * 
 */
    __pyx_t_10 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_prevnode->next), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    if (__Pyx_SetItemInt(((PyObject *)__pyx_v_newnode->next), __pyx_v_level, __pyx_t_10, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":113
 * 
 *             newnode.next[level] = prevnode.next[level]
 *             prevnode.next[level] = newnode             # <<<<<<<<<<<<<<
 * 
 *             newnode.width[level] = prevnode.width[level] - steps
 */
    if (__Pyx_SetItemInt(((PyObject *)__pyx_v_prevnode->next), __pyx_v_level, ((PyObject *)__pyx_v_newnode), sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":115
 *             prevnode.next[level] = newnode
 * 
 *             newnode.width[level] = prevnode.width[level] - steps             # <<<<<<<<<<<<<<
 *             prevnode.width[level] = steps + 1
 * 
 */
    (__pyx_v_newnode->width[__pyx_v_level]) = ((__pyx_v_prevnode->width[__pyx_v_level]) - __pyx_v_steps);

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":116
 * 
 *             newnode.width[level] = prevnode.width[level] - steps
 *             prevnode.width[level] = steps + 1             # <<<<<<<<<<<<<<
 * 
 *             steps = steps + steps_at_level[level]
 */
    (__pyx_v_prevnode->width[__pyx_v_level]) = (__pyx_v_steps + 1);

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":118
 *             prevnode.width[level] = steps + 1
 * 
 *             steps = steps + steps_at_level[level]             # <<<<<<<<<<<<<<
 * 
 *         for level in range(d, self.maxlevels):
 */
    __pyx_t_10 = PyInt_FromLong(__pyx_v_steps); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_steps_at_level), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyNumber_Add(__pyx_t_10, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_steps = __pyx_t_12;
  }

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":120
 *             steps = steps + steps_at_level[level]
 * 
 *         for level in range(d, self.maxlevels):             # <<<<<<<<<<<<<<
 *             (<Node> chain[level]).width[level] += 1
 * 
 */
  __pyx_t_5 = ((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->maxlevels;
  for (__pyx_t_11 = __pyx_v_d; __pyx_t_11 < __pyx_t_5; __pyx_t_11+=1) {
    __pyx_v_level = __pyx_t_11;

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":121
 * 
 *         for level in range(d, self.maxlevels):
 *             (<Node> chain[level]).width[level] += 1             # <<<<<<<<<<<<<<
 * 
 *         self.size += 1
 */
    __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_chain), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    (((struct __pyx_obj_7tseries_Node *)__pyx_t_1)->width[__pyx_v_level]) += 1;
  }

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":123
 *             (<Node> chain[level]).width[level] += 1
 * 
 *         self.size += 1             # <<<<<<<<<<<<<<
 * 
 *     def remove(self, double value):
 */
  ((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->size += 1;

  __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_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("tseries.IndexableSkiplist.insert");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_node);
  __Pyx_DECREF((PyObject *)__pyx_v_prevnode);
  __Pyx_DECREF((PyObject *)__pyx_v_newnode);
  __Pyx_DECREF((PyObject *)__pyx_v_next_at_level);
  __Pyx_DECREF(__pyx_v_chain);
  __Pyx_DECREF(__pyx_v_steps_at_level);
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":125
 *         self.size += 1
 * 
 *     def remove(self, double value):             # <<<<<<<<<<<<<<
 *         cdef int level, d
 *         cdef Node node, prevnode, tmpnode, next_at_level
 */

static PyObject *__pyx_pf_7tseries_17IndexableSkiplist_remove(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static PyObject *__pyx_pf_7tseries_17IndexableSkiplist_remove(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  double __pyx_v_value;
  int __pyx_v_level;
  int __pyx_v_d;
  struct __pyx_obj_7tseries_Node *__pyx_v_node;
  struct __pyx_obj_7tseries_Node *__pyx_v_prevnode;
  struct __pyx_obj_7tseries_Node *__pyx_v_tmpnode;
  struct __pyx_obj_7tseries_Node *__pyx_v_next_at_level;
  PyObject *__pyx_v_chain;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("remove");
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsDouble(__pyx_arg_value); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries.IndexableSkiplist.remove");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_v_node = ((struct __pyx_obj_7tseries_Node *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_prevnode = ((struct __pyx_obj_7tseries_Node *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_tmpnode = ((struct __pyx_obj_7tseries_Node *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_next_at_level = ((struct __pyx_obj_7tseries_Node *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_chain = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":131
 * 
 *         # find first node on each level where node.next[levels].value >= value
 *         chain = [None] * self.maxlevels             # <<<<<<<<<<<<<<
 *         node = self.head
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(Py_None);
  PyList_SET_ITEM(__pyx_t_1, 0, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->maxlevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_t_1), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_chain));
  __pyx_v_chain = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":132
 *         # find first node on each level where node.next[levels].value >= value
 *         chain = [None] * self.maxlevels
 *         node = self.head             # <<<<<<<<<<<<<<
 * 
 *         for level in range(self.maxlevels - 1, -1, -1):
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->head));
  __Pyx_DECREF(((PyObject *)__pyx_v_node));
  __pyx_v_node = ((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->head;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":134
 *         node = self.head
 * 
 *         for level in range(self.maxlevels - 1, -1, -1):             # <<<<<<<<<<<<<<
 *             next_at_level = node.next[level]
 *             while next_at_level.value < value:
 */
  __pyx_t_3 = PyInt_FromLong((((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->maxlevels - 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_4 = 0; __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2);
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_2))) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
    } else {
      __pyx_t_3 = PyIter_Next(__pyx_t_2);
      if (!__pyx_t_3) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_level = __pyx_t_5;

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":135
 * 
 *         for level in range(self.maxlevels - 1, -1, -1):
 *             next_at_level = node.next[level]             # <<<<<<<<<<<<<<
 *             while next_at_level.value < value:
 *                 node = next_at_level
 */
    __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_node->next), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7tseries_Node))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_next_at_level));
    __pyx_v_next_at_level = ((struct __pyx_obj_7tseries_Node *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":136
 *         for level in range(self.maxlevels - 1, -1, -1):
 *             next_at_level = node.next[level]
 *             while next_at_level.value < value:             # <<<<<<<<<<<<<<
 *                 node = next_at_level
 *                 next_at_level = node.next[level]
 */
    while (1) {
      __pyx_t_6 = (__pyx_v_next_at_level->value < __pyx_v_value);
      if (!__pyx_t_6) break;

      /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":137
 *             next_at_level = node.next[level]
 *             while next_at_level.value < value:
 *                 node = next_at_level             # <<<<<<<<<<<<<<
 *                 next_at_level = node.next[level]
 * 
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_next_at_level));
      __Pyx_DECREF(((PyObject *)__pyx_v_node));
      __pyx_v_node = __pyx_v_next_at_level;

      /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":138
 *             while next_at_level.value < value:
 *                 node = next_at_level
 *                 next_at_level = node.next[level]             # <<<<<<<<<<<<<<
 * 
 *             chain[level] = node
 */
      __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_node->next), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7tseries_Node))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_next_at_level));
      __pyx_v_next_at_level = ((struct __pyx_obj_7tseries_Node *)__pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":140
 *                 next_at_level = node.next[level]
 * 
 *             chain[level] = node             # <<<<<<<<<<<<<<
 * 
 *         if value != chain[0].next[0].value:
 */
    if (__Pyx_SetItemInt(((PyObject *)__pyx_v_chain), __pyx_v_level, ((PyObject *)__pyx_v_node), sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":142
 *             chain[level] = node
 * 
 *         if value != chain[0].next[0].value:             # <<<<<<<<<<<<<<
 *             raise KeyError('Not Found')
 * 
 */
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_chain), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__next); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_6) {

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":143
 * 
 *         if value != chain[0].next[0].value:
 *             raise KeyError('Not Found')             # <<<<<<<<<<<<<<
 * 
 *         # remove one link at each level
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_3));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
    __pyx_t_1 = PyObject_Call(__pyx_builtin_KeyError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":146
 * 
 *         # remove one link at each level
 *         d = len(chain[0].next[0].next)             # <<<<<<<<<<<<<<
 * 
 *         for level in range(d):
 */
  __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_chain), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__next); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__next); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_d = __pyx_t_4;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":148
 *         d = len(chain[0].next[0].next)
 * 
 *         for level in range(d):             # <<<<<<<<<<<<<<
 *             prevnode = chain[level]
 *             tmpnode = prevnode.next[level]
 */
  __pyx_t_5 = __pyx_v_d;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_5; __pyx_t_7+=1) {
    __pyx_v_level = __pyx_t_7;

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":149
 * 
 *         for level in range(d):
 *             prevnode = chain[level]             # <<<<<<<<<<<<<<
 *             tmpnode = prevnode.next[level]
 *             prevnode.width[level] += tmpnode.width[level] - 1
 */
    __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_chain), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7tseries_Node))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_prevnode));
    __pyx_v_prevnode = ((struct __pyx_obj_7tseries_Node *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":150
 *         for level in range(d):
 *             prevnode = chain[level]
 *             tmpnode = prevnode.next[level]             # <<<<<<<<<<<<<<
 *             prevnode.width[level] += tmpnode.width[level] - 1
 *             prevnode.next[level] = tmpnode.next[level]
 */
    __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_prevnode->next), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7tseries_Node))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_tmpnode));
    __pyx_v_tmpnode = ((struct __pyx_obj_7tseries_Node *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":151
 *             prevnode = chain[level]
 *             tmpnode = prevnode.next[level]
 *             prevnode.width[level] += tmpnode.width[level] - 1             # <<<<<<<<<<<<<<
 *             prevnode.next[level] = tmpnode.next[level]
 * 
 */
    (__pyx_v_prevnode->width[__pyx_v_level]) += ((__pyx_v_tmpnode->width[__pyx_v_level]) - 1);

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":152
 *             tmpnode = prevnode.next[level]
 *             prevnode.width[level] += tmpnode.width[level] - 1
 *             prevnode.next[level] = tmpnode.next[level]             # <<<<<<<<<<<<<<
 * 
 *         for level in range(d, self.maxlevels):
 */
    __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_tmpnode->next), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_SetItemInt(((PyObject *)__pyx_v_prevnode->next), __pyx_v_level, __pyx_t_3, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":154
 *             prevnode.next[level] = tmpnode.next[level]
 * 
 *         for level in range(d, self.maxlevels):             # <<<<<<<<<<<<<<
 *             tmpnode = chain[level]
 *             tmpnode.width[level] -= 1
 */
  __pyx_t_5 = ((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->maxlevels;
  for (__pyx_t_7 = __pyx_v_d; __pyx_t_7 < __pyx_t_5; __pyx_t_7+=1) {
    __pyx_v_level = __pyx_t_7;

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":155
 * 
 *         for level in range(d, self.maxlevels):
 *             tmpnode = chain[level]             # <<<<<<<<<<<<<<
 *             tmpnode.width[level] -= 1
 * 
 */
    __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_chain), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7tseries_Node))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_tmpnode));
    __pyx_v_tmpnode = ((struct __pyx_obj_7tseries_Node *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":156
 *         for level in range(d, self.maxlevels):
 *             tmpnode = chain[level]
 *             tmpnode.width[level] -= 1             # <<<<<<<<<<<<<<
 * 
 *         self.size -= 1
 */
    (__pyx_v_tmpnode->width[__pyx_v_level]) -= 1;
  }

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":158
 *             tmpnode.width[level] -= 1
 * 
 *         self.size -= 1             # <<<<<<<<<<<<<<
 */
  ((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->size -= 1;

  __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_AddTraceback("tseries.IndexableSkiplist.remove");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_node);
  __Pyx_DECREF((PyObject *)__pyx_v_prevnode);
  __Pyx_DECREF((PyObject *)__pyx_v_tmpnode);
  __Pyx_DECREF((PyObject *)__pyx_v_next_at_level);
  __Pyx_DECREF(__pyx_v_chain);
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":5
 * cdef double NEGINF = -INF
 * 
 * cdef inline _checknull(object val):             # <<<<<<<<<<<<<<
 *     if isinstance(val, float):
 *         return val != val or val == INF or val == NEGINF
 */

static CYTHON_INLINE PyObject *__pyx_f_7tseries__checknull(PyObject *__pyx_v_val) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("_checknull");
  __Pyx_INCREF(__pyx_v_val);

  /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":6
 * 
 * cdef inline _checknull(object val):
 *     if isinstance(val, float):             # <<<<<<<<<<<<<<
 *         return val != val or val == INF or val == NEGINF
 *     else:
 */
  __pyx_t_1 = PyObject_TypeCheck(__pyx_v_val, ((PyTypeObject *)((PyObject*)&PyFloat_Type))); 
  if (__pyx_t_1) {

    /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":7
 * cdef inline _checknull(object val):
 *     if isinstance(val, float):
 *         return val != val or val == INF or val == NEGINF             # <<<<<<<<<<<<<<
 *     else:
 *         return val is None
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_val, __pyx_v_val, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!__pyx_t_1) {
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_7tseries_INF); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_val, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_3 = PyFloat_FromDouble(__pyx_v_7tseries_NEGINF); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_5 = PyObject_RichCompare(__pyx_v_val, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = __pyx_t_5;
        __pyx_t_5 = 0;
      } else {
        __pyx_t_3 = __pyx_t_4;
        __pyx_t_4 = 0;
      }
      __pyx_t_4 = __pyx_t_3;
      __pyx_t_3 = 0;
    } else {
      __pyx_t_4 = __pyx_t_2;
      __pyx_t_2 = 0;
    }
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":9
 *         return val != val or val == INF or val == NEGINF
 *     else:
 *         return val is None             # <<<<<<<<<<<<<<
 * 
 * cdef ndarray _isnullobj(input):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = (__pyx_v_val == Py_None);
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __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_AddTraceback("tseries._checknull");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_val);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":11
 *         return val is None
 * 
 * cdef ndarray _isnullobj(input):             # <<<<<<<<<<<<<<
 *     cdef int i, length
 *     cdef object val
 */

static  PyArrayObject *__pyx_f_7tseries__isnullobj(PyObject *__pyx_v_input) {
  int __pyx_v_i;
  int __pyx_v_length;
  PyObject *__pyx_v_val;
  PyArrayObject *__pyx_v_result;
  PyArrayIterObject *__pyx_v_iter;
  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;
  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;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  __Pyx_RefNannySetupContext("_isnullobj");
  __Pyx_INCREF(__pyx_v_input);
  __pyx_v_val = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_iter = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_bstruct_result.buf = NULL;

  /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":17
 *     cdef flatiter iter
 * 
 *     length = PyArray_SIZE(input)             # <<<<<<<<<<<<<<
 * 
 *     result = <ndarray> np.zeros(length, dtype=np.int8)
 */
  if (!(likely(((__pyx_v_input) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_input, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_length = PyArray_SIZE(((PyArrayObject *)__pyx_v_input));

  /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":19
 *     length = PyArray_SIZE(input)
 * 
 *     result = <ndarray> np.zeros(length, dtype=np.int8)             # <<<<<<<<<<<<<<
 * 
 *     iter= PyArray_IterNew(input)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 19; __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_FromLong(__pyx_v_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 19; __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[3]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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[3]; __pyx_lineno = 19; __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[3]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 19; __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[3]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn_npy_int8, 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_result, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn_npy_int8, 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_result = __pyx_bstruct_result.strides[0];
    __pyx_bshape_0_result = __pyx_bstruct_result.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_5)));
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
  __pyx_v_result = ((PyArrayObject *)__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":21
 *     result = <ndarray> np.zeros(length, dtype=np.int8)
 * 
 *     iter= PyArray_IterNew(input)             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < length:
 */
  __pyx_t_5 = PyArray_IterNew(__pyx_v_input); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_flatiter))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_iter));
  __pyx_v_iter = ((PyArrayIterObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":23
 *     iter= PyArray_IterNew(input)
 * 
 *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
 *         val = PyArray_GETITEM(input, PyArray_ITER_DATA(iter))
 * 
 */
  __pyx_t_7 = __pyx_v_length;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":24
 * 
 *     for i from 0 <= i < length:
 *         val = PyArray_GETITEM(input, PyArray_ITER_DATA(iter))             # <<<<<<<<<<<<<<
 * 
 *         if _checknull(val):
 */
    if (!(likely(((__pyx_v_input) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_input, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = PyArray_GETITEM(((PyArrayObject *)__pyx_v_input), PyArray_ITER_DATA(__pyx_v_iter)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_v_val);
    __pyx_v_val = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":26
 *         val = PyArray_GETITEM(input, PyArray_ITER_DATA(iter))
 * 
 *         if _checknull(val):             # <<<<<<<<<<<<<<
 *             result[i] = 1
 * 
 */
    __pyx_t_5 = __pyx_f_7tseries__checknull(__pyx_v_val); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_11) {

      /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":27
 * 
 *         if _checknull(val):
 *             result[i] = 1             # <<<<<<<<<<<<<<
 * 
 *         PyArray_ITER_NEXT(iter)
 */
      __pyx_t_12 = __pyx_v_i;
      __pyx_t_13 = -1;
      if (__pyx_t_12 < 0) {
        __pyx_t_12 += __pyx_bshape_0_result;
        if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 0;
      } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_result)) __pyx_t_13 = 0;
      if (unlikely(__pyx_t_13 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_13);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(npy_int8 *, __pyx_bstruct_result.buf, __pyx_t_12, __pyx_bstride_0_result) = 1;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":29
 *             result[i] = 1
 * 
 *         PyArray_ITER_NEXT(iter)             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    PyArray_ITER_NEXT(__pyx_v_iter);
  }

  /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":31
 *         PyArray_ITER_NEXT(iter)
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * def isnull(input):
 */
  __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_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_result);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tseries._isnullobj");
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
  __pyx_L2:;
  __Pyx_DECREF(__pyx_v_val);
  __Pyx_DECREF((PyObject *)__pyx_v_result);
  __Pyx_DECREF((PyObject *)__pyx_v_iter);
  __Pyx_DECREF(__pyx_v_input);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":33
 *     return result
 * 
 * def isnull(input):             # <<<<<<<<<<<<<<
 *     '''
 *     Replacement for numpy.isnan / -numpy.isfinite which is suitable
 */

static PyObject *__pyx_pf_7tseries_isnull(PyObject *__pyx_self, PyObject *__pyx_v_input); /*proto*/
static char __pyx_doc_7tseries_isnull[] = "\n    Replacement for numpy.isnan / -numpy.isfinite which is suitable\n    for use on object arrays.\n\n    Parameters\n    ----------\n    arr: ndarray or object value\n\n    Returns\n    -------\n    boolean ndarray or boolean\n    ";
static PyObject *__pyx_pf_7tseries_isnull(PyObject *__pyx_self, PyObject *__pyx_v_input) {
  PyArrayObject *__pyx_v_result;
  Py_buffer __pyx_bstruct_result;
  Py_ssize_t __pyx_bstride_0_result = 0;
  Py_ssize_t __pyx_bshape_0_result = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("isnull");
  __pyx_self = __pyx_self;
  __Pyx_INCREF(__pyx_v_input);
  __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_bstruct_result.buf = NULL;

  /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":48
 *     cdef ndarray[npy_int8, ndim=1] result
 * 
 *     if isinstance(input, np.ndarray):             # <<<<<<<<<<<<<<
 *         if input.dtype.kind in ('O', 'S'):
 *             result = _isnullobj(input)
 */
  __pyx_t_1 = PyObject_TypeCheck(__pyx_v_input, ((PyTypeObject *)((PyObject*)__pyx_ptype_5numpy_ndarray))); 
  if (__pyx_t_1) {

    /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":49
 * 
 *     if isinstance(input, np.ndarray):
 *         if input.dtype.kind in ('O', 'S'):             # <<<<<<<<<<<<<<
 *             result = _isnullobj(input)
 * 
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_input, __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__kind); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__O), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 == (int)-1))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = ((int)__pyx_t_1);
    if (!__pyx_t_4) {
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__S), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 == (int)-1))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = ((int)__pyx_t_1);
      __pyx_t_1 = __pyx_t_5;
    } else {
      __pyx_t_1 = __pyx_t_4;
    }
    __pyx_t_4 = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":50
 *     if isinstance(input, np.ndarray):
 *         if input.dtype.kind in ('O', 'S'):
 *             result = _isnullobj(input)             # <<<<<<<<<<<<<<
 * 
 *             return result.astype(np.bool)
 */
      __pyx_t_3 = ((PyObject *)__pyx_f_7tseries__isnullobj(__pyx_v_input)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
        __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)((PyArrayObject *)__pyx_t_3), &__Pyx_TypeInfo_nn_npy_int8, 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_result, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn_npy_int8, 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_result = __pyx_bstruct_result.strides[0];
        __pyx_bshape_0_result = __pyx_bstruct_result.shape[0];
        if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_DECREF(((PyObject *)__pyx_v_result));
      __pyx_v_result = ((PyArrayObject *)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":52
 *             result = _isnullobj(input)
 * 
 *             return result.astype(np.bool)             # <<<<<<<<<<<<<<
 *         else:
 *             return -np.isfinite(input)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_10 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__bool); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_10);
      __pyx_t_10 = 0;
      __pyx_t_10 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_10;
      __pyx_t_10 = 0;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":54
 *             return result.astype(np.bool)
 *         else:
 *             return -np.isfinite(input)             # <<<<<<<<<<<<<<
 *     else:
 *         return _checknull(input)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_2 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__isfinite); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_v_input);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_input);
      __Pyx_GIVEREF(__pyx_v_input);
      __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_10;
      __pyx_t_10 = 0;
      goto __pyx_L0;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":56
 *             return -np.isfinite(input)
 *     else:
 *         return _checknull(input)             # <<<<<<<<<<<<<<
 * 
 * def notnull(input):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_10 = __pyx_f_7tseries__checknull(__pyx_v_input); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_r = __pyx_t_10;
    __pyx_t_10 = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __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_10);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tseries.isnull");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
  __pyx_L2:;
  __Pyx_DECREF((PyObject *)__pyx_v_result);
  __Pyx_DECREF(__pyx_v_input);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":58
 *         return _checknull(input)
 * 
 * def notnull(input):             # <<<<<<<<<<<<<<
 *     '''
 *     Replacement for numpy.isfinite / -numpy.isnan which is suitable
 */

static PyObject *__pyx_pf_7tseries_notnull(PyObject *__pyx_self, PyObject *__pyx_v_input); /*proto*/
static char __pyx_doc_7tseries_notnull[] = "\n    Replacement for numpy.isfinite / -numpy.isnan which is suitable\n    for use on object arrays.\n\n    Parameters\n    ----------\n    arr: ndarray or object value\n\n    Returns\n    -------\n    boolean ndarray or boolean\n    ";
static PyObject *__pyx_pf_7tseries_notnull(PyObject *__pyx_self, PyObject *__pyx_v_input) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("notnull");
  __pyx_self = __pyx_self;
  __Pyx_INCREF(__pyx_v_input);

  /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":71
 *     boolean ndarray or boolean
 *     '''
 *     if isinstance(input, np.ndarray):             # <<<<<<<<<<<<<<
 *         return -isnull(input)
 *     else:
 */
  __pyx_t_1 = PyObject_TypeCheck(__pyx_v_input, ((PyTypeObject *)((PyObject*)__pyx_ptype_5numpy_ndarray))); 
  if (__pyx_t_1) {

    /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":72
 *     '''
 *     if isinstance(input, np.ndarray):
 *         return -isnull(input)             # <<<<<<<<<<<<<<
 *     else:
 *         return not bool(_checknull(input))
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__isnull); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __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[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_input);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_input);
    __Pyx_GIVEREF(__pyx_v_input);
    __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Negative(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":74
 *         return -isnull(input)
 *     else:
 *         return not bool(_checknull(input))             # <<<<<<<<<<<<<<
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_f_7tseries__checknull(__pyx_v_input); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyBool_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyBool_FromLong((!__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("tseries.notnull");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_input);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":5
 * # Groupby-related functions
 * 
 * cdef inline _isnan(object o):             # <<<<<<<<<<<<<<
 *     return o != o
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_7tseries__isnan(PyObject *__pyx_v_o) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_isnan");

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":6
 * 
 * cdef inline _isnan(object o):
 *     return o != o             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_o, __pyx_v_o, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 6; __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("tseries._isnan");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":9
 * 
 * @cython.boundscheck(False)
 * def arrmap(ndarray[object, ndim=1] index, object func):             # <<<<<<<<<<<<<<
 *     cdef int length = index.shape[0]
 *     cdef int i = 0
 */

static PyObject *__pyx_pf_7tseries_arrmap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries_arrmap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_index = 0;
  PyObject *__pyx_v_func = 0;
  int __pyx_v_length;
  int __pyx_v_i;
  PyArrayObject *__pyx_v_result = 0;
  Py_buffer __pyx_bstruct_index;
  Py_ssize_t __pyx_bstride_0_index = 0;
  Py_ssize_t __pyx_bshape_0_index = 0;
  Py_buffer __pyx_bstruct_result;
  Py_ssize_t __pyx_bstride_0_result = 0;
  Py_ssize_t __pyx_bshape_0_result = 0;
  PyObject *__pyx_r = NULL;
  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;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject **__pyx_t_10;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__func,0};
  __Pyx_RefNannySetupContext("arrmap");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__func);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("arrmap", 1, 2, 2, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __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), "arrmap") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_index = ((PyArrayObject *)values[0]);
    __pyx_v_func = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_index = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_func = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arrmap", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries.arrmap");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_index);
  __Pyx_INCREF(__pyx_v_func);
  __pyx_bstruct_result.buf = NULL;
  __pyx_bstruct_index.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_index, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_index = __pyx_bstruct_index.strides[0];
  __pyx_bshape_0_index = __pyx_bstruct_index.shape[0];

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":10
 * @cython.boundscheck(False)
 * def arrmap(ndarray[object, ndim=1] index, object func):
 *     cdef int length = index.shape[0]             # <<<<<<<<<<<<<<
 *     cdef int i = 0
 * 
 */
  __pyx_v_length = (__pyx_v_index->dimensions[0]);

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":11
 * def arrmap(ndarray[object, ndim=1] index, object func):
 *     cdef int length = index.shape[0]
 *     cdef int i = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[object, ndim=1] result = np.empty(length, dtype=np.object_)
 */
  __pyx_v_i = 0;

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":13
 *     cdef int i = 0
 * 
 *     cdef ndarray[object, ndim=1] result = np.empty(length, dtype=np.object_)             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < length:
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 13; __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[4]; __pyx_lineno = 13; __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_FromLong(__pyx_v_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 13; __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[4]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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[4]; __pyx_lineno = 13; __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[4]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__object_); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 13; __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[4]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((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[4]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_result.buf = NULL;
      {__pyx_filename = __pyx_f[4]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_result = __pyx_bstruct_result.strides[0];
      __pyx_bshape_0_result = __pyx_bstruct_result.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":15
 *     cdef ndarray[object, ndim=1] result = np.empty(length, dtype=np.object_)
 * 
 *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
 *         result[i] = trycall(func, index[i])
 * 
 */
  __pyx_t_7 = __pyx_v_length;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":16
 * 
 *     for i from 0 <= i < length:
 *         result[i] = trycall(func, index[i])             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    __pyx_t_8 = __pyx_v_i;
    if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_0_index;
    __pyx_t_5 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_index.buf, __pyx_t_8, __pyx_bstride_0_index);
    __Pyx_INCREF((PyObject*)__pyx_t_5);
    __pyx_t_1 = __pyx_f_7tseries_trycall(__pyx_v_func, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_9 = __pyx_v_i;
    if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_0_result;
    __pyx_t_10 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_result.buf, __pyx_t_9, __pyx_bstride_0_result);
    __Pyx_GOTREF(*__pyx_t_10);
    __Pyx_DECREF(*__pyx_t_10); __Pyx_INCREF(__pyx_t_1);
    *__pyx_t_10 = __pyx_t_1;
    __Pyx_GIVEREF(*__pyx_t_10);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":18
 *         result[i] = trycall(func, index[i])
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  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_index);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tseries.arrmap");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_index);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_DECREF((PyObject *)__pyx_v_index);
  __Pyx_DECREF(__pyx_v_func);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":21
 * 
 * @cython.boundscheck(False)
 * def groupby(object index, object mapper, output=None):             # <<<<<<<<<<<<<<
 *     cdef dict result
 *     cdef ndarray[object, ndim=1] mapped_index
 */

static PyObject *__pyx_pf_7tseries_groupby(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries_groupby(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_index = 0;
  PyObject *__pyx_v_mapper = 0;
  PyObject *__pyx_v_output = 0;
  PyObject *__pyx_v_result;
  PyArrayObject *__pyx_v_mapped_index;
  PyArrayObject *__pyx_v_index_buf;
  PyArrayObject *__pyx_v_mask;
  int __pyx_v_i;
  int __pyx_v_length;
  PyObject *__pyx_v_members;
  PyObject *__pyx_v_idx;
  PyObject *__pyx_v_key;
  PyObject *__pyx_v_nullkeys;
  Py_buffer __pyx_bstruct_index_buf;
  Py_ssize_t __pyx_bstride_0_index_buf = 0;
  Py_ssize_t __pyx_bshape_0_index_buf = 0;
  Py_buffer __pyx_bstruct_mask;
  Py_ssize_t __pyx_bstride_0_mask = 0;
  Py_ssize_t __pyx_bshape_0_mask = 0;
  Py_buffer __pyx_bstruct_mapped_index;
  Py_ssize_t __pyx_bstride_0_mapped_index = 0;
  Py_ssize_t __pyx_bshape_0_mapped_index = 0;
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  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;
  PyArrayObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  __pyx_t_5numpy_int8_t __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__mapper,&__pyx_n_s__output,0};
  __Pyx_RefNannySetupContext("groupby");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mapper);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("groupby", 0, 2, 3, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__output);
        if (unlikely(value)) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "groupby") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_index = values[0];
    __pyx_v_mapper = values[1];
    __pyx_v_output = values[2];
  } else {
    __pyx_v_output = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3:
      __pyx_v_output = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2:
      __pyx_v_mapper = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v_index = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("groupby", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries.groupby");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_index);
  __Pyx_INCREF(__pyx_v_mapper);
  __Pyx_INCREF(__pyx_v_output);
  __pyx_v_result = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_mapped_index = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_index_buf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_mask = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_members = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_key = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_nullkeys = Py_None; __Pyx_INCREF(Py_None);
  __pyx_bstruct_mapped_index.buf = NULL;
  __pyx_bstruct_index_buf.buf = NULL;
  __pyx_bstruct_mask.buf = NULL;

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":30
 *     cdef object idx, key
 * 
 *     length = len(index)             # <<<<<<<<<<<<<<
 * 
 *     if output is None:
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_index); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_length = __pyx_t_1;

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":32
 *     length = len(index)
 * 
 *     if output is None:             # <<<<<<<<<<<<<<
 *         result = {}
 *     else:
 */
  __pyx_t_2 = (__pyx_v_output == Py_None);
  if (__pyx_t_2) {

    /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":33
 * 
 *     if output is None:
 *         result = {}             # <<<<<<<<<<<<<<
 *     else:
 *         result = <dict> output
 */
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(((PyObject *)__pyx_v_result));
    __pyx_v_result = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":35
 *         result = {}
 *     else:
 *         result = <dict> output             # <<<<<<<<<<<<<<
 * 
 *     index_buf = np.asarray(index)
 */
    __Pyx_INCREF(((PyObject *)((PyObject *)__pyx_v_output)));
    __Pyx_DECREF(((PyObject *)__pyx_v_result));
    __pyx_v_result = ((PyObject *)__pyx_v_output);
  }
  __pyx_L6:;

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":37
 *         result = <dict> output
 * 
 *     index_buf = np.asarray(index)             # <<<<<<<<<<<<<<
 *     mapped_index = arrmap(index_buf, mapper)
 *     mask = _isnullobj(mapped_index)
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__asarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_index);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
  __Pyx_GIVEREF(__pyx_v_index);
  __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__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[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_index_buf);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_index_buf, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_index_buf, (PyObject*)__pyx_v_index_buf, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_bstride_0_index_buf = __pyx_bstruct_index_buf.strides[0];
    __pyx_bshape_0_index_buf = __pyx_bstruct_index_buf.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_index_buf));
  __pyx_v_index_buf = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":38
 * 
 *     index_buf = np.asarray(index)
 *     mapped_index = arrmap(index_buf, mapper)             # <<<<<<<<<<<<<<
 *     mask = _isnullobj(mapped_index)
 *     nullkeys = index_buf[mask.astype(bool)]
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__arrmap); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_index_buf));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_index_buf));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_index_buf));
  __Pyx_INCREF(__pyx_v_mapper);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_mapper);
  __Pyx_GIVEREF(__pyx_v_mapper);
  __pyx_t_4 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mapped_index);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_mapped_index, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_mapped_index, (PyObject*)__pyx_v_mapped_index, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_bstride_0_mapped_index = __pyx_bstruct_mapped_index.strides[0];
    __pyx_bshape_0_mapped_index = __pyx_bstruct_mapped_index.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_mapped_index));
  __pyx_v_mapped_index = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":39
 *     index_buf = np.asarray(index)
 *     mapped_index = arrmap(index_buf, mapper)
 *     mask = _isnullobj(mapped_index)             # <<<<<<<<<<<<<<
 *     nullkeys = index_buf[mask.astype(bool)]
 *     if len(nullkeys) > 0:
 */
  __pyx_t_4 = ((PyObject *)__pyx_f_7tseries__isnullobj(((PyObject *)__pyx_v_mapped_index))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_mask, (PyObject*)((PyArrayObject *)__pyx_t_4), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_mask, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_bstride_0_mask = __pyx_bstruct_mask.strides[0];
    __pyx_bshape_0_mask = __pyx_bstruct_mask.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(((PyObject *)__pyx_v_mask));
  __pyx_v_mask = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":40
 *     mapped_index = arrmap(index_buf, mapper)
 *     mask = _isnullobj(mapped_index)
 *     nullkeys = index_buf[mask.astype(bool)]             # <<<<<<<<<<<<<<
 *     if len(nullkeys) > 0:
 *         result[np.NaN] = nullkeys
 */
  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_mask), __pyx_n_s__astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)((PyObject*)&PyBool_Type)));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)&PyBool_Type)));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyBool_Type)));
  __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_index_buf), __pyx_t_5); if (!__pyx_t_3) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_v_nullkeys);
  __pyx_v_nullkeys = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":41
 *     mask = _isnullobj(mapped_index)
 *     nullkeys = index_buf[mask.astype(bool)]
 *     if len(nullkeys) > 0:             # <<<<<<<<<<<<<<
 *         result[np.NaN] = nullkeys
 * 
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_nullkeys); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_1 > 0);
  if (__pyx_t_2) {

    /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":42
 *     nullkeys = index_buf[mask.astype(bool)]
 *     if len(nullkeys) > 0:
 *         result[np.NaN] = nullkeys             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < length:
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__NaN); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_t_5, __pyx_v_nullkeys) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":44
 *         result[np.NaN] = nullkeys
 * 
 *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
 *         if mask[i]:
 *             continue
 */
  __pyx_t_7 = __pyx_v_length;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":45
 * 
 *     for i from 0 <= i < length:
 *         if mask[i]:             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    __pyx_t_12 = __pyx_v_i;
    if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_0_mask;
    __pyx_t_13 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_bstruct_mask.buf, __pyx_t_12, __pyx_bstride_0_mask));
    if (__pyx_t_13) {

      /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":46
 *     for i from 0 <= i < length:
 *         if mask[i]:
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         key = mapped_index[i]
 */
      goto __pyx_L8_continue;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":48
 *             continue
 * 
 *         key = mapped_index[i]             # <<<<<<<<<<<<<<
 *         idx = index_buf[i]
 *         if key in result:
 */
    __pyx_t_14 = __pyx_v_i;
    if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_mapped_index;
    __pyx_t_5 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_mapped_index.buf, __pyx_t_14, __pyx_bstride_0_mapped_index);
    __Pyx_INCREF((PyObject*)__pyx_t_5);
    __Pyx_DECREF(__pyx_v_key);
    __pyx_v_key = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":49
 * 
 *         key = mapped_index[i]
 *         idx = index_buf[i]             # <<<<<<<<<<<<<<
 *         if key in result:
 *             members = result[key]
 */
    __pyx_t_15 = __pyx_v_i;
    if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_index_buf;
    __pyx_t_5 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_index_buf.buf, __pyx_t_15, __pyx_bstride_0_index_buf);
    __Pyx_INCREF((PyObject*)__pyx_t_5);
    __Pyx_DECREF(__pyx_v_idx);
    __pyx_v_idx = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":50
 *         key = mapped_index[i]
 *         idx = index_buf[i]
 *         if key in result:             # <<<<<<<<<<<<<<
 *             members = result[key]
 *             members.append(idx)
 */
    if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
      __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {
      __pyx_t_2 = ((PyDict_Contains(((PyObject *)__pyx_v_result), __pyx_v_key))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (__pyx_t_2) {

      /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":51
 *         idx = index_buf[i]
 *         if key in result:
 *             members = result[key]             # <<<<<<<<<<<<<<
 *             members.append(idx)
 *         else:
 */
      __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_result), __pyx_v_key); if (!__pyx_t_5) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      if (!(likely(PyList_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_members));
      __pyx_v_members = ((PyObject *)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":52
 *         if key in result:
 *             members = result[key]
 *             members.append(idx)             # <<<<<<<<<<<<<<
 *         else:
 *             result[key] = [idx]
 */
      if (unlikely(__pyx_v_members == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_16 = PyList_Append(((PyObject *)__pyx_v_members), __pyx_v_idx); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L11;
    }
    /*else*/ {

      /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":54
 *             members.append(idx)
 *         else:
 *             result[key] = [idx]             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
      __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_INCREF(__pyx_v_idx);
      PyList_SET_ITEM(__pyx_t_5, 0, __pyx_v_idx);
      __Pyx_GIVEREF(__pyx_v_idx);
      if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_key, ((PyObject *)__pyx_t_5)) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    }
    __pyx_L11:;
    __pyx_L8_continue:;
  }

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":56
 *             result[key] = [idx]
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_index_buf);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mapped_index);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tseries.groupby");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_index_buf);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mapped_index);
  __pyx_L2:;
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_DECREF((PyObject *)__pyx_v_mapped_index);
  __Pyx_DECREF((PyObject *)__pyx_v_index_buf);
  __Pyx_DECREF((PyObject *)__pyx_v_mask);
  __Pyx_DECREF(__pyx_v_members);
  __Pyx_DECREF(__pyx_v_idx);
  __Pyx_DECREF(__pyx_v_key);
  __Pyx_DECREF(__pyx_v_nullkeys);
  __Pyx_DECREF(__pyx_v_index);
  __Pyx_DECREF(__pyx_v_mapper);
  __Pyx_DECREF(__pyx_v_output);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":59
 * 
 * @cython.boundscheck(False)
 * def groupby_indices(object index, object mapper):             # <<<<<<<<<<<<<<
 *     cdef dict result
 *     cdef ndarray[object, ndim=1] mapped_index
 */

static PyObject *__pyx_pf_7tseries_groupby_indices(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries_groupby_indices(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_index = 0;
  PyObject *__pyx_v_mapper = 0;
  PyObject *__pyx_v_result;
  PyArrayObject *__pyx_v_mapped_index;
  PyArrayObject *__pyx_v_mask;
  int __pyx_v_i;
  int __pyx_v_length;
  PyObject *__pyx_v_null_list;
  PyObject *__pyx_v_key;
  Py_buffer __pyx_bstruct_mask;
  Py_ssize_t __pyx_bstride_0_mask = 0;
  Py_ssize_t __pyx_bshape_0_mask = 0;
  Py_buffer __pyx_bstruct_mapped_index;
  Py_ssize_t __pyx_bstride_0_mapped_index = 0;
  Py_ssize_t __pyx_bshape_0_mapped_index = 0;
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  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;
  __pyx_t_5numpy_int8_t __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__mapper,0};
  __Pyx_RefNannySetupContext("groupby_indices");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mapper);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("groupby_indices", 1, 2, 2, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __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), "groupby_indices") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_index = values[0];
    __pyx_v_mapper = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_index = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_mapper = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("groupby_indices", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries.groupby_indices");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_index);
  __Pyx_INCREF(__pyx_v_mapper);
  __pyx_v_result = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_mapped_index = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_mask = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_null_list = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_key = Py_None; __Pyx_INCREF(Py_None);
  __pyx_bstruct_mapped_index.buf = NULL;
  __pyx_bstruct_mask.buf = NULL;

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":67
 *     cdef object key
 * 
 *     length = len(index)             # <<<<<<<<<<<<<<
 * 
 *     result = {}
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_index); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_length = __pyx_t_1;

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":69
 *     length = len(index)
 * 
 *     result = {}             # <<<<<<<<<<<<<<
 *     index = np.asarray(index)
 *     mapped_index = arrmap(index, mapper)
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
  __pyx_v_result = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":70
 * 
 *     result = {}
 *     index = np.asarray(index)             # <<<<<<<<<<<<<<
 *     mapped_index = arrmap(index, mapper)
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_index);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_index);
  __Pyx_GIVEREF(__pyx_v_index);
  __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_index);
  __pyx_v_index = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":71
 *     result = {}
 *     index = np.asarray(index)
 *     mapped_index = arrmap(index, mapper)             # <<<<<<<<<<<<<<
 * 
 *     mask = _isnullobj(mapped_index)
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__arrmap); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_index);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_index);
  __Pyx_GIVEREF(__pyx_v_index);
  __Pyx_INCREF(__pyx_v_mapper);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_mapper);
  __Pyx_GIVEREF(__pyx_v_mapper);
  __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __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_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mapped_index);
    __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_mapped_index, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_object, 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_mapped_index, (PyObject*)__pyx_v_mapped_index, &__Pyx_TypeInfo_object, 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_mapped_index = __pyx_bstruct_mapped_index.strides[0];
    __pyx_bshape_0_mapped_index = __pyx_bstruct_mapped_index.shape[0];
    if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_mapped_index));
  __pyx_v_mapped_index = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":73
 *     mapped_index = arrmap(index, mapper)
 * 
 *     mask = _isnullobj(mapped_index)             # <<<<<<<<<<<<<<
 * 
 *     if mask.astype(bool).any():
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_7tseries__isnullobj(((PyObject *)__pyx_v_mapped_index))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask);
    __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_mask, (PyObject*)((PyArrayObject *)__pyx_t_3), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_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_mask, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_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_mask = __pyx_bstruct_mask.strides[0];
    __pyx_bshape_0_mask = __pyx_bstruct_mask.shape[0];
    if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(((PyObject *)__pyx_v_mask));
  __pyx_v_mask = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":75
 *     mask = _isnullobj(mapped_index)
 * 
 *     if mask.astype(bool).any():             # <<<<<<<<<<<<<<
 *         null_list = []
 *         result[np.NaN] = null_list
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_mask), __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)((PyObject*)&PyBool_Type)));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)&PyBool_Type)));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyBool_Type)));
  __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_10) {

    /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":76
 * 
 *     if mask.astype(bool).any():
 *         null_list = []             # <<<<<<<<<<<<<<
 *         result[np.NaN] = null_list
 * 
 */
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(((PyObject *)__pyx_v_null_list));
    __pyx_v_null_list = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":77
 *     if mask.astype(bool).any():
 *         null_list = []
 *         result[np.NaN] = null_list             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < length:
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__NaN); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_t_2, ((PyObject *)__pyx_v_null_list)) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":79
 *         result[np.NaN] = null_list
 * 
 *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
 *         if mask[i]:
 *             null_list.append(i)
 */
  __pyx_t_6 = __pyx_v_length;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":80
 * 
 *     for i from 0 <= i < length:
 *         if mask[i]:             # <<<<<<<<<<<<<<
 *             null_list.append(i)
 *         key = mapped_index[i]
 */
    __pyx_t_11 = __pyx_v_i;
    if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_0_mask;
    __pyx_t_12 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_bstruct_mask.buf, __pyx_t_11, __pyx_bstride_0_mask));
    if (__pyx_t_12) {

      /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":81
 *     for i from 0 <= i < length:
 *         if mask[i]:
 *             null_list.append(i)             # <<<<<<<<<<<<<<
 *         key = mapped_index[i]
 *         if key in result:
 */
      if (unlikely(__pyx_v_null_list == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_13 = PyList_Append(((PyObject *)__pyx_v_null_list), __pyx_t_2); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":82
 *         if mask[i]:
 *             null_list.append(i)
 *         key = mapped_index[i]             # <<<<<<<<<<<<<<
 *         if key in result:
 *             (<list> result[key]).append(i)
 */
    __pyx_t_13 = __pyx_v_i;
    if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_mapped_index;
    __pyx_t_2 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_mapped_index.buf, __pyx_t_13, __pyx_bstride_0_mapped_index);
    __Pyx_INCREF((PyObject*)__pyx_t_2);
    __Pyx_DECREF(__pyx_v_key);
    __pyx_v_key = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":83
 *             null_list.append(i)
 *         key = mapped_index[i]
 *         if key in result:             # <<<<<<<<<<<<<<
 *             (<list> result[key]).append(i)
 *         else:
 */
    if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
      __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {
      __pyx_t_10 = ((PyDict_Contains(((PyObject *)__pyx_v_result), __pyx_v_key))); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (__pyx_t_10) {

      /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":84
 *         key = mapped_index[i]
 *         if key in result:
 *             (<list> result[key]).append(i)             # <<<<<<<<<<<<<<
 *         else:
 *             result[key] = [i]
 */
      __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_result), __pyx_v_key); if (!__pyx_t_2) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(((PyObject *)__pyx_t_2) == Py_None)) {
        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_4 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_14 = PyList_Append(((PyObject *)((PyObject *)__pyx_t_2)), __pyx_t_4); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L10;
    }
    /*else*/ {

      /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":86
 *             (<list> result[key]).append(i)
 *         else:
 *             result[key] = [i]             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
      __pyx_t_4 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_key, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    }
    __pyx_L10:;
  }

  /* "H:\workspace\pandas\pandas\lib\src\groupby.pyx":88
 *             result[key] = [i]
 * 
 *     return result             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mapped_index);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tseries.groupby_indices");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mapped_index);
  __pyx_L2:;
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_DECREF((PyObject *)__pyx_v_mapped_index);
  __Pyx_DECREF((PyObject *)__pyx_v_mask);
  __Pyx_DECREF(__pyx_v_null_list);
  __Pyx_DECREF(__pyx_v_key);
  __Pyx_DECREF(__pyx_v_index);
  __Pyx_DECREF(__pyx_v_mapper);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\moments.pyx":7
 *     double kth_smallest(double *a, int n, int k)
 * 
 * def median(ndarray arr):             # <<<<<<<<<<<<<<
 *     '''
 *     A faster median
 */

static PyObject *__pyx_pf_7tseries_median(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
static char __pyx_doc_7tseries_median[] = "\n    A faster median\n    ";
static PyObject *__pyx_pf_7tseries_median(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
  double *__pyx_v_values;
  int __pyx_v_n;
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  long __pyx_t_6;
  __Pyx_RefNannySetupContext("median");
  __pyx_self = __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_v_arr);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":12
 *     '''
 *     cdef double *values
 *     cdef int n = len(arr)             # <<<<<<<<<<<<<<
 * 
 *     if len(arr) == 0:
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":14
 *     cdef int n = len(arr)
 * 
 *     if len(arr) == 0:             # <<<<<<<<<<<<<<
 *         return np.NaN
 * 
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_1 == 0);
  if (__pyx_t_2) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":15
 * 
 *     if len(arr) == 0:
 *         return np.NaN             # <<<<<<<<<<<<<<
 * 
 *     if not np.PyArray_CHKFLAGS(arr, np.NPY_C_CONTIGUOUS):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__NaN); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":17
 *         return np.NaN
 * 
 *     if not np.PyArray_CHKFLAGS(arr, np.NPY_C_CONTIGUOUS):             # <<<<<<<<<<<<<<
 *         arr = np.array(arr)
 * 
 */
  __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_arr), NPY_C_CONTIGUOUS));
  if (__pyx_t_2) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":18
 * 
 *     if not np.PyArray_CHKFLAGS(arr, np.NPY_C_CONTIGUOUS):
 *         arr = np.array(arr)             # <<<<<<<<<<<<<<
 * 
 *     values = <double *> arr.data
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_arr);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_arr);
    __Pyx_GIVEREF(__pyx_v_arr);
    __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_v_arr);
    __pyx_v_arr = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":20
 *         arr = np.array(arr)
 * 
 *     values = <double *> arr.data             # <<<<<<<<<<<<<<
 * 
 *     if n % 2:
 */
  __pyx_v_values = ((double *)((PyArrayObject *)__pyx_v_arr)->data);

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":22
 *     values = <double *> arr.data
 * 
 *     if n % 2:             # <<<<<<<<<<<<<<
 *         return kth_smallest(values, n, n / 2)
 *     else:
 */
  __pyx_t_6 = __Pyx_mod_long(__pyx_v_n, 2);
  if (__pyx_t_6) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":23
 * 
 *     if n % 2:
 *         return kth_smallest(values, n, n / 2)             # <<<<<<<<<<<<<<
 *     else:
 *         return (kth_smallest(values, n, n / 2) +
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = PyFloat_FromDouble(kth_smallest(__pyx_v_values, __pyx_v_n, __Pyx_div_long(__pyx_v_n, 2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":25
 *         return kth_smallest(values, n, n / 2)
 *     else:
 *         return (kth_smallest(values, n, n / 2) +             # <<<<<<<<<<<<<<
 *                 kth_smallest(values, n, n / 2 - 1)) / 2
 * 
 */
    __Pyx_XDECREF(__pyx_r);

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":26
 *     else:
 *         return (kth_smallest(values, n, n / 2) +
 *                 kth_smallest(values, n, n / 2 - 1)) / 2             # <<<<<<<<<<<<<<
 * 
 * #-------------------------------------------------------------------------------
 */
    __pyx_t_5 = PyFloat_FromDouble(((kth_smallest(__pyx_v_values, __pyx_v_n, __Pyx_div_long(__pyx_v_n, 2)) + kth_smallest(__pyx_v_values, __pyx_v_n, (__Pyx_div_long(__pyx_v_n, 2) - 1))) / 2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }
  __pyx_L7:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("tseries.median");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_arr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\moments.pyx":31
 * # Rolling sum
 * 
 * def _roll_sum(ndarray[double_t, ndim=1] input,             # <<<<<<<<<<<<<<
 *               int win, int minp):
 *     cdef double val, prev, sum_x = 0
 */

static PyObject *__pyx_pf_7tseries__roll_sum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries__roll_sum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  int __pyx_v_win;
  int __pyx_v_minp;
  double __pyx_v_val;
  double __pyx_v_prev;
  double __pyx_v_sum_x;
  int __pyx_v_nobs;
  int __pyx_v_i;
  int __pyx_v_N;
  PyArrayObject *__pyx_v_output = 0;
  Py_buffer __pyx_bstruct_output;
  Py_ssize_t __pyx_bstride_0_output = 0;
  Py_ssize_t __pyx_bshape_0_output = 0;
  Py_buffer __pyx_bstruct_input;
  Py_ssize_t __pyx_bstride_0_input = 0;
  Py_ssize_t __pyx_bshape_0_input = 0;
  PyObject *__pyx_r = NULL;
  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;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  long __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__win,&__pyx_n_s__minp,0};
  __Pyx_RefNannySetupContext("_roll_sum");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__win);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_roll_sum", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_roll_sum", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __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), "_roll_sum") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_input = ((PyArrayObject *)values[0]);
    __pyx_v_win = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_input = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_win = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_roll_sum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries._roll_sum");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_input);
  __pyx_bstruct_output.buf = NULL;
  __pyx_bstruct_input.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_input, (PyObject*)__pyx_v_input, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_input = __pyx_bstruct_input.strides[0];
  __pyx_bshape_0_input = __pyx_bstruct_input.shape[0];

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":33
 * def _roll_sum(ndarray[double_t, ndim=1] input,
 *               int win, int minp):
 *     cdef double val, prev, sum_x = 0             # <<<<<<<<<<<<<<
 *     cdef int nobs = 0, i
 *     cdef int N = len(input)
 */
  __pyx_v_sum_x = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":34
 *               int win, int minp):
 *     cdef double val, prev, sum_x = 0
 *     cdef int nobs = 0, i             # <<<<<<<<<<<<<<
 *     cdef int N = len(input)
 * 
 */
  __pyx_v_nobs = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":35
 *     cdef double val, prev, sum_x = 0
 *     cdef int nobs = 0, i
 *     cdef int N = len(input)             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":37
 *     cdef int N = len(input)
 * 
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)             # <<<<<<<<<<<<<<
 * 
 *     if minp > N:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __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[2]; __pyx_lineno = 37; __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_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __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[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_output = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_output.buf = NULL;
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_output = __pyx_bstruct_output.strides[0];
      __pyx_bshape_0_output = __pyx_bstruct_output.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":39
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)
 * 
 *     if minp > N:             # <<<<<<<<<<<<<<
 *         minp = N + 1
 * 
 */
  __pyx_t_7 = (__pyx_v_minp > __pyx_v_N);
  if (__pyx_t_7) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":40
 * 
 *     if minp > N:
 *         minp = N + 1             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < minp - 1:
 */
    __pyx_v_minp = (__pyx_v_N + 1);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":42
 *         minp = N + 1
 * 
 *     for i from 0 <= i < minp - 1:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_8 = (__pyx_v_minp - 1);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":43
 * 
 *     for i from 0 <= i < minp - 1:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         # Not NaN
 */
    __pyx_t_9 = __pyx_v_i;
    __pyx_t_10 = -1;
    if (__pyx_t_9 < 0) {
      __pyx_t_9 += __pyx_bshape_0_input;
      if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_input)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_9, __pyx_bstride_0_input));

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":46
 * 
 *         # Not NaN
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             sum_x += val
 */
    __pyx_t_7 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":47
 *         # Not NaN
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             sum_x += val
 * 
 */
      __pyx_v_nobs += 1;

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":48
 *         if val == val:
 *             nobs += 1
 *             sum_x += val             # <<<<<<<<<<<<<<
 * 
 *         output[i] = NaN
 */
      __pyx_v_sum_x += __pyx_v_val;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":50
 *             sum_x += val
 * 
 *         output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     for i from minp - 1 <= i < N:
 */
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_11 = -1;
    if (__pyx_t_10 < 0) {
      __pyx_t_10 += __pyx_bshape_0_output;
      if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
    } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_output)) __pyx_t_11 = 0;
    if (unlikely(__pyx_t_11 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_11);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_10, __pyx_bstride_0_output) = __pyx_v_7tseries_NaN;
  }

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":52
 *         output[i] = NaN
 * 
 *     for i from minp - 1 <= i < N:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_11 = __pyx_v_N;
  for (__pyx_v_i = (__pyx_v_minp - 1); __pyx_v_i < __pyx_t_11; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":53
 * 
 *     for i from minp - 1 <= i < N:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         if i > win - 1:
 */
    __pyx_t_12 = __pyx_v_i;
    __pyx_t_13 = -1;
    if (__pyx_t_12 < 0) {
      __pyx_t_12 += __pyx_bshape_0_input;
      if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 0;
    } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_input)) __pyx_t_13 = 0;
    if (unlikely(__pyx_t_13 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_13);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_12, __pyx_bstride_0_input));

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":55
 *         val = input[i]
 * 
 *         if i > win - 1:             # <<<<<<<<<<<<<<
 *             prev = input[i - win]
 *             if prev == prev:
 */
    __pyx_t_7 = (__pyx_v_i > (__pyx_v_win - 1));
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":56
 * 
 *         if i > win - 1:
 *             prev = input[i - win]             # <<<<<<<<<<<<<<
 *             if prev == prev:
 *                 sum_x -= prev
 */
      __pyx_t_13 = (__pyx_v_i - __pyx_v_win);
      __pyx_t_14 = -1;
      if (__pyx_t_13 < 0) {
        __pyx_t_13 += __pyx_bshape_0_input;
        if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0;
      } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_input)) __pyx_t_14 = 0;
      if (unlikely(__pyx_t_14 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_14);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_13, __pyx_bstride_0_input));

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":57
 *         if i > win - 1:
 *             prev = input[i - win]
 *             if prev == prev:             # <<<<<<<<<<<<<<
 *                 sum_x -= prev
 *                 nobs -= 1
 */
      __pyx_t_7 = (__pyx_v_prev == __pyx_v_prev);
      if (__pyx_t_7) {

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":58
 *             prev = input[i - win]
 *             if prev == prev:
 *                 sum_x -= prev             # <<<<<<<<<<<<<<
 *                 nobs -= 1
 * 
 */
        __pyx_v_sum_x -= __pyx_v_prev;

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":59
 *             if prev == prev:
 *                 sum_x -= prev
 *                 nobs -= 1             # <<<<<<<<<<<<<<
 * 
 *         if val == val:
 */
        __pyx_v_nobs -= 1;
        goto __pyx_L13;
      }
      __pyx_L13:;
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":61
 *                 nobs -= 1
 * 
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             sum_x += val
 */
    __pyx_t_7 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":62
 * 
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             sum_x += val
 * 
 */
      __pyx_v_nobs += 1;

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":63
 *         if val == val:
 *             nobs += 1
 *             sum_x += val             # <<<<<<<<<<<<<<
 * 
 *         if nobs >= minp:
 */
      __pyx_v_sum_x += __pyx_v_val;
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":65
 *             sum_x += val
 * 
 *         if nobs >= minp:             # <<<<<<<<<<<<<<
 *             output[i] = sum_x
 *         else:
 */
    __pyx_t_7 = (__pyx_v_nobs >= __pyx_v_minp);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":66
 * 
 *         if nobs >= minp:
 *             output[i] = sum_x             # <<<<<<<<<<<<<<
 *         else:
 *             output[i] = NaN
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_15 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_14 += __pyx_bshape_0_output;
        if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_output)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_14, __pyx_bstride_0_output) = __pyx_v_sum_x;
      goto __pyx_L15;
    }
    /*else*/ {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":68
 *             output[i] = sum_x
 *         else:
 *             output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     return output
 */
      __pyx_t_15 = __pyx_v_i;
      __pyx_t_16 = -1;
      if (__pyx_t_15 < 0) {
        __pyx_t_15 += __pyx_bshape_0_output;
        if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
      } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_output)) __pyx_t_16 = 0;
      if (unlikely(__pyx_t_16 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_16);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_15, __pyx_bstride_0_output) = __pyx_v_7tseries_NaN;
    }
    __pyx_L15:;
  }

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":70
 *             output[i] = NaN
 * 
 *     return output             # <<<<<<<<<<<<<<
 * 
 * #-------------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_input);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tseries._roll_sum");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_input);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_DECREF((PyObject *)__pyx_v_input);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\moments.pyx":75
 * # Rolling mean
 * 
 * def _roll_mean(ndarray[double_t, ndim=1] input,             # <<<<<<<<<<<<<<
 *                int win, int minp):
 *     cdef double val, prev, sum_x = 0
 */

static PyObject *__pyx_pf_7tseries__roll_mean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries__roll_mean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  int __pyx_v_win;
  int __pyx_v_minp;
  double __pyx_v_val;
  double __pyx_v_prev;
  double __pyx_v_sum_x;
  int __pyx_v_nobs;
  int __pyx_v_i;
  int __pyx_v_N;
  PyArrayObject *__pyx_v_output = 0;
  Py_buffer __pyx_bstruct_output;
  Py_ssize_t __pyx_bstride_0_output = 0;
  Py_ssize_t __pyx_bshape_0_output = 0;
  Py_buffer __pyx_bstruct_input;
  Py_ssize_t __pyx_bstride_0_input = 0;
  Py_ssize_t __pyx_bshape_0_input = 0;
  PyObject *__pyx_r = NULL;
  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;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  long __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__win,&__pyx_n_s__minp,0};
  __Pyx_RefNannySetupContext("_roll_mean");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__win);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_roll_mean", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_roll_mean", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 75; __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), "_roll_mean") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_input = ((PyArrayObject *)values[0]);
    __pyx_v_win = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_input = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_win = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_roll_mean", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries._roll_mean");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_input);
  __pyx_bstruct_output.buf = NULL;
  __pyx_bstruct_input.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_input, (PyObject*)__pyx_v_input, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_input = __pyx_bstruct_input.strides[0];
  __pyx_bshape_0_input = __pyx_bstruct_input.shape[0];

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":77
 * def _roll_mean(ndarray[double_t, ndim=1] input,
 *                int win, int minp):
 *     cdef double val, prev, sum_x = 0             # <<<<<<<<<<<<<<
 *     cdef int nobs = 0, i
 *     cdef int N = len(input)
 */
  __pyx_v_sum_x = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":78
 *                int win, int minp):
 *     cdef double val, prev, sum_x = 0
 *     cdef int nobs = 0, i             # <<<<<<<<<<<<<<
 *     cdef int N = len(input)
 * 
 */
  __pyx_v_nobs = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":79
 *     cdef double val, prev, sum_x = 0
 *     cdef int nobs = 0, i
 *     cdef int N = len(input)             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":81
 *     cdef int N = len(input)
 * 
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)             # <<<<<<<<<<<<<<
 * 
 *     if minp > N:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __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[2]; __pyx_lineno = 81; __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_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __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[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_output = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_output.buf = NULL;
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_output = __pyx_bstruct_output.strides[0];
      __pyx_bshape_0_output = __pyx_bstruct_output.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":83
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)
 * 
 *     if minp > N:             # <<<<<<<<<<<<<<
 *         minp = N + 1
 * 
 */
  __pyx_t_7 = (__pyx_v_minp > __pyx_v_N);
  if (__pyx_t_7) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":84
 * 
 *     if minp > N:
 *         minp = N + 1             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < minp - 1:
 */
    __pyx_v_minp = (__pyx_v_N + 1);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":86
 *         minp = N + 1
 * 
 *     for i from 0 <= i < minp - 1:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_8 = (__pyx_v_minp - 1);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":87
 * 
 *     for i from 0 <= i < minp - 1:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         # Not NaN
 */
    __pyx_t_9 = __pyx_v_i;
    __pyx_t_10 = -1;
    if (__pyx_t_9 < 0) {
      __pyx_t_9 += __pyx_bshape_0_input;
      if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_input)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_9, __pyx_bstride_0_input));

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":90
 * 
 *         # Not NaN
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             sum_x += val
 */
    __pyx_t_7 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":91
 *         # Not NaN
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             sum_x += val
 * 
 */
      __pyx_v_nobs += 1;

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":92
 *         if val == val:
 *             nobs += 1
 *             sum_x += val             # <<<<<<<<<<<<<<
 * 
 *         output[i] = NaN
 */
      __pyx_v_sum_x += __pyx_v_val;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":94
 *             sum_x += val
 * 
 *         output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     for i from minp - 1 <= i < N:
 */
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_11 = -1;
    if (__pyx_t_10 < 0) {
      __pyx_t_10 += __pyx_bshape_0_output;
      if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
    } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_output)) __pyx_t_11 = 0;
    if (unlikely(__pyx_t_11 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_11);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_10, __pyx_bstride_0_output) = __pyx_v_7tseries_NaN;
  }

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":96
 *         output[i] = NaN
 * 
 *     for i from minp - 1 <= i < N:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_11 = __pyx_v_N;
  for (__pyx_v_i = (__pyx_v_minp - 1); __pyx_v_i < __pyx_t_11; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":97
 * 
 *     for i from minp - 1 <= i < N:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         if i > win - 1:
 */
    __pyx_t_12 = __pyx_v_i;
    __pyx_t_13 = -1;
    if (__pyx_t_12 < 0) {
      __pyx_t_12 += __pyx_bshape_0_input;
      if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 0;
    } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_input)) __pyx_t_13 = 0;
    if (unlikely(__pyx_t_13 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_13);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_12, __pyx_bstride_0_input));

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":99
 *         val = input[i]
 * 
 *         if i > win - 1:             # <<<<<<<<<<<<<<
 *             prev = input[i - win]
 *             if prev == prev:
 */
    __pyx_t_7 = (__pyx_v_i > (__pyx_v_win - 1));
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":100
 * 
 *         if i > win - 1:
 *             prev = input[i - win]             # <<<<<<<<<<<<<<
 *             if prev == prev:
 *                 sum_x -= prev
 */
      __pyx_t_13 = (__pyx_v_i - __pyx_v_win);
      __pyx_t_14 = -1;
      if (__pyx_t_13 < 0) {
        __pyx_t_13 += __pyx_bshape_0_input;
        if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0;
      } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_input)) __pyx_t_14 = 0;
      if (unlikely(__pyx_t_14 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_14);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_13, __pyx_bstride_0_input));

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":101
 *         if i > win - 1:
 *             prev = input[i - win]
 *             if prev == prev:             # <<<<<<<<<<<<<<
 *                 sum_x -= prev
 *                 nobs -= 1
 */
      __pyx_t_7 = (__pyx_v_prev == __pyx_v_prev);
      if (__pyx_t_7) {

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":102
 *             prev = input[i - win]
 *             if prev == prev:
 *                 sum_x -= prev             # <<<<<<<<<<<<<<
 *                 nobs -= 1
 * 
 */
        __pyx_v_sum_x -= __pyx_v_prev;

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":103
 *             if prev == prev:
 *                 sum_x -= prev
 *                 nobs -= 1             # <<<<<<<<<<<<<<
 * 
 *         if val == val:
 */
        __pyx_v_nobs -= 1;
        goto __pyx_L13;
      }
      __pyx_L13:;
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":105
 *                 nobs -= 1
 * 
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             sum_x += val
 */
    __pyx_t_7 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":106
 * 
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             sum_x += val
 * 
 */
      __pyx_v_nobs += 1;

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":107
 *         if val == val:
 *             nobs += 1
 *             sum_x += val             # <<<<<<<<<<<<<<
 * 
 *         if nobs >= minp:
 */
      __pyx_v_sum_x += __pyx_v_val;
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":109
 *             sum_x += val
 * 
 *         if nobs >= minp:             # <<<<<<<<<<<<<<
 *             output[i] = sum_x / nobs
 *         else:
 */
    __pyx_t_7 = (__pyx_v_nobs >= __pyx_v_minp);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":110
 * 
 *         if nobs >= minp:
 *             output[i] = sum_x / nobs             # <<<<<<<<<<<<<<
 *         else:
 *             output[i] = NaN
 */
      if (unlikely(__pyx_v_nobs == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_15 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_14 += __pyx_bshape_0_output;
        if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_output)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_14, __pyx_bstride_0_output) = (__pyx_v_sum_x / __pyx_v_nobs);
      goto __pyx_L15;
    }
    /*else*/ {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":112
 *             output[i] = sum_x / nobs
 *         else:
 *             output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     return output
 */
      __pyx_t_15 = __pyx_v_i;
      __pyx_t_16 = -1;
      if (__pyx_t_15 < 0) {
        __pyx_t_15 += __pyx_bshape_0_output;
        if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
      } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_output)) __pyx_t_16 = 0;
      if (unlikely(__pyx_t_16 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_16);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_15, __pyx_bstride_0_output) = __pyx_v_7tseries_NaN;
    }
    __pyx_L15:;
  }

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":114
 *             output[i] = NaN
 * 
 *     return output             # <<<<<<<<<<<<<<
 * 
 * #-------------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_input);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tseries._roll_mean");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_input);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_DECREF((PyObject *)__pyx_v_input);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\moments.pyx":119
 * # Exponentially weighted moving average
 * 
 * def _ewma(ndarray[double_t, ndim=1] input,             # <<<<<<<<<<<<<<
 *           int com):
 *     cdef double cur, prev, neww, oldw, adj
 */

static PyObject *__pyx_pf_7tseries__ewma(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries__ewma(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  int __pyx_v_com;
  double __pyx_v_cur;
  double __pyx_v_prev;
  double __pyx_v_neww;
  double __pyx_v_oldw;
  double __pyx_v_adj;
  int __pyx_v_i;
  int __pyx_v_N;
  PyArrayObject *__pyx_v_output = 0;
  Py_buffer __pyx_bstruct_output;
  Py_ssize_t __pyx_bstride_0_output = 0;
  Py_ssize_t __pyx_bshape_0_output = 0;
  Py_buffer __pyx_bstruct_input;
  Py_ssize_t __pyx_bstride_0_input = 0;
  Py_ssize_t __pyx_bshape_0_input = 0;
  PyObject *__pyx_r = NULL;
  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;
  PyArrayObject *__pyx_t_6 = NULL;
  double __pyx_t_7;
  long __pyx_t_8;
  int __pyx_t_9;
  long __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  long __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  int __pyx_t_18;
  int __pyx_t_19;
  __pyx_t_5numpy_double_t __pyx_t_20;
  int __pyx_t_21;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__com,0};
  __Pyx_RefNannySetupContext("_ewma");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__com);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_ewma", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 119; __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), "_ewma") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_input = ((PyArrayObject *)values[0]);
    __pyx_v_com = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_com == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_input = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_com = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_com == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_ewma", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries._ewma");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_input);
  __pyx_bstruct_output.buf = NULL;
  __pyx_bstruct_input.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_input, (PyObject*)__pyx_v_input, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_input = __pyx_bstruct_input.strides[0];
  __pyx_bshape_0_input = __pyx_bstruct_input.shape[0];

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":123
 *     cdef double cur, prev, neww, oldw, adj
 *     cdef int i
 *     cdef int N = len(input)             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":125
 *     cdef int N = len(input)
 * 
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __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[2]; __pyx_lineno = 125; __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_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __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[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_output = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_output.buf = NULL;
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_output = __pyx_bstruct_output.strides[0];
      __pyx_bshape_0_output = __pyx_bstruct_output.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":128
 * 
 * 
 *     neww = 1. / (1. + com)             # <<<<<<<<<<<<<<
 *     oldw = 1. - neww
 *     adj = oldw
 */
  __pyx_t_7 = (1.0 + __pyx_v_com);
  if (unlikely(__pyx_t_7 == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_neww = (1.0 / __pyx_t_7);

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":129
 * 
 *     neww = 1. / (1. + com)
 *     oldw = 1. - neww             # <<<<<<<<<<<<<<
 *     adj = oldw
 * 
 */
  __pyx_v_oldw = (1.0 - __pyx_v_neww);

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":130
 *     neww = 1. / (1. + com)
 *     oldw = 1. - neww
 *     adj = oldw             # <<<<<<<<<<<<<<
 * 
 *     output[0] = neww * input[0]
 */
  __pyx_v_adj = __pyx_v_oldw;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":132
 *     adj = oldw
 * 
 *     output[0] = neww * input[0]             # <<<<<<<<<<<<<<
 * 
 *     for i from 1 <= i < N:
 */
  __pyx_t_8 = 0;
  __pyx_t_9 = -1;
  if (__pyx_t_8 < 0) {
    __pyx_t_8 += __pyx_bshape_0_input;
    if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
  } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_input)) __pyx_t_9 = 0;
  if (unlikely(__pyx_t_9 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_9);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_10 = 0;
  __pyx_t_9 = -1;
  if (__pyx_t_10 < 0) {
    __pyx_t_10 += __pyx_bshape_0_output;
    if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
  } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_output)) __pyx_t_9 = 0;
  if (unlikely(__pyx_t_9 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_9);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_10, __pyx_bstride_0_output) = (__pyx_v_neww * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_8, __pyx_bstride_0_input)));

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":134
 *     output[0] = neww * input[0]
 * 
 *     for i from 1 <= i < N:             # <<<<<<<<<<<<<<
 *         cur = input[i]
 *         prev = output[i - 1]
 */
  __pyx_t_9 = __pyx_v_N;
  for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_9; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":135
 * 
 *     for i from 1 <= i < N:
 *         cur = input[i]             # <<<<<<<<<<<<<<
 *         prev = output[i - 1]
 * 
 */
    __pyx_t_11 = __pyx_v_i;
    __pyx_t_12 = -1;
    if (__pyx_t_11 < 0) {
      __pyx_t_11 += __pyx_bshape_0_input;
      if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0;
    } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_input)) __pyx_t_12 = 0;
    if (unlikely(__pyx_t_12 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_12);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_cur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_11, __pyx_bstride_0_input));

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":136
 *     for i from 1 <= i < N:
 *         cur = input[i]
 *         prev = output[i - 1]             # <<<<<<<<<<<<<<
 * 
 *         if cur == cur:
 */
    __pyx_t_13 = (__pyx_v_i - 1);
    __pyx_t_12 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_bshape_0_output;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_12 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_output)) __pyx_t_12 = 0;
    if (unlikely(__pyx_t_12 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_12);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_13, __pyx_bstride_0_output));

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":138
 *         prev = output[i - 1]
 * 
 *         if cur == cur:             # <<<<<<<<<<<<<<
 *             if prev == prev:
 *                 output[i] = oldw * prev + neww * cur
 */
    __pyx_t_14 = (__pyx_v_cur == __pyx_v_cur);
    if (__pyx_t_14) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":139
 * 
 *         if cur == cur:
 *             if prev == prev:             # <<<<<<<<<<<<<<
 *                 output[i] = oldw * prev + neww * cur
 *             else:
 */
      __pyx_t_14 = (__pyx_v_prev == __pyx_v_prev);
      if (__pyx_t_14) {

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":140
 *         if cur == cur:
 *             if prev == prev:
 *                 output[i] = oldw * prev + neww * cur             # <<<<<<<<<<<<<<
 *             else:
 *                 output[i] = neww * cur
 */
        __pyx_t_12 = __pyx_v_i;
        __pyx_t_15 = -1;
        if (__pyx_t_12 < 0) {
          __pyx_t_12 += __pyx_bshape_0_output;
          if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 0;
        } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_output)) __pyx_t_15 = 0;
        if (unlikely(__pyx_t_15 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_15);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_12, __pyx_bstride_0_output) = ((__pyx_v_oldw * __pyx_v_prev) + (__pyx_v_neww * __pyx_v_cur));
        goto __pyx_L9;
      }
      /*else*/ {

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":142
 *                 output[i] = oldw * prev + neww * cur
 *             else:
 *                 output[i] = neww * cur             # <<<<<<<<<<<<<<
 *         else:
 *             output[i] = prev
 */
        __pyx_t_15 = __pyx_v_i;
        __pyx_t_16 = -1;
        if (__pyx_t_15 < 0) {
          __pyx_t_15 += __pyx_bshape_0_output;
          if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
        } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_output)) __pyx_t_16 = 0;
        if (unlikely(__pyx_t_16 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_16);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_15, __pyx_bstride_0_output) = (__pyx_v_neww * __pyx_v_cur);
      }
      __pyx_L9:;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":144
 *                 output[i] = neww * cur
 *         else:
 *             output[i] = prev             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < N:
 */
      __pyx_t_16 = __pyx_v_i;
      __pyx_t_17 = -1;
      if (__pyx_t_16 < 0) {
        __pyx_t_16 += __pyx_bshape_0_output;
        if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 0;
      } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_output)) __pyx_t_17 = 0;
      if (unlikely(__pyx_t_17 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_17);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_16, __pyx_bstride_0_output) = __pyx_v_prev;
    }
    __pyx_L8:;
  }

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":146
 *             output[i] = prev
 * 
 *     for i from 0 <= i < N:             # <<<<<<<<<<<<<<
 *         cur = input[i]
 *         output[i] = output[i] / (1. - adj)
 */
  __pyx_t_9 = __pyx_v_N;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_9; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":147
 * 
 *     for i from 0 <= i < N:
 *         cur = input[i]             # <<<<<<<<<<<<<<
 *         output[i] = output[i] / (1. - adj)
 * 
 */
    __pyx_t_17 = __pyx_v_i;
    __pyx_t_18 = -1;
    if (__pyx_t_17 < 0) {
      __pyx_t_17 += __pyx_bshape_0_input;
      if (unlikely(__pyx_t_17 < 0)) __pyx_t_18 = 0;
    } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_input)) __pyx_t_18 = 0;
    if (unlikely(__pyx_t_18 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_18);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_cur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_17, __pyx_bstride_0_input));

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":148
 *     for i from 0 <= i < N:
 *         cur = input[i]
 *         output[i] = output[i] / (1. - adj)             # <<<<<<<<<<<<<<
 * 
 *         if cur == cur:
 */
    __pyx_t_18 = __pyx_v_i;
    __pyx_t_19 = -1;
    if (__pyx_t_18 < 0) {
      __pyx_t_18 += __pyx_bshape_0_output;
      if (unlikely(__pyx_t_18 < 0)) __pyx_t_19 = 0;
    } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_output)) __pyx_t_19 = 0;
    if (unlikely(__pyx_t_19 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_19);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_20 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_18, __pyx_bstride_0_output));
    __pyx_t_7 = (1.0 - __pyx_v_adj);
    if (unlikely(__pyx_t_7 == 0)) {
      PyErr_Format(PyExc_ZeroDivisionError, "float division");
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_19 = __pyx_v_i;
    __pyx_t_21 = -1;
    if (__pyx_t_19 < 0) {
      __pyx_t_19 += __pyx_bshape_0_output;
      if (unlikely(__pyx_t_19 < 0)) __pyx_t_21 = 0;
    } else if (unlikely(__pyx_t_19 >= __pyx_bshape_0_output)) __pyx_t_21 = 0;
    if (unlikely(__pyx_t_21 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_21);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_19, __pyx_bstride_0_output) = (__pyx_t_20 / __pyx_t_7);

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":150
 *         output[i] = output[i] / (1. - adj)
 * 
 *         if cur == cur:             # <<<<<<<<<<<<<<
 *             adj *= oldw
 * 
 */
    __pyx_t_14 = (__pyx_v_cur == __pyx_v_cur);
    if (__pyx_t_14) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":151
 * 
 *         if cur == cur:
 *             adj *= oldw             # <<<<<<<<<<<<<<
 * 
 *     return output
 */
      __pyx_v_adj *= __pyx_v_oldw;
      goto __pyx_L12;
    }
    __pyx_L12:;
  }

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":153
 *             adj *= oldw
 * 
 *     return output             # <<<<<<<<<<<<<<
 * 
 * #-------------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_input);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tseries._ewma");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_input);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_DECREF((PyObject *)__pyx_v_input);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\moments.pyx":158
 * # Rolling variance
 * 
 * def _roll_var(ndarray[double_t, ndim=1] input,             # <<<<<<<<<<<<<<
 *               int win, int minp):
 *     cdef double val, prev, sum_x = 0, sum_xx = 0, nobs = 0
 */

static PyObject *__pyx_pf_7tseries__roll_var(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries__roll_var(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  int __pyx_v_win;
  int __pyx_v_minp;
  double __pyx_v_val;
  double __pyx_v_prev;
  double __pyx_v_sum_x;
  double __pyx_v_sum_xx;
  double __pyx_v_nobs;
  int __pyx_v_i;
  int __pyx_v_N;
  PyArrayObject *__pyx_v_output = 0;
  Py_buffer __pyx_bstruct_output;
  Py_ssize_t __pyx_bstride_0_output = 0;
  Py_ssize_t __pyx_bshape_0_output = 0;
  Py_buffer __pyx_bstruct_input;
  Py_ssize_t __pyx_bstride_0_input = 0;
  Py_ssize_t __pyx_bshape_0_input = 0;
  PyObject *__pyx_r = NULL;
  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;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  long __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  double __pyx_t_15;
  double __pyx_t_16;
  int __pyx_t_17;
  int __pyx_t_18;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__win,&__pyx_n_s__minp,0};
  __Pyx_RefNannySetupContext("_roll_var");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__win);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_roll_var", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_roll_var", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 158; __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), "_roll_var") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_input = ((PyArrayObject *)values[0]);
    __pyx_v_win = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_input = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_win = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_roll_var", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries._roll_var");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_input);
  __pyx_bstruct_output.buf = NULL;
  __pyx_bstruct_input.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_input, (PyObject*)__pyx_v_input, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_input = __pyx_bstruct_input.strides[0];
  __pyx_bshape_0_input = __pyx_bstruct_input.shape[0];

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":160
 * def _roll_var(ndarray[double_t, ndim=1] input,
 *               int win, int minp):
 *     cdef double val, prev, sum_x = 0, sum_xx = 0, nobs = 0             # <<<<<<<<<<<<<<
 *     cdef int i
 *     cdef int N = len(input)
 */
  __pyx_v_sum_x = 0;
  __pyx_v_sum_xx = 0;
  __pyx_v_nobs = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":162
 *     cdef double val, prev, sum_x = 0, sum_xx = 0, nobs = 0
 *     cdef int i
 *     cdef int N = len(input)             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":164
 *     cdef int N = len(input)
 * 
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)             # <<<<<<<<<<<<<<
 * 
 *     if minp > N:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __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[2]; __pyx_lineno = 164; __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_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __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[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_output = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_output.buf = NULL;
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_output = __pyx_bstruct_output.strides[0];
      __pyx_bshape_0_output = __pyx_bstruct_output.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":166
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)
 * 
 *     if minp > N:             # <<<<<<<<<<<<<<
 *         minp = N + 1
 * 
 */
  __pyx_t_7 = (__pyx_v_minp > __pyx_v_N);
  if (__pyx_t_7) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":167
 * 
 *     if minp > N:
 *         minp = N + 1             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < minp - 1:
 */
    __pyx_v_minp = (__pyx_v_N + 1);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":169
 *         minp = N + 1
 * 
 *     for i from 0 <= i < minp - 1:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_8 = (__pyx_v_minp - 1);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":170
 * 
 *     for i from 0 <= i < minp - 1:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         # Not NaN
 */
    __pyx_t_9 = __pyx_v_i;
    __pyx_t_10 = -1;
    if (__pyx_t_9 < 0) {
      __pyx_t_9 += __pyx_bshape_0_input;
      if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_input)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_9, __pyx_bstride_0_input));

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":173
 * 
 *         # Not NaN
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             sum_x += val
 */
    __pyx_t_7 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":174
 *         # Not NaN
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             sum_x += val
 *             sum_xx += val * val
 */
      __pyx_v_nobs += 1;

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":175
 *         if val == val:
 *             nobs += 1
 *             sum_x += val             # <<<<<<<<<<<<<<
 *             sum_xx += val * val
 * 
 */
      __pyx_v_sum_x += __pyx_v_val;

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":176
 *             nobs += 1
 *             sum_x += val
 *             sum_xx += val * val             # <<<<<<<<<<<<<<
 * 
 *         output[i] = NaN
 */
      __pyx_v_sum_xx += (__pyx_v_val * __pyx_v_val);
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":178
 *             sum_xx += val * val
 * 
 *         output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     for i from minp - 1 <= i < N:
 */
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_11 = -1;
    if (__pyx_t_10 < 0) {
      __pyx_t_10 += __pyx_bshape_0_output;
      if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
    } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_output)) __pyx_t_11 = 0;
    if (unlikely(__pyx_t_11 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_11);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_10, __pyx_bstride_0_output) = __pyx_v_7tseries_NaN;
  }

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":180
 *         output[i] = NaN
 * 
 *     for i from minp - 1 <= i < N:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_11 = __pyx_v_N;
  for (__pyx_v_i = (__pyx_v_minp - 1); __pyx_v_i < __pyx_t_11; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":181
 * 
 *     for i from minp - 1 <= i < N:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         if i > win - 1:
 */
    __pyx_t_12 = __pyx_v_i;
    __pyx_t_13 = -1;
    if (__pyx_t_12 < 0) {
      __pyx_t_12 += __pyx_bshape_0_input;
      if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 0;
    } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_input)) __pyx_t_13 = 0;
    if (unlikely(__pyx_t_13 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_13);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_12, __pyx_bstride_0_input));

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":183
 *         val = input[i]
 * 
 *         if i > win - 1:             # <<<<<<<<<<<<<<
 *             prev = input[i - win]
 *             if prev == prev:
 */
    __pyx_t_7 = (__pyx_v_i > (__pyx_v_win - 1));
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":184
 * 
 *         if i > win - 1:
 *             prev = input[i - win]             # <<<<<<<<<<<<<<
 *             if prev == prev:
 *                 sum_x -= prev
 */
      __pyx_t_13 = (__pyx_v_i - __pyx_v_win);
      __pyx_t_14 = -1;
      if (__pyx_t_13 < 0) {
        __pyx_t_13 += __pyx_bshape_0_input;
        if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0;
      } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_input)) __pyx_t_14 = 0;
      if (unlikely(__pyx_t_14 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_14);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_13, __pyx_bstride_0_input));

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":185
 *         if i > win - 1:
 *             prev = input[i - win]
 *             if prev == prev:             # <<<<<<<<<<<<<<
 *                 sum_x -= prev
 *                 sum_xx -= prev * prev
 */
      __pyx_t_7 = (__pyx_v_prev == __pyx_v_prev);
      if (__pyx_t_7) {

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":186
 *             prev = input[i - win]
 *             if prev == prev:
 *                 sum_x -= prev             # <<<<<<<<<<<<<<
 *                 sum_xx -= prev * prev
 *                 nobs -= 1
 */
        __pyx_v_sum_x -= __pyx_v_prev;

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":187
 *             if prev == prev:
 *                 sum_x -= prev
 *                 sum_xx -= prev * prev             # <<<<<<<<<<<<<<
 *                 nobs -= 1
 * 
 */
        __pyx_v_sum_xx -= (__pyx_v_prev * __pyx_v_prev);

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":188
 *                 sum_x -= prev
 *                 sum_xx -= prev * prev
 *                 nobs -= 1             # <<<<<<<<<<<<<<
 * 
 *         if val == val:
 */
        __pyx_v_nobs -= 1;
        goto __pyx_L13;
      }
      __pyx_L13:;
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":190
 *                 nobs -= 1
 * 
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             sum_x += val
 */
    __pyx_t_7 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":191
 * 
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             sum_x += val
 *             sum_xx += val * val
 */
      __pyx_v_nobs += 1;

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":192
 *         if val == val:
 *             nobs += 1
 *             sum_x += val             # <<<<<<<<<<<<<<
 *             sum_xx += val * val
 * 
 */
      __pyx_v_sum_x += __pyx_v_val;

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":193
 *             nobs += 1
 *             sum_x += val
 *             sum_xx += val * val             # <<<<<<<<<<<<<<
 * 
 *         if nobs >= minp:
 */
      __pyx_v_sum_xx += (__pyx_v_val * __pyx_v_val);
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":195
 *             sum_xx += val * val
 * 
 *         if nobs >= minp:             # <<<<<<<<<<<<<<
 *             output[i] = (nobs * sum_xx - sum_x * sum_x) / (nobs * nobs - nobs)
 *         else:
 */
    __pyx_t_7 = (__pyx_v_nobs >= __pyx_v_minp);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":196
 * 
 *         if nobs >= minp:
 *             output[i] = (nobs * sum_xx - sum_x * sum_x) / (nobs * nobs - nobs)             # <<<<<<<<<<<<<<
 *         else:
 *             output[i] = NaN
 */
      __pyx_t_15 = ((__pyx_v_nobs * __pyx_v_sum_xx) - (__pyx_v_sum_x * __pyx_v_sum_x));
      __pyx_t_16 = ((__pyx_v_nobs * __pyx_v_nobs) - __pyx_v_nobs);
      if (unlikely(__pyx_t_16 == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_17 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_14 += __pyx_bshape_0_output;
        if (unlikely(__pyx_t_14 < 0)) __pyx_t_17 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_output)) __pyx_t_17 = 0;
      if (unlikely(__pyx_t_17 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_17);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_14, __pyx_bstride_0_output) = (__pyx_t_15 / __pyx_t_16);
      goto __pyx_L15;
    }
    /*else*/ {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":198
 *             output[i] = (nobs * sum_xx - sum_x * sum_x) / (nobs * nobs - nobs)
 *         else:
 *             output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     return output
 */
      __pyx_t_17 = __pyx_v_i;
      __pyx_t_18 = -1;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_bshape_0_output;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_18 = 0;
      } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_output)) __pyx_t_18 = 0;
      if (unlikely(__pyx_t_18 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_18);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_17, __pyx_bstride_0_output) = __pyx_v_7tseries_NaN;
    }
    __pyx_L15:;
  }

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":200
 *             output[i] = NaN
 * 
 *     return output             # <<<<<<<<<<<<<<
 * 
 * #-------------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_input);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tseries._roll_var");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_input);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_DECREF((PyObject *)__pyx_v_input);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\moments.pyx":205
 * # Rolling skewness
 * 
 * def _roll_skew(ndarray[double_t, ndim=1] input,             # <<<<<<<<<<<<<<
 *                int win, int minp):
 *     cdef double val, prev
 */

static PyObject *__pyx_pf_7tseries__roll_skew(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries__roll_skew(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  int __pyx_v_win;
  int __pyx_v_minp;
  double __pyx_v_val;
  double __pyx_v_prev;
  double __pyx_v_x;
  double __pyx_v_xx;
  double __pyx_v_xxx;
  int __pyx_v_nobs;
  int __pyx_v_i;
  int __pyx_v_N;
  PyArrayObject *__pyx_v_output = 0;
  double __pyx_v_A;
  double __pyx_v_B;
  double __pyx_v_C;
  double __pyx_v_R;
  Py_buffer __pyx_bstruct_output;
  Py_ssize_t __pyx_bstride_0_output = 0;
  Py_ssize_t __pyx_bshape_0_output = 0;
  Py_buffer __pyx_bstruct_input;
  Py_ssize_t __pyx_bstride_0_input = 0;
  Py_ssize_t __pyx_bshape_0_input = 0;
  PyObject *__pyx_r = NULL;
  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;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  long __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  double __pyx_t_15;
  double __pyx_t_16;
  int __pyx_t_17;
  int __pyx_t_18;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__win,&__pyx_n_s__minp,0};
  __Pyx_RefNannySetupContext("_roll_skew");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__win);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_roll_skew", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_roll_skew", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __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), "_roll_skew") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_input = ((PyArrayObject *)values[0]);
    __pyx_v_win = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_input = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_win = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_roll_skew", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries._roll_skew");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_input);
  __pyx_bstruct_output.buf = NULL;
  __pyx_bstruct_input.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_input, (PyObject*)__pyx_v_input, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_input = __pyx_bstruct_input.strides[0];
  __pyx_bshape_0_input = __pyx_bstruct_input.shape[0];

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":208
 *                int win, int minp):
 *     cdef double val, prev
 *     cdef double x = 0, xx = 0, xxx = 0             # <<<<<<<<<<<<<<
 *     cdef int nobs = 0, i
 *     cdef int N = len(input)
 */
  __pyx_v_x = 0;
  __pyx_v_xx = 0;
  __pyx_v_xxx = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":209
 *     cdef double val, prev
 *     cdef double x = 0, xx = 0, xxx = 0
 *     cdef int nobs = 0, i             # <<<<<<<<<<<<<<
 *     cdef int N = len(input)
 * 
 */
  __pyx_v_nobs = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":210
 *     cdef double x = 0, xx = 0, xxx = 0
 *     cdef int nobs = 0, i
 *     cdef int N = len(input)             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":212
 *     cdef int N = len(input)
 * 
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)             # <<<<<<<<<<<<<<
 * 
 *     # 3 components of the skewness equation
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 212; __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[2]; __pyx_lineno = 212; __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_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 212; __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[2]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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[2]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_output = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_output.buf = NULL;
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_output = __pyx_bstruct_output.strides[0];
      __pyx_bshape_0_output = __pyx_bstruct_output.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":217
 *     cdef double A, B, C, R
 * 
 *     if minp > N:             # <<<<<<<<<<<<<<
 *         minp = N + 1
 * 
 */
  __pyx_t_7 = (__pyx_v_minp > __pyx_v_N);
  if (__pyx_t_7) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":218
 * 
 *     if minp > N:
 *         minp = N + 1             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < minp - 1:
 */
    __pyx_v_minp = (__pyx_v_N + 1);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":220
 *         minp = N + 1
 * 
 *     for i from 0 <= i < minp - 1:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_8 = (__pyx_v_minp - 1);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":221
 * 
 *     for i from 0 <= i < minp - 1:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         # Not NaN
 */
    __pyx_t_9 = __pyx_v_i;
    __pyx_t_10 = -1;
    if (__pyx_t_9 < 0) {
      __pyx_t_9 += __pyx_bshape_0_input;
      if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_input)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_9, __pyx_bstride_0_input));

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":224
 * 
 *         # Not NaN
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             x += val
 */
    __pyx_t_7 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":225
 *         # Not NaN
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             x += val
 *             xx += val * val
 */
      __pyx_v_nobs += 1;

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":226
 *         if val == val:
 *             nobs += 1
 *             x += val             # <<<<<<<<<<<<<<
 *             xx += val * val
 *             xxx += val * val * val
 */
      __pyx_v_x += __pyx_v_val;

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":227
 *             nobs += 1
 *             x += val
 *             xx += val * val             # <<<<<<<<<<<<<<
 *             xxx += val * val * val
 * 
 */
      __pyx_v_xx += (__pyx_v_val * __pyx_v_val);

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":228
 *             x += val
 *             xx += val * val
 *             xxx += val * val * val             # <<<<<<<<<<<<<<
 * 
 *         output[i] = NaN
 */
      __pyx_v_xxx += ((__pyx_v_val * __pyx_v_val) * __pyx_v_val);
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":230
 *             xxx += val * val * val
 * 
 *         output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     for i from minp - 1 <= i < N:
 */
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_11 = -1;
    if (__pyx_t_10 < 0) {
      __pyx_t_10 += __pyx_bshape_0_output;
      if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
    } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_output)) __pyx_t_11 = 0;
    if (unlikely(__pyx_t_11 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_11);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_10, __pyx_bstride_0_output) = __pyx_v_7tseries_NaN;
  }

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":232
 *         output[i] = NaN
 * 
 *     for i from minp - 1 <= i < N:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_11 = __pyx_v_N;
  for (__pyx_v_i = (__pyx_v_minp - 1); __pyx_v_i < __pyx_t_11; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":233
 * 
 *     for i from minp - 1 <= i < N:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         if i > win - 1:
 */
    __pyx_t_12 = __pyx_v_i;
    __pyx_t_13 = -1;
    if (__pyx_t_12 < 0) {
      __pyx_t_12 += __pyx_bshape_0_input;
      if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 0;
    } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_input)) __pyx_t_13 = 0;
    if (unlikely(__pyx_t_13 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_13);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_12, __pyx_bstride_0_input));

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":235
 *         val = input[i]
 * 
 *         if i > win - 1:             # <<<<<<<<<<<<<<
 *             prev = input[i - win]
 *             if prev == prev:
 */
    __pyx_t_7 = (__pyx_v_i > (__pyx_v_win - 1));
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":236
 * 
 *         if i > win - 1:
 *             prev = input[i - win]             # <<<<<<<<<<<<<<
 *             if prev == prev:
 *                 x -= prev
 */
      __pyx_t_13 = (__pyx_v_i - __pyx_v_win);
      __pyx_t_14 = -1;
      if (__pyx_t_13 < 0) {
        __pyx_t_13 += __pyx_bshape_0_input;
        if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0;
      } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_input)) __pyx_t_14 = 0;
      if (unlikely(__pyx_t_14 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_14);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_13, __pyx_bstride_0_input));

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":237
 *         if i > win - 1:
 *             prev = input[i - win]
 *             if prev == prev:             # <<<<<<<<<<<<<<
 *                 x -= prev
 *                 xx -= prev * prev
 */
      __pyx_t_7 = (__pyx_v_prev == __pyx_v_prev);
      if (__pyx_t_7) {

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":238
 *             prev = input[i - win]
 *             if prev == prev:
 *                 x -= prev             # <<<<<<<<<<<<<<
 *                 xx -= prev * prev
 *                 xxx -= prev * prev * prev
 */
        __pyx_v_x -= __pyx_v_prev;

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":239
 *             if prev == prev:
 *                 x -= prev
 *                 xx -= prev * prev             # <<<<<<<<<<<<<<
 *                 xxx -= prev * prev * prev
 * 
 */
        __pyx_v_xx -= (__pyx_v_prev * __pyx_v_prev);

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":240
 *                 x -= prev
 *                 xx -= prev * prev
 *                 xxx -= prev * prev * prev             # <<<<<<<<<<<<<<
 * 
 *                 nobs -= 1
 */
        __pyx_v_xxx -= ((__pyx_v_prev * __pyx_v_prev) * __pyx_v_prev);

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":242
 *                 xxx -= prev * prev * prev
 * 
 *                 nobs -= 1             # <<<<<<<<<<<<<<
 * 
 *         if val == val:
 */
        __pyx_v_nobs -= 1;
        goto __pyx_L13;
      }
      __pyx_L13:;
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":244
 *                 nobs -= 1
 * 
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             x += val
 */
    __pyx_t_7 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":245
 * 
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             x += val
 *             xx += val * val
 */
      __pyx_v_nobs += 1;

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":246
 *         if val == val:
 *             nobs += 1
 *             x += val             # <<<<<<<<<<<<<<
 *             xx += val * val
 *             xxx += val * val * val
 */
      __pyx_v_x += __pyx_v_val;

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":247
 *             nobs += 1
 *             x += val
 *             xx += val * val             # <<<<<<<<<<<<<<
 *             xxx += val * val * val
 * 
 */
      __pyx_v_xx += (__pyx_v_val * __pyx_v_val);

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":248
 *             x += val
 *             xx += val * val
 *             xxx += val * val * val             # <<<<<<<<<<<<<<
 * 
 *         if nobs >= minp:
 */
      __pyx_v_xxx += ((__pyx_v_val * __pyx_v_val) * __pyx_v_val);
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":250
 *             xxx += val * val * val
 * 
 *         if nobs >= minp:             # <<<<<<<<<<<<<<
 *             A = x / nobs
 *             B = xx / nobs - A * A
 */
    __pyx_t_7 = (__pyx_v_nobs >= __pyx_v_minp);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":251
 * 
 *         if nobs >= minp:
 *             A = x / nobs             # <<<<<<<<<<<<<<
 *             B = xx / nobs - A * A
 *             C = xxx / nobs - A * A * A - 3 * A * B
 */
      if (unlikely(__pyx_v_nobs == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_A = (__pyx_v_x / __pyx_v_nobs);

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":252
 *         if nobs >= minp:
 *             A = x / nobs
 *             B = xx / nobs - A * A             # <<<<<<<<<<<<<<
 *             C = xxx / nobs - A * A * A - 3 * A * B
 * 
 */
      if (unlikely(__pyx_v_nobs == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_B = ((__pyx_v_xx / __pyx_v_nobs) - (__pyx_v_A * __pyx_v_A));

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":253
 *             A = x / nobs
 *             B = xx / nobs - A * A
 *             C = xxx / nobs - A * A * A - 3 * A * B             # <<<<<<<<<<<<<<
 * 
 *             R = sqrt(B)
 */
      if (unlikely(__pyx_v_nobs == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_C = (((__pyx_v_xxx / __pyx_v_nobs) - ((__pyx_v_A * __pyx_v_A) * __pyx_v_A)) - ((3 * __pyx_v_A) * __pyx_v_B));

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":255
 *             C = xxx / nobs - A * A * A - 3 * A * B
 * 
 *             R = sqrt(B)             # <<<<<<<<<<<<<<
 * 
 *             output[i] = ((sqrt(nobs * (nobs - 1.)) * C) /
 */
      __pyx_v_R = sqrt(__pyx_v_B);

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":257
 *             R = sqrt(B)
 * 
 *             output[i] = ((sqrt(nobs * (nobs - 1.)) * C) /             # <<<<<<<<<<<<<<
 *                          ((nobs-2) * R * R * R))
 *         else:
 */
      __pyx_t_15 = (sqrt((__pyx_v_nobs * (__pyx_v_nobs - 1.0))) * __pyx_v_C);

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":258
 * 
 *             output[i] = ((sqrt(nobs * (nobs - 1.)) * C) /
 *                          ((nobs-2) * R * R * R))             # <<<<<<<<<<<<<<
 *         else:
 *             output[i] = NaN
 */
      __pyx_t_16 = ((((__pyx_v_nobs - 2) * __pyx_v_R) * __pyx_v_R) * __pyx_v_R);
      if (unlikely(__pyx_t_16 == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":257
 *             R = sqrt(B)
 * 
 *             output[i] = ((sqrt(nobs * (nobs - 1.)) * C) /             # <<<<<<<<<<<<<<
 *                          ((nobs-2) * R * R * R))
 *         else:
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_17 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_14 += __pyx_bshape_0_output;
        if (unlikely(__pyx_t_14 < 0)) __pyx_t_17 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_output)) __pyx_t_17 = 0;
      if (unlikely(__pyx_t_17 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_17);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_14, __pyx_bstride_0_output) = (__pyx_t_15 / __pyx_t_16);
      goto __pyx_L15;
    }
    /*else*/ {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":260
 *                          ((nobs-2) * R * R * R))
 *         else:
 *             output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     return output
 */
      __pyx_t_17 = __pyx_v_i;
      __pyx_t_18 = -1;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_bshape_0_output;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_18 = 0;
      } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_output)) __pyx_t_18 = 0;
      if (unlikely(__pyx_t_18 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_18);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_17, __pyx_bstride_0_output) = __pyx_v_7tseries_NaN;
    }
    __pyx_L15:;
  }

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":262
 *             output[i] = NaN
 * 
 *     return output             # <<<<<<<<<<<<<<
 * 
 * #-------------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_input);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tseries._roll_skew");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_input);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_DECREF((PyObject *)__pyx_v_input);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\moments.pyx":268
 * 
 * 
 * def _roll_kurt(ndarray[double_t, ndim=1] input,             # <<<<<<<<<<<<<<
 *                int win, int minp):
 *     cdef double val, prev
 */

static PyObject *__pyx_pf_7tseries__roll_kurt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries__roll_kurt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  int __pyx_v_win;
  int __pyx_v_minp;
  double __pyx_v_val;
  double __pyx_v_prev;
  double __pyx_v_x;
  double __pyx_v_xx;
  double __pyx_v_xxx;
  double __pyx_v_xxxx;
  int __pyx_v_nobs;
  int __pyx_v_i;
  int __pyx_v_N;
  PyArrayObject *__pyx_v_output = 0;
  double __pyx_v_A;
  double __pyx_v_B;
  double __pyx_v_C;
  double __pyx_v_D;
  double __pyx_v_R;
  double __pyx_v_K;
  Py_buffer __pyx_bstruct_output;
  Py_ssize_t __pyx_bstride_0_output = 0;
  Py_ssize_t __pyx_bshape_0_output = 0;
  Py_buffer __pyx_bstruct_input;
  Py_ssize_t __pyx_bstride_0_input = 0;
  Py_ssize_t __pyx_bshape_0_input = 0;
  PyObject *__pyx_r = NULL;
  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;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  long __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  double __pyx_t_15;
  double __pyx_t_16;
  int __pyx_t_17;
  int __pyx_t_18;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__win,&__pyx_n_s__minp,0};
  __Pyx_RefNannySetupContext("_roll_kurt");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__win);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_roll_kurt", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_roll_kurt", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 268; __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), "_roll_kurt") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_input = ((PyArrayObject *)values[0]);
    __pyx_v_win = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_input = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_win = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_roll_kurt", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries._roll_kurt");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_input);
  __pyx_bstruct_output.buf = NULL;
  __pyx_bstruct_input.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_input, (PyObject*)__pyx_v_input, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_input = __pyx_bstruct_input.strides[0];
  __pyx_bshape_0_input = __pyx_bstruct_input.shape[0];

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":271
 *                int win, int minp):
 *     cdef double val, prev
 *     cdef double x = 0, xx = 0, xxx = 0, xxxx = 0             # <<<<<<<<<<<<<<
 *     cdef int nobs = 0, i
 *     cdef int N = len(input)
 */
  __pyx_v_x = 0;
  __pyx_v_xx = 0;
  __pyx_v_xxx = 0;
  __pyx_v_xxxx = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":272
 *     cdef double val, prev
 *     cdef double x = 0, xx = 0, xxx = 0, xxxx = 0
 *     cdef int nobs = 0, i             # <<<<<<<<<<<<<<
 *     cdef int N = len(input)
 * 
 */
  __pyx_v_nobs = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":273
 *     cdef double x = 0, xx = 0, xxx = 0, xxxx = 0
 *     cdef int nobs = 0, i
 *     cdef int N = len(input)             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":275
 *     cdef int N = len(input)
 * 
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)             # <<<<<<<<<<<<<<
 * 
 *     # 5 components of the kurtosis equation
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __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[2]; __pyx_lineno = 275; __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_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __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[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_output = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_output.buf = NULL;
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_output = __pyx_bstruct_output.strides[0];
      __pyx_bshape_0_output = __pyx_bstruct_output.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":280
 *     cdef double A, B, C, D, R, K
 * 
 *     if minp > N:             # <<<<<<<<<<<<<<
 *         minp = N + 1
 * 
 */
  __pyx_t_7 = (__pyx_v_minp > __pyx_v_N);
  if (__pyx_t_7) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":281
 * 
 *     if minp > N:
 *         minp = N + 1             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < minp - 1:
 */
    __pyx_v_minp = (__pyx_v_N + 1);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":283
 *         minp = N + 1
 * 
 *     for i from 0 <= i < minp - 1:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_8 = (__pyx_v_minp - 1);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":284
 * 
 *     for i from 0 <= i < minp - 1:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         # Not NaN
 */
    __pyx_t_9 = __pyx_v_i;
    __pyx_t_10 = -1;
    if (__pyx_t_9 < 0) {
      __pyx_t_9 += __pyx_bshape_0_input;
      if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_input)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_9, __pyx_bstride_0_input));

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":287
 * 
 *         # Not NaN
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 * 
 */
    __pyx_t_7 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":288
 *         # Not NaN
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 * 
 *             # seriously don't ask me why this is faster
 */
      __pyx_v_nobs += 1;

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":291
 * 
 *             # seriously don't ask me why this is faster
 *             x += val             # <<<<<<<<<<<<<<
 *             xx += val * val
 *             xxx += val * val * val
 */
      __pyx_v_x += __pyx_v_val;

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":292
 *             # seriously don't ask me why this is faster
 *             x += val
 *             xx += val * val             # <<<<<<<<<<<<<<
 *             xxx += val * val * val
 *             xxxx += val * val * val * val
 */
      __pyx_v_xx += (__pyx_v_val * __pyx_v_val);

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":293
 *             x += val
 *             xx += val * val
 *             xxx += val * val * val             # <<<<<<<<<<<<<<
 *             xxxx += val * val * val * val
 * 
 */
      __pyx_v_xxx += ((__pyx_v_val * __pyx_v_val) * __pyx_v_val);

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":294
 *             xx += val * val
 *             xxx += val * val * val
 *             xxxx += val * val * val * val             # <<<<<<<<<<<<<<
 * 
 *         output[i] = NaN
 */
      __pyx_v_xxxx += (((__pyx_v_val * __pyx_v_val) * __pyx_v_val) * __pyx_v_val);
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":296
 *             xxxx += val * val * val * val
 * 
 *         output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     for i from minp - 1 <= i < N:
 */
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_11 = -1;
    if (__pyx_t_10 < 0) {
      __pyx_t_10 += __pyx_bshape_0_output;
      if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
    } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_output)) __pyx_t_11 = 0;
    if (unlikely(__pyx_t_11 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_11);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_10, __pyx_bstride_0_output) = __pyx_v_7tseries_NaN;
  }

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":298
 *         output[i] = NaN
 * 
 *     for i from minp - 1 <= i < N:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_11 = __pyx_v_N;
  for (__pyx_v_i = (__pyx_v_minp - 1); __pyx_v_i < __pyx_t_11; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":299
 * 
 *     for i from minp - 1 <= i < N:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         if i > win - 1:
 */
    __pyx_t_12 = __pyx_v_i;
    __pyx_t_13 = -1;
    if (__pyx_t_12 < 0) {
      __pyx_t_12 += __pyx_bshape_0_input;
      if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 0;
    } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_input)) __pyx_t_13 = 0;
    if (unlikely(__pyx_t_13 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_13);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_12, __pyx_bstride_0_input));

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":301
 *         val = input[i]
 * 
 *         if i > win - 1:             # <<<<<<<<<<<<<<
 *             prev = input[i - win]
 *             if prev == prev:
 */
    __pyx_t_7 = (__pyx_v_i > (__pyx_v_win - 1));
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":302
 * 
 *         if i > win - 1:
 *             prev = input[i - win]             # <<<<<<<<<<<<<<
 *             if prev == prev:
 *                 x -= prev
 */
      __pyx_t_13 = (__pyx_v_i - __pyx_v_win);
      __pyx_t_14 = -1;
      if (__pyx_t_13 < 0) {
        __pyx_t_13 += __pyx_bshape_0_input;
        if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0;
      } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_input)) __pyx_t_14 = 0;
      if (unlikely(__pyx_t_14 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_14);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_13, __pyx_bstride_0_input));

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":303
 *         if i > win - 1:
 *             prev = input[i - win]
 *             if prev == prev:             # <<<<<<<<<<<<<<
 *                 x -= prev
 *                 xx -= prev * prev
 */
      __pyx_t_7 = (__pyx_v_prev == __pyx_v_prev);
      if (__pyx_t_7) {

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":304
 *             prev = input[i - win]
 *             if prev == prev:
 *                 x -= prev             # <<<<<<<<<<<<<<
 *                 xx -= prev * prev
 *                 xxx -= prev * prev * prev
 */
        __pyx_v_x -= __pyx_v_prev;

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":305
 *             if prev == prev:
 *                 x -= prev
 *                 xx -= prev * prev             # <<<<<<<<<<<<<<
 *                 xxx -= prev * prev * prev
 *                 xxxx -= prev * prev * prev * prev
 */
        __pyx_v_xx -= (__pyx_v_prev * __pyx_v_prev);

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":306
 *                 x -= prev
 *                 xx -= prev * prev
 *                 xxx -= prev * prev * prev             # <<<<<<<<<<<<<<
 *                 xxxx -= prev * prev * prev * prev
 * 
 */
        __pyx_v_xxx -= ((__pyx_v_prev * __pyx_v_prev) * __pyx_v_prev);

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":307
 *                 xx -= prev * prev
 *                 xxx -= prev * prev * prev
 *                 xxxx -= prev * prev * prev * prev             # <<<<<<<<<<<<<<
 * 
 *                 nobs -= 1
 */
        __pyx_v_xxxx -= (((__pyx_v_prev * __pyx_v_prev) * __pyx_v_prev) * __pyx_v_prev);

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":309
 *                 xxxx -= prev * prev * prev * prev
 * 
 *                 nobs -= 1             # <<<<<<<<<<<<<<
 * 
 *         if val == val:
 */
        __pyx_v_nobs -= 1;
        goto __pyx_L13;
      }
      __pyx_L13:;
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":311
 *                 nobs -= 1
 * 
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             x += val
 */
    __pyx_t_7 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":312
 * 
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             x += val
 *             xx += val * val
 */
      __pyx_v_nobs += 1;

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":313
 *         if val == val:
 *             nobs += 1
 *             x += val             # <<<<<<<<<<<<<<
 *             xx += val * val
 *             xxx += val * val * val
 */
      __pyx_v_x += __pyx_v_val;

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":314
 *             nobs += 1
 *             x += val
 *             xx += val * val             # <<<<<<<<<<<<<<
 *             xxx += val * val * val
 *             xxxx += val * val * val * val
 */
      __pyx_v_xx += (__pyx_v_val * __pyx_v_val);

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":315
 *             x += val
 *             xx += val * val
 *             xxx += val * val * val             # <<<<<<<<<<<<<<
 *             xxxx += val * val * val * val
 * 
 */
      __pyx_v_xxx += ((__pyx_v_val * __pyx_v_val) * __pyx_v_val);

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":316
 *             xx += val * val
 *             xxx += val * val * val
 *             xxxx += val * val * val * val             # <<<<<<<<<<<<<<
 * 
 *         if nobs >= minp:
 */
      __pyx_v_xxxx += (((__pyx_v_val * __pyx_v_val) * __pyx_v_val) * __pyx_v_val);
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":318
 *             xxxx += val * val * val * val
 * 
 *         if nobs >= minp:             # <<<<<<<<<<<<<<
 *             A = x / nobs
 *             R = A * A
 */
    __pyx_t_7 = (__pyx_v_nobs >= __pyx_v_minp);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":319
 * 
 *         if nobs >= minp:
 *             A = x / nobs             # <<<<<<<<<<<<<<
 *             R = A * A
 *             B = xx / nobs - R
 */
      if (unlikely(__pyx_v_nobs == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_A = (__pyx_v_x / __pyx_v_nobs);

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":320
 *         if nobs >= minp:
 *             A = x / nobs
 *             R = A * A             # <<<<<<<<<<<<<<
 *             B = xx / nobs - R
 *             R = R * A
 */
      __pyx_v_R = (__pyx_v_A * __pyx_v_A);

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":321
 *             A = x / nobs
 *             R = A * A
 *             B = xx / nobs - R             # <<<<<<<<<<<<<<
 *             R = R * A
 *             C = xxx / nobs - R - 3 * A * B
 */
      if (unlikely(__pyx_v_nobs == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_B = ((__pyx_v_xx / __pyx_v_nobs) - __pyx_v_R);

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":322
 *             R = A * A
 *             B = xx / nobs - R
 *             R = R * A             # <<<<<<<<<<<<<<
 *             C = xxx / nobs - R - 3 * A * B
 *             R = R * A
 */
      __pyx_v_R = (__pyx_v_R * __pyx_v_A);

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":323
 *             B = xx / nobs - R
 *             R = R * A
 *             C = xxx / nobs - R - 3 * A * B             # <<<<<<<<<<<<<<
 *             R = R * A
 *             D = xxxx / nobs - R - 6*B*A*A - 4*C*A
 */
      if (unlikely(__pyx_v_nobs == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_C = (((__pyx_v_xxx / __pyx_v_nobs) - __pyx_v_R) - ((3 * __pyx_v_A) * __pyx_v_B));

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":324
 *             R = R * A
 *             C = xxx / nobs - R - 3 * A * B
 *             R = R * A             # <<<<<<<<<<<<<<
 *             D = xxxx / nobs - R - 6*B*A*A - 4*C*A
 * 
 */
      __pyx_v_R = (__pyx_v_R * __pyx_v_A);

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":325
 *             C = xxx / nobs - R - 3 * A * B
 *             R = R * A
 *             D = xxxx / nobs - R - 6*B*A*A - 4*C*A             # <<<<<<<<<<<<<<
 * 
 *             K = (nobs * nobs - 1.)*D/(B*B) - 3*((nobs-1.)**2)
 */
      if (unlikely(__pyx_v_nobs == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_D = ((((__pyx_v_xxxx / __pyx_v_nobs) - __pyx_v_R) - (((6 * __pyx_v_B) * __pyx_v_A) * __pyx_v_A)) - ((4 * __pyx_v_C) * __pyx_v_A));

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":327
 *             D = xxxx / nobs - R - 6*B*A*A - 4*C*A
 * 
 *             K = (nobs * nobs - 1.)*D/(B*B) - 3*((nobs-1.)**2)             # <<<<<<<<<<<<<<
 *             K = K / ((nobs - 2.)*(nobs-3.))
 * 
 */
      __pyx_t_15 = (((__pyx_v_nobs * __pyx_v_nobs) - 1.0) * __pyx_v_D);
      __pyx_t_16 = (__pyx_v_B * __pyx_v_B);
      if (unlikely(__pyx_t_16 == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_K = ((__pyx_t_15 / __pyx_t_16) - (3 * pow((__pyx_v_nobs - 1.0), 2)));

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":328
 * 
 *             K = (nobs * nobs - 1.)*D/(B*B) - 3*((nobs-1.)**2)
 *             K = K / ((nobs - 2.)*(nobs-3.))             # <<<<<<<<<<<<<<
 * 
 *             output[i] = K
 */
      __pyx_t_16 = ((__pyx_v_nobs - 2.0) * (__pyx_v_nobs - 3.0));
      if (unlikely(__pyx_t_16 == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_K = (__pyx_v_K / __pyx_t_16);

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":330
 *             K = K / ((nobs - 2.)*(nobs-3.))
 * 
 *             output[i] = K             # <<<<<<<<<<<<<<
 *         else:
 *             output[i] = NaN
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_17 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_14 += __pyx_bshape_0_output;
        if (unlikely(__pyx_t_14 < 0)) __pyx_t_17 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_output)) __pyx_t_17 = 0;
      if (unlikely(__pyx_t_17 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_17);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_14, __pyx_bstride_0_output) = __pyx_v_K;
      goto __pyx_L15;
    }
    /*else*/ {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":332
 *             output[i] = K
 *         else:
 *             output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     return output
 */
      __pyx_t_17 = __pyx_v_i;
      __pyx_t_18 = -1;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_bshape_0_output;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_18 = 0;
      } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_output)) __pyx_t_18 = 0;
      if (unlikely(__pyx_t_18 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_18);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_17, __pyx_bstride_0_output) = __pyx_v_7tseries_NaN;
    }
    __pyx_L15:;
  }

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":334
 *             output[i] = NaN
 * 
 *     return output             # <<<<<<<<<<<<<<
 * 
 * #-------------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_input);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tseries._roll_kurt");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_input);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_DECREF((PyObject *)__pyx_v_input);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\moments.pyx":339
 * # Rolling median
 * 
 * def _roll_median(ndarray[double_t, ndim=1] input,             # <<<<<<<<<<<<<<
 *                  int win, int minp):
 * 
 */

static PyObject *__pyx_pf_7tseries__roll_median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries__roll_median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  int __pyx_v_win;
  int __pyx_v_minp;
  double __pyx_v_val;
  double __pyx_v_prev;
  double __pyx_v_midpoint;
  struct __pyx_obj_7tseries_IndexableSkiplist *__pyx_v_skiplist;
  int __pyx_v_nobs;
  int __pyx_v_i;
  int __pyx_v_N;
  PyArrayObject *__pyx_v_output = 0;
  Py_buffer __pyx_bstruct_output;
  Py_ssize_t __pyx_bstride_0_output = 0;
  Py_ssize_t __pyx_bshape_0_output = 0;
  Py_buffer __pyx_bstruct_input;
  Py_ssize_t __pyx_bstride_0_input = 0;
  Py_ssize_t __pyx_bshape_0_input = 0;
  PyObject *__pyx_r = NULL;
  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;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  long __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  __pyx_t_5numpy_double_t __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  int __pyx_t_18;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__win,&__pyx_n_s__minp,0};
  __Pyx_RefNannySetupContext("_roll_median");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__win);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_roll_median", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_roll_median", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 339; __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), "_roll_median") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_input = ((PyArrayObject *)values[0]);
    __pyx_v_win = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_input = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_win = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_roll_median", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries._roll_median");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_input);
  __pyx_v_skiplist = ((struct __pyx_obj_7tseries_IndexableSkiplist *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_bstruct_output.buf = NULL;
  __pyx_bstruct_input.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_input, (PyObject*)__pyx_v_input, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_input = __pyx_bstruct_input.strides[0];
  __pyx_bshape_0_input = __pyx_bstruct_input.shape[0];

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":344
 *     cdef double val, prev, midpoint
 *     cdef IndexableSkiplist skiplist
 *     cdef int nobs = 0, i             # <<<<<<<<<<<<<<
 *     cdef int N = len(input)
 * 
 */
  __pyx_v_nobs = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":345
 *     cdef IndexableSkiplist skiplist
 *     cdef int nobs = 0, i
 *     cdef int N = len(input)             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":347
 *     cdef int N = len(input)
 * 
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)             # <<<<<<<<<<<<<<
 * 
 *     skiplist = IndexableSkiplist(win)
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 347; __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[2]; __pyx_lineno = 347; __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_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 347; __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[2]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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[2]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_output = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_output.buf = NULL;
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_output = __pyx_bstruct_output.strides[0];
      __pyx_bshape_0_output = __pyx_bstruct_output.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":349
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)
 * 
 *     skiplist = IndexableSkiplist(win)             # <<<<<<<<<<<<<<
 * 
 *     if minp > N:
 */
  __pyx_t_5 = PyInt_FromLong(__pyx_v_win); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7tseries_IndexableSkiplist)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 349; __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_v_skiplist));
  __pyx_v_skiplist = ((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":351
 *     skiplist = IndexableSkiplist(win)
 * 
 *     if minp > N:             # <<<<<<<<<<<<<<
 *         minp = N + 1
 * 
 */
  __pyx_t_7 = (__pyx_v_minp > __pyx_v_N);
  if (__pyx_t_7) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":352
 * 
 *     if minp > N:
 *         minp = N + 1             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < minp - 1:
 */
    __pyx_v_minp = (__pyx_v_N + 1);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":354
 *         minp = N + 1
 * 
 *     for i from 0 <= i < minp - 1:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_8 = (__pyx_v_minp - 1);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":355
 * 
 *     for i from 0 <= i < minp - 1:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         # Not NaN
 */
    __pyx_t_9 = __pyx_v_i;
    __pyx_t_10 = -1;
    if (__pyx_t_9 < 0) {
      __pyx_t_9 += __pyx_bshape_0_input;
      if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_input)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_9, __pyx_bstride_0_input));

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":358
 * 
 *         # Not NaN
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             skiplist.insert(val)
 */
    __pyx_t_7 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":359
 *         # Not NaN
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             skiplist.insert(val)
 * 
 */
      __pyx_v_nobs += 1;

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":360
 *         if val == val:
 *             nobs += 1
 *             skiplist.insert(val)             # <<<<<<<<<<<<<<
 * 
 *         output[i] = NaN
 */
      __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_skiplist), __pyx_n_s__insert); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 360; __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[2]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__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 = PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":362
 *             skiplist.insert(val)
 * 
 *         output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     for i from minp - 1 <= i < N:
 */
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_11 = -1;
    if (__pyx_t_10 < 0) {
      __pyx_t_10 += __pyx_bshape_0_output;
      if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
    } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_output)) __pyx_t_11 = 0;
    if (unlikely(__pyx_t_11 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_11);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_10, __pyx_bstride_0_output) = __pyx_v_7tseries_NaN;
  }

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":364
 *         output[i] = NaN
 * 
 *     for i from minp - 1 <= i < N:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_11 = __pyx_v_N;
  for (__pyx_v_i = (__pyx_v_minp - 1); __pyx_v_i < __pyx_t_11; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":365
 * 
 *     for i from minp - 1 <= i < N:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         if i > win - 1:
 */
    __pyx_t_12 = __pyx_v_i;
    __pyx_t_13 = -1;
    if (__pyx_t_12 < 0) {
      __pyx_t_12 += __pyx_bshape_0_input;
      if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 0;
    } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_input)) __pyx_t_13 = 0;
    if (unlikely(__pyx_t_13 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_13);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_12, __pyx_bstride_0_input));

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":367
 *         val = input[i]
 * 
 *         if i > win - 1:             # <<<<<<<<<<<<<<
 *             prev = input[i - win]
 * 
 */
    __pyx_t_7 = (__pyx_v_i > (__pyx_v_win - 1));
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":368
 * 
 *         if i > win - 1:
 *             prev = input[i - win]             # <<<<<<<<<<<<<<
 * 
 *             if prev == prev:
 */
      __pyx_t_13 = (__pyx_v_i - __pyx_v_win);
      __pyx_t_14 = -1;
      if (__pyx_t_13 < 0) {
        __pyx_t_13 += __pyx_bshape_0_input;
        if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0;
      } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_input)) __pyx_t_14 = 0;
      if (unlikely(__pyx_t_14 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_14);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_13, __pyx_bstride_0_input));

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":370
 *             prev = input[i - win]
 * 
 *             if prev == prev:             # <<<<<<<<<<<<<<
 *                 skiplist.remove(prev)
 *                 nobs -= 1
 */
      __pyx_t_7 = (__pyx_v_prev == __pyx_v_prev);
      if (__pyx_t_7) {

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":371
 * 
 *             if prev == prev:
 *                 skiplist.remove(prev)             # <<<<<<<<<<<<<<
 *                 nobs -= 1
 * 
 */
        __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_skiplist), __pyx_n_s__remove); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = PyFloat_FromDouble(__pyx_v_prev); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":372
 *             if prev == prev:
 *                 skiplist.remove(prev)
 *                 nobs -= 1             # <<<<<<<<<<<<<<
 * 
 *         if val == val:
 */
        __pyx_v_nobs -= 1;
        goto __pyx_L13;
      }
      __pyx_L13:;
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":374
 *                 nobs -= 1
 * 
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             skiplist.insert(val)
 */
    __pyx_t_7 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":375
 * 
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             skiplist.insert(val)
 * 
 */
      __pyx_v_nobs += 1;

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":376
 *         if val == val:
 *             nobs += 1
 *             skiplist.insert(val)             # <<<<<<<<<<<<<<
 * 
 *         if nobs >= minp:
 */
      __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_skiplist), __pyx_n_s__insert); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":378
 *             skiplist.insert(val)
 * 
 *         if nobs >= minp:             # <<<<<<<<<<<<<<
 *             midpoint = nobs / 2
 *             if nobs % 2:
 */
    __pyx_t_7 = (__pyx_v_nobs >= __pyx_v_minp);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":379
 * 
 *         if nobs >= minp:
 *             midpoint = nobs / 2             # <<<<<<<<<<<<<<
 *             if nobs % 2:
 *                 output[i] = skiplist.get(midpoint)
 */
      __pyx_v_midpoint = __Pyx_div_long(__pyx_v_nobs, 2);

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":380
 *         if nobs >= minp:
 *             midpoint = nobs / 2
 *             if nobs % 2:             # <<<<<<<<<<<<<<
 *                 output[i] = skiplist.get(midpoint)
 *             else:
 */
      __pyx_t_8 = __Pyx_mod_long(__pyx_v_nobs, 2);
      if (__pyx_t_8) {

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":381
 *             midpoint = nobs / 2
 *             if nobs % 2:
 *                 output[i] = skiplist.get(midpoint)             # <<<<<<<<<<<<<<
 *             else:
 *                 output[i] = (skiplist.get(midpoint) +
 */
        __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_skiplist), __pyx_n_s__get); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_midpoint); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 381; __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[2]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__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 = PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_15 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_14 = __pyx_v_i;
        __pyx_t_16 = -1;
        if (__pyx_t_14 < 0) {
          __pyx_t_14 += __pyx_bshape_0_output;
          if (unlikely(__pyx_t_14 < 0)) __pyx_t_16 = 0;
        } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_output)) __pyx_t_16 = 0;
        if (unlikely(__pyx_t_16 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_16);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_14, __pyx_bstride_0_output) = __pyx_t_15;
        goto __pyx_L16;
      }
      /*else*/ {

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":383
 *                 output[i] = skiplist.get(midpoint)
 *             else:
 *                 output[i] = (skiplist.get(midpoint) +             # <<<<<<<<<<<<<<
 *                              skiplist.get(midpoint - 1)) / 2
 *         else:
 */
        __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_skiplist), __pyx_n_s__get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = PyFloat_FromDouble(__pyx_v_midpoint); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":384
 *             else:
 *                 output[i] = (skiplist.get(midpoint) +
 *                              skiplist.get(midpoint - 1)) / 2             # <<<<<<<<<<<<<<
 *         else:
 *             output[i] = NaN
 */
        __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_skiplist), __pyx_n_s__get); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_2 = PyFloat_FromDouble((__pyx_v_midpoint - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 384; __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[2]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__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_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 383; __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_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_15 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":383
 *                 output[i] = skiplist.get(midpoint)
 *             else:
 *                 output[i] = (skiplist.get(midpoint) +             # <<<<<<<<<<<<<<
 *                              skiplist.get(midpoint - 1)) / 2
 *         else:
 */
        __pyx_t_16 = __pyx_v_i;
        __pyx_t_17 = -1;
        if (__pyx_t_16 < 0) {
          __pyx_t_16 += __pyx_bshape_0_output;
          if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 0;
        } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_output)) __pyx_t_17 = 0;
        if (unlikely(__pyx_t_17 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_17);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_16, __pyx_bstride_0_output) = __pyx_t_15;
      }
      __pyx_L16:;
      goto __pyx_L15;
    }
    /*else*/ {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":386
 *                              skiplist.get(midpoint - 1)) / 2
 *         else:
 *             output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     return output
 */
      __pyx_t_17 = __pyx_v_i;
      __pyx_t_18 = -1;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_bshape_0_output;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_18 = 0;
      } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_output)) __pyx_t_18 = 0;
      if (unlikely(__pyx_t_18 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_18);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_17, __pyx_bstride_0_output) = __pyx_v_7tseries_NaN;
    }
    __pyx_L15:;
  }

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":388
 *             output[i] = NaN
 * 
 *     return output             # <<<<<<<<<<<<<<
 * 
 * #-------------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_input);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tseries._roll_median");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_input);
  __pyx_L2:;
  __Pyx_DECREF((PyObject *)__pyx_v_skiplist);
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_DECREF((PyObject *)__pyx_v_input);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\moments.pyx":393
 * # Rolling min / max
 * 
 * def _roll_max(ndarray[double_t, ndim=1] input,             # <<<<<<<<<<<<<<
 *               int win):
 *     cdef double val
 */

static PyObject *__pyx_pf_7tseries__roll_max(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries__roll_max(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  int __pyx_v_win;
  double __pyx_v_val;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_N;
  PyArrayObject *__pyx_v_output = 0;
  Py_buffer __pyx_bstruct_output;
  Py_ssize_t __pyx_bstride_0_output = 0;
  Py_ssize_t __pyx_bshape_0_output = 0;
  Py_buffer __pyx_bstruct_input;
  Py_ssize_t __pyx_bstride_0_input = 0;
  Py_ssize_t __pyx_bshape_0_input = 0;
  PyObject *__pyx_r = NULL;
  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;
  PyArrayObject *__pyx_t_6 = NULL;
  long __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  double __pyx_t_13;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__win,0};
  __Pyx_RefNannySetupContext("_roll_max");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__win);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_roll_max", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 393; __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), "_roll_max") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_input = ((PyArrayObject *)values[0]);
    __pyx_v_win = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_input = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_win = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_roll_max", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries._roll_max");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_input);
  __pyx_bstruct_output.buf = NULL;
  __pyx_bstruct_input.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_input, (PyObject*)__pyx_v_input, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_input = __pyx_bstruct_input.strides[0];
  __pyx_bshape_0_input = __pyx_bstruct_input.shape[0];

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":397
 *     cdef double val
 *     cdef int i, j
 *     cdef int N = len(input)             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":399
 *     cdef int N = len(input)
 * 
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < win - 1:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 399; __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[2]; __pyx_lineno = 399; __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_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 399; __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[2]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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[2]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_output = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_output.buf = NULL;
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_output = __pyx_bstruct_output.strides[0];
      __pyx_bshape_0_output = __pyx_bstruct_output.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":401
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)
 * 
 *     for i from 0 <= i < win - 1:             # <<<<<<<<<<<<<<
 *         output[i] = NaN
 * 
 */
  __pyx_t_7 = (__pyx_v_win - 1);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":402
 * 
 *     for i from 0 <= i < win - 1:
 *         output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     for i from win - 1 <= i < N:
 */
    __pyx_t_8 = __pyx_v_i;
    __pyx_t_9 = -1;
    if (__pyx_t_8 < 0) {
      __pyx_t_8 += __pyx_bshape_0_output;
      if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
    } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_output)) __pyx_t_9 = 0;
    if (unlikely(__pyx_t_9 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_9);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_8, __pyx_bstride_0_output) = __pyx_v_7tseries_NaN;
  }

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":404
 *         output[i] = NaN
 * 
 *     for i from win - 1 <= i < N:             # <<<<<<<<<<<<<<
 *         val = input[i - win + 1]
 * 
 */
  __pyx_t_9 = __pyx_v_N;
  for (__pyx_v_i = (__pyx_v_win - 1); __pyx_v_i < __pyx_t_9; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":405
 * 
 *     for i from win - 1 <= i < N:
 *         val = input[i - win + 1]             # <<<<<<<<<<<<<<
 * 
 *         for j from (i - win + 1) <= j <= i:
 */
    __pyx_t_7 = ((__pyx_v_i - __pyx_v_win) + 1);
    __pyx_t_10 = -1;
    if (__pyx_t_7 < 0) {
      __pyx_t_7 += __pyx_bshape_0_input;
      if (unlikely(__pyx_t_7 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_7 >= __pyx_bshape_0_input)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_7, __pyx_bstride_0_input));

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":407
 *         val = input[i - win + 1]
 * 
 *         for j from (i - win + 1) <= j <= i:             # <<<<<<<<<<<<<<
 *             val = max(val, input[j])
 * 
 */
    __pyx_t_10 = __pyx_v_i;
    for (__pyx_v_j = ((__pyx_v_i - __pyx_v_win) + 1); __pyx_v_j <= __pyx_t_10; __pyx_v_j++) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":408
 * 
 *         for j from (i - win + 1) <= j <= i:
 *             val = max(val, input[j])             # <<<<<<<<<<<<<<
 * 
 *         output[j] = val
 */
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_11 = __pyx_v_j;
      __pyx_t_12 = -1;
      if (__pyx_t_11 < 0) {
        __pyx_t_11 += __pyx_bshape_0_input;
        if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0;
      } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_input)) __pyx_t_12 = 0;
      if (unlikely(__pyx_t_12 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_12);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_11, __pyx_bstride_0_input))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_5 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_builtin_max, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_val = __pyx_t_13;
    }

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":410
 *             val = max(val, input[j])
 * 
 *         output[j] = val             # <<<<<<<<<<<<<<
 * 
 *     return output
 */
    __pyx_t_10 = __pyx_v_j;
    __pyx_t_12 = -1;
    if (__pyx_t_10 < 0) {
      __pyx_t_10 += __pyx_bshape_0_output;
      if (unlikely(__pyx_t_10 < 0)) __pyx_t_12 = 0;
    } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_output)) __pyx_t_12 = 0;
    if (unlikely(__pyx_t_12 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_12);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_10, __pyx_bstride_0_output) = __pyx_v_val;
  }

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":412
 *         output[j] = val
 * 
 *     return output             # <<<<<<<<<<<<<<
 * 
 * def _roll_min(ndarray[double_t, ndim=1] input,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_input);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tseries._roll_max");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_input);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_DECREF((PyObject *)__pyx_v_input);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\moments.pyx":414
 *     return output
 * 
 * def _roll_min(ndarray[double_t, ndim=1] input,             # <<<<<<<<<<<<<<
 *               int win):
 *     cdef double val
 */

static PyObject *__pyx_pf_7tseries__roll_min(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries__roll_min(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  int __pyx_v_win;
  double __pyx_v_val;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_N;
  PyArrayObject *__pyx_v_output = 0;
  Py_buffer __pyx_bstruct_output;
  Py_ssize_t __pyx_bstride_0_output = 0;
  Py_ssize_t __pyx_bshape_0_output = 0;
  Py_buffer __pyx_bstruct_input;
  Py_ssize_t __pyx_bstride_0_input = 0;
  Py_ssize_t __pyx_bshape_0_input = 0;
  PyObject *__pyx_r = NULL;
  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;
  PyArrayObject *__pyx_t_6 = NULL;
  long __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  double __pyx_t_13;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__win,0};
  __Pyx_RefNannySetupContext("_roll_min");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__win);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("_roll_min", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 414; __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), "_roll_min") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_input = ((PyArrayObject *)values[0]);
    __pyx_v_win = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_input = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_win = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_roll_min", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries._roll_min");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_input);
  __pyx_bstruct_output.buf = NULL;
  __pyx_bstruct_input.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_input, (PyObject*)__pyx_v_input, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_bstride_0_input = __pyx_bstruct_input.strides[0];
  __pyx_bshape_0_input = __pyx_bstruct_input.shape[0];

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":418
 *     cdef double val
 *     cdef int i, j
 *     cdef int N = len(input)             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":420
 *     cdef int N = len(input)
 * 
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < win - 1:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 420; __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[2]; __pyx_lineno = 420; __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_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 420; __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[2]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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[2]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_output = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_output.buf = NULL;
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_output = __pyx_bstruct_output.strides[0];
      __pyx_bshape_0_output = __pyx_bstruct_output.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":422
 *     cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float)
 * 
 *     for i from 0 <= i < win - 1:             # <<<<<<<<<<<<<<
 *         output[i] = NaN
 * 
 */
  __pyx_t_7 = (__pyx_v_win - 1);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":423
 * 
 *     for i from 0 <= i < win - 1:
 *         output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     for i from win - 1 <= i < N:
 */
    __pyx_t_8 = __pyx_v_i;
    __pyx_t_9 = -1;
    if (__pyx_t_8 < 0) {
      __pyx_t_8 += __pyx_bshape_0_output;
      if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
    } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_output)) __pyx_t_9 = 0;
    if (unlikely(__pyx_t_9 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_9);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_8, __pyx_bstride_0_output) = __pyx_v_7tseries_NaN;
  }

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":425
 *         output[i] = NaN
 * 
 *     for i from win - 1 <= i < N:             # <<<<<<<<<<<<<<
 *         val = input[i - win + 1]
 * 
 */
  __pyx_t_9 = __pyx_v_N;
  for (__pyx_v_i = (__pyx_v_win - 1); __pyx_v_i < __pyx_t_9; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":426
 * 
 *     for i from win - 1 <= i < N:
 *         val = input[i - win + 1]             # <<<<<<<<<<<<<<
 * 
 *         for j from (i - win + 1) <= j <= i:
 */
    __pyx_t_7 = ((__pyx_v_i - __pyx_v_win) + 1);
    __pyx_t_10 = -1;
    if (__pyx_t_7 < 0) {
      __pyx_t_7 += __pyx_bshape_0_input;
      if (unlikely(__pyx_t_7 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_7 >= __pyx_bshape_0_input)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_7, __pyx_bstride_0_input));

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":428
 *         val = input[i - win + 1]
 * 
 *         for j from (i - win + 1) <= j <= i:             # <<<<<<<<<<<<<<
 *             val = min(val, input[j])
 * 
 */
    __pyx_t_10 = __pyx_v_i;
    for (__pyx_v_j = ((__pyx_v_i - __pyx_v_win) + 1); __pyx_v_j <= __pyx_t_10; __pyx_v_j++) {

      /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":429
 * 
 *         for j from (i - win + 1) <= j <= i:
 *             val = min(val, input[j])             # <<<<<<<<<<<<<<
 * 
 *         output[j] = val
 */
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_11 = __pyx_v_j;
      __pyx_t_12 = -1;
      if (__pyx_t_11 < 0) {
        __pyx_t_11 += __pyx_bshape_0_input;
        if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0;
      } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_input)) __pyx_t_12 = 0;
      if (unlikely(__pyx_t_12 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_12);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_input.buf, __pyx_t_11, __pyx_bstride_0_input))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_5 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_builtin_min, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_val = __pyx_t_13;
    }

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":431
 *             val = min(val, input[j])
 * 
 *         output[j] = val             # <<<<<<<<<<<<<<
 * 
 *     return output
 */
    __pyx_t_10 = __pyx_v_j;
    __pyx_t_12 = -1;
    if (__pyx_t_10 < 0) {
      __pyx_t_10 += __pyx_bshape_0_output;
      if (unlikely(__pyx_t_10 < 0)) __pyx_t_12 = 0;
    } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_output)) __pyx_t_12 = 0;
    if (unlikely(__pyx_t_12 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_12);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_10, __pyx_bstride_0_output) = __pyx_v_val;
  }

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":433
 *         output[j] = val
 * 
 *     return output             # <<<<<<<<<<<<<<
 * 
 * #-------------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_input);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tseries._roll_min");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_input);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_DECREF((PyObject *)__pyx_v_input);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\moments.pyx":438
 * # Python interface
 * 
 * def rolling_sum(ndarray input, window, minp=None):             # <<<<<<<<<<<<<<
 *     '''
 *     Compute rolling sum of input array
 */

static PyObject *__pyx_pf_7tseries_rolling_sum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7tseries_rolling_sum[] = "\n    Compute rolling sum of input array\n\n    Parameters\n    ----------\n    input: ndarray\n    window: int\n    minp: int\n\n    Returns\n    -------\n    ndarray with length of input\n    ";
static PyObject *__pyx_pf_7tseries_rolling_sum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  PyObject *__pyx_v_window = 0;
  PyObject *__pyx_v_minp = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__window,&__pyx_n_s__minp,0};
  __Pyx_RefNannySetupContext("rolling_sum");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__window);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("rolling_sum", 0, 2, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp);
        if (unlikely(value)) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "rolling_sum") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_input = ((PyArrayObject *)values[0]);
    __pyx_v_window = values[1];
    __pyx_v_minp = values[2];
  } else {
    __pyx_v_minp = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3:
      __pyx_v_minp = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2:
      __pyx_v_window = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v_input = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rolling_sum", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries.rolling_sum");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_input);
  __Pyx_INCREF(__pyx_v_window);
  __Pyx_INCREF(__pyx_v_minp);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":452
 *     ndarray with length of input
 *     '''
 *     if minp is None:             # <<<<<<<<<<<<<<
 *         minp = window
 * 
 */
  __pyx_t_1 = (__pyx_v_minp == Py_None);
  if (__pyx_t_1) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":453
 *     '''
 *     if minp is None:
 *         minp = window             # <<<<<<<<<<<<<<
 * 
 *     if not issubclass(input.dtype.type, float):
 */
    __Pyx_INCREF(__pyx_v_window);
    __Pyx_DECREF(__pyx_v_minp);
    __pyx_v_minp = __pyx_v_window;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":455
 *         minp = window
 * 
 *     if not issubclass(input.dtype.type, float):             # <<<<<<<<<<<<<<
 *         input = input.astype(float)
 * 
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_input), __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = PyObject_IsSubclass(__pyx_t_3, ((PyObject *)((PyObject*)&PyFloat_Type))); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = (!__pyx_t_1);
  if (__pyx_t_4) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":456
 * 
 *     if not issubclass(input.dtype.type, float):
 *         input = input.astype(float)             # <<<<<<<<<<<<<<
 * 
 *     return _roll_sum(input, window, minp)
 */
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_input), __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)((PyObject*)&PyFloat_Type)));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)&PyFloat_Type)));
    __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyFloat_Type)));
    __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_input));
    __pyx_v_input = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":458
 *         input = input.astype(float)
 * 
 *     return _roll_sum(input, window, minp)             # <<<<<<<<<<<<<<
 * 
 * def rolling_mean(ndarray input, window, minp=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s___roll_sum); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_input));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_input));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_input));
  __Pyx_INCREF(__pyx_v_window);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_window);
  __Pyx_GIVEREF(__pyx_v_window);
  __Pyx_INCREF(__pyx_v_minp);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_minp);
  __Pyx_GIVEREF(__pyx_v_minp);
  __pyx_t_3 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  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_5);
  __Pyx_AddTraceback("tseries.rolling_sum");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_input);
  __Pyx_DECREF(__pyx_v_window);
  __Pyx_DECREF(__pyx_v_minp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\moments.pyx":460
 *     return _roll_sum(input, window, minp)
 * 
 * def rolling_mean(ndarray input, window, minp=None):             # <<<<<<<<<<<<<<
 *     if minp is None:
 *         minp = window
 */

static PyObject *__pyx_pf_7tseries_rolling_mean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries_rolling_mean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  PyObject *__pyx_v_window = 0;
  PyObject *__pyx_v_minp = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__window,&__pyx_n_s__minp,0};
  __Pyx_RefNannySetupContext("rolling_mean");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__window);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("rolling_mean", 0, 2, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp);
        if (unlikely(value)) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "rolling_mean") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_input = ((PyArrayObject *)values[0]);
    __pyx_v_window = values[1];
    __pyx_v_minp = values[2];
  } else {
    __pyx_v_minp = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3:
      __pyx_v_minp = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2:
      __pyx_v_window = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v_input = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rolling_mean", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries.rolling_mean");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_input);
  __Pyx_INCREF(__pyx_v_window);
  __Pyx_INCREF(__pyx_v_minp);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":461
 * 
 * def rolling_mean(ndarray input, window, minp=None):
 *     if minp is None:             # <<<<<<<<<<<<<<
 *         minp = window
 * 
 */
  __pyx_t_1 = (__pyx_v_minp == Py_None);
  if (__pyx_t_1) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":462
 * def rolling_mean(ndarray input, window, minp=None):
 *     if minp is None:
 *         minp = window             # <<<<<<<<<<<<<<
 * 
 *     if not issubclass(input.dtype.type, float):
 */
    __Pyx_INCREF(__pyx_v_window);
    __Pyx_DECREF(__pyx_v_minp);
    __pyx_v_minp = __pyx_v_window;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":464
 *         minp = window
 * 
 *     if not issubclass(input.dtype.type, float):             # <<<<<<<<<<<<<<
 *         input = input.astype(float)
 * 
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_input), __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = PyObject_IsSubclass(__pyx_t_3, ((PyObject *)((PyObject*)&PyFloat_Type))); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = (!__pyx_t_1);
  if (__pyx_t_4) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":465
 * 
 *     if not issubclass(input.dtype.type, float):
 *         input = input.astype(float)             # <<<<<<<<<<<<<<
 * 
 *     return _roll_mean(input, window, minp)
 */
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_input), __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)((PyObject*)&PyFloat_Type)));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)&PyFloat_Type)));
    __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyFloat_Type)));
    __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_input));
    __pyx_v_input = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":467
 *         input = input.astype(float)
 * 
 *     return _roll_mean(input, window, minp)             # <<<<<<<<<<<<<<
 * 
 * def rolling_median(ndarray input, window, minp=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s___roll_mean); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_input));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_input));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_input));
  __Pyx_INCREF(__pyx_v_window);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_window);
  __Pyx_GIVEREF(__pyx_v_window);
  __Pyx_INCREF(__pyx_v_minp);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_minp);
  __Pyx_GIVEREF(__pyx_v_minp);
  __pyx_t_3 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  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_5);
  __Pyx_AddTraceback("tseries.rolling_mean");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_input);
  __Pyx_DECREF(__pyx_v_window);
  __Pyx_DECREF(__pyx_v_minp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\moments.pyx":469
 *     return _roll_mean(input, window, minp)
 * 
 * def rolling_median(ndarray input, window, minp=None):             # <<<<<<<<<<<<<<
 *     if minp is None:
 *         minp = window
 */

static PyObject *__pyx_pf_7tseries_rolling_median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries_rolling_median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  PyObject *__pyx_v_window = 0;
  PyObject *__pyx_v_minp = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__window,&__pyx_n_s__minp,0};
  __Pyx_RefNannySetupContext("rolling_median");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__window);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("rolling_median", 0, 2, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp);
        if (unlikely(value)) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "rolling_median") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_input = ((PyArrayObject *)values[0]);
    __pyx_v_window = values[1];
    __pyx_v_minp = values[2];
  } else {
    __pyx_v_minp = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3:
      __pyx_v_minp = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2:
      __pyx_v_window = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v_input = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rolling_median", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries.rolling_median");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_input);
  __Pyx_INCREF(__pyx_v_window);
  __Pyx_INCREF(__pyx_v_minp);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":470
 * 
 * def rolling_median(ndarray input, window, minp=None):
 *     if minp is None:             # <<<<<<<<<<<<<<
 *         minp = window
 * 
 */
  __pyx_t_1 = (__pyx_v_minp == Py_None);
  if (__pyx_t_1) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":471
 * def rolling_median(ndarray input, window, minp=None):
 *     if minp is None:
 *         minp = window             # <<<<<<<<<<<<<<
 * 
 *     if not issubclass(input.dtype.type, float):
 */
    __Pyx_INCREF(__pyx_v_window);
    __Pyx_DECREF(__pyx_v_minp);
    __pyx_v_minp = __pyx_v_window;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":473
 *         minp = window
 * 
 *     if not issubclass(input.dtype.type, float):             # <<<<<<<<<<<<<<
 *         input = input.astype(float)
 * 
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_input), __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = PyObject_IsSubclass(__pyx_t_3, ((PyObject *)((PyObject*)&PyFloat_Type))); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = (!__pyx_t_1);
  if (__pyx_t_4) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":474
 * 
 *     if not issubclass(input.dtype.type, float):
 *         input = input.astype(float)             # <<<<<<<<<<<<<<
 * 
 *     return _roll_median(input, window, minp)
 */
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_input), __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)((PyObject*)&PyFloat_Type)));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)&PyFloat_Type)));
    __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyFloat_Type)));
    __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_input));
    __pyx_v_input = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":476
 *         input = input.astype(float)
 * 
 *     return _roll_median(input, window, minp)             # <<<<<<<<<<<<<<
 * 
 * def rolling_var(ndarray input, window, minp=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s___roll_median); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_input));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_input));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_input));
  __Pyx_INCREF(__pyx_v_window);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_window);
  __Pyx_GIVEREF(__pyx_v_window);
  __Pyx_INCREF(__pyx_v_minp);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_minp);
  __Pyx_GIVEREF(__pyx_v_minp);
  __pyx_t_3 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  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_5);
  __Pyx_AddTraceback("tseries.rolling_median");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_input);
  __Pyx_DECREF(__pyx_v_window);
  __Pyx_DECREF(__pyx_v_minp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\moments.pyx":478
 *     return _roll_median(input, window, minp)
 * 
 * def rolling_var(ndarray input, window, minp=None):             # <<<<<<<<<<<<<<
 *     if minp is None:
 *         minp = window
 */

static PyObject *__pyx_pf_7tseries_rolling_var(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries_rolling_var(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  PyObject *__pyx_v_window = 0;
  PyObject *__pyx_v_minp = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__window,&__pyx_n_s__minp,0};
  __Pyx_RefNannySetupContext("rolling_var");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__window);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("rolling_var", 0, 2, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp);
        if (unlikely(value)) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "rolling_var") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_input = ((PyArrayObject *)values[0]);
    __pyx_v_window = values[1];
    __pyx_v_minp = values[2];
  } else {
    __pyx_v_minp = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3:
      __pyx_v_minp = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2:
      __pyx_v_window = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v_input = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rolling_var", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries.rolling_var");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_input);
  __Pyx_INCREF(__pyx_v_window);
  __Pyx_INCREF(__pyx_v_minp);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":479
 * 
 * def rolling_var(ndarray input, window, minp=None):
 *     if minp is None:             # <<<<<<<<<<<<<<
 *         minp = window
 *     else:
 */
  __pyx_t_1 = (__pyx_v_minp == Py_None);
  if (__pyx_t_1) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":480
 * def rolling_var(ndarray input, window, minp=None):
 *     if minp is None:
 *         minp = window             # <<<<<<<<<<<<<<
 *     else:
 *         minp = max(2, minp)
 */
    __Pyx_INCREF(__pyx_v_window);
    __Pyx_DECREF(__pyx_v_minp);
    __pyx_v_minp = __pyx_v_window;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":482
 *         minp = window
 *     else:
 *         minp = max(2, minp)             # <<<<<<<<<<<<<<
 * 
 *     if not issubclass(input.dtype.type, float):
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_int_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_2);
    __Pyx_GIVEREF(__pyx_int_2);
    __Pyx_INCREF(__pyx_v_minp);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_minp);
    __Pyx_GIVEREF(__pyx_v_minp);
    __pyx_t_3 = PyObject_Call(__pyx_builtin_max, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_minp);
    __pyx_v_minp = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L6:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":484
 *         minp = max(2, minp)
 * 
 *     if not issubclass(input.dtype.type, float):             # <<<<<<<<<<<<<<
 *         input = input.astype(float)
 * 
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_input), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = PyObject_IsSubclass(__pyx_t_2, ((PyObject *)((PyObject*)&PyFloat_Type))); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (!__pyx_t_1);
  if (__pyx_t_4) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":485
 * 
 *     if not issubclass(input.dtype.type, float):
 *         input = input.astype(float)             # <<<<<<<<<<<<<<
 * 
 *     return _roll_var(input, window, minp)
 */
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_input), __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 485; __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[2]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)((PyObject*)&PyFloat_Type)));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)&PyFloat_Type)));
    __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyFloat_Type)));
    __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_input));
    __pyx_v_input = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":487
 *         input = input.astype(float)
 * 
 *     return _roll_var(input, window, minp)             # <<<<<<<<<<<<<<
 * 
 * def rolling_std(ndarray input, window, minp=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s___roll_var); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_input));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_input));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_input));
  __Pyx_INCREF(__pyx_v_window);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_window);
  __Pyx_GIVEREF(__pyx_v_window);
  __Pyx_INCREF(__pyx_v_minp);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_minp);
  __Pyx_GIVEREF(__pyx_v_minp);
  __pyx_t_2 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  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_5);
  __Pyx_AddTraceback("tseries.rolling_var");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_input);
  __Pyx_DECREF(__pyx_v_window);
  __Pyx_DECREF(__pyx_v_minp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\moments.pyx":489
 *     return _roll_var(input, window, minp)
 * 
 * def rolling_std(ndarray input, window, minp=None):             # <<<<<<<<<<<<<<
 *     output = rolling_var(input, window, minp=minp)
 *     return np.sqrt(output)
 */

static PyObject *__pyx_pf_7tseries_rolling_std(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries_rolling_std(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  PyObject *__pyx_v_window = 0;
  PyObject *__pyx_v_minp = 0;
  PyObject *__pyx_v_output;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__window,&__pyx_n_s__minp,0};
  __Pyx_RefNannySetupContext("rolling_std");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__window);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("rolling_std", 0, 2, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp);
        if (unlikely(value)) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "rolling_std") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_input = ((PyArrayObject *)values[0]);
    __pyx_v_window = values[1];
    __pyx_v_minp = values[2];
  } else {
    __pyx_v_minp = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3:
      __pyx_v_minp = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2:
      __pyx_v_window = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v_input = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rolling_std", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries.rolling_std");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_output = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":490
 * 
 * def rolling_std(ndarray input, window, minp=None):
 *     output = rolling_var(input, window, minp=minp)             # <<<<<<<<<<<<<<
 *     return np.sqrt(output)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__rolling_var); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 490; __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[2]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_input));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_input));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_input));
  __Pyx_INCREF(__pyx_v_window);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_window);
  __Pyx_GIVEREF(__pyx_v_window);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__minp), __pyx_v_minp) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_2, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_v_output);
  __pyx_v_output = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":491
 * def rolling_std(ndarray input, window, minp=None):
 *     output = rolling_var(input, window, minp=minp)
 *     return np.sqrt(output)             # <<<<<<<<<<<<<<
 * 
 * def rolling_skew(ndarray input, window, minp=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_output);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_output);
  __Pyx_GIVEREF(__pyx_v_output);
  __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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("tseries.rolling_std");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_output);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\moments.pyx":493
 *     return np.sqrt(output)
 * 
 * def rolling_skew(ndarray input, window, minp=None):             # <<<<<<<<<<<<<<
 *     if minp is None:
 *         minp = window
 */

static PyObject *__pyx_pf_7tseries_rolling_skew(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries_rolling_skew(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  PyObject *__pyx_v_window = 0;
  PyObject *__pyx_v_minp = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__window,&__pyx_n_s__minp,0};
  __Pyx_RefNannySetupContext("rolling_skew");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__window);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("rolling_skew", 0, 2, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp);
        if (unlikely(value)) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "rolling_skew") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_input = ((PyArrayObject *)values[0]);
    __pyx_v_window = values[1];
    __pyx_v_minp = values[2];
  } else {
    __pyx_v_minp = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3:
      __pyx_v_minp = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2:
      __pyx_v_window = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v_input = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rolling_skew", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries.rolling_skew");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_input);
  __Pyx_INCREF(__pyx_v_window);
  __Pyx_INCREF(__pyx_v_minp);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":494
 * 
 * def rolling_skew(ndarray input, window, minp=None):
 *     if minp is None:             # <<<<<<<<<<<<<<
 *         minp = window
 *     else:
 */
  __pyx_t_1 = (__pyx_v_minp == Py_None);
  if (__pyx_t_1) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":495
 * def rolling_skew(ndarray input, window, minp=None):
 *     if minp is None:
 *         minp = window             # <<<<<<<<<<<<<<
 *     else:
 *         minp = max(2, minp)
 */
    __Pyx_INCREF(__pyx_v_window);
    __Pyx_DECREF(__pyx_v_minp);
    __pyx_v_minp = __pyx_v_window;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":497
 *         minp = window
 *     else:
 *         minp = max(2, minp)             # <<<<<<<<<<<<<<
 * 
 *     if not issubclass(input.dtype.type, float):
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_int_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_2);
    __Pyx_GIVEREF(__pyx_int_2);
    __Pyx_INCREF(__pyx_v_minp);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_minp);
    __Pyx_GIVEREF(__pyx_v_minp);
    __pyx_t_3 = PyObject_Call(__pyx_builtin_max, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_minp);
    __pyx_v_minp = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L6:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":499
 *         minp = max(2, minp)
 * 
 *     if not issubclass(input.dtype.type, float):             # <<<<<<<<<<<<<<
 *         input = input.astype(float)
 * 
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_input), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = PyObject_IsSubclass(__pyx_t_2, ((PyObject *)((PyObject*)&PyFloat_Type))); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (!__pyx_t_1);
  if (__pyx_t_4) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":500
 * 
 *     if not issubclass(input.dtype.type, float):
 *         input = input.astype(float)             # <<<<<<<<<<<<<<
 * 
 *     return _roll_skew(input, window, minp)
 */
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_input), __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 500; __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[2]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)((PyObject*)&PyFloat_Type)));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)&PyFloat_Type)));
    __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyFloat_Type)));
    __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_input));
    __pyx_v_input = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":502
 *         input = input.astype(float)
 * 
 *     return _roll_skew(input, window, minp)             # <<<<<<<<<<<<<<
 * 
 * def rolling_kurt(ndarray input, window, minp=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s___roll_skew); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_input));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_input));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_input));
  __Pyx_INCREF(__pyx_v_window);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_window);
  __Pyx_GIVEREF(__pyx_v_window);
  __Pyx_INCREF(__pyx_v_minp);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_minp);
  __Pyx_GIVEREF(__pyx_v_minp);
  __pyx_t_2 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  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_5);
  __Pyx_AddTraceback("tseries.rolling_skew");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_input);
  __Pyx_DECREF(__pyx_v_window);
  __Pyx_DECREF(__pyx_v_minp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\moments.pyx":504
 *     return _roll_skew(input, window, minp)
 * 
 * def rolling_kurt(ndarray input, window, minp=None):             # <<<<<<<<<<<<<<
 *     if minp is None:
 *         minp = window
 */

static PyObject *__pyx_pf_7tseries_rolling_kurt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries_rolling_kurt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  PyObject *__pyx_v_window = 0;
  PyObject *__pyx_v_minp = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__window,&__pyx_n_s__minp,0};
  __Pyx_RefNannySetupContext("rolling_kurt");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__window);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("rolling_kurt", 0, 2, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp);
        if (unlikely(value)) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "rolling_kurt") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_input = ((PyArrayObject *)values[0]);
    __pyx_v_window = values[1];
    __pyx_v_minp = values[2];
  } else {
    __pyx_v_minp = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3:
      __pyx_v_minp = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2:
      __pyx_v_window = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v_input = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rolling_kurt", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries.rolling_kurt");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_input);
  __Pyx_INCREF(__pyx_v_window);
  __Pyx_INCREF(__pyx_v_minp);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":505
 * 
 * def rolling_kurt(ndarray input, window, minp=None):
 *     if minp is None:             # <<<<<<<<<<<<<<
 *         minp = window
 *     else:
 */
  __pyx_t_1 = (__pyx_v_minp == Py_None);
  if (__pyx_t_1) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":506
 * def rolling_kurt(ndarray input, window, minp=None):
 *     if minp is None:
 *         minp = window             # <<<<<<<<<<<<<<
 *     else:
 *         minp = max(2, minp)
 */
    __Pyx_INCREF(__pyx_v_window);
    __Pyx_DECREF(__pyx_v_minp);
    __pyx_v_minp = __pyx_v_window;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":508
 *         minp = window
 *     else:
 *         minp = max(2, minp)             # <<<<<<<<<<<<<<
 * 
 *     if not issubclass(input.dtype.type, float):
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_int_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_2);
    __Pyx_GIVEREF(__pyx_int_2);
    __Pyx_INCREF(__pyx_v_minp);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_minp);
    __Pyx_GIVEREF(__pyx_v_minp);
    __pyx_t_3 = PyObject_Call(__pyx_builtin_max, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_minp);
    __pyx_v_minp = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L6:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":510
 *         minp = max(2, minp)
 * 
 *     if not issubclass(input.dtype.type, float):             # <<<<<<<<<<<<<<
 *         input = input.astype(float)
 * 
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_input), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = PyObject_IsSubclass(__pyx_t_2, ((PyObject *)((PyObject*)&PyFloat_Type))); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (!__pyx_t_1);
  if (__pyx_t_4) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":511
 * 
 *     if not issubclass(input.dtype.type, float):
 *         input = input.astype(float)             # <<<<<<<<<<<<<<
 * 
 *     return _roll_kurt(input, window, minp)
 */
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_input), __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 511; __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[2]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)((PyObject*)&PyFloat_Type)));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)&PyFloat_Type)));
    __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyFloat_Type)));
    __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_input));
    __pyx_v_input = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":513
 *         input = input.astype(float)
 * 
 *     return _roll_kurt(input, window, minp)             # <<<<<<<<<<<<<<
 * 
 * def ewma(ndarray input, com):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s___roll_kurt); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_input));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_input));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_input));
  __Pyx_INCREF(__pyx_v_window);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_window);
  __Pyx_GIVEREF(__pyx_v_window);
  __Pyx_INCREF(__pyx_v_minp);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_minp);
  __Pyx_GIVEREF(__pyx_v_minp);
  __pyx_t_2 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  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_5);
  __Pyx_AddTraceback("tseries.rolling_kurt");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_input);
  __Pyx_DECREF(__pyx_v_window);
  __Pyx_DECREF(__pyx_v_minp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\moments.pyx":515
 *     return _roll_kurt(input, window, minp)
 * 
 * def ewma(ndarray input, com):             # <<<<<<<<<<<<<<
 *     N = len(input)
 * 
 */

static PyObject *__pyx_pf_7tseries_ewma(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries_ewma(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  PyObject *__pyx_v_com = 0;
  PyObject *__pyx_v_N;
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__com,0};
  __Pyx_RefNannySetupContext("ewma");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__com);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("ewma", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 515; __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), "ewma") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_input = ((PyArrayObject *)values[0]);
    __pyx_v_com = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_input = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_com = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ewma", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries.ewma");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_input);
  __Pyx_INCREF(__pyx_v_com);
  __pyx_v_N = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":516
 * 
 * def ewma(ndarray input, com):
 *     N = len(input)             # <<<<<<<<<<<<<<
 * 
 *     if not issubclass(input.dtype.type, float):
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_v_N);
  __pyx_v_N = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":518
 *     N = len(input)
 * 
 *     if not issubclass(input.dtype.type, float):             # <<<<<<<<<<<<<<
 *         input = input.astype(float)
 * 
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_input), __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = PyObject_IsSubclass(__pyx_t_3, ((PyObject *)((PyObject*)&PyFloat_Type))); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = (!__pyx_t_4);
  if (__pyx_t_5) {

    /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":519
 * 
 *     if not issubclass(input.dtype.type, float):
 *         input = input.astype(float)             # <<<<<<<<<<<<<<
 * 
 *     return _ewma(input, com)
 */
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_input), __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)((PyObject*)&PyFloat_Type)));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)&PyFloat_Type)));
    __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyFloat_Type)));
    __pyx_t_6 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__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[2]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_input));
    __pyx_v_input = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "H:\workspace\pandas\pandas\lib\src\moments.pyx":521
 *         input = input.astype(float)
 * 
 *     return _ewma(input, com)             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s___ewma); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_input));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_input));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_input));
  __Pyx_INCREF(__pyx_v_com);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_com);
  __Pyx_GIVEREF(__pyx_v_com);
  __pyx_t_3 = PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  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_6);
  __Pyx_AddTraceback("tseries.ewma");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_N);
  __Pyx_DECREF((PyObject *)__pyx_v_input);
  __Pyx_DECREF(__pyx_v_com);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":2
 * 
 * cdef tuple _backfill(ndarray oldIndex, ndarray newIndex, dict oldMap, dict newMap):             # <<<<<<<<<<<<<<
 *     '''
 *     Backfilling logic for generating fill vector
 */

static  PyObject *__pyx_f_7tseries__backfill(PyArrayObject *__pyx_v_oldIndex, PyArrayObject *__pyx_v_newIndex, PyObject *__pyx_v_oldMap, PyObject *__pyx_v_newMap) {
  int __pyx_v_i;
  int __pyx_v_oldLength;
  int __pyx_v_newLength;
  int __pyx_v_curLoc;
  PyArrayObject *__pyx_v_fillVec;
  PyArrayObject *__pyx_v_maskVec;
  int *__pyx_v_fillLocs;
  char *__pyx_v_mask;
  PyArrayIterObject *__pyx_v_iterold;
  PyArrayIterObject *__pyx_v_iternew;
  int __pyx_v_newPos;
  int __pyx_v_oldPos;
  PyObject *__pyx_v_prevOld;
  PyObject *__pyx_v_curOld;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __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;
  __Pyx_RefNannySetupContext("_backfill");
  __Pyx_INCREF((PyObject *)__pyx_v_oldIndex);
  __Pyx_INCREF((PyObject *)__pyx_v_newIndex);
  __Pyx_INCREF(__pyx_v_oldMap);
  __Pyx_INCREF(__pyx_v_newMap);
  __pyx_v_fillVec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_maskVec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_iterold = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_iternew = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_prevOld = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_curOld = Py_None; __Pyx_INCREF(Py_None);

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":31
 *     cdef ndarray fillVec
 *     cdef ndarray maskVec
 *     fillVec = <ndarray> np.empty(len(newIndex), dtype = np.int32)             # <<<<<<<<<<<<<<
 *     maskVec = <ndarray> np.zeros(len(newIndex), dtype = np.int8)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 31; __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[5]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_newIndex)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 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[5]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 31; __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[5]; __pyx_lineno = 31; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_4, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_6)));
  __Pyx_DECREF(((PyObject *)__pyx_v_fillVec));
  __pyx_v_fillVec = ((PyArrayObject *)__pyx_t_6);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":32
 *     cdef ndarray maskVec
 *     fillVec = <ndarray> np.empty(len(newIndex), dtype = np.int32)
 *     maskVec = <ndarray> np.zeros(len(newIndex), dtype = np.int8)             # <<<<<<<<<<<<<<
 * 
 *     # Get references
 */
  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_newIndex)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_4, ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 32; __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_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_5)));
  __Pyx_DECREF(((PyObject *)__pyx_v_maskVec));
  __pyx_v_maskVec = ((PyArrayObject *)__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":37
 *     cdef int *fillLocs
 *     cdef char *mask
 *     fillLocs = <int *> fillVec.data             # <<<<<<<<<<<<<<
 *     mask = <char *> maskVec.data
 * 
 */
  __pyx_v_fillLocs = ((int *)__pyx_v_fillVec->data);

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":38
 *     cdef char *mask
 *     fillLocs = <int *> fillVec.data
 *     mask = <char *> maskVec.data             # <<<<<<<<<<<<<<
 * 
 *     # Create the iterators
 */
  __pyx_v_mask = ((char *)__pyx_v_maskVec->data);

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":42
 *     # Create the iterators
 *     cdef flatiter iterold, iternew
 *     iterold = <flatiter> PyArray_IterNew(oldIndex)             # <<<<<<<<<<<<<<
 *     iternew = <flatiter> PyArray_IterNew(newIndex)
 * 
 */
  __pyx_t_5 = PyArray_IterNew(((PyObject *)__pyx_v_oldIndex)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)((PyArrayIterObject *)__pyx_t_5)));
  __Pyx_DECREF(((PyObject *)__pyx_v_iterold));
  __pyx_v_iterold = ((PyArrayIterObject *)__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":43
 *     cdef flatiter iterold, iternew
 *     iterold = <flatiter> PyArray_IterNew(oldIndex)
 *     iternew = <flatiter> PyArray_IterNew(newIndex)             # <<<<<<<<<<<<<<
 * 
 *     # Get the size
 */
  __pyx_t_5 = PyArray_IterNew(((PyObject *)__pyx_v_newIndex)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)((PyArrayIterObject *)__pyx_t_5)));
  __Pyx_DECREF(((PyObject *)__pyx_v_iternew));
  __pyx_v_iternew = ((PyArrayIterObject *)__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":46
 * 
 *     # Get the size
 *     oldLength = PyArray_SIZE(oldIndex)             # <<<<<<<<<<<<<<
 *     newLength = PyArray_SIZE(newIndex)
 * 
 */
  __pyx_v_oldLength = PyArray_SIZE(__pyx_v_oldIndex);

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":47
 *     # Get the size
 *     oldLength = PyArray_SIZE(oldIndex)
 *     newLength = PyArray_SIZE(newIndex)             # <<<<<<<<<<<<<<
 * 
 *     # Current positions
 */
  __pyx_v_newLength = PyArray_SIZE(__pyx_v_newIndex);

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":51
 *     # Current positions
 *     cdef int newPos, oldPos
 *     oldPos = oldLength - 1             # <<<<<<<<<<<<<<
 *     newPos = newLength - 1
 * 
 */
  __pyx_v_oldPos = (__pyx_v_oldLength - 1);

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":52
 *     cdef int newPos, oldPos
 *     oldPos = oldLength - 1
 *     newPos = newLength - 1             # <<<<<<<<<<<<<<
 * 
 *     # References holding indices
 */
  __pyx_v_newPos = (__pyx_v_newLength - 1);

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":57
 *     cdef object prevOld, curOld
 * 
 *     while newPos >= 0:             # <<<<<<<<<<<<<<
 *         # Move to the current position
 *         PyArray_ITER_GOTO1D(iternew, newPos)
 */
  while (1) {
    __pyx_t_7 = (__pyx_v_newPos >= 0);
    if (!__pyx_t_7) break;

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":59
 *     while newPos >= 0:
 *         # Move to the current position
 *         PyArray_ITER_GOTO1D(iternew, newPos)             # <<<<<<<<<<<<<<
 *         PyArray_ITER_GOTO1D(iterold, oldPos)
 * 
 */
    PyArray_ITER_GOTO1D(__pyx_v_iternew, __pyx_v_newPos);

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":60
 *         # Move to the current position
 *         PyArray_ITER_GOTO1D(iternew, newPos)
 *         PyArray_ITER_GOTO1D(iterold, oldPos)             # <<<<<<<<<<<<<<
 * 
 *         # Get the current index
 */
    PyArray_ITER_GOTO1D(__pyx_v_iterold, __pyx_v_oldPos);

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":63
 * 
 *         # Get the current index
 *         curOld = PyArray_GETITEM(oldIndex, PyArray_ITER_DATA(iterold))             # <<<<<<<<<<<<<<
 * 
 *         # Until we reach a point where we are before the curOld point
 */
    __pyx_t_5 = PyArray_GETITEM(__pyx_v_oldIndex, PyArray_ITER_DATA(__pyx_v_iterold)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_v_curOld);
    __pyx_v_curOld = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":66
 * 
 *         # Until we reach a point where we are before the curOld point
 *         while PyArray_GETITEM(newIndex, PyArray_ITER_DATA(iternew)) > curOld:             # <<<<<<<<<<<<<<
 *             newPos -= 1
 *             if newPos < 0:
 */
    while (1) {
      __pyx_t_5 = PyArray_GETITEM(__pyx_v_newIndex, PyArray_ITER_DATA(__pyx_v_iternew)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_v_curOld, Py_GT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (!__pyx_t_7) break;

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":67
 *         # Until we reach a point where we are before the curOld point
 *         while PyArray_GETITEM(newIndex, PyArray_ITER_DATA(iternew)) > curOld:
 *             newPos -= 1             # <<<<<<<<<<<<<<
 *             if newPos < 0:
 *                 break
 */
      __pyx_v_newPos -= 1;

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":68
 *         while PyArray_GETITEM(newIndex, PyArray_ITER_DATA(iternew)) > curOld:
 *             newPos -= 1
 *             if newPos < 0:             # <<<<<<<<<<<<<<
 *                 break
 *             PyArray_ITER_GOTO1D(iternew, newPos)
 */
      __pyx_t_7 = (__pyx_v_newPos < 0);
      if (__pyx_t_7) {

        /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":69
 *             newPos -= 1
 *             if newPos < 0:
 *                 break             # <<<<<<<<<<<<<<
 *             PyArray_ITER_GOTO1D(iternew, newPos)
 * 
 */
        goto __pyx_L6_break;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":70
 *             if newPos < 0:
 *                 break
 *             PyArray_ITER_GOTO1D(iternew, newPos)             # <<<<<<<<<<<<<<
 * 
 *         # Get the location in the old index
 */
      PyArray_ITER_GOTO1D(__pyx_v_iternew, __pyx_v_newPos);
    }
    __pyx_L6_break:;

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":73
 * 
 *         # Get the location in the old index
 *         curLoc = oldMap[curOld]             # <<<<<<<<<<<<<<
 * 
 *         # At the beginning of the old index
 */
    __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_oldMap), __pyx_v_curOld); if (!__pyx_t_6) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_curLoc = __pyx_t_8;

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":76
 * 
 *         # At the beginning of the old index
 *         if oldPos == 0:             # <<<<<<<<<<<<<<
 * 
 *             # Make sure we are before the curOld index
 */
    __pyx_t_7 = (__pyx_v_oldPos == 0);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":79
 * 
 *             # Make sure we are before the curOld index
 *             if PyArray_GETITEM(newIndex, PyArray_ITER_DATA(iternew)) <= curOld:             # <<<<<<<<<<<<<<
 *                 fillVec[:newPos + 1] = curLoc
 *                 maskVec[:newPos + 1] = 1
 */
      __pyx_t_6 = PyArray_GETITEM(__pyx_v_newIndex, PyArray_ITER_DATA(__pyx_v_iternew)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_v_curOld, Py_LE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {

        /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":80
 *             # Make sure we are before the curOld index
 *             if PyArray_GETITEM(newIndex, PyArray_ITER_DATA(iternew)) <= curOld:
 *                 fillVec[:newPos + 1] = curLoc             # <<<<<<<<<<<<<<
 *                 maskVec[:newPos + 1] = 1
 * 
 */
        __pyx_t_5 = PyInt_FromLong(__pyx_v_curLoc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        if (PySequence_SetSlice(((PyObject *)__pyx_v_fillVec), 0, (__pyx_v_newPos + 1), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":81
 *             if PyArray_GETITEM(newIndex, PyArray_ITER_DATA(iternew)) <= curOld:
 *                 fillVec[:newPos + 1] = curLoc
 *                 maskVec[:newPos + 1] = 1             # <<<<<<<<<<<<<<
 * 
 *             # Exit the main loop
 */
        if (PySequence_SetSlice(((PyObject *)__pyx_v_maskVec), 0, (__pyx_v_newPos + 1), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":84
 * 
 *             # Exit the main loop
 *             break             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
      goto __pyx_L4_break;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":88
 *         else:
 *             # Move one position back
 *             PyArray_ITER_GOTO1D(iterold, oldPos - 1)             # <<<<<<<<<<<<<<
 * 
 *             # Get the index there
 */
      PyArray_ITER_GOTO1D(__pyx_v_iterold, (__pyx_v_oldPos - 1));

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":91
 * 
 *             # Get the index there
 *             prevOld = PyArray_GETITEM(oldIndex, PyArray_ITER_DATA(iterold))             # <<<<<<<<<<<<<<
 * 
 *             # Until we reach the previous index
 */
      __pyx_t_5 = PyArray_GETITEM(__pyx_v_oldIndex, PyArray_ITER_DATA(__pyx_v_iterold)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_v_prevOld);
      __pyx_v_prevOld = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":94
 * 
 *             # Until we reach the previous index
 *             while PyArray_GETITEM(newIndex, PyArray_ITER_DATA(iternew)) > prevOld:             # <<<<<<<<<<<<<<
 * 
 *                 # Set the current fill location
 */
      while (1) {
        __pyx_t_5 = PyArray_GETITEM(__pyx_v_newIndex, PyArray_ITER_DATA(__pyx_v_iternew)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_v_prevOld, Py_GT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (!__pyx_t_7) break;

        /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":97
 * 
 *                 # Set the current fill location
 *                 fillLocs[newPos] = curLoc             # <<<<<<<<<<<<<<
 *                 mask[newPos] = 1
 * 
 */
        (__pyx_v_fillLocs[__pyx_v_newPos]) = __pyx_v_curLoc;

        /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":98
 *                 # Set the current fill location
 *                 fillLocs[newPos] = curLoc
 *                 mask[newPos] = 1             # <<<<<<<<<<<<<<
 * 
 *                 newPos -= 1
 */
        (__pyx_v_mask[__pyx_v_newPos]) = 1;

        /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":100
 *                 mask[newPos] = 1
 * 
 *                 newPos -= 1             # <<<<<<<<<<<<<<
 *                 if newPos < 0:
 *                     break
 */
        __pyx_v_newPos -= 1;

        /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":101
 * 
 *                 newPos -= 1
 *                 if newPos < 0:             # <<<<<<<<<<<<<<
 *                     break
 * 
 */
        __pyx_t_7 = (__pyx_v_newPos < 0);
        if (__pyx_t_7) {

          /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":102
 *                 newPos -= 1
 *                 if newPos < 0:
 *                     break             # <<<<<<<<<<<<<<
 * 
 *                 # Move the iterator back
 */
          goto __pyx_L11_break;
          goto __pyx_L12;
        }
        __pyx_L12:;

        /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":105
 * 
 *                 # Move the iterator back
 *                 PyArray_ITER_GOTO1D(iternew, newPos)             # <<<<<<<<<<<<<<
 * 
 *         # Move one period back
 */
        PyArray_ITER_GOTO1D(__pyx_v_iternew, __pyx_v_newPos);
      }
      __pyx_L11_break:;
    }
    __pyx_L8:;

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":108
 * 
 *         # Move one period back
 *         oldPos -= 1             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < newLength:
 */
    __pyx_v_oldPos -= 1;
  }
  __pyx_L4_break:;

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":110
 *         oldPos -= 1
 * 
 *     for i from 0 <= i < newLength:             # <<<<<<<<<<<<<<
 *         if mask[i] == 0:
 *             # Fill from some generic location
 */
  __pyx_t_8 = __pyx_v_newLength;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":111
 * 
 *     for i from 0 <= i < newLength:
 *         if mask[i] == 0:             # <<<<<<<<<<<<<<
 *             # Fill from some generic location
 *             fillLocs[i] = -1
 */
    __pyx_t_7 = ((__pyx_v_mask[__pyx_v_i]) == 0);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":113
 *         if mask[i] == 0:
 *             # Fill from some generic location
 *             fillLocs[i] = -1             # <<<<<<<<<<<<<<
 * 
 *     return (fillVec, maskVec)
 */
      (__pyx_v_fillLocs[__pyx_v_i]) = -1;
      goto __pyx_L15;
    }
    __pyx_L15:;
  }

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":115
 *             fillLocs[i] = -1
 * 
 *     return (fillVec, maskVec)             # <<<<<<<<<<<<<<
 * 
 * cdef tuple _pad(ndarray oldIndex, ndarray newIndex, dict oldMap, dict newMap):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_fillVec));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_fillVec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_fillVec));
  __Pyx_INCREF(((PyObject *)__pyx_v_maskVec));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_maskVec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_maskVec));
  if (!(likely(PyTuple_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = ((PyObject *)__pyx_t_6);
  __pyx_t_6 = 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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("tseries._backfill");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_fillVec);
  __Pyx_DECREF((PyObject *)__pyx_v_maskVec);
  __Pyx_DECREF((PyObject *)__pyx_v_iterold);
  __Pyx_DECREF((PyObject *)__pyx_v_iternew);
  __Pyx_DECREF(__pyx_v_prevOld);
  __Pyx_DECREF(__pyx_v_curOld);
  __Pyx_DECREF((PyObject *)__pyx_v_oldIndex);
  __Pyx_DECREF((PyObject *)__pyx_v_newIndex);
  __Pyx_DECREF(__pyx_v_oldMap);
  __Pyx_DECREF(__pyx_v_newMap);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":117
 *     return (fillVec, maskVec)
 * 
 * cdef tuple _pad(ndarray oldIndex, ndarray newIndex, dict oldMap, dict newMap):             # <<<<<<<<<<<<<<
 *     '''
 *     Padding logic for generating fill vector
 */

static  PyObject *__pyx_f_7tseries__pad(PyArrayObject *__pyx_v_oldIndex, PyArrayObject *__pyx_v_newIndex, PyObject *__pyx_v_oldMap, PyObject *__pyx_v_newMap) {
  PyArrayObject *__pyx_v_fillVec;
  PyArrayObject *__pyx_v_maskVec;
  int *__pyx_v_fillLocs;
  char *__pyx_v_mask;
  int __pyx_v_i;
  int __pyx_v_oldLength;
  int __pyx_v_newLength;
  int __pyx_v_curLoc;
  int __pyx_v_newPos;
  int __pyx_v_oldPos;
  PyArrayIterObject *__pyx_v_iterold;
  PyArrayIterObject *__pyx_v_iternew;
  PyObject *__pyx_v_nextOld;
  PyObject *__pyx_v_curOld;
  char __pyx_v_done;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __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;
  char __pyx_t_9;
  __Pyx_RefNannySetupContext("_pad");
  __Pyx_INCREF((PyObject *)__pyx_v_oldIndex);
  __Pyx_INCREF((PyObject *)__pyx_v_newIndex);
  __Pyx_INCREF(__pyx_v_oldMap);
  __Pyx_INCREF(__pyx_v_newMap);
  __pyx_v_fillVec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_maskVec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_iterold = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_iternew = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_nextOld = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_curOld = Py_None; __Pyx_INCREF(Py_None);

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":151
 * 
 *     # Make empty fill vector and mask vector, cast to ndarray
 *     fillVec = <ndarray> np.empty(len(newIndex), dtype = np.int32)             # <<<<<<<<<<<<<<
 *     maskVec = <ndarray> np.zeros(len(newIndex), dtype = np.int8)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 151; __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[5]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_newIndex)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 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[5]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 151; __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[5]; __pyx_lineno = 151; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_4, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_6)));
  __Pyx_DECREF(((PyObject *)__pyx_v_fillVec));
  __pyx_v_fillVec = ((PyArrayObject *)__pyx_t_6);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":152
 *     # Make empty fill vector and mask vector, cast to ndarray
 *     fillVec = <ndarray> np.empty(len(newIndex), dtype = np.int32)
 *     maskVec = <ndarray> np.zeros(len(newIndex), dtype = np.int8)             # <<<<<<<<<<<<<<
 * 
 *     # Get reference to the arrays inside
 */
  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_newIndex)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_4, ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 152; __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_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_5)));
  __Pyx_DECREF(((PyObject *)__pyx_v_maskVec));
  __pyx_v_maskVec = ((PyArrayObject *)__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":155
 * 
 *     # Get reference to the arrays inside
 *     fillLocs = <int *> fillVec.data             # <<<<<<<<<<<<<<
 *     mask = <char *> maskVec.data
 * 
 */
  __pyx_v_fillLocs = ((int *)__pyx_v_fillVec->data);

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":156
 *     # Get reference to the arrays inside
 *     fillLocs = <int *> fillVec.data
 *     mask = <char *> maskVec.data             # <<<<<<<<<<<<<<
 * 
 *     # Create simple ndarray iterators using C API
 */
  __pyx_v_mask = ((char *)__pyx_v_maskVec->data);

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":159
 * 
 *     # Create simple ndarray iterators using C API
 *     iterold = <flatiter> PyArray_IterNew(oldIndex)             # <<<<<<<<<<<<<<
 *     iternew = <flatiter> PyArray_IterNew(newIndex)
 * 
 */
  __pyx_t_5 = PyArray_IterNew(((PyObject *)__pyx_v_oldIndex)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)((PyArrayIterObject *)__pyx_t_5)));
  __Pyx_DECREF(((PyObject *)__pyx_v_iterold));
  __pyx_v_iterold = ((PyArrayIterObject *)__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":160
 *     # Create simple ndarray iterators using C API
 *     iterold = <flatiter> PyArray_IterNew(oldIndex)
 *     iternew = <flatiter> PyArray_IterNew(newIndex)             # <<<<<<<<<<<<<<
 * 
 *     # Length of each index
 */
  __pyx_t_5 = PyArray_IterNew(((PyObject *)__pyx_v_newIndex)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)((PyArrayIterObject *)__pyx_t_5)));
  __Pyx_DECREF(((PyObject *)__pyx_v_iternew));
  __pyx_v_iternew = ((PyArrayIterObject *)__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":163
 * 
 *     # Length of each index
 *     oldLength = PyArray_SIZE(oldIndex)             # <<<<<<<<<<<<<<
 *     newLength = PyArray_SIZE(newIndex)
 * 
 */
  __pyx_v_oldLength = PyArray_SIZE(__pyx_v_oldIndex);

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":164
 *     # Length of each index
 *     oldLength = PyArray_SIZE(oldIndex)
 *     newLength = PyArray_SIZE(newIndex)             # <<<<<<<<<<<<<<
 * 
 *     oldPos = 0
 */
  __pyx_v_newLength = PyArray_SIZE(__pyx_v_newIndex);

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":166
 *     newLength = PyArray_SIZE(newIndex)
 * 
 *     oldPos = 0             # <<<<<<<<<<<<<<
 *     newPos = 0
 *     while newPos < newLength:
 */
  __pyx_v_oldPos = 0;

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":167
 * 
 *     oldPos = 0
 *     newPos = 0             # <<<<<<<<<<<<<<
 *     while newPos < newLength:
 *         curOld = PyArray_GETITEM(oldIndex, PyArray_ITER_DATA(iterold))
 */
  __pyx_v_newPos = 0;

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":168
 *     oldPos = 0
 *     newPos = 0
 *     while newPos < newLength:             # <<<<<<<<<<<<<<
 *         curOld = PyArray_GETITEM(oldIndex, PyArray_ITER_DATA(iterold))
 * 
 */
  while (1) {
    __pyx_t_7 = (__pyx_v_newPos < __pyx_v_newLength);
    if (!__pyx_t_7) break;

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":169
 *     newPos = 0
 *     while newPos < newLength:
 *         curOld = PyArray_GETITEM(oldIndex, PyArray_ITER_DATA(iterold))             # <<<<<<<<<<<<<<
 * 
 *         # At beginning, keep going until we go exceed the
 */
    __pyx_t_5 = PyArray_GETITEM(__pyx_v_oldIndex, PyArray_ITER_DATA(__pyx_v_iterold)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_v_curOld);
    __pyx_v_curOld = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":173
 *         # At beginning, keep going until we go exceed the
 *         # first OLD index in the NEW index
 *         while PyArray_GETITEM(newIndex, PyArray_ITER_DATA(iternew)) < curOld:             # <<<<<<<<<<<<<<
 *             newPos += 1
 *             if newPos > newLength - 1:
 */
    while (1) {
      __pyx_t_5 = PyArray_GETITEM(__pyx_v_newIndex, PyArray_ITER_DATA(__pyx_v_iternew)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_v_curOld, Py_LT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (!__pyx_t_7) break;

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":174
 *         # first OLD index in the NEW index
 *         while PyArray_GETITEM(newIndex, PyArray_ITER_DATA(iternew)) < curOld:
 *             newPos += 1             # <<<<<<<<<<<<<<
 *             if newPos > newLength - 1:
 *                 break
 */
      __pyx_v_newPos += 1;

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":175
 *         while PyArray_GETITEM(newIndex, PyArray_ITER_DATA(iternew)) < curOld:
 *             newPos += 1
 *             if newPos > newLength - 1:             # <<<<<<<<<<<<<<
 *                 break
 *             PyArray_ITER_NEXT(iternew)
 */
      __pyx_t_7 = (__pyx_v_newPos > (__pyx_v_newLength - 1));
      if (__pyx_t_7) {

        /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":176
 *             newPos += 1
 *             if newPos > newLength - 1:
 *                 break             # <<<<<<<<<<<<<<
 *             PyArray_ITER_NEXT(iternew)
 * 
 */
        goto __pyx_L6_break;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":177
 *             if newPos > newLength - 1:
 *                 break
 *             PyArray_ITER_NEXT(iternew)             # <<<<<<<<<<<<<<
 * 
 *         # We got there, get the current location in the old index
 */
      PyArray_ITER_NEXT(__pyx_v_iternew);
    }
    __pyx_L6_break:;

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":180
 * 
 *         # We got there, get the current location in the old index
 *         curLoc = oldMap[curOld]             # <<<<<<<<<<<<<<
 * 
 *         # We're at the end of the road, need to propagate this value to the end
 */
    __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_oldMap), __pyx_v_curOld); if (!__pyx_t_6) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_curLoc = __pyx_t_8;

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":183
 * 
 *         # We're at the end of the road, need to propagate this value to the end
 *         if oldPos == oldLength - 1:             # <<<<<<<<<<<<<<
 *             if PyArray_GETITEM(newIndex, PyArray_ITER_DATA(iternew)) >= curOld:
 *                 fillVec[newPos:] = curLoc
 */
    __pyx_t_7 = (__pyx_v_oldPos == (__pyx_v_oldLength - 1));
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":184
 *         # We're at the end of the road, need to propagate this value to the end
 *         if oldPos == oldLength - 1:
 *             if PyArray_GETITEM(newIndex, PyArray_ITER_DATA(iternew)) >= curOld:             # <<<<<<<<<<<<<<
 *                 fillVec[newPos:] = curLoc
 *                 maskVec[newPos:] = 1
 */
      __pyx_t_6 = PyArray_GETITEM(__pyx_v_newIndex, PyArray_ITER_DATA(__pyx_v_iternew)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_v_curOld, Py_GE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {

        /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":185
 *         if oldPos == oldLength - 1:
 *             if PyArray_GETITEM(newIndex, PyArray_ITER_DATA(iternew)) >= curOld:
 *                 fillVec[newPos:] = curLoc             # <<<<<<<<<<<<<<
 *                 maskVec[newPos:] = 1
 *             break
 */
        __pyx_t_5 = PyInt_FromLong(__pyx_v_curLoc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        if (PySequence_SetSlice(((PyObject *)__pyx_v_fillVec), __pyx_v_newPos, PY_SSIZE_T_MAX, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":186
 *             if PyArray_GETITEM(newIndex, PyArray_ITER_DATA(iternew)) >= curOld:
 *                 fillVec[newPos:] = curLoc
 *                 maskVec[newPos:] = 1             # <<<<<<<<<<<<<<
 *             break
 *         else:
 */
        if (PySequence_SetSlice(((PyObject *)__pyx_v_maskVec), __pyx_v_newPos, PY_SSIZE_T_MAX, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":187
 *                 fillVec[newPos:] = curLoc
 *                 maskVec[newPos:] = 1
 *             break             # <<<<<<<<<<<<<<
 *         else:
 *             # Not at the end, need to go about filling
 */
      goto __pyx_L4_break;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":192
 * 
 *             # Get the next index so we know when to stop propagating this value
 *             PyArray_ITER_NEXT(iterold)             # <<<<<<<<<<<<<<
 *             nextOld = PyArray_GETITEM(oldIndex, PyArray_ITER_DATA(iterold))
 * 
 */
      PyArray_ITER_NEXT(__pyx_v_iterold);

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":193
 *             # Get the next index so we know when to stop propagating this value
 *             PyArray_ITER_NEXT(iterold)
 *             nextOld = PyArray_GETITEM(oldIndex, PyArray_ITER_DATA(iterold))             # <<<<<<<<<<<<<<
 * 
 *             done = 0
 */
      __pyx_t_5 = PyArray_GETITEM(__pyx_v_oldIndex, PyArray_ITER_DATA(__pyx_v_iterold)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_v_nextOld);
      __pyx_v_nextOld = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":195
 *             nextOld = PyArray_GETITEM(oldIndex, PyArray_ITER_DATA(iterold))
 * 
 *             done = 0             # <<<<<<<<<<<<<<
 * 
 *             # Until we reach the next OLD value in the NEW index
 */
      __pyx_v_done = 0;

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":198
 * 
 *             # Until we reach the next OLD value in the NEW index
 *             while PyArray_GETITEM(newIndex, PyArray_ITER_DATA(iternew)) < nextOld:             # <<<<<<<<<<<<<<
 * 
 *                 # Use this location to fill
 */
      while (1) {
        __pyx_t_5 = PyArray_GETITEM(__pyx_v_newIndex, PyArray_ITER_DATA(__pyx_v_iternew)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_v_nextOld, Py_LT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (!__pyx_t_7) break;

        /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":201
 * 
 *                 # Use this location to fill
 *                 fillLocs[newPos] = curLoc             # <<<<<<<<<<<<<<
 * 
 *                 # Set mask to be 1 so will not be NaN'd
 */
        (__pyx_v_fillLocs[__pyx_v_newPos]) = __pyx_v_curLoc;

        /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":204
 * 
 *                 # Set mask to be 1 so will not be NaN'd
 *                 mask[newPos] = 1             # <<<<<<<<<<<<<<
 *                 newPos += 1
 * 
 */
        (__pyx_v_mask[__pyx_v_newPos]) = 1;

        /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":205
 *                 # Set mask to be 1 so will not be NaN'd
 *                 mask[newPos] = 1
 *                 newPos += 1             # <<<<<<<<<<<<<<
 * 
 *                 # We got to the end of the new index
 */
        __pyx_v_newPos += 1;

        /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":208
 * 
 *                 # We got to the end of the new index
 *                 if newPos > newLength - 1:             # <<<<<<<<<<<<<<
 *                     done = 1
 *                     break
 */
        __pyx_t_7 = (__pyx_v_newPos > (__pyx_v_newLength - 1));
        if (__pyx_t_7) {

          /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":209
 *                 # We got to the end of the new index
 *                 if newPos > newLength - 1:
 *                     done = 1             # <<<<<<<<<<<<<<
 *                     break
 * 
 */
          __pyx_v_done = 1;

          /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":210
 *                 if newPos > newLength - 1:
 *                     done = 1
 *                     break             # <<<<<<<<<<<<<<
 * 
 *                 # Advance the pointer
 */
          goto __pyx_L11_break;
          goto __pyx_L12;
        }
        __pyx_L12:;

        /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":213
 * 
 *                 # Advance the pointer
 *                 PyArray_ITER_NEXT(iternew)             # <<<<<<<<<<<<<<
 * 
 *             # We got to the end of the new index
 */
        PyArray_ITER_NEXT(__pyx_v_iternew);
      }
      __pyx_L11_break:;

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":216
 * 
 *             # We got to the end of the new index
 *             if done:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
      __pyx_t_9 = __pyx_v_done;
      if (__pyx_t_9) {

        /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":217
 *             # We got to the end of the new index
 *             if done:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *         # We already advanced the iterold pointer to the next value,
 */
        goto __pyx_L4_break;
        goto __pyx_L13;
      }
      __pyx_L13:;
    }
    __pyx_L8:;

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":221
 *         # We already advanced the iterold pointer to the next value,
 *         # inc the count
 *         oldPos += 1             # <<<<<<<<<<<<<<
 * 
 *     # Places where the mask is 0, fill with an arbitrary value
 */
    __pyx_v_oldPos += 1;
  }
  __pyx_L4_break:;

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":225
 *     # Places where the mask is 0, fill with an arbitrary value
 *     # (will be NA'd out)
 *     for i from 0 <= i < newLength:             # <<<<<<<<<<<<<<
 *         if mask[i] == 0:
 *             fillLocs[i] = -1
 */
  __pyx_t_8 = __pyx_v_newLength;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":226
 *     # (will be NA'd out)
 *     for i from 0 <= i < newLength:
 *         if mask[i] == 0:             # <<<<<<<<<<<<<<
 *             fillLocs[i] = -1
 * 
 */
    __pyx_t_7 = ((__pyx_v_mask[__pyx_v_i]) == 0);
    if (__pyx_t_7) {

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":227
 *     for i from 0 <= i < newLength:
 *         if mask[i] == 0:
 *             fillLocs[i] = -1             # <<<<<<<<<<<<<<
 * 
 *     return fillVec, maskVec
 */
      (__pyx_v_fillLocs[__pyx_v_i]) = -1;
      goto __pyx_L16;
    }
    __pyx_L16:;
  }

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":229
 *             fillLocs[i] = -1
 * 
 *     return fillVec, maskVec             # <<<<<<<<<<<<<<
 * 
 * def getFillVec(ndarray oldIndex, ndarray newIndex, dict oldMap, dict newMap,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_fillVec));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_fillVec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_fillVec));
  __Pyx_INCREF(((PyObject *)__pyx_v_maskVec));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_maskVec));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_maskVec));
  if (!(likely(PyTuple_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = ((PyObject *)__pyx_t_6);
  __pyx_t_6 = 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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("tseries._pad");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_fillVec);
  __Pyx_DECREF((PyObject *)__pyx_v_maskVec);
  __Pyx_DECREF((PyObject *)__pyx_v_iterold);
  __Pyx_DECREF((PyObject *)__pyx_v_iternew);
  __Pyx_DECREF(__pyx_v_nextOld);
  __Pyx_DECREF(__pyx_v_curOld);
  __Pyx_DECREF((PyObject *)__pyx_v_oldIndex);
  __Pyx_DECREF((PyObject *)__pyx_v_newIndex);
  __Pyx_DECREF(__pyx_v_oldMap);
  __Pyx_DECREF(__pyx_v_newMap);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":231
 *     return fillVec, maskVec
 * 
 * def getFillVec(ndarray oldIndex, ndarray newIndex, dict oldMap, dict newMap,             # <<<<<<<<<<<<<<
 *                object kind):
 * 
 */

static PyObject *__pyx_pf_7tseries_getFillVec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries_getFillVec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_oldIndex = 0;
  PyArrayObject *__pyx_v_newIndex = 0;
  PyObject *__pyx_v_oldMap = 0;
  PyObject *__pyx_v_newMap = 0;
  PyObject *__pyx_v_kind = 0;
  PyObject *__pyx_v_fillVec;
  PyObject *__pyx_v_maskVec;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__oldIndex,&__pyx_n_s__newIndex,&__pyx_n_s__oldMap,&__pyx_n_s__newMap,&__pyx_n_s__kind,0};
  __Pyx_RefNannySetupContext("getFillVec");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[5] = {0,0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__oldIndex);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__newIndex);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("getFillVec", 1, 5, 5, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__oldMap);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("getFillVec", 1, 5, 5, 2); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__newMap);
      if (likely(values[3])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("getFillVec", 1, 5, 5, 3); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  4:
      values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__kind);
      if (likely(values[4])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("getFillVec", 1, 5, 5, 4); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "getFillVec") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_oldIndex = ((PyArrayObject *)values[0]);
    __pyx_v_newIndex = ((PyArrayObject *)values[1]);
    __pyx_v_oldMap = ((PyObject *)values[2]);
    __pyx_v_newMap = ((PyObject *)values[3]);
    __pyx_v_kind = values[4];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_oldIndex = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_newIndex = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1));
    __pyx_v_oldMap = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 2));
    __pyx_v_newMap = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 3));
    __pyx_v_kind = PyTuple_GET_ITEM(__pyx_args, 4);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getFillVec", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries.getFillVec");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_oldIndex);
  __Pyx_INCREF((PyObject *)__pyx_v_newIndex);
  __Pyx_INCREF(__pyx_v_oldMap);
  __Pyx_INCREF(__pyx_v_newMap);
  __Pyx_INCREF(__pyx_v_kind);
  __pyx_v_fillVec = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_maskVec = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_oldIndex), __pyx_ptype_5numpy_ndarray, 1, "oldIndex", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_newIndex), __pyx_ptype_5numpy_ndarray, 1, "newIndex", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_oldMap), &PyDict_Type, 1, "oldMap", 1))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_newMap), &PyDict_Type, 1, "newMap", 1))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":234
 *                object kind):
 * 
 *     if kind is None:             # <<<<<<<<<<<<<<
 *         fillVec, maskVec = getMergeVec(newIndex, oldMap)
 *     elif kind == 'PAD':
 */
  __pyx_t_1 = (__pyx_v_kind == Py_None);
  if (__pyx_t_1) {

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":235
 * 
 *     if kind is None:
 *         fillVec, maskVec = getMergeVec(newIndex, oldMap)             # <<<<<<<<<<<<<<
 *     elif kind == 'PAD':
 *         fillVec, maskVec = _pad(oldIndex, newIndex, oldMap, newMap)
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__getMergeVec); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_newIndex));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_newIndex));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_newIndex));
    __Pyx_INCREF(((PyObject *)__pyx_v_oldMap));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_oldMap));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_oldMap));
    __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) {
      PyObject* tuple = __pyx_t_4;
      __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3);
      __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_fillVec);
      __pyx_v_fillVec = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_v_maskVec);
      __pyx_v_maskVec = __pyx_t_2;
      __pyx_t_2 = 0;
    } else {
      __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_EndUnpack(__pyx_t_5) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_fillVec);
      __pyx_v_fillVec = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_v_maskVec);
      __pyx_v_maskVec = __pyx_t_2;
      __pyx_t_2 = 0;
    }
    goto __pyx_L6;
  }

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":236
 *     if kind is None:
 *         fillVec, maskVec = getMergeVec(newIndex, oldMap)
 *     elif kind == 'PAD':             # <<<<<<<<<<<<<<
 *         fillVec, maskVec = _pad(oldIndex, newIndex, oldMap, newMap)
 *     elif kind == 'BACKFILL':
 */
  __pyx_t_4 = PyObject_RichCompare(__pyx_v_kind, ((PyObject *)__pyx_n_s__PAD), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":237
 *         fillVec, maskVec = getMergeVec(newIndex, oldMap)
 *     elif kind == 'PAD':
 *         fillVec, maskVec = _pad(oldIndex, newIndex, oldMap, newMap)             # <<<<<<<<<<<<<<
 *     elif kind == 'BACKFILL':
 *         fillVec, maskVec = _backfill(oldIndex, newIndex, oldMap, newMap)
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_7tseries__pad(__pyx_v_oldIndex, __pyx_v_newIndex, __pyx_v_oldMap, __pyx_v_newMap)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (likely(__pyx_t_4 != Py_None) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) {
      PyObject* tuple = __pyx_t_4;
      __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_fillVec);
      __pyx_v_fillVec = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_maskVec);
      __pyx_v_maskVec = __pyx_t_3;
      __pyx_t_3 = 0;
    } else {
      __Pyx_UnpackTupleError(__pyx_t_4, 2);
      {__pyx_filename = __pyx_f[5]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L6;
  }

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":238
 *     elif kind == 'PAD':
 *         fillVec, maskVec = _pad(oldIndex, newIndex, oldMap, newMap)
 *     elif kind == 'BACKFILL':             # <<<<<<<<<<<<<<
 *         fillVec, maskVec = _backfill(oldIndex, newIndex, oldMap, newMap)
 *     else:
 */
  __pyx_t_4 = PyObject_RichCompare(__pyx_v_kind, ((PyObject *)__pyx_n_s__BACKFILL), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":239
 *         fillVec, maskVec = _pad(oldIndex, newIndex, oldMap, newMap)
 *     elif kind == 'BACKFILL':
 *         fillVec, maskVec = _backfill(oldIndex, newIndex, oldMap, newMap)             # <<<<<<<<<<<<<<
 *     else:
 *         raise Exception("Don't recognize fillMethod: %s" % kind)
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_7tseries__backfill(__pyx_v_oldIndex, __pyx_v_newIndex, __pyx_v_oldMap, __pyx_v_newMap)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (likely(__pyx_t_4 != Py_None) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) {
      PyObject* tuple = __pyx_t_4;
      __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3);
      __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_fillVec);
      __pyx_v_fillVec = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_v_maskVec);
      __pyx_v_maskVec = __pyx_t_2;
      __pyx_t_2 = 0;
    } else {
      __Pyx_UnpackTupleError(__pyx_t_4, 2);
      {__pyx_filename = __pyx_f[5]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L6;
  }
  /*else*/ {

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":241
 *         fillVec, maskVec = _backfill(oldIndex, newIndex, oldMap, newMap)
 *     else:
 *         raise Exception("Don't recognize fillMethod: %s" % kind)             # <<<<<<<<<<<<<<
 * 
 *     return fillVec, maskVec.astype(np.bool)
 */
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), __pyx_v_kind); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_builtin_Exception, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[5]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L6:;

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":243
 *         raise Exception("Don't recognize fillMethod: %s" % kind)
 * 
 *     return fillVec, maskVec.astype(np.bool)             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyObject_GetAttr(__pyx_v_maskVec, __pyx_n_s__astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__bool); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 243; __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_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_fillVec);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fillVec);
  __Pyx_GIVEREF(__pyx_v_fillVec);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __Pyx_GIVEREF(__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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("tseries.getFillVec");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_fillVec);
  __Pyx_DECREF(__pyx_v_maskVec);
  __Pyx_DECREF((PyObject *)__pyx_v_oldIndex);
  __Pyx_DECREF((PyObject *)__pyx_v_newIndex);
  __Pyx_DECREF(__pyx_v_oldMap);
  __Pyx_DECREF(__pyx_v_newMap);
  __Pyx_DECREF(__pyx_v_kind);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":246
 * 
 * @cython.boundscheck(False)
 * def getMergeVec(ndarray values, dict oldMap):             # <<<<<<<<<<<<<<
 *     cdef int i, j, length, newLength
 * 
 */

static PyObject *__pyx_pf_7tseries_getMergeVec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_7tseries_getMergeVec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyObject *__pyx_v_oldMap = 0;
  int __pyx_v_i;
  int __pyx_v_newLength;
  PyArrayIterObject *__pyx_v_iternew;
  PyObject *__pyx_v_idx;
  PyArrayObject *__pyx_v_fillLocs;
  PyArrayObject *__pyx_v_mask;
  Py_buffer __pyx_bstruct_mask;
  Py_ssize_t __pyx_bstride_0_mask = 0;
  Py_ssize_t __pyx_bshape_0_mask = 0;
  Py_buffer __pyx_bstruct_fillLocs;
  Py_ssize_t __pyx_bstride_0_fillLocs = 0;
  Py_ssize_t __pyx_bshape_0_fillLocs = 0;
  PyObject *__pyx_r = NULL;
  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;
  PyArrayObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  __pyx_t_5numpy_int32_t __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  int __pyx_t_18;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__oldMap,0};
  __Pyx_RefNannySetupContext("getMergeVec");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    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;
    }
    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__oldMap);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("getMergeVec", 1, 2, 2, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 246; __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), "getMergeVec") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_oldMap = ((PyObject *)values[1]);
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_values = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_oldMap = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 1));
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getMergeVec", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries.getMergeVec");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_values);
  __Pyx_INCREF(__pyx_v_oldMap);
  __pyx_v_iternew = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_fillLocs = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_mask = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_bstruct_fillLocs.buf = NULL;
  __pyx_bstruct_mask.buf = NULL;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_oldMap), &PyDict_Type, 1, "oldMap", 1))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":254
 *     cdef ndarray[int8_t, ndim=1] mask
 * 
 *     newLength = len(values)             # <<<<<<<<<<<<<<
 *     fillLocs = np.empty(newLength, dtype=np.int32)
 *     mask = np.zeros(newLength, dtype=np.int8)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_newLength = __pyx_t_1;

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":255
 * 
 *     newLength = len(values)
 *     fillLocs = np.empty(newLength, dtype=np.int32)             # <<<<<<<<<<<<<<
 *     mask = np.zeros(newLength, dtype=np.int8)
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 255; __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[5]; __pyx_lineno = 255; __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_FromLong(__pyx_v_newLength); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 255; __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[5]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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[5]; __pyx_lineno = 255; __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[5]; __pyx_lineno = 255; __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[5]; __pyx_lineno = 255; __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[5]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__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[5]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fillLocs);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_fillLocs, (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_fillLocs, (PyObject*)__pyx_v_fillLocs, &__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_fillLocs = __pyx_bstruct_fillLocs.strides[0];
    __pyx_bshape_0_fillLocs = __pyx_bstruct_fillLocs.shape[0];
    if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_fillLocs));
  __pyx_v_fillLocs = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":256
 *     newLength = len(values)
 *     fillLocs = np.empty(newLength, dtype=np.int32)
 *     mask = np.zeros(newLength, dtype=np.int8)             # <<<<<<<<<<<<<<
 * 
 *     iternew = <flatiter> PyArray_IterNew(values)
 */
  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyInt_FromLong(__pyx_v_newLength); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_4, ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_mask, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_8 < 0)) {
      PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_mask, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      }
    }
    __pyx_bstride_0_mask = __pyx_bstruct_mask.strides[0];
    __pyx_bshape_0_mask = __pyx_bstruct_mask.shape[0];
    if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_12 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_mask));
  __pyx_v_mask = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":258
 *     mask = np.zeros(newLength, dtype=np.int8)
 * 
 *     iternew = <flatiter> PyArray_IterNew(values)             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < newLength:
 */
  __pyx_t_5 = PyArray_IterNew(((PyObject *)__pyx_v_values)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)((PyArrayIterObject *)__pyx_t_5)));
  __Pyx_DECREF(((PyObject *)__pyx_v_iternew));
  __pyx_v_iternew = ((PyArrayIterObject *)__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":260
 *     iternew = <flatiter> PyArray_IterNew(values)
 * 
 *     for i from 0 <= i < newLength:             # <<<<<<<<<<<<<<
 *         idx = PyArray_GETITEM(values, PyArray_ITER_DATA(iternew))
 * 
 */
  __pyx_t_8 = __pyx_v_newLength;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":261
 * 
 *     for i from 0 <= i < newLength:
 *         idx = PyArray_GETITEM(values, PyArray_ITER_DATA(iternew))             # <<<<<<<<<<<<<<
 * 
 *         if idx in oldMap:
 */
    __pyx_t_5 = PyArray_GETITEM(__pyx_v_values, PyArray_ITER_DATA(__pyx_v_iternew)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_v_idx);
    __pyx_v_idx = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":263
 *         idx = PyArray_GETITEM(values, PyArray_ITER_DATA(iternew))
 * 
 *         if idx in oldMap:             # <<<<<<<<<<<<<<
 *             fillLocs[i] = oldMap[idx]
 *             mask[i] = 1
 */
    if (unlikely(((PyObject *)__pyx_v_oldMap) == Py_None)) {
      __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {
      __pyx_t_13 = ((PyDict_Contains(((PyObject *)__pyx_v_oldMap), __pyx_v_idx))); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (__pyx_t_13) {

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":264
 * 
 *         if idx in oldMap:
 *             fillLocs[i] = oldMap[idx]             # <<<<<<<<<<<<<<
 *             mask[i] = 1
 * 
 */
      __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_oldMap), __pyx_v_idx); if (!__pyx_t_5) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_14 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_5); if (unlikely((__pyx_t_14 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_15 = __pyx_v_i;
      if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_fillLocs;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_fillLocs.buf, __pyx_t_15, __pyx_bstride_0_fillLocs) = __pyx_t_14;

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":265
 *         if idx in oldMap:
 *             fillLocs[i] = oldMap[idx]
 *             mask[i] = 1             # <<<<<<<<<<<<<<
 * 
 *         PyArray_ITER_NEXT(iternew)
 */
      __pyx_t_16 = __pyx_v_i;
      if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_mask;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_bstruct_mask.buf, __pyx_t_16, __pyx_bstride_0_mask) = 1;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":267
 *             mask[i] = 1
 * 
 *         PyArray_ITER_NEXT(iternew)             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < newLength:
 */
    PyArray_ITER_NEXT(__pyx_v_iternew);
  }

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":269
 *         PyArray_ITER_NEXT(iternew)
 * 
 *     for i from 0 <= i < newLength:             # <<<<<<<<<<<<<<
 *         if mask[i] == 0:
 *             fillLocs[i] = -1
 */
  __pyx_t_8 = __pyx_v_newLength;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":270
 * 
 *     for i from 0 <= i < newLength:
 *         if mask[i] == 0:             # <<<<<<<<<<<<<<
 *             fillLocs[i] = -1
 * 
 */
    __pyx_t_17 = __pyx_v_i;
    if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_0_mask;
    __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_bstruct_mask.buf, __pyx_t_17, __pyx_bstride_0_mask)) == 0);
    if (__pyx_t_13) {

      /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":271
 *     for i from 0 <= i < newLength:
 *         if mask[i] == 0:
 *             fillLocs[i] = -1             # <<<<<<<<<<<<<<
 * 
 *     return fillLocs, mask.astype(bool)
 */
      __pyx_t_18 = __pyx_v_i;
      if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_0_fillLocs;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_fillLocs.buf, __pyx_t_18, __pyx_bstride_0_fillLocs) = -1;
      goto __pyx_L11;
    }
    __pyx_L11:;
  }

  /* "H:\workspace\pandas\pandas\lib\src\reindex.pyx":273
 *             fillLocs[i] = -1
 * 
 *     return fillLocs, mask.astype(bool)             # <<<<<<<<<<<<<<
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_mask), __pyx_n_s__astype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)((PyObject*)&PyBool_Type)));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)((PyObject*)&PyBool_Type)));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyBool_Type)));
  __pyx_t_4 = PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_fillLocs));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_fillLocs));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_fillLocs));
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __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_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_mask);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fillLocs);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tseries.getMergeVec");
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fillLocs);
  __pyx_L2:;
  __Pyx_DECREF((PyObject *)__pyx_v_iternew);
  __Pyx_DECREF(__pyx_v_idx);
  __Pyx_DECREF((PyObject *)__pyx_v_fillLocs);
  __Pyx_DECREF((PyObject *)__pyx_v_mask);
  __Pyx_DECREF((PyObject *)__pyx_v_values);
  __Pyx_DECREF(__pyx_v_oldMap);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\operators.pyx":1
 * cdef double __add(double a, double b):             # <<<<<<<<<<<<<<
 *     return a + b
 * cdef double __sub(double a, double b):
 */

static  double __pyx_f_7tseries___add(double __pyx_v_a, double __pyx_v_b) {
  double __pyx_r;
  __Pyx_RefNannySetupContext("__add");

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":2
 * cdef double __add(double a, double b):
 *     return a + b             # <<<<<<<<<<<<<<
 * cdef double __sub(double a, double 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;
}

/* "H:\workspace\pandas\pandas\lib\src\operators.pyx":3
 * cdef double __add(double a, double b):
 *     return a + b
 * cdef double __sub(double a, double b):             # <<<<<<<<<<<<<<
 *     return a - b
 * cdef double __div(double a, double b):
 */

static  double __pyx_f_7tseries___sub(double __pyx_v_a, double __pyx_v_b) {
  double __pyx_r;
  __Pyx_RefNannySetupContext("__sub");

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":4
 *     return a + b
 * cdef double __sub(double a, double b):
 *     return a - b             # <<<<<<<<<<<<<<
 * cdef double __div(double a, double 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;
}

/* "H:\workspace\pandas\pandas\lib\src\operators.pyx":5
 * cdef double __sub(double a, double b):
 *     return a - b
 * cdef double __div(double a, double b):             # <<<<<<<<<<<<<<
 *     return a / b
 * cdef double __mul(double a, double b):
 */

static  double __pyx_f_7tseries___div(double __pyx_v_a, double __pyx_v_b) {
  double __pyx_r;
  __Pyx_RefNannySetupContext("__div");

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":6
 *     return a - b
 * cdef double __div(double a, double b):
 *     return a / b             # <<<<<<<<<<<<<<
 * cdef double __mul(double a, double b):
 *     return a * b
 */
  if (unlikely(__pyx_v_b == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_r = (__pyx_v_a / __pyx_v_b);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("tseries.__div");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\operators.pyx":7
 * cdef double __div(double a, double b):
 *     return a / b
 * cdef double __mul(double a, double b):             # <<<<<<<<<<<<<<
 *     return a * b
 * cdef double __eq(double a, double b):
 */

static  double __pyx_f_7tseries___mul(double __pyx_v_a, double __pyx_v_b) {
  double __pyx_r;
  __Pyx_RefNannySetupContext("__mul");

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":8
 *     return a / b
 * cdef double __mul(double a, double b):
 *     return a * b             # <<<<<<<<<<<<<<
 * cdef double __eq(double a, double 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;
}

/* "H:\workspace\pandas\pandas\lib\src\operators.pyx":9
 * cdef double __mul(double a, double b):
 *     return a * b
 * cdef double __eq(double a, double b):             # <<<<<<<<<<<<<<
 *     return a == b
 * cdef double __ne(double a, double b):
 */

static  double __pyx_f_7tseries___eq(double __pyx_v_a, double __pyx_v_b) {
  double __pyx_r;
  __Pyx_RefNannySetupContext("__eq");

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":10
 *     return a * b
 * cdef double __eq(double a, double b):
 *     return a == b             # <<<<<<<<<<<<<<
 * cdef double __ne(double a, double 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;
}

/* "H:\workspace\pandas\pandas\lib\src\operators.pyx":11
 * cdef double __eq(double a, double b):
 *     return a == b
 * cdef double __ne(double a, double b):             # <<<<<<<<<<<<<<
 *     return a != b
 * cdef double __lt(double a, double b):
 */

static  double __pyx_f_7tseries___ne(double __pyx_v_a, double __pyx_v_b) {
  double __pyx_r;
  __Pyx_RefNannySetupContext("__ne");

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":12
 *     return a == b
 * cdef double __ne(double a, double b):
 *     return a != b             # <<<<<<<<<<<<<<
 * cdef double __lt(double a, double 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;
}

/* "H:\workspace\pandas\pandas\lib\src\operators.pyx":13
 * cdef double __ne(double a, double b):
 *     return a != b
 * cdef double __lt(double a, double b):             # <<<<<<<<<<<<<<
 *     return a < b
 * cdef double __gt(double a, double b):
 */

static  double __pyx_f_7tseries___lt(double __pyx_v_a, double __pyx_v_b) {
  double __pyx_r;
  __Pyx_RefNannySetupContext("__lt");

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":14
 *     return a != b
 * cdef double __lt(double a, double b):
 *     return a < b             # <<<<<<<<<<<<<<
 * cdef double __gt(double a, double 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;
}

/* "H:\workspace\pandas\pandas\lib\src\operators.pyx":15
 * cdef double __lt(double a, double b):
 *     return a < b
 * cdef double __gt(double a, double b):             # <<<<<<<<<<<<<<
 *     return a > b
 * cdef double __pow(double a, double b):
 */

static  double __pyx_f_7tseries___gt(double __pyx_v_a, double __pyx_v_b) {
  double __pyx_r;
  __Pyx_RefNannySetupContext("__gt");

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":16
 *     return a < b
 * cdef double __gt(double a, double b):
 *     return a > b             # <<<<<<<<<<<<<<
 * cdef double __pow(double a, double 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;
}

/* "H:\workspace\pandas\pandas\lib\src\operators.pyx":17
 * cdef double __gt(double a, double b):
 *     return a > b
 * cdef double __pow(double a, double b):             # <<<<<<<<<<<<<<
 *     return a ** b
 * 
 */

static  double __pyx_f_7tseries___pow(double __pyx_v_a, double __pyx_v_b) {
  double __pyx_r;
  __Pyx_RefNannySetupContext("__pow");

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":18
 *     return a > b
 * cdef double __pow(double a, double b):
 *     return a ** b             # <<<<<<<<<<<<<<
 * 
 * ctypedef double (* double_func)(double a, double b)
 */
  __pyx_r = pow(__pyx_v_a, __pyx_v_b);
  goto __pyx_L0;

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

/* "H:\workspace\pandas\pandas\lib\src\operators.pyx":22
 * ctypedef double (* double_func)(double a, double b)
 * 
 * cdef ndarray _applyFunc(double_func func, ndarray index, object ao,             # <<<<<<<<<<<<<<
 *                         object bo, dict aMap, dict bMap):
 *     '''
 */

static  PyArrayObject *__pyx_f_7tseries__applyFunc(__pyx_t_7tseries_double_func __pyx_v_func, PyArrayObject *__pyx_v_index, PyObject *__pyx_v_ao, PyObject *__pyx_v_bo, PyObject *__pyx_v_aMap, PyObject *__pyx_v_bMap) {
  PyArrayObject *__pyx_v_A;
  PyArrayObject *__pyx_v_B;
  PyArrayObject *__pyx_v_result;
  double *__pyx_v_result_data;
  int __pyx_v_i;
  int __pyx_v_length;
  PyArrayIterObject *__pyx_v_itera;
  PyArrayIterObject *__pyx_v_iteridx;
  double __pyx_v_nan;
  PyObject *__pyx_v_idx;
  PyArrayObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  double __pyx_t_3;
  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;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  __Pyx_RefNannySetupContext("_applyFunc");
  __Pyx_INCREF((PyObject *)__pyx_v_index);
  __Pyx_INCREF(__pyx_v_ao);
  __Pyx_INCREF(__pyx_v_bo);
  __Pyx_INCREF(__pyx_v_aMap);
  __Pyx_INCREF(__pyx_v_bMap);
  __pyx_v_A = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_B = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_itera = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_iteridx = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None);

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":36
 *     # This is EXTREMELY important, otherwise you will get very
 *     # undesired results
 *     A = PyArray_ContiguousFromAny(ao, NPY_DOUBLE, 1, 1)             # <<<<<<<<<<<<<<
 *     B = PyArray_ContiguousFromAny(bo, NPY_DOUBLE, 1, 1)
 * 
 */
  __pyx_t_1 = PyArray_ContiguousFromAny(__pyx_v_ao, NPY_DOUBLE, 1, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_A));
  __pyx_v_A = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":37
 *     # undesired results
 *     A = PyArray_ContiguousFromAny(ao, NPY_DOUBLE, 1, 1)
 *     B = PyArray_ContiguousFromAny(bo, NPY_DOUBLE, 1, 1)             # <<<<<<<<<<<<<<
 * 
 *     nan = <double> np.NaN
 */
  __pyx_t_1 = PyArray_ContiguousFromAny(__pyx_v_bo, NPY_DOUBLE, 1, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_B));
  __pyx_v_B = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":39
 *     B = PyArray_ContiguousFromAny(bo, NPY_DOUBLE, 1, 1)
 * 
 *     nan = <double> np.NaN             # <<<<<<<<<<<<<<
 *     length = PyArray_SIZE(index)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 39; __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[6]; __pyx_lineno = 39; __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 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_nan = ((double)__pyx_t_3);

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":40
 * 
 *     nan = <double> np.NaN
 *     length = PyArray_SIZE(index)             # <<<<<<<<<<<<<<
 * 
 *     result = <ndarray> np.empty(length, np.float64)
 */
  __pyx_v_length = PyArray_SIZE(__pyx_v_index);

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":42
 *     length = PyArray_SIZE(index)
 * 
 *     result = <ndarray> np.empty(length, np.float64)             # <<<<<<<<<<<<<<
 *     result_data = <double *>result.data
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 42; __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[6]; __pyx_lineno = 42; __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_FromLong(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_2 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 42; __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_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_5)));
  __Pyx_DECREF(((PyObject *)__pyx_v_result));
  __pyx_v_result = ((PyArrayObject *)__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":43
 * 
 *     result = <ndarray> np.empty(length, np.float64)
 *     result_data = <double *>result.data             # <<<<<<<<<<<<<<
 * 
 *     itera = <flatiter> PyArray_IterNew(A)
 */
  __pyx_v_result_data = ((double *)__pyx_v_result->data);

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":45
 *     result_data = <double *>result.data
 * 
 *     itera = <flatiter> PyArray_IterNew(A)             # <<<<<<<<<<<<<<
 *     iteridx = PyArray_IterNew(index)
 * 
 */
  __pyx_t_5 = PyArray_IterNew(((PyObject *)__pyx_v_A)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)((PyArrayIterObject *)__pyx_t_5)));
  __Pyx_DECREF(((PyObject *)__pyx_v_itera));
  __pyx_v_itera = ((PyArrayIterObject *)__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":46
 * 
 *     itera = <flatiter> PyArray_IterNew(A)
 *     iteridx = PyArray_IterNew(index)             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < length:
 */
  __pyx_t_5 = PyArray_IterNew(((PyObject *)__pyx_v_index)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_flatiter))))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_iteridx));
  __pyx_v_iteridx = ((PyArrayIterObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":48
 *     iteridx = PyArray_IterNew(index)
 * 
 *     for i from 0 <= i < length:             # <<<<<<<<<<<<<<
 *         idx = PyArray_GETITEM(index, PyArray_ITER_DATA(iteridx))
 *         PyArray_ITER_NEXT(iteridx)
 */
  __pyx_t_6 = __pyx_v_length;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {

    /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":49
 * 
 *     for i from 0 <= i < length:
 *         idx = PyArray_GETITEM(index, PyArray_ITER_DATA(iteridx))             # <<<<<<<<<<<<<<
 *         PyArray_ITER_NEXT(iteridx)
 * 
 */
    __pyx_t_5 = PyArray_GETITEM(__pyx_v_index, PyArray_ITER_DATA(__pyx_v_iteridx)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_v_idx);
    __pyx_v_idx = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":50
 *     for i from 0 <= i < length:
 *         idx = PyArray_GETITEM(index, PyArray_ITER_DATA(iteridx))
 *         PyArray_ITER_NEXT(iteridx)             # <<<<<<<<<<<<<<
 * 
 *         if idx not in aMap or idx not in bMap:
 */
    PyArray_ITER_NEXT(__pyx_v_iteridx);

    /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":52
 *         PyArray_ITER_NEXT(iteridx)
 * 
 *         if idx not in aMap or idx not in bMap:             # <<<<<<<<<<<<<<
 *             result_data[i] = nan
 *             continue
 */
    if (unlikely(((PyObject *)__pyx_v_aMap) == Py_None)) {
      __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {
      __pyx_t_7 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_aMap), __pyx_v_idx))); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (!__pyx_t_7) {
      if (unlikely(((PyObject *)__pyx_v_bMap) == Py_None)) {
        __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      } else {
        __pyx_t_8 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_bMap), __pyx_v_idx))); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_9 = __pyx_t_8;
    } else {
      __pyx_t_9 = __pyx_t_7;
    }
    if (__pyx_t_9) {

      /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":53
 * 
 *         if idx not in aMap or idx not in bMap:
 *             result_data[i] = nan             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
      (__pyx_v_result_data[__pyx_v_i]) = __pyx_v_nan;

      /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":54
 *         if idx not in aMap or idx not in bMap:
 *             result_data[i] = nan
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         result_data[i] = func((<double *>A.data)[aMap[idx]],
 */
      goto __pyx_L3_continue;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":56
 *             continue
 * 
 *         result_data[i] = func((<double *>A.data)[aMap[idx]],             # <<<<<<<<<<<<<<
 *                             (<double *>B.data)[bMap[idx]])
 * 
 */
    __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_aMap), __pyx_v_idx); if (!__pyx_t_5) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":57
 * 
 *         result_data[i] = func((<double *>A.data)[aMap[idx]],
 *                             (<double *>B.data)[bMap[idx]])             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_bMap), __pyx_v_idx); if (!__pyx_t_5) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":56
 *             continue
 * 
 *         result_data[i] = func((<double *>A.data)[aMap[idx]],             # <<<<<<<<<<<<<<
 *                             (<double *>B.data)[bMap[idx]])
 * 
 */
    (__pyx_v_result_data[__pyx_v_i]) = __pyx_v_func((((double *)__pyx_v_A->data)[__pyx_t_10]), (((double *)__pyx_v_B->data)[__pyx_t_11]));
    __pyx_L3_continue:;
  }

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":59
 *                             (<double *>B.data)[bMap[idx]])
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * def combineFunc(object name, ndarray index, object ao,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("tseries._applyFunc");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_A);
  __Pyx_DECREF((PyObject *)__pyx_v_B);
  __Pyx_DECREF((PyObject *)__pyx_v_result);
  __Pyx_DECREF((PyObject *)__pyx_v_itera);
  __Pyx_DECREF((PyObject *)__pyx_v_iteridx);
  __Pyx_DECREF(__pyx_v_idx);
  __Pyx_DECREF((PyObject *)__pyx_v_index);
  __Pyx_DECREF(__pyx_v_ao);
  __Pyx_DECREF(__pyx_v_bo);
  __Pyx_DECREF(__pyx_v_aMap);
  __Pyx_DECREF(__pyx_v_bMap);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "H:\workspace\pandas\pandas\lib\src\operators.pyx":61
 *     return result
 * 
 * def combineFunc(object name, ndarray index, object ao,             # <<<<<<<<<<<<<<
 *                 object bo, dict aMap, dict bMap):
 *     '''
 */

static PyObject *__pyx_pf_7tseries_combineFunc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7tseries_combineFunc[] = "\n    Combine two series (values and index maps for each passed in) using the\n    indicated function.\n    ";
static PyObject *__pyx_pf_7tseries_combineFunc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyArrayObject *__pyx_v_index = 0;
  PyObject *__pyx_v_ao = 0;
  PyObject *__pyx_v_bo = 0;
  PyObject *__pyx_v_aMap = 0;
  PyObject *__pyx_v_bMap = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,&__pyx_n_s__index,&__pyx_n_s__ao,&__pyx_n_s__bo,&__pyx_n_s__aMap,&__pyx_n_s__bMap,0};
  __Pyx_RefNannySetupContext("combineFunc");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[6] = {0,0,0,0,0,0};
    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;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("combineFunc", 1, 6, 6, 1); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ao);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("combineFunc", 1, 6, 6, 2); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bo);
      if (likely(values[3])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("combineFunc", 1, 6, 6, 3); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  4:
      values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__aMap);
      if (likely(values[4])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("combineFunc", 1, 6, 6, 4); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  5:
      values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bMap);
      if (likely(values[5])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("combineFunc", 1, 6, 6, 5); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 61; __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), "combineFunc") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_name = values[0];
    __pyx_v_index = ((PyArrayObject *)values[1]);
    __pyx_v_ao = values[2];
    __pyx_v_bo = values[3];
    __pyx_v_aMap = ((PyObject *)values[4]);
    __pyx_v_bMap = ((PyObject *)values[5]);
  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_name = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_index = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1));
    __pyx_v_ao = PyTuple_GET_ITEM(__pyx_args, 2);
    __pyx_v_bo = PyTuple_GET_ITEM(__pyx_args, 3);
    __pyx_v_aMap = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 4));
    __pyx_v_bMap = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 5));
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("combineFunc", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("tseries.combineFunc");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_INCREF((PyObject *)__pyx_v_index);
  __Pyx_INCREF(__pyx_v_ao);
  __Pyx_INCREF(__pyx_v_bo);
  __Pyx_INCREF(__pyx_v_aMap);
  __Pyx_INCREF(__pyx_v_bMap);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_aMap), &PyDict_Type, 1, "aMap", 1))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bMap), &PyDict_Type, 1, "bMap", 1))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":67
 *     indicated function.
 *     '''
 *     if name == "__add__":             # <<<<<<<<<<<<<<
 *         return _applyFunc(__add, index, ao, bo, aMap, bMap)
 *     elif name == "__sub__":
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_name, ((PyObject *)__pyx_n_s____add__), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":68
 *     '''
 *     if name == "__add__":
 *         return _applyFunc(__add, index, ao, bo, aMap, bMap)             # <<<<<<<<<<<<<<
 *     elif name == "__sub__":
 *         return _applyFunc(__sub, index, ao, bo, aMap, bMap)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___add, __pyx_v_index, __pyx_v_ao, __pyx_v_bo, __pyx_v_aMap, __pyx_v_bMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 68; __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;
  }

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":69
 *     if name == "__add__":
 *         return _applyFunc(__add, index, ao, bo, aMap, bMap)
 *     elif name == "__sub__":             # <<<<<<<<<<<<<<
 *         return _applyFunc(__sub, index, ao, bo, aMap, bMap)
 *     elif name == "__div__":
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_name, ((PyObject *)__pyx_n_s____sub__), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":70
 *         return _applyFunc(__add, index, ao, bo, aMap, bMap)
 *     elif name == "__sub__":
 *         return _applyFunc(__sub, index, ao, bo, aMap, bMap)             # <<<<<<<<<<<<<<
 *     elif name == "__div__":
 *         return _applyFunc(__div, index, ao, bo, aMap, bMap)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___sub, __pyx_v_index, __pyx_v_ao, __pyx_v_bo, __pyx_v_aMap, __pyx_v_bMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __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_L6;
  }

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":71
 *     elif name == "__sub__":
 *         return _applyFunc(__sub, index, ao, bo, aMap, bMap)
 *     elif name == "__div__":             # <<<<<<<<<<<<<<
 *         return _applyFunc(__div, index, ao, bo, aMap, bMap)
 *     elif name == "__mul__":
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_name, ((PyObject *)__pyx_n_s____div__), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":72
 *         return _applyFunc(__sub, index, ao, bo, aMap, bMap)
 *     elif name == "__div__":
 *         return _applyFunc(__div, index, ao, bo, aMap, bMap)             # <<<<<<<<<<<<<<
 *     elif name == "__mul__":
 *         return _applyFunc(__mul, index, ao, bo, aMap, bMap)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___div, __pyx_v_index, __pyx_v_ao, __pyx_v_bo, __pyx_v_aMap, __pyx_v_bMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 72; __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;
  }

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":73
 *     elif name == "__div__":
 *         return _applyFunc(__div, index, ao, bo, aMap, bMap)
 *     elif name == "__mul__":             # <<<<<<<<<<<<<<
 *         return _applyFunc(__mul, index, ao, bo, aMap, bMap)
 *     elif name == "__eq__":
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_name, ((PyObject *)__pyx_n_s____mul__), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":74
 *         return _applyFunc(__div, index, ao, bo, aMap, bMap)
 *     elif name == "__mul__":
 *         return _applyFunc(__mul, index, ao, bo, aMap, bMap)             # <<<<<<<<<<<<<<
 *     elif name == "__eq__":
 *         return _applyFunc(__eq, index, ao, bo, aMap, bMap)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___mul, __pyx_v_index, __pyx_v_ao, __pyx_v_bo, __pyx_v_aMap, __pyx_v_bMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 74; __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;
  }

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":75
 *     elif name == "__mul__":
 *         return _applyFunc(__mul, index, ao, bo, aMap, bMap)
 *     elif name == "__eq__":             # <<<<<<<<<<<<<<
 *         return _applyFunc(__eq, index, ao, bo, aMap, bMap)
 *     elif name == "__ne__":
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_name, ((PyObject *)__pyx_n_s____eq__), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":76
 *         return _applyFunc(__mul, index, ao, bo, aMap, bMap)
 *     elif name == "__eq__":
 *         return _applyFunc(__eq, index, ao, bo, aMap, bMap)             # <<<<<<<<<<<<<<
 *     elif name == "__ne__":
 *         return _applyFunc(__ne, index, ao, bo, aMap, bMap)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___eq, __pyx_v_index, __pyx_v_ao, __pyx_v_bo, __pyx_v_aMap, __pyx_v_bMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 76; __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;
  }

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":77
 *     elif name == "__eq__":
 *         return _applyFunc(__eq, index, ao, bo, aMap, bMap)
 *     elif name == "__ne__":             # <<<<<<<<<<<<<<
 *         return _applyFunc(__ne, index, ao, bo, aMap, bMap)
 *     elif name == "__lt__":
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_name, ((PyObject *)__pyx_n_s____ne__), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":78
 *         return _applyFunc(__eq, index, ao, bo, aMap, bMap)
 *     elif name == "__ne__":
 *         return _applyFunc(__ne, index, ao, bo, aMap, bMap)             # <<<<<<<<<<<<<<
 *     elif name == "__lt__":
 *         return _applyFunc(__lt, index, ao, bo, aMap, bMap)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___ne, __pyx_v_index, __pyx_v_ao, __pyx_v_bo, __pyx_v_aMap, __pyx_v_bMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 78; __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;
  }

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":79
 *     elif name == "__ne__":
 *         return _applyFunc(__ne, index, ao, bo, aMap, bMap)
 *     elif name == "__lt__":             # <<<<<<<<<<<<<<
 *         return _applyFunc(__lt, index, ao, bo, aMap, bMap)
 *     elif name == "__gt__":
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_name, ((PyObject *)__pyx_n_s____lt__), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":80
 *         return _applyFunc(__ne, index, ao, bo, aMap, bMap)
 *     elif name == "__lt__":
 *         return _applyFunc(__lt, index, ao, bo, aMap, bMap)             # <<<<<<<<<<<<<<
 *     elif name == "__gt__":
 *         return _applyFunc(__gt, index, ao, bo, aMap, bMap)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___lt, __pyx_v_index, __pyx_v_ao, __pyx_v_bo, __pyx_v_aMap, __pyx_v_bMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 80; __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;
  }

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":81
 *     elif name == "__lt__":
 *         return _applyFunc(__lt, index, ao, bo, aMap, bMap)
 *     elif name == "__gt__":             # <<<<<<<<<<<<<<
 *         return _applyFunc(__gt, index, ao, bo, aMap, bMap)
 *     elif name == "__pow__":
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_name, ((PyObject *)__pyx_n_s____gt__), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":82
 *         return _applyFunc(__lt, index, ao, bo, aMap, bMap)
 *     elif name == "__gt__":
 *         return _applyFunc(__gt, index, ao, bo, aMap, bMap)             # <<<<<<<<<<<<<<
 *     elif name == "__pow__":
 *         return _applyFunc(__pow, index, ao, bo, aMap, bMap)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___gt, __pyx_v_index, __pyx_v_ao, __pyx_v_bo, __pyx_v_aMap, __pyx_v_bMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 82; __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;
  }

  /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":83
 *     elif name == "__gt__":
 *         return _applyFunc(__gt, index, ao, bo, aMap, bMap)
 *     elif name == "__pow__":             # <<<<<<<<<<<<<<
 *         return _applyFunc(__pow, index, ao, bo, aMap, bMap)
 *     else:
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_name, ((PyObject *)__pyx_n_s____pow__), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":84
 *         return _applyFunc(__gt, index, ao, bo, aMap, bMap)
 *     elif name == "__pow__":
 *         return _applyFunc(__pow, index, ao, bo, aMap, bMap)             # <<<<<<<<<<<<<<
 *     else:
 *         raise Exception('bad funcname requested of Cython code')
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___pow, __pyx_v_index, __pyx_v_ao, __pyx_v_bo, __pyx_v_aMap, __pyx_v_bMap)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 84; __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;
  }
  /*else*/ {

    /* "H:\workspace\pandas\pandas\lib\src\operators.pyx":86
 *         return _applyFunc(__pow, index, ao, bo, aMap, bMap)
 *     else:
 *         raise Exception('bad funcname requested of Cython code')             # <<<<<<<<<<<<<<
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_5));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
    __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L6:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("tseries.combineFunc");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_name);
  __Pyx_DECREF((PyObject *)__pyx_v_index);
  __Pyx_DECREF(__pyx_v_ao);
  __Pyx_DECREF(__pyx_v_bo);
  __Pyx_DECREF(__pyx_v_aMap);
  __Pyx_DECREF(__pyx_v_bMap);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":187
 *         # 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 int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static 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;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  char *__pyx_t_9;
  __Pyx_RefNannySetupContext("__getbuffer__");
  if (__pyx_v_info == NULL) return 0;
  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_info->obj);
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":193
 *             # of flags
 *             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;

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":194
 *             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);

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":196
 *             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));

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":198
 *             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) {

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":199
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 copy_shape = 1             # <<<<<<<<<<<<<<
 *             else:
 *                 copy_shape = 0
 */
    __pyx_v_copy_shape = 1;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":201
 *                 copy_shape = 1
 *             else:
 *                 copy_shape = 0             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 */
    __pyx_v_copy_shape = 0;
  }
  __pyx_L5:;

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":203
 *                 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) {

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":204
 * 
 *             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) {

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":205
 *             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 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_6));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6));
    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":207
 *                 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) {

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":208
 * 
 *             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) {

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":209
 *             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_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_7));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_7));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7));
    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[7]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":211
 *                 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));

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":212
 * 
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim             # <<<<<<<<<<<<<<
 *             if copy_shape:
 *                 # Allocate new buffer for strides and shape info. This is allocated
 */
  __pyx_v_info->ndim = __pyx_v_ndim;

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":213
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim
 *             if copy_shape:             # <<<<<<<<<<<<<<
 *                 # Allocate new buffer for strides and shape info. This is allocated
 *                 # as one block, strides first.
 */
  __pyx_t_6 = __pyx_v_copy_shape;
  if (__pyx_t_6) {

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":216
 *                 # 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) * ndim * 2)             # <<<<<<<<<<<<<<
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 */
    __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2)));

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":217
 *                 # as one block, strides first.
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_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);

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":218
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_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_6 = __pyx_v_ndim;
    for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
      __pyx_v_i = __pyx_t_7;

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":219
 *                 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]);

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":220
 *                 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_L8;
  }
  /*else*/ {

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":222
 *                     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)));

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":223
 *             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_L8:;

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":224
 *                 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;

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":225
 *                 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));

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":226
 *             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)));

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":229
 * 
 *             cdef int t
 *             cdef char* f = NULL             # <<<<<<<<<<<<<<
 *             cdef dtype descr = self.descr
 *             cdef list stack
 */
  __pyx_v_f = NULL;

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":230
 *             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;

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":234
 *             cdef int offset
 * 
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields and not copy_shape:
 */
  __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":236
 *             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) {

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":238
 *             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_L11;
  }
  /*else*/ {

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":241
 *             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_L11:;

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":243
 *                 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) {

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":244
 * 
 *             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;

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":245
 *             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) {

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":246
 *                 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_8 = __pyx_t_3;
      } else {
        __pyx_t_8 = __pyx_t_1;
      }
      __pyx_t_1 = __pyx_t_8;
    } else {
      __pyx_t_1 = __pyx_t_2;
    }
    if (__pyx_t_1) {

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":247
 *                 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 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(((PyObject *)__pyx_kp_u_8));
      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_8));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8));
      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L13;
    }
    __pyx_L13:;

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":248
 *                     (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_L14;
    }

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":249
 *                     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_L14;
    }

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":250
 *                 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_L14;
    }

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":251
 *                 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_L14;
    }

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":252
 *                 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_L14;
    }

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":253
 *                 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_L14;
    }

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":254
 *                 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_L14;
    }

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":255
 *                 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_L14;
    }

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":256
 *                 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_L14;
    }

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":257
 *                 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_L14;
    }

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":258
 *                 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_L14;
    }

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":259
 *                 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_L14;
    }

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":260
 *                 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_L14;
    }

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":261
 *                 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_L14;
    }

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":262
 *                 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_L14;
    }

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":263
 *                 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_L14;
    }

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":264
 *                 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_L14;
    }
    /*else*/ {

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":266
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *                 info.format = f
 *                 return
 */
      __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L14:;

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":267
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f             # <<<<<<<<<<<<<<
 *                 return
 *             else:
 */
    __pyx_v_info->format = __pyx_v_f;

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":268
 *                     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_L12;
  }
  /*else*/ {

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":270
 *                 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));

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":271
 *             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]) = '^';

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":272
 *                 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;

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":275
 *                 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[7]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_f = __pyx_t_9;

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":276
 *                                       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_L12:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__");
  __pyx_r = -1;
  __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->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_DECREF((PyObject *)__pyx_v_self);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":278
 *                 f[0] = 0 # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 */

static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__releasebuffer__");
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":279
 * 
 *         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) {

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":280
 *         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:;

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":281
 *             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) {

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":282
 *                 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_DECREF((PyObject *)__pyx_v_self);
  __Pyx_RefNannyFinishContext();
}

/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":755
 * 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;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1");

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":756
 * 
 * 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[7]; __pyx_lineno = 756; __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_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":758
 *     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;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2");

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":759
 * 
 * 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[7]; __pyx_lineno = 759; __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_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":761
 *     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;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3");

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":762
 * 
 * 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[7]; __pyx_lineno = 762; __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_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":764
 *     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;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4");

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":765
 * 
 * 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[7]; __pyx_lineno = 765; __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_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":767
 *     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;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5");

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":768
 * 
 * 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[7]; __pyx_lineno = 768; __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_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":770
 *     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;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  PyObject *__pyx_v_fields;
  PyObject *__pyx_v_childname;
  PyObject *__pyx_v_new_offset;
  PyObject *__pyx_v_t;
  char *__pyx_r;
  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;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  char *__pyx_t_10;
  __Pyx_RefNannySetupContext("_util_dtypestring");
  __Pyx_INCREF((PyObject *)__pyx_v_descr);
  __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_t = Py_None; __Pyx_INCREF(Py_None);

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":777
 *     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;

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":778
 *     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);

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":781
 *     cdef tuple fields
 * 
 *     for childname in descr.names:             # <<<<<<<<<<<<<<
 *         fields = descr.fields[childname]
 *         child, new_offset = fields
 */
  if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) {
    __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2);
  } else {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    __Pyx_DECREF(__pyx_v_childname);
    __pyx_v_childname = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":782
 * 
 *     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[7]; __pyx_lineno = 782; __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[7]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_fields));
    __pyx_v_fields = ((PyObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":783
 *     for childname in descr.names:
 *         fields = descr.fields[childname]
 *         child, new_offset = fields             # <<<<<<<<<<<<<<
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 */
    if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) {
      PyObject* tuple = ((PyObject *)__pyx_v_fields);
      __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3);
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4);
      __Pyx_DECREF(((PyObject *)__pyx_v_child));
      __pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_v_new_offset);
      __pyx_v_new_offset = __pyx_t_4;
      __pyx_t_4 = 0;
    } else {
      __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2);
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":785
 *         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[7]; __pyx_lineno = 785; __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[7]; __pyx_lineno = 785; __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[7]; __pyx_lineno = 785; __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[7]; __pyx_lineno = 785; __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[7]; __pyx_lineno = 785; __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[7]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_6) {

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":786
 * 
 *         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 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(((PyObject *)__pyx_kp_u_10));
      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_10));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_10));
      __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":788
 *             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) {

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":789
 * 
 *         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) {

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":790
 *         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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(((PyObject *)__pyx_kp_u_8));
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_8));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8));
      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[7]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":800
 * 
 *         # 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[7]; __pyx_lineno = 800; __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[7]; __pyx_lineno = 800; __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[7]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_6) break;

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":801
 *         # Output padding bytes
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
 *             f += 1
 *             offset[0] += 1
 */
      (__pyx_v_f[0]) = 120;

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":802
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte
 *             f += 1             # <<<<<<<<<<<<<<
 *             offset[0] += 1
 * 
 */
      __pyx_v_f += 1;

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":803
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 *             offset[0] += 1             # <<<<<<<<<<<<<<
 * 
 *         offset[0] += child.itemsize
 */
      (__pyx_v_offset[0]) += 1;
    }

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":805
 *             offset[0] += 1
 * 
 *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not PyDataType_HASFIELDS(child):
 */
    (__pyx_v_offset[0]) += __pyx_v_child->elsize;

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":807
 *         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) {

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":808
 * 
 *         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[7]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_t);
      __pyx_v_t = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":809
 *         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) {

        /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":810
 *             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 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(((PyObject *)__pyx_kp_u_11));
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_11));
        __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11));
        __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_t_5, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        {__pyx_filename = __pyx_f[7]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L10;
      }
      __pyx_L10:;

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":813
 * 
 *             # 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_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 813; __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[7]; __pyx_lineno = 813; __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[7]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 98;
        goto __pyx_L11;
      }

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":814
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 814; __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[7]; __pyx_lineno = 814; __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[7]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 66;
        goto __pyx_L11;
      }

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":815
 *             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_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 815; __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[7]; __pyx_lineno = 815; __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[7]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 104;
        goto __pyx_L11;
      }

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":816
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 816; __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[7]; __pyx_lineno = 816; __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[7]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 72;
        goto __pyx_L11;
      }

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":817
 *             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_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 817; __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[7]; __pyx_lineno = 817; __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[7]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 105;
        goto __pyx_L11;
      }

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":818
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 818; __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[7]; __pyx_lineno = 818; __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[7]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 73;
        goto __pyx_L11;
      }

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":819
 *             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_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 819; __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[7]; __pyx_lineno = 819; __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[7]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 108;
        goto __pyx_L11;
      }

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":820
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 820; __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[7]; __pyx_lineno = 820; __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[7]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 76;
        goto __pyx_L11;
      }

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":821
 *             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_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 821; __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[7]; __pyx_lineno = 821; __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[7]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 113;
        goto __pyx_L11;
      }

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":822
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 822; __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[7]; __pyx_lineno = 822; __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[7]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 81;
        goto __pyx_L11;
      }

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":823
 *             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_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 823; __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[7]; __pyx_lineno = 823; __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[7]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 102;
        goto __pyx_L11;
      }

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":824
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 */
      __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 824; __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[7]; __pyx_lineno = 824; __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[7]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 100;
        goto __pyx_L11;
      }

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":825
 *             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_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 825; __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[7]; __pyx_lineno = 825; __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[7]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 103;
        goto __pyx_L11;
      }

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":826
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 */
      __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 826; __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[7]; __pyx_lineno = 826; __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[7]; __pyx_lineno = 826; __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]) = 102;
        __pyx_v_f += 1;
        goto __pyx_L11;
      }

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":827
 *             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_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 827; __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[7]; __pyx_lineno = 827; __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[7]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 100;
        __pyx_v_f += 1;
        goto __pyx_L11;
      }

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":828
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 */
      __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 828; __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[7]; __pyx_lineno = 828; __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[7]; __pyx_lineno = 828; __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]) = 103;
        __pyx_v_f += 1;
        goto __pyx_L11;
      }

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":829
 *             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_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 829; __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[7]; __pyx_lineno = 829; __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[7]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 79;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":831
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *             f += 1
 *         else:
 */
        __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_Raise(__pyx_t_3, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[7]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L11:;

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":832
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *             f += 1             # <<<<<<<<<<<<<<
 *         else:
 *             # Cython ignores struct boundary information ("T{...}"),
 */
      __pyx_v_f += 1;
      goto __pyx_L9;
    }
    /*else*/ {

      /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":836
 *             # Cython ignores struct boundary information ("T{...}"),
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
 *     return f
 * 
 */
      __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_f = __pyx_t_10;
    }
    __pyx_L9:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":837
 *             # 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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("numpy._util_dtypestring");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_child);
  __Pyx_DECREF(__pyx_v_fields);
  __Pyx_DECREF(__pyx_v_childname);
  __Pyx_DECREF(__pyx_v_new_offset);
  __Pyx_DECREF(__pyx_v_t);
  __Pyx_DECREF((PyObject *)__pyx_v_descr);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":952
 * 
 * 
 * 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;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("set_array_base");
  __Pyx_INCREF((PyObject *)__pyx_v_arr);
  __Pyx_INCREF(__pyx_v_base);

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":954
 * 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) {

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":955
 *      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*/ {

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":957
 *          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);

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":958
 *      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:;

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":959
 *          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);

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":960
 *          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_DECREF((PyObject *)__pyx_v_arr);
  __Pyx_DECREF(__pyx_v_base);
  __Pyx_RefNannyFinishContext();
}

/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":962
 *      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;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("get_array_base");
  __Pyx_INCREF((PyObject *)__pyx_v_arr);

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":963
 * 
 * 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) {

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":964
 * 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*/ {

    /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\numpy.pxd":966
 *         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_DECREF((PyObject *)__pyx_v_arr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_tp_new_7tseries_Node(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7tseries_Node *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_7tseries_Node *)o);
  p->next = ((PyObject *)Py_None); Py_INCREF(Py_None);
  p->width_arr = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_7tseries_Node(PyObject *o) {
  struct __pyx_obj_7tseries_Node *p = (struct __pyx_obj_7tseries_Node *)o;
  Py_XDECREF(((PyObject *)p->next));
  Py_XDECREF(((PyObject *)p->width_arr));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7tseries_Node(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7tseries_Node *p = (struct __pyx_obj_7tseries_Node *)o;
  if (p->next) {
    e = (*v)(p->next, a); if (e) return e;
  }
  if (p->width_arr) {
    e = (*v)(((PyObject*)p->width_arr), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7tseries_Node(PyObject *o) {
  struct __pyx_obj_7tseries_Node *p = (struct __pyx_obj_7tseries_Node *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->next);
  p->next = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->width_arr);
  p->width_arr = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_7tseries_4Node_next(PyObject *o, void *x) {
  return __pyx_pf_7tseries_4Node_4next___get__(o);
}

static int __pyx_setprop_7tseries_4Node_next(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_7tseries_4Node_4next___set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_7tseries_4Node_width_arr(PyObject *o, void *x) {
  return __pyx_pf_7tseries_4Node_9width_arr___get__(o);
}

static int __pyx_setprop_7tseries_4Node_width_arr(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_7tseries_4Node_9width_arr___set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static struct PyMethodDef __pyx_methods_7tseries_Node[] = {
  {0, 0, 0, 0}
};

static struct PyMemberDef __pyx_members_7tseries_Node[] = {
  {(char *)"value", T_DOUBLE, offsetof(struct __pyx_obj_7tseries_Node, value), 0, 0},
  {0, 0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7tseries_Node[] = {
  {(char *)"next", __pyx_getprop_7tseries_4Node_next, __pyx_setprop_7tseries_4Node_next, 0, 0},
  {(char *)"width_arr", __pyx_getprop_7tseries_4Node_width_arr, __pyx_setprop_7tseries_4Node_width_arr, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Node = {
  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, /*reserved*/
  #else
  0, /*nb_long*/
  #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Node = {
  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_Node = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Node = {
  #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
};

PyTypeObject __pyx_type_7tseries_Node = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("tseries.Node"), /*tp_name*/
  sizeof(struct __pyx_obj_7tseries_Node), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7tseries_Node, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_Node, /*tp_as_number*/
  &__pyx_tp_as_sequence_Node, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Node, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Node, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7tseries_Node, /*tp_traverse*/
  __pyx_tp_clear_7tseries_Node, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7tseries_Node, /*tp_methods*/
  __pyx_members_7tseries_Node, /*tp_members*/
  __pyx_getsets_7tseries_Node, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_7tseries_4Node___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7tseries_Node, /*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 PyObject *__pyx_tp_new_7tseries_IndexableSkiplist(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7tseries_IndexableSkiplist *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_7tseries_IndexableSkiplist *)o);
  p->head = ((struct __pyx_obj_7tseries_Node *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_7tseries_IndexableSkiplist(PyObject *o) {
  struct __pyx_obj_7tseries_IndexableSkiplist *p = (struct __pyx_obj_7tseries_IndexableSkiplist *)o;
  Py_XDECREF(((PyObject *)p->head));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7tseries_IndexableSkiplist(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7tseries_IndexableSkiplist *p = (struct __pyx_obj_7tseries_IndexableSkiplist *)o;
  if (p->head) {
    e = (*v)(((PyObject*)p->head), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7tseries_IndexableSkiplist(PyObject *o) {
  struct __pyx_obj_7tseries_IndexableSkiplist *p = (struct __pyx_obj_7tseries_IndexableSkiplist *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->head);
  p->head = ((struct __pyx_obj_7tseries_Node *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_7tseries_IndexableSkiplist(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static struct PyMethodDef __pyx_methods_7tseries_IndexableSkiplist[] = {
  {__Pyx_NAMESTR("__getitem__"), (PyCFunction)__pyx_pf_7tseries_17IndexableSkiplist___getitem__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_7tseries_17IndexableSkiplist_get, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pf_7tseries_17IndexableSkiplist_insert, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("remove"), (PyCFunction)__pyx_pf_7tseries_17IndexableSkiplist_remove, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_IndexableSkiplist = {
  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, /*reserved*/
  #else
  0, /*nb_long*/
  #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_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_IndexableSkiplist = {
  __pyx_pf_7tseries_17IndexableSkiplist___len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_7tseries_IndexableSkiplist, /*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_IndexableSkiplist = {
  __pyx_pf_7tseries_17IndexableSkiplist___len__, /*mp_length*/
  __pyx_pf_7tseries_17IndexableSkiplist___getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_IndexableSkiplist = {
  #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
};

PyTypeObject __pyx_type_7tseries_IndexableSkiplist = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("tseries.IndexableSkiplist"), /*tp_name*/
  sizeof(struct __pyx_obj_7tseries_IndexableSkiplist), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7tseries_IndexableSkiplist, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_IndexableSkiplist, /*tp_as_number*/
  &__pyx_tp_as_sequence_IndexableSkiplist, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_IndexableSkiplist, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_IndexableSkiplist, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("\n    Sorted collection supporting O(lg n) insertion, removal, and lookup by rank.\n    "), /*tp_doc*/
  __pyx_tp_traverse_7tseries_IndexableSkiplist, /*tp_traverse*/
  __pyx_tp_clear_7tseries_IndexableSkiplist, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7tseries_IndexableSkiplist, /*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_7tseries_17IndexableSkiplist___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7tseries_IndexableSkiplist, /*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 PyMethodDef __pyx_methods[] = {
  {__Pyx_NAMESTR("map_indices"), (PyCFunction)__pyx_pf_7tseries_map_indices, METH_O, __Pyx_DOCSTR(__pyx_doc_7tseries_map_indices)},
  {__Pyx_NAMESTR("isAllDates"), (PyCFunction)__pyx_pf_7tseries_isAllDates, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("isAllDates2"), (PyCFunction)__pyx_pf_7tseries_isAllDates2, METH_O, __Pyx_DOCSTR(__pyx_doc_7tseries_isAllDates2)},
  {__Pyx_NAMESTR("isnull"), (PyCFunction)__pyx_pf_7tseries_isnull, METH_O, __Pyx_DOCSTR(__pyx_doc_7tseries_isnull)},
  {__Pyx_NAMESTR("notnull"), (PyCFunction)__pyx_pf_7tseries_notnull, METH_O, __Pyx_DOCSTR(__pyx_doc_7tseries_notnull)},
  {__Pyx_NAMESTR("arrmap"), (PyCFunction)__pyx_pf_7tseries_arrmap, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("groupby"), (PyCFunction)__pyx_pf_7tseries_groupby, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("groupby_indices"), (PyCFunction)__pyx_pf_7tseries_groupby_indices, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("median"), (PyCFunction)__pyx_pf_7tseries_median, METH_O, __Pyx_DOCSTR(__pyx_doc_7tseries_median)},
  {__Pyx_NAMESTR("_roll_sum"), (PyCFunction)__pyx_pf_7tseries__roll_sum, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("_roll_mean"), (PyCFunction)__pyx_pf_7tseries__roll_mean, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("_ewma"), (PyCFunction)__pyx_pf_7tseries__ewma, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("_roll_var"), (PyCFunction)__pyx_pf_7tseries__roll_var, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("_roll_skew"), (PyCFunction)__pyx_pf_7tseries__roll_skew, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("_roll_kurt"), (PyCFunction)__pyx_pf_7tseries__roll_kurt, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("_roll_median"), (PyCFunction)__pyx_pf_7tseries__roll_median, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("_roll_max"), (PyCFunction)__pyx_pf_7tseries__roll_max, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("_roll_min"), (PyCFunction)__pyx_pf_7tseries__roll_min, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("rolling_sum"), (PyCFunction)__pyx_pf_7tseries_rolling_sum, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7tseries_rolling_sum)},
  {__Pyx_NAMESTR("rolling_mean"), (PyCFunction)__pyx_pf_7tseries_rolling_mean, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("rolling_median"), (PyCFunction)__pyx_pf_7tseries_rolling_median, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("rolling_var"), (PyCFunction)__pyx_pf_7tseries_rolling_var, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("rolling_std"), (PyCFunction)__pyx_pf_7tseries_rolling_std, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("rolling_skew"), (PyCFunction)__pyx_pf_7tseries_rolling_skew, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("rolling_kurt"), (PyCFunction)__pyx_pf_7tseries_rolling_kurt, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("ewma"), (PyCFunction)__pyx_pf_7tseries_ewma, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("getFillVec"), (PyCFunction)__pyx_pf_7tseries_getFillVec, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("getMergeVec"), (PyCFunction)__pyx_pf_7tseries_getMergeVec, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("combineFunc"), (PyCFunction)__pyx_pf_7tseries_combineFunc, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7tseries_combineFunc)},
  {0, 0, 0, 0}
};

static void __pyx_init_filenames(void); /*proto*/

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("tseries"),
    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_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
  {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0},
  {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0},
  {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
  {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
  {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
  {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
  {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0},
  {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0},
  {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0},
  {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0},
  {&__pyx_n_s__BACKFILL, __pyx_k__BACKFILL, sizeof(__pyx_k__BACKFILL), 0, 0, 1, 1},
  {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
  {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1},
  {&__pyx_n_s__NIL, __pyx_k__NIL, sizeof(__pyx_k__NIL), 0, 0, 1, 1},
  {&__pyx_n_s__NaN, __pyx_k__NaN, sizeof(__pyx_k__NaN), 0, 0, 1, 1},
  {&__pyx_n_s__O, __pyx_k__O, sizeof(__pyx_k__O), 0, 0, 1, 1},
  {&__pyx_n_s__PAD, __pyx_k__PAD, sizeof(__pyx_k__PAD), 0, 0, 1, 1},
  {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s__S, __pyx_k__S, sizeof(__pyx_k__S), 0, 0, 1, 1},
  {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
  {&__pyx_n_s____add__, __pyx_k____add__, sizeof(__pyx_k____add__), 0, 0, 1, 1},
  {&__pyx_n_s____div__, __pyx_k____div__, sizeof(__pyx_k____div__), 0, 0, 1, 1},
  {&__pyx_n_s____eq__, __pyx_k____eq__, sizeof(__pyx_k____eq__), 0, 0, 1, 1},
  {&__pyx_n_s____gt__, __pyx_k____gt__, sizeof(__pyx_k____gt__), 0, 0, 1, 1},
  {&__pyx_n_s____lt__, __pyx_k____lt__, sizeof(__pyx_k____lt__), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____mul__, __pyx_k____mul__, sizeof(__pyx_k____mul__), 0, 0, 1, 1},
  {&__pyx_n_s____ne__, __pyx_k____ne__, sizeof(__pyx_k____ne__), 0, 0, 1, 1},
  {&__pyx_n_s____pow__, __pyx_k____pow__, sizeof(__pyx_k____pow__), 0, 0, 1, 1},
  {&__pyx_n_s____sub__, __pyx_k____sub__, sizeof(__pyx_k____sub__), 0, 0, 1, 1},
  {&__pyx_n_s___ewma, __pyx_k___ewma, sizeof(__pyx_k___ewma), 0, 0, 1, 1},
  {&__pyx_n_s___roll_kurt, __pyx_k___roll_kurt, sizeof(__pyx_k___roll_kurt), 0, 0, 1, 1},
  {&__pyx_n_s___roll_mean, __pyx_k___roll_mean, sizeof(__pyx_k___roll_mean), 0, 0, 1, 1},
  {&__pyx_n_s___roll_median, __pyx_k___roll_median, sizeof(__pyx_k___roll_median), 0, 0, 1, 1},
  {&__pyx_n_s___roll_skew, __pyx_k___roll_skew, sizeof(__pyx_k___roll_skew), 0, 0, 1, 1},
  {&__pyx_n_s___roll_sum, __pyx_k___roll_sum, sizeof(__pyx_k___roll_sum), 0, 0, 1, 1},
  {&__pyx_n_s___roll_var, __pyx_k___roll_var, sizeof(__pyx_k___roll_var), 0, 0, 1, 1},
  {&__pyx_n_s__aMap, __pyx_k__aMap, sizeof(__pyx_k__aMap), 0, 0, 1, 1},
  {&__pyx_n_s__any, __pyx_k__any, sizeof(__pyx_k__any), 0, 0, 1, 1},
  {&__pyx_n_s__ao, __pyx_k__ao, sizeof(__pyx_k__ao), 0, 0, 1, 1},
  {&__pyx_n_s__array, __pyx_k__array, sizeof(__pyx_k__array), 0, 0, 1, 1},
  {&__pyx_n_s__arrmap, __pyx_k__arrmap, sizeof(__pyx_k__arrmap), 0, 0, 1, 1},
  {&__pyx_n_s__asarray, __pyx_k__asarray, sizeof(__pyx_k__asarray), 0, 0, 1, 1},
  {&__pyx_n_s__astype, __pyx_k__astype, sizeof(__pyx_k__astype), 0, 0, 1, 1},
  {&__pyx_n_s__bMap, __pyx_k__bMap, sizeof(__pyx_k__bMap), 0, 0, 1, 1},
  {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1},
  {&__pyx_n_s__bo, __pyx_k__bo, sizeof(__pyx_k__bo), 0, 0, 1, 1},
  {&__pyx_n_s__bool, __pyx_k__bool, sizeof(__pyx_k__bool), 0, 0, 1, 1},
  {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1},
  {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1},
  {&__pyx_n_s__com, __pyx_k__com, sizeof(__pyx_k__com), 0, 0, 1, 1},
  {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1},
  {&__pyx_n_s__datetime, __pyx_k__datetime, sizeof(__pyx_k__datetime), 0, 0, 1, 1},
  {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 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__expected_size, __pyx_k__expected_size, sizeof(__pyx_k__expected_size), 0, 0, 1, 1},
  {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1},
  {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1},
  {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1},
  {&__pyx_n_s__func, __pyx_k__func, sizeof(__pyx_k__func), 0, 0, 1, 1},
  {&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1},
  {&__pyx_n_s__getMergeVec, __pyx_k__getMergeVec, sizeof(__pyx_k__getMergeVec), 0, 0, 1, 1},
  {&__pyx_n_s__head, __pyx_k__head, sizeof(__pyx_k__head), 0, 0, 1, 1},
  {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1},
  {&__pyx_n_s__inf, __pyx_k__inf, sizeof(__pyx_k__inf), 0, 0, 1, 1},
  {&__pyx_n_s__input, __pyx_k__input, sizeof(__pyx_k__input), 0, 0, 1, 1},
  {&__pyx_n_s__insert, __pyx_k__insert, sizeof(__pyx_k__insert), 0, 0, 1, 1},
  {&__pyx_n_s__int32, __pyx_k__int32, sizeof(__pyx_k__int32), 0, 0, 1, 1},
  {&__pyx_n_s__int8, __pyx_k__int8, sizeof(__pyx_k__int8), 0, 0, 1, 1},
  {&__pyx_n_s__isfinite, __pyx_k__isfinite, sizeof(__pyx_k__isfinite), 0, 0, 1, 1},
  {&__pyx_n_s__isnan, __pyx_k__isnan, sizeof(__pyx_k__isnan), 0, 0, 1, 1},
  {&__pyx_n_s__isnull, __pyx_k__isnull, sizeof(__pyx_k__isnull), 0, 0, 1, 1},
  {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1},
  {&__pyx_n_s__kind, __pyx_k__kind, sizeof(__pyx_k__kind), 0, 0, 1, 1},
  {&__pyx_n_s__mapper, __pyx_k__mapper, sizeof(__pyx_k__mapper), 0, 0, 1, 1},
  {&__pyx_n_s__max, __pyx_k__max, sizeof(__pyx_k__max), 0, 0, 1, 1},
  {&__pyx_n_s__maxlevels, __pyx_k__maxlevels, sizeof(__pyx_k__maxlevels), 0, 0, 1, 1},
  {&__pyx_n_s__min, __pyx_k__min, sizeof(__pyx_k__min), 0, 0, 1, 1},
  {&__pyx_n_s__minp, __pyx_k__minp, sizeof(__pyx_k__minp), 0, 0, 1, 1},
  {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1},
  {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1},
  {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1},
  {&__pyx_n_s__newIndex, __pyx_k__newIndex, sizeof(__pyx_k__newIndex), 0, 0, 1, 1},
  {&__pyx_n_s__newMap, __pyx_k__newMap, sizeof(__pyx_k__newMap), 0, 0, 1, 1},
  {&__pyx_n_s__next, __pyx_k__next, sizeof(__pyx_k__next), 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__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1},
  {&__pyx_n_s__object_, __pyx_k__object_, sizeof(__pyx_k__object_), 0, 0, 1, 1},
  {&__pyx_n_s__oldIndex, __pyx_k__oldIndex, sizeof(__pyx_k__oldIndex), 0, 0, 1, 1},
  {&__pyx_n_s__oldMap, __pyx_k__oldMap, sizeof(__pyx_k__oldMap), 0, 0, 1, 1},
  {&__pyx_n_s__ones, __pyx_k__ones, sizeof(__pyx_k__ones), 0, 0, 1, 1},
  {&__pyx_n_s__output, __pyx_k__output, sizeof(__pyx_k__output), 0, 0, 1, 1},
  {&__pyx_n_s__pydatetime, __pyx_k__pydatetime, sizeof(__pyx_k__pydatetime), 0, 0, 1, 1},
  {&__pyx_n_s__random, __pyx_k__random, sizeof(__pyx_k__random), 0, 0, 1, 1},
  {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
  {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1},
  {&__pyx_n_s__remove, __pyx_k__remove, sizeof(__pyx_k__remove), 0, 0, 1, 1},
  {&__pyx_n_s__rolling_var, __pyx_k__rolling_var, sizeof(__pyx_k__rolling_var), 0, 0, 1, 1},
  {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1},
  {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1},
  {&__pyx_n_s__sqrt, __pyx_k__sqrt, sizeof(__pyx_k__sqrt), 0, 0, 1, 1},
  {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1},
  {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1},
  {&__pyx_n_s__type, __pyx_k__type, sizeof(__pyx_k__type), 0, 0, 1, 1},
  {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1},
  {&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1},
  {&__pyx_n_s__values, __pyx_k__values, sizeof(__pyx_k__values), 0, 0, 1, 1},
  {&__pyx_n_s__width, __pyx_k__width, sizeof(__pyx_k__width), 0, 0, 1, 1},
  {&__pyx_n_s__width_arr, __pyx_k__width_arr, sizeof(__pyx_k__width_arr), 0, 0, 1, 1},
  {&__pyx_n_s__win, __pyx_k__win, sizeof(__pyx_k__win), 0, 0, 1, 1},
  {&__pyx_n_s__window, __pyx_k__window, sizeof(__pyx_k__window), 0, 0, 1, 1},
  {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __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 = 31; __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[1]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_min = __Pyx_GetName(__pyx_b, __pyx_n_s__min); if (!__pyx_builtin_min) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_max = __Pyx_GetName(__pyx_b, __pyx_n_s__max); if (!__pyx_builtin_max) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 408; __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[7]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[8]; __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[8]; __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[8]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC inittseries(void); /*proto*/
PyMODINIT_FUNC inittseries(void)
#else
PyMODINIT_FUNC PyInit_tseries(void); /*proto*/
PyMODINIT_FUNC PyInit_tseries(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  double __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  #if CYTHON_REFNANNY
  void* __pyx_refnanny = NULL;
  __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");
  }
  __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_tseries(void)", __LINE__, __FILE__);
  #endif
  __pyx_init_filenames();
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if PY_MAJOR_VERSION < 3
  __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #else
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[8]; __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("tseries"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (!__pyx_m) {__pyx_filename = __pyx_f[8]; __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[8]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_module_is_main_tseries) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  __pyx_ptype_7tseries_datetime = __Pyx_ImportType("datetime", "datetime", sizeof(PyDateTime_DateTime), 0); if (unlikely(!__pyx_ptype_7tseries_datetime)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyType_Ready(&__pyx_type_7tseries_Node) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Node", (PyObject *)&__pyx_type_7tseries_Node) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7tseries_Node = &__pyx_type_7tseries_Node;
  if (PyType_Ready(&__pyx_type_7tseries_IndexableSkiplist) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "IndexableSkiplist", (PyObject *)&__pyx_type_7tseries_IndexableSkiplist) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7tseries_IndexableSkiplist = &__pyx_type_7tseries_IndexableSkiplist;
  /*--- 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[7]; __pyx_lineno = 148; __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[7]; __pyx_lineno = 158; __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[7]; __pyx_lineno = 162; __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[7]; __pyx_lineno = 171; __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[7]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":9
 * from python_float cimport PyFloat_Check
 * 
 * import numpy as np             # <<<<<<<<<<<<<<
 * isnan = np.isnan
 * cdef double NaN = <double> np.NaN
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __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 = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":10
 * 
 * import numpy as np
 * isnan = np.isnan             # <<<<<<<<<<<<<<
 * cdef double NaN = <double> np.NaN
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__isnan); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__isnan, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":11
 * import numpy as np
 * isnan = np.isnan
 * cdef double NaN = <double> np.NaN             # <<<<<<<<<<<<<<
 * 
 * from datetime import datetime as pydatetime
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__NaN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __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 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_7tseries_NaN = ((double)__pyx_t_3);

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":13
 * cdef double NaN = <double> np.NaN
 * 
 * from datetime import datetime as pydatetime             # <<<<<<<<<<<<<<
 * 
 * cdef inline object trycall(object func, object arg):
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__datetime));
  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__datetime));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__datetime));
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__datetime), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__datetime); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pydatetime, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":78
 * 
 * # import datetime C API
 * PyDateTime_IMPORT             # <<<<<<<<<<<<<<
 * 
 * # initialize numpy
 */
  PyDateTime_IMPORT;

  /* "H:\workspace\pandas\pandas\lib\src\common.pyx":81
 * 
 * # initialize numpy
 * import_array()             # <<<<<<<<<<<<<<
 * 
 * cpdef map_indices(ndarray index):
 */
  import_array();

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":23
 * cimport numpy as np
 * from numpy cimport *
 * import numpy as np             # <<<<<<<<<<<<<<
 * 
 * from random import random
 */
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":25
 * import numpy as np
 * 
 * from random import random             # <<<<<<<<<<<<<<
 * 
 * # initialize numpy
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__random));
  PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__random));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__random));
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__random), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__random); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__random, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":28
 * 
 * # initialize numpy
 * import_array()             # <<<<<<<<<<<<<<
 * 
 * cdef class Node:
 */
  import_array();

  /* "H:\workspace\pandas\pandas\lib\src\skiplist.pyx":46
 *         self.width = <int *> width.data
 * 
 * NIL = Node(np.inf, [], np.array([])) # Singleton terminator node             # <<<<<<<<<<<<<<
 * 
 * cdef class IndexableSkiplist:
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 46; __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[1]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__array); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7tseries_Node)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__NIL, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":2
 * 
 * cdef double INF = <double> np.inf             # <<<<<<<<<<<<<<
 * cdef double NEGINF = -INF
 * 
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__inf); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_7tseries_INF = ((double)__pyx_t_3);

  /* "H:\workspace\pandas\pandas\lib\src\isnull.pyx":3
 * 
 * cdef double INF = <double> np.inf
 * cdef double NEGINF = -INF             # <<<<<<<<<<<<<<
 * 
 * cdef inline _checknull(object val):
 */
  __pyx_v_7tseries_NEGINF = (-__pyx_v_7tseries_INF);

  /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5.egg\Cython\Includes\python_dict.pxd":1
 * from python_ref cimport PyObject             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "Python.h":
 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  if (__pyx_m) {
    __Pyx_AddTraceback("init tseries");
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init tseries");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

static const char *__pyx_filenames[] = {
  "common.pyx",
  "skiplist.pyx",
  "moments.pyx",
  "isnull.pyx",
  "groupby.pyx",
  "reindex.pyx",
  "operators.pyx",
  "numpy.pxd",
  "tseries.pyx",
};

/* Runtime support code */

static void __pyx_init_filenames(void) {
  __pyx_f = __pyx_filenames;
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *local_type, *local_value, *local_tb;
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
    if (unlikely(tstate->curexc_type))
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
        goto bad;
    #endif
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
    Py_INCREF(local_type);
    Py_INCREF(local_value);
    Py_INCREF(local_tb);
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    /* Make sure tstate is in a consistent state when we XDECREF
       these objects (XDECREF may run arbitrary code). */
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}


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;
  int new_count, enc_count;
  int is_complex;
  char enc_type;
  char 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->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) {
  char msg[] = {ch, 0};
  PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%s'", msg);
}

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_s_long_long;
#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_s_long_long) - 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 size_t __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->packmode == '@' || ctx->packmode == '^') {
      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
    } else {
      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
    }
    if (ctx->packmode == '@') {
      int align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
      int 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", ctx->fmt_offset, 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 int __Pyx_BufFmt_FirstPack(__Pyx_BufFmt_Context* ctx) {
  if (ctx->enc_type != 0 || ctx->packmode != '@') {
    PyErr_SetString(PyExc_ValueError, "Buffer packing mode currently only allowed at beginning of format string (this is a defect)");
    return -1;
  }
  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;
        }
        if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL;
        ctx->packmode = '=';
        ++ts;
        break;
      case '>':
      case '!':
        if (__Pyx_IsLittleEndian()) {
          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
          return NULL;
        }
        if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL;
        ctx->packmode = '=';
        ++ts;
        break;
      case '=':
      case '@':
      case '^':
        if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL;
        ctx->packmode = *ts++;
        break;
      case 'T': /* substruct */
        {
          int i;
          const char* ts_after_sub;
          int 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;
        ++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) {
          /* 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_type = *ts;
          ctx->is_complex = got_Z;
        }
        ++ts;
        ctx->new_count = 1;
        got_Z = 0;
        break;
      default:
        {
          ctx->new_count = __Pyx_BufFmt_ParseNumber(&ts);
          if (ctx->new_count == -1) { /* First char was not a digit */
            char msg[2] = { *ts, 0 };
            PyErr_Format(PyExc_ValueError,
                         "Does not understand character buffer dtype format string ('%s')", msg);
            return NULL;
          }
        }
      
    }
  }
}

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 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) {
    __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,
      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_RaiseBufferIndexError(int axis) {
  PyErr_Format(PyExc_IndexError,
     "Out of bounds on buffer access (axis %d)", axis);
}


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


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 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 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 *number, *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";
    }
    number = (num_expected == 1) ? "" : "s";
    PyErr_Format(PyExc_TypeError,
        #if PY_VERSION_HEX < 0x02050000
            "%s() takes %s %d positional argument%s (%d given)",
        #else
            "%s() takes %s %zd positional argument%s (%zd given)",
        #endif
        func_name, more_or_less, num_expected, number, num_found);
}

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 void __Pyx_RaiseBufferFallbackError(void) {
  PyErr_Format(PyExc_ValueError,
     "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
}


static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
    long r = a % b;
    r += ((r != 0) & ((r ^ b) < 0)) * b;
    return r;
}

static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
    long q = a / b;
    long r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
        #if PY_VERSION_HEX < 0x02050000
                 "need more than %d value%s to unpack", (int)index,
        #else
                 "need more than %zd value%s to unpack", index,
        #endif
                 (index == 1) ? "" : "s");
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) {
    PyErr_SetString(PyExc_ValueError, "too many values to unpack");
}

static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
    PyObject *item;
    if (!(item = PyIter_Next(iter))) {
        if (!PyErr_Occurred()) {
            __Pyx_RaiseNeedMoreValuesError(index);
        }
    }
    return item;
}

static int __Pyx_EndUnpack(PyObject *iter) {
    PyObject *item;
    if ((item = PyIter_Next(iter))) {
        Py_DECREF(item);
        __Pyx_RaiseTooManyValuesError();
        return -1;
    }
    else if (!PyErr_Occurred())
        return 0;
    else
        return -1;
}

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

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_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}

static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}

#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
  #if PY_VERSION_HEX >= 0x02060000
  if (Py_TYPE(obj)->tp_flags & Py_TPFLAGS_HAVE_NEWBUFFER)
      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 (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray___releasebuffer__(obj, view);
    Py_DECREF(obj);
    view->obj = NULL;
  }
}

#endif

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
    PyObject *__import__ = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    __import__ = __Pyx_GetAttrString(__pyx_b, "__import__");
    if (!__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;
    module = PyObject_CallFunctionObjArgs(__import__,
        name, global_dict, empty_dict, list, NULL);
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(__import__);
    Py_XDECREF(empty_dict);
    return module;
}

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result)
        PyErr_SetObject(PyExc_NameError, name);
    return result;
}

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    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) {
    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;
    }

    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 CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject* x) {
    const npy_int32 neg_one = (npy_int32)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    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);
#if 0
    } else if (sizeof(npy_int32) > sizeof(short) &&
               sizeof(npy_int32) < sizeof(int)) { /*  __int32 ILP64 ? */
        if (is_unsigned)
            return (npy_int32)__Pyx_PyInt_AsUnsignedInt(x);
        else
            return (npy_int32)__Pyx_PyInt_AsSignedInt(x);
#endif
    }
    PyErr_SetString(PyExc_TypeError, "npy_int32");
    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;
    }
/*
    static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) {
#if HAVE_HYPOT
        return hypotf(z.real, z.imag);
#else
        return sqrtf(z.real*z.real + z.imag*z.imag);
#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;
    }
/*
    static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) {
#if HAVE_HYPOT
        return hypot(z.real, z.imag);
#else
        return sqrt(z.real*z.real + z.imag*z.imag);
#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 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 PyLong_AsUnsignedLong(x);
        } else {
            return 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 PyLong_AsUnsignedLongLong(x);
        } else {
            return 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 PyLong_AsUnsignedLong(x);
        } else {
            return 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 PyLong_AsUnsignedLongLong(x);
        } else {
            return 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 PyLong_AsUnsignedLong(x);
        } else {
            return 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 PyLong_AsUnsignedLongLong(x);
        } else {
            return 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) {
    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);
    }
}

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    long 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 > size) {
        PyOS_snprintf(warning, sizeof(warning), 
            "%s.%s size changed, may indicate binary incompatibility",
            module_name, class_name);
        PyErr_WarnEx(NULL, warning, 0);
    }
    else if (((PyTypeObject *)result)->tp_basicsize != 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 0;
}
#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) {
    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) {
   if (x == Py_True) return 1;
   else if ((x == Py_False) | (x == Py_None)) return 0;
   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 */
