From dcf34904e628c1065e0bacf1374b381f8d61bc42 Mon Sep 17 00:00:00 2001 From: Wes McKinney Date: Mon, 27 Jun 2011 18:06:16 -0400 Subject: [PATCH] Cython code reorg and co-opted pyzmq build framework so do not have to check in cythonized .c code into git --- .gitignore | 3 + MANIFEST.in | 16 +- RELEASE.rst | 3 + {pandas/lib => bench}/bench_sparse.py | 0 pandas/lib/bench.py => bench/bench_tseries.py | 0 pandas/core/common.py | 8 +- pandas/core/frame.py | 4 +- pandas/core/functions.py | 2 +- pandas/core/groupby.py | 7 +- pandas/core/index.py | 8 +- pandas/core/panel.py | 12 +- pandas/core/series.py | 14 +- pandas/core/sparse.py | 4 +- pandas/finance/portstats.py | 2 +- pandas/io/pytables.py | 4 +- pandas/lib/__init__.py | 0 pandas/lib/rebuild.sh | 2 - pandas/lib/setup.py | 32 - pandas/lib/src/sparse.c | 21342 ---------------- pandas/lib/src/tseries.c | 20305 --------------- pandas/setup.py | 11 +- pandas/{lib => }/src/common.pyx | 0 pandas/{lib => }/src/groupby.pyx | 6 +- pandas/{lib => }/src/io.pyx | 0 pandas/{lib => }/src/isnull.pyx | 0 pandas/{lib => }/src/moments.pyx | 0 pandas/{lib => }/src/operators.pyx | 0 pandas/{lib => }/src/reindex.pyx | 93 +- pandas/{lib => }/src/skiplist.pyx | 0 pandas/{lib => }/src/sparse.pyx | 0 pandas/{lib => }/src/tseries.pyx | 0 pandas/stats/fama_macbeth.py | 1 - pandas/stats/moments.py | 22 +- pandas/{core => }/tests/test_common.py | 0 pandas/{core => }/tests/test_daterange.py | 0 pandas/{core => }/tests/test_datetools.py | 0 pandas/{core => }/tests/test_frame.py | 0 pandas/{core => }/tests/test_functions.py | 0 pandas/{core => }/tests/test_groupby.py | 2 - pandas/{core => }/tests/test_index.py | 3 +- pandas/{core => }/tests/test_internals.py | 0 pandas/{lib => }/tests/test_libsparse.py | 4 +- pandas/{core => }/tests/test_panel.py | 0 pandas/{core => }/tests/test_pytools.py | 0 pandas/{core => }/tests/test_series.py | 0 pandas/{core => }/tests/test_sparse.py | 0 pandas/{lib => }/tests/test_tseries.py | 2 +- setup.py | 196 +- 48 files changed, 337 insertions(+), 41771 deletions(-) rename {pandas/lib => bench}/bench_sparse.py (100%) rename pandas/lib/bench.py => bench/bench_tseries.py (100%) delete mode 100644 pandas/lib/__init__.py delete mode 100755 pandas/lib/rebuild.sh delete mode 100644 pandas/lib/setup.py delete mode 100644 pandas/lib/src/sparse.c delete mode 100644 pandas/lib/src/tseries.c rename pandas/{lib => }/src/common.pyx (100%) rename pandas/{lib => }/src/groupby.pyx (99%) rename pandas/{lib => }/src/io.pyx (100%) rename pandas/{lib => }/src/isnull.pyx (100%) rename pandas/{lib => }/src/moments.pyx (100%) rename pandas/{lib => }/src/operators.pyx (100%) rename pandas/{lib => }/src/reindex.pyx (77%) rename pandas/{lib => }/src/skiplist.pyx (100%) rename pandas/{lib => }/src/sparse.pyx (100%) rename pandas/{lib => }/src/tseries.pyx (100%) rename pandas/{core => }/tests/test_common.py (100%) rename pandas/{core => }/tests/test_daterange.py (100%) rename pandas/{core => }/tests/test_datetools.py (100%) rename pandas/{core => }/tests/test_frame.py (100%) rename pandas/{core => }/tests/test_functions.py (100%) rename pandas/{core => }/tests/test_groupby.py (95%) rename pandas/{core => }/tests/test_index.py (99%) rename pandas/{core => }/tests/test_internals.py (100%) rename pandas/{lib => }/tests/test_libsparse.py (99%) rename pandas/{core => }/tests/test_panel.py (100%) rename pandas/{core => }/tests/test_pytools.py (100%) rename pandas/{core => }/tests/test_series.py (100%) rename pandas/{core => }/tests/test_sparse.py (100%) rename pandas/{lib => }/tests/test_tseries.py (98%) diff --git a/.gitignore b/.gitignore index 6a2346bd346ee..6fc0b4d6e9b5e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,9 @@ dist MANIFEST *.so *.pyd +pandas/src/tseries.c +pandas/src/sparse.c doc/source/generated +*flymake* scikits .coverage \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in index 44c1134a80726..115a23273511a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -5,7 +5,21 @@ include README.rst include TODO.rst include setup.py include setupegg.py + +graft docs +prune docs/build +prune docs/gh-pages + +graft examples +graft pandas + +global-exclude *.so +global-exclude *.pyd +global-exclude *.pyc +global-exclude .git* +global-exclude .DS_Store + # include examples/data/* -recursive-include examples *.py +# recursive-include examples *.py # recursive-include doc/source * # recursive-include doc/sphinxext * diff --git a/RELEASE.rst b/RELEASE.rst index be07df7ca4969..a8179874e155d 100644 --- a/RELEASE.rst +++ b/RELEASE.rst @@ -150,6 +150,9 @@ Thanks - Chris Uga - Chris Withers - Jeff Reback +- William Ferreira +- Daniel Fortunov +- Martin Felder ************************ pandas 0.3 Release Notes diff --git a/pandas/lib/bench_sparse.py b/bench/bench_sparse.py similarity index 100% rename from pandas/lib/bench_sparse.py rename to bench/bench_sparse.py diff --git a/pandas/lib/bench.py b/bench/bench_tseries.py similarity index 100% rename from pandas/lib/bench.py rename to bench/bench_tseries.py diff --git a/pandas/core/common.py b/pandas/core/common.py index dd91b91276105..89258b60e2ac8 100644 --- a/pandas/core/common.py +++ b/pandas/core/common.py @@ -7,7 +7,7 @@ from numpy.lib.format import read_array, write_array import numpy as np -import pandas.lib.tseries as tseries +import pandas._tseries as _tseries # XXX: HACK for NumPy 1.5.1 to suppress warnings try: @@ -32,11 +32,11 @@ def isnull(input): if input.dtype.kind in ('O', 'S'): # Working around NumPy ticket 1542 result = input.copy().astype(bool) - result[:] = tseries.isnullobj(input) + result[:] = _tseries.isnullobj(input) else: result = -np.isfinite(input) else: - result = tseries.checknull(input) + result = _tseries.checknull(input) return result @@ -56,7 +56,7 @@ def notnull(input): if isinstance(input, np.ndarray): return -isnull(input) else: - return not tseries.checknull(input) + return not _tseries.checknull(input) def _pickle_array(arr): arr = arr.view(np.ndarray) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 2ff9245e219ad..38b441547010f 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -30,7 +30,7 @@ from pandas.core.series import Series import pandas.core.common as common import pandas.core.datetools as datetools -import pandas.lib.tseries as tseries +import pandas._tseries as _tseries #------------------------------------------------------------------------------- # Factory helper methods @@ -2182,7 +2182,7 @@ def median(self, axis=0): def f(arr): if arr.dtype != np.float_: arr = arr.astype(float) - return tseries.median(arr[notnull(arr)]) + return _tseries.median(arr[notnull(arr)]) if axis == 0: med = [f(self[col].values) for col in self.columns] diff --git a/pandas/core/functions.py b/pandas/core/functions.py index c1fbf6b10f2dc..02adc7b2e028f 100644 --- a/pandas/core/functions.py +++ b/pandas/core/functions.py @@ -116,5 +116,5 @@ def ts_upsample(dates, buckets, values, aggfunc, inclusive=True): result = reduce_mean(values, index, buckets) - import pandas.lib.tseries as tseries + import pandas._tseries as tseries tseries.ts_upsample_mean(index, buckets, values) diff --git a/pandas/core/groupby.py b/pandas/core/groupby.py index 3dd65f904330a..068e0f9faec8e 100644 --- a/pandas/core/groupby.py +++ b/pandas/core/groupby.py @@ -6,7 +6,7 @@ from pandas.core.series import Series from pandas.core.panel import WidePanel import pandas.core.common as common -import pandas.lib.tseries as tseries +import pandas._tseries as _tseries class GroupDict(dict): def __repr__(self): @@ -54,15 +54,14 @@ def __init__(self, obj, grouper): grouper = grouper.get self.grouper = grouper axis = self._group_axis - self.groups = tseries.groupby(axis, self.grouper, + self.groups = _tseries.groupby(axis, self.grouper, output=GroupDict()) @property def group_indices(self): if self._group_indices is None: axis = self._group_axis - self._group_indices = tseries.groupby_indices(axis, - self.grouper) + self._group_indices = _tseries.groupby_indices(axis, self.grouper) return self._group_indices diff --git a/pandas/core/index.py b/pandas/core/index.py index 0f3eb2d1ba3f2..91823df861724 100644 --- a/pandas/core/index.py +++ b/pandas/core/index.py @@ -3,7 +3,7 @@ import numpy as np from pandas.core.common import _ensure_index -import pandas.lib.tseries as _tseries +import pandas._tseries as _tseries __all__ = ['Index'] @@ -260,8 +260,6 @@ def get_indexer(self, target, method=None): ------- (indexer, mask) """ - import pandas.lib.tseries as tseries - if method: method = method.upper() @@ -273,8 +271,8 @@ def get_indexer(self, target, method=None): target = _ensure_index(target) method = aliases.get(method, method) - indexer, mask = tseries.getFillVec(self, target, self.indexMap, - target.indexMap, method) + indexer, mask = _tseries.getFillVec(self, target, self.indexMap, + target.indexMap, method) return indexer, mask def slice_locs(self, start=None, end=None): diff --git a/pandas/core/panel.py b/pandas/core/panel.py index ae0160eba1e66..3bc6c1db22923 100644 --- a/pandas/core/panel.py +++ b/pandas/core/panel.py @@ -14,7 +14,7 @@ from pandas.core.frame import DataFrame from pandas.core.generic import PandasGeneric, Picklable import pandas.core.common as common -import pandas.lib.tseries as tseries +import pandas._tseries as _tseries class PanelError(Exception): pass @@ -900,7 +900,7 @@ def median(self, axis='major'): y : DataFrame """ def f(arr): - return tseries.median(arr[common.notnull(arr)]) + return _tseries.median(arr[common.notnull(arr)]) return self.apply(f, axis=axis) @@ -1086,8 +1086,8 @@ def fromRecords(cls, data, major_field, minor_field, major_axis = Index(sorted(set(major_vec))) minor_axis = Index(sorted(set(minor_vec))) - major_labels, _ = tseries.getMergeVec(major_vec, major_axis.indexMap) - minor_labels, _ = tseries.getMergeVec(minor_vec, minor_axis.indexMap) + major_labels, _ = _tseries.getMergeVec(major_vec, major_axis.indexMap) + minor_labels, _ = _tseries.getMergeVec(minor_vec, minor_axis.indexMap) for col in exclude: del data[col] @@ -2012,8 +2012,8 @@ def _make_long_index(major_values, minor_values): major_axis = Index(sorted(set(major_values))) minor_axis = Index(sorted(set(minor_values))) - major_labels, _ = tseries.getMergeVec(major_values, major_axis.indexMap) - minor_labels, _ = tseries.getMergeVec(minor_values, minor_axis.indexMap) + major_labels, _ = _tseries.getMergeVec(major_values, major_axis.indexMap) + minor_labels, _ = _tseries.getMergeVec(minor_values, minor_axis.indexMap) long_index = LongPanelIndex(major_axis, minor_axis, major_labels, minor_labels) diff --git a/pandas/core/series.py b/pandas/core/series.py index 53ee0dbd412cf..93018727764f5 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -18,7 +18,7 @@ from pandas.core.generic import PandasGeneric from pandas.core.index import Index import pandas.core.datetools as datetools -import pandas.lib.tseries as tseries +import pandas._tseries as _tseries __all__ = ['Series', 'TimeSeries'] @@ -58,10 +58,10 @@ def wrapper(self, other): # buffered Cython function expects double type - arr = tseries.combineFunc(name, newIndex, - this, other, - self.index.indexMap, - other.index.indexMap) + arr = _tseries.combineFunc(name, newIndex, + this, other, + self.index.indexMap, + other.index.indexMap) except Exception: arr = Series._combineFunc(self, other, getattr(type(self[0]), name)) @@ -613,7 +613,7 @@ def median(self): arr = arr.astype(float) arr = arr[notnull(arr)] - return tseries.median(arr) + return _tseries.median(arr) def corr(self, other): """ @@ -923,7 +923,7 @@ def map(self, arg): if isinstance(arg, dict): arg = Series(arg) - indexer, mask = tseries.getMergeVec(self, arg.index.indexMap) + indexer, mask = _tseries.getMergeVec(self, arg.index.indexMap) notmask = -mask new_values = arg.view(np.ndarray).take(indexer) diff --git a/pandas/core/sparse.py b/pandas/core/sparse.py index 0d7a062703565..ea8d58f16a8e8 100644 --- a/pandas/core/sparse.py +++ b/pandas/core/sparse.py @@ -20,8 +20,8 @@ import pandas.core.common as common import pandas.core.datetools as datetools -from pandas.lib.sparse import BlockIndex, IntIndex -import pandas.lib.sparse as splib +from pandas._sparse import BlockIndex, IntIndex +import pandas._sparse as splib def make_sparse(arr, kind='block', fill_value=nan): """ diff --git a/pandas/finance/portstats.py b/pandas/finance/portstats.py index cdf93f31cee46..74426a193b177 100644 --- a/pandas/finance/portstats.py +++ b/pandas/finance/portstats.py @@ -2,7 +2,7 @@ Compute common portfolio statistics """ -import pandas.lib.tseries as _tseries +import pandas._tseries as _tseries import pandas.stats.moments as moments def leverage(weights): diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index b2703adaf637f..6e3b4328ffe76 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -13,7 +13,7 @@ LongPanel) from pandas.core.pytools import adjoin import pandas.core.internals as internals -import pandas.lib.tseries as tseries +import pandas._tseries as _tseries # reading and writing the full object in one go _TYPE_MAP = { @@ -593,7 +593,7 @@ def _read_index_legacy(group, key): def _unconvert_index_legacy(data, kind, legacy=False): if kind == 'datetime': - index = tseries.array_to_datetime(data) + index = _tseries.array_to_datetime(data) elif kind in ('string', 'integer'): index = np.array(data, dtype=object) else: # pragma: no cover diff --git a/pandas/lib/__init__.py b/pandas/lib/__init__.py deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pandas/lib/rebuild.sh b/pandas/lib/rebuild.sh deleted file mode 100755 index 166eae279ac03..0000000000000 --- a/pandas/lib/rebuild.sh +++ /dev/null @@ -1,2 +0,0 @@ -cython src/tseries.pyx -python build.py build_ext --inplace \ No newline at end of file diff --git a/pandas/lib/setup.py b/pandas/lib/setup.py deleted file mode 100644 index 0b1f6a62176e4..0000000000000 --- a/pandas/lib/setup.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python - -from distutils.core import Extension -import numpy - -def get_cython_ext(): - from Cython.Distutils import build_ext - - pyx_ext = Extension('tseries', ['pandas/lib/src/tseries.pyx'], - include_dirs=[numpy.get_include()]) - - - setup(name='pandas.lib.tseries', description='Nothing', - ext_modules=[pyx_ext], - cmdclass = { - 'build_ext' : build_ext - }) - -def configuration(parent_package='', top_path=None): - from numpy.distutils.misc_util import Configuration - - config = Configuration('lib', parent_package, top_path) - config.add_extension('tseries', - sources=['src/tseries.c'], - include_dirs=[numpy.get_include()]) - - - config.add_extension('sparse', - sources=['src/sparse.c'], - include_dirs=[numpy.get_include()]) - - return config diff --git a/pandas/lib/src/sparse.c b/pandas/lib/src/sparse.c deleted file mode 100644 index 93d6413b62c58..0000000000000 --- a/pandas/lib/src/sparse.c +++ /dev/null @@ -1,21342 +0,0 @@ -/* Generated by Cython 0.14.1 on Thu May 12 16:14:35 2011 */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#else - -#include /* For offsetof */ -#ifndef offsetof -#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif - -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif - -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif - -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif - -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) -#endif - -#if PY_VERSION_HEX < 0x02050000 - typedef int Py_ssize_t; - #define PY_SSIZE_T_MAX INT_MAX - #define PY_SSIZE_T_MIN INT_MIN - #define PY_FORMAT_SIZE_T "" - #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) 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 PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#endif - -#if PY_VERSION_HEX < 0x02060000 - #define PyBytesObject PyStringObject - #define PyBytes_Type PyString_Type - #define PyBytes_Check PyString_Check - #define PyBytes_CheckExact PyString_CheckExact - #define PyBytes_FromString PyString_FromString - #define PyBytes_FromStringAndSize PyString_FromStringAndSize - #define PyBytes_FromFormat PyString_FromFormat - #define PyBytes_DecodeEscape PyString_DecodeEscape - #define PyBytes_AsString PyString_AsString - #define PyBytes_AsStringAndSize PyString_AsStringAndSize - #define PyBytes_Size PyString_Size - #define PyBytes_AS_STRING PyString_AS_STRING - #define PyBytes_GET_SIZE PyString_GET_SIZE - #define PyBytes_Repr PyString_Repr - #define PyBytes_Concat PyString_Concat - #define PyBytes_ConcatAndDel PyString_ConcatAndDel -#endif - -#if PY_VERSION_HEX < 0x02060000 - #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) - #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif - -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) - -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask -#endif - -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif - - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - -#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) - #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) - #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) - #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) -#else - #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ - (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ - (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ - (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) - #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ - (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ - (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ - (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) - #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ - (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ - (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ - (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) -#endif - -#if PY_MAJOR_VERSION >= 3 - #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) -#endif - -#if PY_VERSION_HEX < 0x02050000 - #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) - #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) - #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) -#else - #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) - #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) - #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) -#endif - -#if PY_VERSION_HEX < 0x02050000 - #define __Pyx_NAMESTR(n) ((char *)(n)) - #define __Pyx_DOCSTR(n) ((char *)(n)) -#else - #define __Pyx_NAMESTR(n) (n) - #define __Pyx_DOCSTR(n) (n) -#endif - -#ifdef __cplusplus -#define __PYX_EXTERN_C extern "C" -#else -#define __PYX_EXTERN_C extern -#endif - -#if defined(WIN32) || defined(MS_WINDOWS) -#define _USE_MATH_DEFINES -#endif -#include -#define __PYX_HAVE_API__pandas__lib__sparse -#include "stdio.h" -#include "stdlib.h" -#include "numpy/arrayobject.h" -#include "numpy/ufuncobject.h" - -#ifdef PYREX_WITHOUT_ASSERTIONS -#define CYTHON_WITHOUT_ASSERTIONS -#endif - - -/* inline attribute */ -#ifndef CYTHON_INLINE - #if defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif - -/* unused attribute */ -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || defined(__INTEL_COMPILER) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif - -typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ - - -/* Type Conversion Predeclarations */ - -#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) -#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) - -#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); - -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); - -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) - - -#ifdef __GNUC__ -/* Test for GCC > 2.95 */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) -#else /* __GNUC__ > 2 ... */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ > 2 ... */ -#else /* __GNUC__ */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ */ - -static PyObject *__pyx_m; -static PyObject *__pyx_b; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - - -#if !defined(CYTHON_CCOMPLEX) - #if defined(__cplusplus) - #define CYTHON_CCOMPLEX 1 - #elif defined(_Complex_I) - #define CYTHON_CCOMPLEX 1 - #else - #define CYTHON_CCOMPLEX 0 - #endif -#endif - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - #include - #else - #include - #endif -#endif - -#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) - #undef _Complex_I - #define _Complex_I 1.0fj -#endif - -static const char *__pyx_f[] = { - "sparse.pyx", - "numpy.pxd", -}; - -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 Py_ssize_t __pyx_t_6pandas_3lib_6sparse_pyst; - -#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 __pyx_t_5numpy_float64_t (*__pyx_t_6pandas_3lib_6sparse_double_func)(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); - -/* "pandas/lib/src/sparse.pyx":548 - * - * - * cdef class BlockMerge(object): # <<<<<<<<<<<<<< - * ''' - * Object-oriented approach makes sharing state between recursive functions a - */ - -struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge { - PyObject_HEAD - struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockMerge *__pyx_vtab; - struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *x; - struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *y; - struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *result; - PyArrayObject *xstart; - PyArrayObject *xlen; - PyArrayObject *xend; - PyArrayObject *ystart; - PyArrayObject *ylen; - PyArrayObject *yend; - __pyx_t_5numpy_int32_t xi; - __pyx_t_5numpy_int32_t yi; -}; - -/* "pandas/lib/src/sparse.pyx":590 - * self.yi = xi - * - * cdef class BlockIntersection(BlockMerge): # <<<<<<<<<<<<<< - * ''' - * not done yet - */ - -struct __pyx_obj_6pandas_3lib_6sparse_BlockIntersection { - struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge __pyx_base; -}; - -/* "pandas/lib/src/sparse.pyx":55 - * #------------------------------------------------------------------------------- - * - * cdef class SparseIndex: # <<<<<<<<<<<<<< - * ''' - * Abstract superclass for sparse index types - */ - -struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex { - PyObject_HEAD -}; - -/* "pandas/lib/src/sparse.pyx":284 - * # BlockIndex - * - * cdef class BlockIndex(SparseIndex): # <<<<<<<<<<<<<< - * ''' - * Object for holding block-based sparse indexing information - */ - -struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex { - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex __pyx_base; - struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockIndex *__pyx_vtab; - __pyx_t_6pandas_3lib_6sparse_pyst nblocks; - __pyx_t_6pandas_3lib_6sparse_pyst npoints; - __pyx_t_6pandas_3lib_6sparse_pyst length; - PyArrayObject *blocs; - PyArrayObject *blengths; - PyObject *__weakref__; - __pyx_t_5numpy_int32_t *locbuf; - __pyx_t_5numpy_int32_t *lenbuf; -}; - -/* "pandas/lib/src/sparse.pyx":596 - * pass - * - * cdef class BlockUnion(BlockMerge): # <<<<<<<<<<<<<< - * ''' - * Object-oriented approach makes sharing state between recursive functions a - */ - -struct __pyx_obj_6pandas_3lib_6sparse_BlockUnion { - struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge __pyx_base; -}; - -/* "pandas/lib/src/sparse.pyx":62 - * raise NotImplementedError - * - * cdef class IntIndex(SparseIndex): # <<<<<<<<<<<<<< - * ''' - * Object for holding exact integer sparse indexing information - */ - -struct __pyx_obj_6pandas_3lib_6sparse_IntIndex { - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex __pyx_base; - struct __pyx_vtabstruct_6pandas_3lib_6sparse_IntIndex *__pyx_vtab; - __pyx_t_6pandas_3lib_6sparse_pyst length; - __pyx_t_6pandas_3lib_6sparse_pyst npoints; - PyArrayObject *indices; -}; - - -struct __pyx_vtabstruct_6pandas_3lib_6sparse_IntIndex { - struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *(*intersect)(struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, int __pyx_skip_dispatch); - struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *(*make_union)(struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, int __pyx_skip_dispatch); - PyObject *(*lookup)(struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *, __pyx_t_6pandas_3lib_6sparse_pyst, int __pyx_skip_dispatch); - PyArrayObject *(*reindex)(struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *, PyArrayObject *, __pyx_t_5numpy_float64_t, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, int __pyx_skip_dispatch); - PyObject *(*put)(struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *, PyArrayObject *, PyArrayObject *, PyObject *, int __pyx_skip_dispatch); - PyObject *(*take)(struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); -}; -static struct __pyx_vtabstruct_6pandas_3lib_6sparse_IntIndex *__pyx_vtabptr_6pandas_3lib_6sparse_IntIndex; - - -/* "pandas/lib/src/sparse.pyx":284 - * # BlockIndex - * - * cdef class BlockIndex(SparseIndex): # <<<<<<<<<<<<<< - * ''' - * Object for holding block-based sparse indexing information - */ - -struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockIndex { - PyObject *(*check_integrity)(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *, int __pyx_skip_dispatch); - struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *(*intersect)(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, int __pyx_skip_dispatch); - struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *(*make_union)(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, int __pyx_skip_dispatch); - PyObject *(*lookup)(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *, __pyx_t_6pandas_3lib_6sparse_pyst, int __pyx_skip_dispatch); - PyArrayObject *(*reindex)(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *, PyArrayObject *, __pyx_t_5numpy_float64_t, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, int __pyx_skip_dispatch); - PyObject *(*put)(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *, PyArrayObject *, PyArrayObject *, PyObject *, int __pyx_skip_dispatch); - PyObject *(*take)(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); -}; -static struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockIndex *__pyx_vtabptr_6pandas_3lib_6sparse_BlockIndex; - - -/* "pandas/lib/src/sparse.pyx":548 - * - * - * cdef class BlockMerge(object): # <<<<<<<<<<<<<< - * ''' - * Object-oriented approach makes sharing state between recursive functions a - */ - -struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockMerge { - PyObject *(*_make_merged_blocks)(struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *); - PyObject *(*_set_current_indices)(struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *, __pyx_t_5numpy_int32_t, __pyx_t_5numpy_int32_t, int); -}; -static struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockMerge *__pyx_vtabptr_6pandas_3lib_6sparse_BlockMerge; - - -/* "pandas/lib/src/sparse.pyx":596 - * pass - * - * cdef class BlockUnion(BlockMerge): # <<<<<<<<<<<<<< - * ''' - * Object-oriented approach makes sharing state between recursive functions a - */ - -struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockUnion { - struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockMerge __pyx_base; - __pyx_t_5numpy_int32_t (*_find_next_block_end)(struct __pyx_obj_6pandas_3lib_6sparse_BlockUnion *, int); -}; -static struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockUnion *__pyx_vtabptr_6pandas_3lib_6sparse_BlockUnion; - - -/* "pandas/lib/src/sparse.pyx":590 - * self.yi = xi - * - * cdef class BlockIntersection(BlockMerge): # <<<<<<<<<<<<<< - * ''' - * not done yet - */ - -struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockIntersection { - struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockMerge __pyx_base; -}; -static struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockIntersection *__pyx_vtabptr_6pandas_3lib_6sparse_BlockIntersection; - -#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 PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ - -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ - -static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, - const char* function_name, int kw_allowed); /*proto*/ - -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ - -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ - -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ - -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/ - -/* Run-time type information about structs used with buffers */ -struct __Pyx_StructField_; - -typedef struct { - const char* name; /* for error messages only */ - struct __Pyx_StructField_* fields; - size_t size; /* sizeof(type) */ - char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ -} __Pyx_TypeInfo; - -typedef struct __Pyx_StructField_ { - __Pyx_TypeInfo* type; - const char* name; - size_t offset; -} __Pyx_StructField; - -typedef struct { - __Pyx_StructField* field; - size_t parent_offset; -} __Pyx_BufFmt_StackElem; - - -static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); -static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); - -static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ -static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/ -#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); /*proto*/ - - -static CYTHON_INLINE 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) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) - -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { - 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, PyInt_FromSsize_t(i)); -} - -#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_Tuple_Fast(o, i) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) - -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { - 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, PyInt_FromSsize_t(i)); -} - - -#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_Fast(o, i) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) - -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { - 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, PyInt_FromSsize_t(i)); - } - return r; -} - -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_RaiseNoneIndexingError(void); - -#if PY_MAJOR_VERSION >= 3 -static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { - PyObject *value; - if (unlikely(d == Py_None)) { - __Pyx_RaiseNoneIndexingError(); - return NULL; - } - value = PyDict_GetItemWithError(d, key); - if (unlikely(!value)) { - if (!PyErr_Occurred()) - PyErr_SetObject(PyExc_KeyError, key); - return NULL; - } - Py_INCREF(value); - return value; -} -#else - #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) -#endif - -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ -#if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); -static void __Pyx_ReleaseBuffer(Py_buffer *view); -#else -#define __Pyx_GetBuffer PyObject_GetBuffer -#define __Pyx_ReleaseBuffer PyBuffer_Release -#endif - -Py_ssize_t __Pyx_zeros[] = {0}; -Py_ssize_t __Pyx_minusones[] = {-1}; - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ - -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32); - -static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject *); - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - #define __Pyx_CREAL(z) ((z).real()) - #define __Pyx_CIMAG(z) ((z).imag()) - #else - #define __Pyx_CREAL(z) (__real__(z)) - #define __Pyx_CIMAG(z) (__imag__(z)) - #endif -#else - #define __Pyx_CREAL(z) ((z).real) - #define __Pyx_CIMAG(z) ((z).imag) -#endif - -#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX - #define __Pyx_SET_CREAL(z,x) ((z).real(x)) - #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) -#else - #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) - #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) -#endif - -static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); - -#if CYTHON_CCOMPLEX - #define __Pyx_c_eqf(a, b) ((a)==(b)) - #define __Pyx_c_sumf(a, b) ((a)+(b)) - #define __Pyx_c_difff(a, b) ((a)-(b)) - #define __Pyx_c_prodf(a, b) ((a)*(b)) - #define __Pyx_c_quotf(a, b) ((a)/(b)) - #define __Pyx_c_negf(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zerof(z) ((z)==(float)0) - #define __Pyx_c_conjf(z) (::std::conj(z)) - #if 1 - #define __Pyx_c_absf(z) (::std::abs(z)) - #define __Pyx_c_powf(a, b) (::std::pow(a, b)) - #endif - #else - #define __Pyx_c_is_zerof(z) ((z)==0) - #define __Pyx_c_conjf(z) (conjf(z)) - #if 1 - #define __Pyx_c_absf(z) (cabsf(z)) - #define __Pyx_c_powf(a, b) (cpowf(a, b)) - #endif - #endif -#else - static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); - static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); - #if 1 - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); - #endif -#endif - -static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); - -#if CYTHON_CCOMPLEX - #define __Pyx_c_eq(a, b) ((a)==(b)) - #define __Pyx_c_sum(a, b) ((a)+(b)) - #define __Pyx_c_diff(a, b) ((a)-(b)) - #define __Pyx_c_prod(a, b) ((a)*(b)) - #define __Pyx_c_quot(a, b) ((a)/(b)) - #define __Pyx_c_neg(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zero(z) ((z)==(double)0) - #define __Pyx_c_conj(z) (::std::conj(z)) - #if 1 - #define __Pyx_c_abs(z) (::std::abs(z)) - #define __Pyx_c_pow(a, b) (::std::pow(a, b)) - #endif - #else - #define __Pyx_c_is_zero(z) ((z)==0) - #define __Pyx_c_conj(z) (conj(z)) - #if 1 - #define __Pyx_c_abs(z) (cabs(z)) - #define __Pyx_c_pow(a, b) (cpow(a, b)) - #endif - #endif -#else - static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); - static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - #if 1 - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); - #endif -#endif - -static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); - -static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); - -static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); - -static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); - -static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); - -static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); - -static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); - -static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); - -static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); - -static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); - -static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); - -static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); - -static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); - -static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); - -static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); - -static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); - -static void __Pyx_WriteUnraisable(const char *name); /*proto*/ - -static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*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 cpython.buffer */ - -/* Module declarations from cpython.ref */ - -/* Module declarations from libc.stdio */ - -/* Module declarations from cpython.object */ - -/* Module declarations from libc.stdlib */ - -/* Module declarations from numpy */ - -/* Module declarations from numpy */ - -static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; -static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; -static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; -static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; -static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ -/* Module declarations from cython */ - -/* Module declarations from pandas.lib.sparse */ - -static PyTypeObject *__pyx_ptype_6pandas_3lib_6sparse_SparseIndex = 0; -static PyTypeObject *__pyx_ptype_6pandas_3lib_6sparse_IntIndex = 0; -static PyTypeObject *__pyx_ptype_6pandas_3lib_6sparse_BlockIndex = 0; -static PyTypeObject *__pyx_ptype_6pandas_3lib_6sparse_BlockMerge = 0; -static PyTypeObject *__pyx_ptype_6pandas_3lib_6sparse_BlockIntersection = 0; -static PyTypeObject *__pyx_ptype_6pandas_3lib_6sparse_BlockUnion = 0; -static __pyx_t_5numpy_float64_t __pyx_v_6pandas_3lib_6sparse_NaN; -static __pyx_t_5numpy_float64_t __pyx_v_6pandas_3lib_6sparse_INF; -static CYTHON_INLINE int __pyx_f_6pandas_3lib_6sparse_int_max(int, int); /*proto*/ -static CYTHON_INLINE int __pyx_f_6pandas_3lib_6sparse_int_min(int, int); /*proto*/ -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_3lib_6sparse___add(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/ -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_3lib_6sparse___sub(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/ -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_3lib_6sparse___div(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/ -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_3lib_6sparse___mul(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/ -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_3lib_6sparse___eq(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/ -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_3lib_6sparse___ne(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/ -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_3lib_6sparse___lt(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/ -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_3lib_6sparse___gt(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/ -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_3lib_6sparse___pow(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_get_blocks(PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_nanadd(PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_nansub(PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_nanmul(PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_nandiv(PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_nanpow(PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, int __pyx_skip_dispatch); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_nancombine(PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, __pyx_t_6pandas_3lib_6sparse_double_func); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_add(PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, __pyx_t_5numpy_float64_t, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_sub(PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, __pyx_t_5numpy_float64_t, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_mul(PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, __pyx_t_5numpy_float64_t, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_div(PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, __pyx_t_5numpy_float64_t, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_pow(PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, __pyx_t_5numpy_float64_t, int __pyx_skip_dispatch); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_combine(PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, __pyx_t_5numpy_float64_t, __pyx_t_6pandas_3lib_6sparse_double_func); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_6pandas_3lib_6sparse_block_nanop(PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *, PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *, __pyx_t_6pandas_3lib_6sparse_double_func); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_6pandas_3lib_6sparse_int_nanop(PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *, PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *, __pyx_t_6pandas_3lib_6sparse_double_func); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_6pandas_3lib_6sparse_block_op(PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *, __pyx_t_5numpy_float64_t, __pyx_t_6pandas_3lib_6sparse_double_func); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_6pandas_3lib_6sparse_int_op(PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *, __pyx_t_5numpy_float64_t, PyArrayObject *, struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *, __pyx_t_5numpy_float64_t, __pyx_t_6pandas_3lib_6sparse_double_func); /*proto*/ -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), 'I' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), 'R' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_object = { "Python object", NULL, sizeof(PyObject *), 'O' }; -#define __Pyx_MODULE_NAME "pandas.lib.sparse" -static int __pyx_module_is_main_pandas__lib__sparse = 0; - -/* Implementation of pandas.lib.sparse */ -static PyObject *__pyx_builtin_NotImplementedError; -static PyObject *__pyx_builtin_Exception; -static PyObject *__pyx_builtin_ValueError; -static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin_RuntimeError; -static char __pyx_k_1[] = "IntIndex\n"; -static char __pyx_k_2[] = "Indices: %s\n"; -static char __pyx_k_3[] = "Indices must reference same underlying length"; -static char __pyx_k_6[] = "BlockIndex\n"; -static char __pyx_k_7[] = "Block locations: %s\n"; -static char __pyx_k_8[] = "Block lengths: %s"; -static char __pyx_k_9[] = "block bound arrays must be same length"; -static char __pyx_k_11[] = "Locations not in ascending order"; -static char __pyx_k_13[] = "Block %d overlaps"; -static char __pyx_k_14[] = "Block %d extends beyond end"; -static char __pyx_k_15[] = "Zero-length block %d"; -static char __pyx_k_18[] = "_find_next_block_end"; -static char __pyx_k_19[] = "Mode must be 0 or 1"; -static char __pyx_k_21[] = "_set_current_indices"; -static char __pyx_k_22[] = "ndarray is not C contiguous"; -static char __pyx_k_24[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_26[] = "Non-native byte order not supported"; -static char __pyx_k_28[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_29[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_32[] = "Format string allocated too short."; -static char __pyx_k_34[] = "pandas.lib.sparse"; -static char __pyx_k__B[] = "B"; -static char __pyx_k__H[] = "H"; -static char __pyx_k__I[] = "I"; -static char __pyx_k__L[] = "L"; -static char __pyx_k__O[] = "O"; -static char __pyx_k__Q[] = "Q"; -static char __pyx_k__b[] = "b"; -static char __pyx_k__d[] = "d"; -static char __pyx_k__f[] = "f"; -static char __pyx_k__g[] = "g"; -static char __pyx_k__h[] = "h"; -static char __pyx_k__i[] = "i"; -static char __pyx_k__l[] = "l"; -static char __pyx_k__q[] = "q"; -static char __pyx_k__x[] = "x"; -static char __pyx_k__y[] = "y"; -static char __pyx_k__Zd[] = "Zd"; -static char __pyx_k__Zf[] = "Zf"; -static char __pyx_k__Zg[] = "Zg"; -static char __pyx_k__np[] = "np"; -static char __pyx_k__xi[] = "xi"; -static char __pyx_k__yi[] = "yi"; -static char __pyx_k__NaN[] = "NaN"; -static char __pyx_k__buf[] = "buf"; -static char __pyx_k__inf[] = "inf"; -static char __pyx_k__obj[] = "obj"; -static char __pyx_k__put[] = "put"; -static char __pyx_k__sum[] = "sum"; -static char __pyx_k__sys[] = "sys"; -static char __pyx_k__base[] = "base"; -static char __pyx_k__data[] = "data"; -static char __pyx_k__fill[] = "fill"; -static char __pyx_k__ndim[] = "ndim"; -static char __pyx_k__take[] = "take"; -static char __pyx_k__xend[] = "xend"; -static char __pyx_k__yend[] = "yend"; -static char __pyx_k__blocs[] = "blocs"; -static char __pyx_k__descr[] = "descr"; -static char __pyx_k__dtype[] = "dtype"; -static char __pyx_k__empty[] = "empty"; -static char __pyx_k__int32[] = "int32"; -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__xfill[] = "xfill"; -static char __pyx_k__yfill[] = "yfill"; -static char __pyx_k__append[] = "append"; -static char __pyx_k__fields[] = "fields"; -static char __pyx_k__format[] = "format"; -static char __pyx_k__lenbuf[] = "lenbuf"; -static char __pyx_k__length[] = "length"; -static char __pyx_k__locbuf[] = "locbuf"; -static char __pyx_k__lookup[] = "lookup"; -static char __pyx_k__other_[] = "other_"; -static char __pyx_k__result[] = "result"; -static char __pyx_k__to_put[] = "to_put"; -static char __pyx_k__values[] = "values"; -static char __pyx_k__xindex[] = "xindex"; -static char __pyx_k__xstart[] = "xstart"; -static char __pyx_k__yindex[] = "yindex"; -static char __pyx_k__ystart[] = "ystart"; -static char __pyx_k__float64[] = "float64"; -static char __pyx_k__indexer[] = "indexer"; -static char __pyx_k__indices[] = "indices"; -static char __pyx_k__nblocks[] = "nblocks"; -static char __pyx_k__npoints[] = "npoints"; -static char __pyx_k__reindex[] = "reindex"; -static char __pyx_k__strides[] = "strides"; -static char __pyx_k____main__[] = "__main__"; -static char __pyx_k____test__[] = "__test__"; -static char __pyx_k__blengths[] = "blengths"; -static char __pyx_k__itemsize[] = "itemsize"; -static char __pyx_k__operator[] = "operator"; -static char __pyx_k__readonly[] = "readonly"; -static char __pyx_k__type_num[] = "type_num"; -static char __pyx_k__Exception[] = "Exception"; -static char __pyx_k__byteorder[] = "byteorder"; -static char __pyx_k__index_map[] = "index_map"; -static char __pyx_k__intersect[] = "intersect"; -static char __pyx_k__ValueError[] = "ValueError"; -static char __pyx_k__fill_value[] = "fill_value"; -static char __pyx_k__make_union[] = "make_union"; -static char __pyx_k__suboffsets[] = "suboffsets"; -static char __pyx_k__array_equal[] = "array_equal"; -static char __pyx_k__RuntimeError[] = "RuntimeError"; -static char __pyx_k__searchsorted[] = "searchsorted"; -static char __pyx_k__sparse_index[] = "sparse_index"; -static char __pyx_k__to_int_index[] = "to_int_index"; -static char __pyx_k__get_reindexer[] = "get_reindexer"; -static char __pyx_k__reindex_block[] = "reindex_block"; -static char __pyx_k__to_block_index[] = "to_block_index"; -static char __pyx_k__check_integrity[] = "check_integrity"; -static char __pyx_k__reindex_integer[] = "reindex_integer"; -static char __pyx_k__ascontiguousarray[] = "ascontiguousarray"; -static char __pyx_k__NotImplementedError[] = "NotImplementedError"; -static char __pyx_k___make_merged_blocks[] = "_make_merged_blocks"; -static PyObject *__pyx_n_s_1; -static PyObject *__pyx_kp_s_11; -static PyObject *__pyx_kp_s_13; -static PyObject *__pyx_kp_s_14; -static PyObject *__pyx_kp_s_15; -static PyObject *__pyx_n_s_18; -static PyObject *__pyx_kp_s_19; -static PyObject *__pyx_kp_s_2; -static PyObject *__pyx_n_s_21; -static PyObject *__pyx_kp_u_22; -static PyObject *__pyx_kp_u_24; -static PyObject *__pyx_kp_u_26; -static PyObject *__pyx_kp_u_28; -static PyObject *__pyx_kp_u_29; -static PyObject *__pyx_kp_s_3; -static PyObject *__pyx_kp_u_32; -static PyObject *__pyx_n_s_34; -static PyObject *__pyx_n_s_6; -static PyObject *__pyx_kp_s_7; -static PyObject *__pyx_kp_s_8; -static PyObject *__pyx_kp_s_9; -static PyObject *__pyx_n_s__Exception; -static PyObject *__pyx_n_s__NaN; -static PyObject *__pyx_n_s__NotImplementedError; -static PyObject *__pyx_n_s__RuntimeError; -static PyObject *__pyx_n_s__ValueError; -static PyObject *__pyx_n_s____main__; -static PyObject *__pyx_n_s____test__; -static PyObject *__pyx_n_s___make_merged_blocks; -static PyObject *__pyx_n_s__append; -static PyObject *__pyx_n_s__array_equal; -static PyObject *__pyx_n_s__ascontiguousarray; -static PyObject *__pyx_n_s__base; -static PyObject *__pyx_n_s__blengths; -static PyObject *__pyx_n_s__blocs; -static PyObject *__pyx_n_s__buf; -static PyObject *__pyx_n_s__byteorder; -static PyObject *__pyx_n_s__check_integrity; -static PyObject *__pyx_n_s__data; -static PyObject *__pyx_n_s__descr; -static PyObject *__pyx_n_s__dtype; -static PyObject *__pyx_n_s__empty; -static PyObject *__pyx_n_s__fields; -static PyObject *__pyx_n_s__fill; -static PyObject *__pyx_n_s__fill_value; -static PyObject *__pyx_n_s__float64; -static PyObject *__pyx_n_s__format; -static PyObject *__pyx_n_s__get_reindexer; -static PyObject *__pyx_n_s__index_map; -static PyObject *__pyx_n_s__indexer; -static PyObject *__pyx_n_s__indices; -static PyObject *__pyx_n_s__inf; -static PyObject *__pyx_n_s__int32; -static PyObject *__pyx_n_s__intersect; -static PyObject *__pyx_n_s__itemsize; -static PyObject *__pyx_n_s__lenbuf; -static PyObject *__pyx_n_s__length; -static PyObject *__pyx_n_s__locbuf; -static PyObject *__pyx_n_s__lookup; -static PyObject *__pyx_n_s__make_union; -static PyObject *__pyx_n_s__names; -static PyObject *__pyx_n_s__nblocks; -static PyObject *__pyx_n_s__ndim; -static PyObject *__pyx_n_s__np; -static PyObject *__pyx_n_s__npoints; -static PyObject *__pyx_n_s__numpy; -static PyObject *__pyx_n_s__obj; -static PyObject *__pyx_n_s__operator; -static PyObject *__pyx_n_s__other_; -static PyObject *__pyx_n_s__put; -static PyObject *__pyx_n_s__range; -static PyObject *__pyx_n_s__readonly; -static PyObject *__pyx_n_s__reindex; -static PyObject *__pyx_n_s__reindex_block; -static PyObject *__pyx_n_s__reindex_integer; -static PyObject *__pyx_n_s__result; -static PyObject *__pyx_n_s__searchsorted; -static PyObject *__pyx_n_s__shape; -static PyObject *__pyx_n_s__sparse_index; -static PyObject *__pyx_n_s__strides; -static PyObject *__pyx_n_s__suboffsets; -static PyObject *__pyx_n_s__sum; -static PyObject *__pyx_n_s__sys; -static PyObject *__pyx_n_s__take; -static PyObject *__pyx_n_s__to_block_index; -static PyObject *__pyx_n_s__to_int_index; -static PyObject *__pyx_n_s__to_put; -static PyObject *__pyx_n_s__type_num; -static PyObject *__pyx_n_s__values; -static PyObject *__pyx_n_s__x; -static PyObject *__pyx_n_s__xend; -static PyObject *__pyx_n_s__xfill; -static PyObject *__pyx_n_s__xi; -static PyObject *__pyx_n_s__xindex; -static PyObject *__pyx_n_s__xstart; -static PyObject *__pyx_n_s__y; -static PyObject *__pyx_n_s__yend; -static PyObject *__pyx_n_s__yfill; -static PyObject *__pyx_n_s__yi; -static PyObject *__pyx_n_s__yindex; -static PyObject *__pyx_n_s__ystart; -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_neg_1; -static PyObject *__pyx_int_15; -static PyObject *__pyx_k_tuple_4; -static PyObject *__pyx_k_tuple_5; -static PyObject *__pyx_k_tuple_10; -static PyObject *__pyx_k_tuple_12; -static PyObject *__pyx_k_tuple_16; -static PyObject *__pyx_k_tuple_17; -static PyObject *__pyx_k_tuple_20; -static PyObject *__pyx_k_tuple_23; -static PyObject *__pyx_k_tuple_25; -static PyObject *__pyx_k_tuple_27; -static PyObject *__pyx_k_tuple_30; -static PyObject *__pyx_k_tuple_31; -static PyObject *__pyx_k_tuple_33; - -/* "pandas/lib/src/sparse.pyx":18 - * cdef float64_t INF = np.inf - * - * cdef inline int int_max(int a, int b): return a if a >= b else b # <<<<<<<<<<<<<< - * cdef inline int int_min(int a, int b): return a if a <= b else b - * - */ - -static CYTHON_INLINE int __pyx_f_6pandas_3lib_6sparse_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; -} - -/* "pandas/lib/src/sparse.pyx":19 - * - * 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 # <<<<<<<<<<<<<< - * - * cdef inline float64_t __add(float64_t a, float64_t b): - */ - -static CYTHON_INLINE int __pyx_f_6pandas_3lib_6sparse_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; -} - -/* "pandas/lib/src/sparse.pyx":21 - * cdef inline int int_min(int a, int b): return a if a <= b else b - * - * cdef inline float64_t __add(float64_t a, float64_t b): # <<<<<<<<<<<<<< - * return a + b - * cdef inline float64_t __sub(float64_t a, float64_t b): - */ - -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_3lib_6sparse___add(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) { - __pyx_t_5numpy_float64_t __pyx_r; - __Pyx_RefNannySetupContext("__add"); - - /* "pandas/lib/src/sparse.pyx":22 - * - * cdef inline float64_t __add(float64_t a, float64_t b): - * return a + b # <<<<<<<<<<<<<< - * cdef inline float64_t __sub(float64_t a, float64_t b): - * return a - b - */ - __pyx_r = (__pyx_v_a + __pyx_v_b); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":23 - * cdef inline float64_t __add(float64_t a, float64_t b): - * return a + b - * cdef inline float64_t __sub(float64_t a, float64_t b): # <<<<<<<<<<<<<< - * return a - b - * cdef inline float64_t __div(float64_t a, float64_t b): - */ - -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_3lib_6sparse___sub(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) { - __pyx_t_5numpy_float64_t __pyx_r; - __Pyx_RefNannySetupContext("__sub"); - - /* "pandas/lib/src/sparse.pyx":24 - * return a + b - * cdef inline float64_t __sub(float64_t a, float64_t b): - * return a - b # <<<<<<<<<<<<<< - * cdef inline float64_t __div(float64_t a, float64_t b): - * if b == 0: - */ - __pyx_r = (__pyx_v_a - __pyx_v_b); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":25 - * cdef inline float64_t __sub(float64_t a, float64_t b): - * return a - b - * cdef inline float64_t __div(float64_t a, float64_t b): # <<<<<<<<<<<<<< - * if b == 0: - * if a >= 0: - */ - -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_3lib_6sparse___div(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) { - __pyx_t_5numpy_float64_t __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("__div"); - - /* "pandas/lib/src/sparse.pyx":26 - * return a - b - * cdef inline float64_t __div(float64_t a, float64_t b): - * if b == 0: # <<<<<<<<<<<<<< - * if a >= 0: - * return INF - */ - __pyx_t_1 = (__pyx_v_b == 0.0); - if (__pyx_t_1) { - - /* "pandas/lib/src/sparse.pyx":27 - * cdef inline float64_t __div(float64_t a, float64_t b): - * if b == 0: - * if a >= 0: # <<<<<<<<<<<<<< - * return INF - * else: - */ - __pyx_t_1 = (__pyx_v_a >= 0.0); - if (__pyx_t_1) { - - /* "pandas/lib/src/sparse.pyx":28 - * if b == 0: - * if a >= 0: - * return INF # <<<<<<<<<<<<<< - * else: - * return -INF - */ - __pyx_r = __pyx_v_6pandas_3lib_6sparse_INF; - goto __pyx_L0; - goto __pyx_L4; - } - /*else*/ { - - /* "pandas/lib/src/sparse.pyx":30 - * return INF - * else: - * return -INF # <<<<<<<<<<<<<< - * else: - * return a / b - */ - __pyx_r = (-__pyx_v_6pandas_3lib_6sparse_INF); - goto __pyx_L0; - } - __pyx_L4:; - goto __pyx_L3; - } - /*else*/ { - - /* "pandas/lib/src/sparse.pyx":32 - * return -INF - * else: - * return a / b # <<<<<<<<<<<<<< - * - * cdef inline float64_t __mul(float64_t a, float64_t b): - */ - if (unlikely(__pyx_v_b == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_r = (__pyx_v_a / __pyx_v_b); - goto __pyx_L0; - } - __pyx_L3:; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_WriteUnraisable("pandas.lib.sparse.__div"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":34 - * return a / b - * - * cdef inline float64_t __mul(float64_t a, float64_t b): # <<<<<<<<<<<<<< - * return a * b - * cdef inline float64_t __eq(float64_t a, float64_t b): - */ - -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_3lib_6sparse___mul(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) { - __pyx_t_5numpy_float64_t __pyx_r; - __Pyx_RefNannySetupContext("__mul"); - - /* "pandas/lib/src/sparse.pyx":35 - * - * cdef inline float64_t __mul(float64_t a, float64_t b): - * return a * b # <<<<<<<<<<<<<< - * cdef inline float64_t __eq(float64_t a, float64_t b): - * return a == b - */ - __pyx_r = (__pyx_v_a * __pyx_v_b); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":36 - * cdef inline float64_t __mul(float64_t a, float64_t b): - * return a * b - * cdef inline float64_t __eq(float64_t a, float64_t b): # <<<<<<<<<<<<<< - * return a == b - * cdef inline float64_t __ne(float64_t a, float64_t b): - */ - -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_3lib_6sparse___eq(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) { - __pyx_t_5numpy_float64_t __pyx_r; - __Pyx_RefNannySetupContext("__eq"); - - /* "pandas/lib/src/sparse.pyx":37 - * return a * b - * cdef inline float64_t __eq(float64_t a, float64_t b): - * return a == b # <<<<<<<<<<<<<< - * cdef inline float64_t __ne(float64_t a, float64_t b): - * return a != b - */ - __pyx_r = (__pyx_v_a == __pyx_v_b); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":38 - * cdef inline float64_t __eq(float64_t a, float64_t b): - * return a == b - * cdef inline float64_t __ne(float64_t a, float64_t b): # <<<<<<<<<<<<<< - * return a != b - * cdef inline float64_t __lt(float64_t a, float64_t b): - */ - -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_3lib_6sparse___ne(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) { - __pyx_t_5numpy_float64_t __pyx_r; - __Pyx_RefNannySetupContext("__ne"); - - /* "pandas/lib/src/sparse.pyx":39 - * return a == b - * cdef inline float64_t __ne(float64_t a, float64_t b): - * return a != b # <<<<<<<<<<<<<< - * cdef inline float64_t __lt(float64_t a, float64_t b): - * return a < b - */ - __pyx_r = (__pyx_v_a != __pyx_v_b); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":40 - * cdef inline float64_t __ne(float64_t a, float64_t b): - * return a != b - * cdef inline float64_t __lt(float64_t a, float64_t b): # <<<<<<<<<<<<<< - * return a < b - * cdef inline float64_t __gt(float64_t a, float64_t b): - */ - -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_3lib_6sparse___lt(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) { - __pyx_t_5numpy_float64_t __pyx_r; - __Pyx_RefNannySetupContext("__lt"); - - /* "pandas/lib/src/sparse.pyx":41 - * return a != b - * cdef inline float64_t __lt(float64_t a, float64_t b): - * return a < b # <<<<<<<<<<<<<< - * cdef inline float64_t __gt(float64_t a, float64_t b): - * return a > b - */ - __pyx_r = (__pyx_v_a < __pyx_v_b); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":42 - * cdef inline float64_t __lt(float64_t a, float64_t b): - * return a < b - * cdef inline float64_t __gt(float64_t a, float64_t b): # <<<<<<<<<<<<<< - * return a > b - * - */ - -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_3lib_6sparse___gt(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) { - __pyx_t_5numpy_float64_t __pyx_r; - __Pyx_RefNannySetupContext("__gt"); - - /* "pandas/lib/src/sparse.pyx":43 - * return a < b - * cdef inline float64_t __gt(float64_t a, float64_t b): - * return a > b # <<<<<<<<<<<<<< - * - * cdef inline float64_t __pow(float64_t a, float64_t b): - */ - __pyx_r = (__pyx_v_a > __pyx_v_b); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":45 - * return a > b - * - * cdef inline float64_t __pow(float64_t a, float64_t b): # <<<<<<<<<<<<<< - * # NaN - * if a != a or b != b: - */ - -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_3lib_6sparse___pow(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) { - __pyx_t_5numpy_float64_t __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - __Pyx_RefNannySetupContext("__pow"); - - /* "pandas/lib/src/sparse.pyx":47 - * cdef inline float64_t __pow(float64_t a, float64_t b): - * # NaN - * if a != a or b != b: # <<<<<<<<<<<<<< - * return NaN - * return a ** b - */ - __pyx_t_1 = (__pyx_v_a != __pyx_v_a); - if (!__pyx_t_1) { - __pyx_t_2 = (__pyx_v_b != __pyx_v_b); - __pyx_t_3 = __pyx_t_2; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (__pyx_t_3) { - - /* "pandas/lib/src/sparse.pyx":48 - * # NaN - * if a != a or b != b: - * return NaN # <<<<<<<<<<<<<< - * return a ** b - * - */ - __pyx_r = __pyx_v_6pandas_3lib_6sparse_NaN; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "pandas/lib/src/sparse.pyx":49 - * if a != a or b != b: - * return NaN - * return a ** b # <<<<<<<<<<<<<< - * - * ctypedef float64_t (* double_func)(float64_t a, float64_t b) - */ - __pyx_r = pow(__pyx_v_a, __pyx_v_b); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":59 - * Abstract superclass for sparse index types - * ''' - * def __init__(self): # <<<<<<<<<<<<<< - * raise NotImplementedError - * - */ - -static int __pyx_pf_6pandas_3lib_6sparse_11SparseIndex___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_6pandas_3lib_6sparse_11SparseIndex___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_r; - __Pyx_RefNannySetupContext("__init__"); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; - - /* "pandas/lib/src/sparse.pyx":60 - * ''' - * def __init__(self): - * raise NotImplementedError # <<<<<<<<<<<<<< - * - * cdef class IntIndex(SparseIndex): - */ - __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("pandas.lib.sparse.SparseIndex.__init__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":76 - * ndarray indices - * - * def __init__(self, pyst length, indices): # <<<<<<<<<<<<<< - * self.length = length - * self.indices = np.ascontiguousarray(indices, dtype=np.int32) - */ - -static int __pyx_pf_6pandas_3lib_6sparse_8IntIndex___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_6pandas_3lib_6sparse_8IntIndex___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_length; - PyObject *__pyx_v_indices = 0; - int __pyx_r; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__length,&__pyx_n_s__indices,0}; - __Pyx_RefNannySetupContext("__init__"); - 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__length); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indices); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_length = __Pyx_PyIndex_AsSsize_t(values[0]); if (unlikely((__pyx_v_length == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_indices = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_length = __Pyx_PyIndex_AsSsize_t(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_length == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_indices = PyTuple_GET_ITEM(__pyx_args, 1); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.__init__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - - /* "pandas/lib/src/sparse.pyx":77 - * - * def __init__(self, pyst length, indices): - * self.length = length # <<<<<<<<<<<<<< - * self.indices = np.ascontiguousarray(indices, dtype=np.int32) - * self.npoints = len(self.indices) - */ - ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->length = __pyx_v_length; - - /* "pandas/lib/src/sparse.pyx":78 - * def __init__(self, pyst length, indices): - * self.length = length - * self.indices = np.ascontiguousarray(indices, dtype=np.int32) # <<<<<<<<<<<<<< - * self.npoints = len(self.indices) - * - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_v_indices); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_indices); - __Pyx_GIVEREF(__pyx_v_indices); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_5); - __Pyx_GOTREF(((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->indices); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->indices)); - ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->indices = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; - - /* "pandas/lib/src/sparse.pyx":79 - * self.length = length - * self.indices = np.ascontiguousarray(indices, dtype=np.int32) - * self.npoints = len(self.indices) # <<<<<<<<<<<<<< - * - * def __reduce__(self): - */ - __pyx_t_5 = ((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->indices); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->npoints = __pyx_t_6; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.__init__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":81 - * self.npoints = len(self.indices) - * - * def __reduce__(self): # <<<<<<<<<<<<<< - * args = (self.length, self.indices) - * return (IntIndex, args) - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_1__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_1__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_v_args; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__reduce__"); - __pyx_v_args = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); - - /* "pandas/lib/src/sparse.pyx":82 - * - * def __reduce__(self): - * args = (self.length, self.indices) # <<<<<<<<<<<<<< - * return (IntIndex, args) - * - */ - __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->indices)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->indices)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->indices)); - __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_args)); - __pyx_v_args = __pyx_t_2; - __pyx_t_2 = 0; - - /* "pandas/lib/src/sparse.pyx":83 - * def __reduce__(self): - * args = (self.length, self.indices) - * return (IntIndex, args) # <<<<<<<<<<<<<< - * - * def __repr__(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6pandas_3lib_6sparse_IntIndex))); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)__pyx_ptype_6pandas_3lib_6sparse_IntIndex))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6pandas_3lib_6sparse_IntIndex))); - __Pyx_INCREF(((PyObject *)__pyx_v_args)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_args)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); - __pyx_r = ((PyObject *)__pyx_t_2); - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.__reduce__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_args); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":85 - * return (IntIndex, args) - * - * def __repr__(self): # <<<<<<<<<<<<<< - * output = 'IntIndex\n' - * output += 'Indices: %s\n' % repr(self.indices) - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_2__repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_2__repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_v_output; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__repr__"); - __pyx_v_output = Py_None; __Pyx_INCREF(Py_None); - - /* "pandas/lib/src/sparse.pyx":86 - * - * def __repr__(self): - * output = 'IntIndex\n' # <<<<<<<<<<<<<< - * output += 'Indices: %s\n' % repr(self.indices) - * return output - */ - __Pyx_INCREF(((PyObject *)__pyx_n_s_1)); - __Pyx_DECREF(__pyx_v_output); - __pyx_v_output = ((PyObject *)__pyx_n_s_1); - - /* "pandas/lib/src/sparse.pyx":87 - * def __repr__(self): - * output = 'IntIndex\n' - * output += 'Indices: %s\n' % repr(self.indices) # <<<<<<<<<<<<<< - * return output - * - */ - __pyx_t_1 = ((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->indices); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_output, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_output); - __pyx_v_output = __pyx_t_2; - __pyx_t_2 = 0; - - /* "pandas/lib/src/sparse.pyx":88 - * output = 'IntIndex\n' - * output += 'Indices: %s\n' % repr(self.indices) - * return output # <<<<<<<<<<<<<< - * - * def check_integrity(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_output); - __pyx_r = __pyx_v_output; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.__repr__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_output); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":90 - * return output - * - * def check_integrity(self): # <<<<<<<<<<<<<< - * ''' - * Only need be strictly ascending and nothing less than 0 or greater than - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_3check_integrity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_6pandas_3lib_6sparse_8IntIndex_3check_integrity[] = "\n Only need be strictly ascending and nothing less than 0 or greater than\n totall ength\n "; -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_3check_integrity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("check_integrity"); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":97 - * pass - * - * def equals(self, other): # <<<<<<<<<<<<<< - * if not isinstance(other, IntIndex): - * return False - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_4equals(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_4equals(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { - PyObject *__pyx_v_same_length; - PyObject *__pyx_v_same_indices; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("equals"); - __pyx_v_same_length = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_same_indices = Py_None; __Pyx_INCREF(Py_None); - - /* "pandas/lib/src/sparse.pyx":98 - * - * def equals(self, other): - * if not isinstance(other, IntIndex): # <<<<<<<<<<<<<< - * return False - * - */ - __pyx_t_1 = __pyx_v_other; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)((PyObject*)__pyx_ptype_6pandas_3lib_6sparse_IntIndex)); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __Pyx_TypeCheck(__pyx_t_1, __pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = (!__pyx_t_3); - if (__pyx_t_4) { - - /* "pandas/lib/src/sparse.pyx":99 - * def equals(self, other): - * if not isinstance(other, IntIndex): - * return False # <<<<<<<<<<<<<< - * - * if self is other: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - - /* "pandas/lib/src/sparse.pyx":101 - * return False - * - * if self is other: # <<<<<<<<<<<<<< - * return True - * - */ - __pyx_t_4 = (__pyx_v_self == __pyx_v_other); - if (__pyx_t_4) { - - /* "pandas/lib/src/sparse.pyx":102 - * - * if self is other: - * return True # <<<<<<<<<<<<<< - * - * same_length = self.length == other.length - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; - - /* "pandas/lib/src/sparse.pyx":104 - * return True - * - * same_length = self.length == other.length # <<<<<<<<<<<<<< - * same_indices = np.array_equal(self.indices, other.indices) - * return same_length and same_indices - */ - __pyx_t_2 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__length); 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_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __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_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_same_length); - __pyx_v_same_length = __pyx_t_5; - __pyx_t_5 = 0; - - /* "pandas/lib/src/sparse.pyx":105 - * - * same_length = self.length == other.length - * same_indices = np.array_equal(self.indices, other.indices) # <<<<<<<<<<<<<< - * return same_length and same_indices - * - */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__array_equal); 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); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__indices); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->indices)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->indices)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->indices)); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_same_indices); - __pyx_v_same_indices = __pyx_t_5; - __pyx_t_5 = 0; - - /* "pandas/lib/src/sparse.pyx":106 - * same_length = self.length == other.length - * same_indices = np.array_equal(self.indices, other.indices) - * return same_length and same_indices # <<<<<<<<<<<<<< - * - * def to_int_index(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_same_length); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_4) { - __Pyx_INCREF(__pyx_v_same_indices); - __pyx_t_5 = __pyx_v_same_indices; - } else { - __Pyx_INCREF(__pyx_v_same_length); - __pyx_t_5 = __pyx_v_same_length; - } - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.equals"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_same_length); - __Pyx_DECREF(__pyx_v_same_indices); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":108 - * return same_length and same_indices - * - * def to_int_index(self): # <<<<<<<<<<<<<< - * return self - * - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_5to_int_index(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_5to_int_index(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("to_int_index"); - - /* "pandas/lib/src/sparse.pyx":109 - * - * def to_int_index(self): - * return self # <<<<<<<<<<<<<< - * - * def to_block_index(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self); - __pyx_r = __pyx_v_self; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":111 - * return self - * - * def to_block_index(self): # <<<<<<<<<<<<<< - * locs, lens = get_blocks(self.indices) - * return BlockIndex(self.length, locs, lens) - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_6to_block_index(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_6to_block_index(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_v_locs; - PyObject *__pyx_v_lens; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("to_block_index"); - __pyx_v_locs = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_lens = Py_None; __Pyx_INCREF(Py_None); - - /* "pandas/lib/src/sparse.pyx":112 - * - * def to_block_index(self): - * locs, lens = get_blocks(self.indices) # <<<<<<<<<<<<<< - * return BlockIndex(self.length, locs, lens) - * - */ - __pyx_t_1 = ((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->indices); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_6pandas_3lib_6sparse_get_blocks(((PyArrayObject *)__pyx_t_1), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) { - PyObject* tuple = __pyx_t_2; - __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_locs); - __pyx_v_locs = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_lens); - __pyx_v_lens = __pyx_t_3; - __pyx_t_3 = 0; - } else { - __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_4, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_4, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_EndUnpack(__pyx_t_4, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_locs); - __pyx_v_locs = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_lens); - __pyx_v_lens = __pyx_t_3; - __pyx_t_3 = 0; - } - - /* "pandas/lib/src/sparse.pyx":113 - * def to_block_index(self): - * locs, lens = get_blocks(self.indices) - * return BlockIndex(self.length, locs, lens) # <<<<<<<<<<<<<< - * - * cpdef IntIndex intersect(self, SparseIndex y_): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_locs); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_locs); - __Pyx_GIVEREF(__pyx_v_locs); - __Pyx_INCREF(__pyx_v_lens); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_lens); - __Pyx_GIVEREF(__pyx_v_lens); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pandas_3lib_6sparse_BlockIndex)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.to_block_index"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_locs); - __Pyx_DECREF(__pyx_v_lens); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":115 - * return BlockIndex(self.length, locs, lens) - * - * cpdef IntIndex intersect(self, SparseIndex y_): # <<<<<<<<<<<<<< - * cdef: - * pyst out_length, xi, yi = 0 - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_7intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_y_); /*proto*/ -static struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_f_6pandas_3lib_6sparse_8IntIndex_intersect(struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_v_self, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_y_, int __pyx_skip_dispatch) { - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_xi; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_yi; - __pyx_t_5numpy_int32_t __pyx_v_xind; - PyArrayObject *__pyx_v_xindices; - PyArrayObject *__pyx_v_yindices; - PyObject *__pyx_v_new_list = 0; - struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_v_y; - Py_buffer __pyx_bstruct_yindices; - Py_ssize_t __pyx_bstride_0_yindices = 0; - Py_ssize_t __pyx_bshape_0_yindices = 0; - Py_buffer __pyx_bstruct_xindices; - Py_ssize_t __pyx_bstride_0_xindices = 0; - Py_ssize_t __pyx_bshape_0_xindices = 0; - struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyArrayObject *__pyx_t_5 = NULL; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_10; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_11; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_15; - __Pyx_RefNannySetupContext("intersect"); - __pyx_v_xindices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_yindices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_y = ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_xindices.buf = NULL; - __pyx_bstruct_yindices.buf = NULL; - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overriden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__intersect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_3lib_6sparse_8IntIndex_7intersect)) { - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)__pyx_v_y_)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_y_)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_y_)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pandas_3lib_6sparse_IntIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_t_3); - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "pandas/lib/src/sparse.pyx":117 - * cpdef IntIndex intersect(self, SparseIndex y_): - * cdef: - * pyst out_length, xi, yi = 0 # <<<<<<<<<<<<<< - * int32_t xind - * ndarray[int32_t, ndim=1] xindices, yindices - */ - __pyx_v_yi = 0; - - /* "pandas/lib/src/sparse.pyx":120 - * int32_t xind - * ndarray[int32_t, ndim=1] xindices, yindices - * list new_list = [] # <<<<<<<<<<<<<< - * IntIndex y - * - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_v_new_list = __pyx_t_1; - __pyx_t_1 = 0; - - /* "pandas/lib/src/sparse.pyx":124 - * - * # if is one already, returns self - * y = y_.to_int_index() # <<<<<<<<<<<<<< - * - * if self.length != y.length: - */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_y_), __pyx_n_s__to_int_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pandas_3lib_6sparse_IntIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_y)); - __pyx_v_y = ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "pandas/lib/src/sparse.pyx":126 - * y = y_.to_int_index() - * - * if self.length != y.length: # <<<<<<<<<<<<<< - * raise Exception('Indices must reference same underlying length') - * - */ - __pyx_t_4 = (__pyx_v_self->length != __pyx_v_y->length); - if (__pyx_t_4) { - - /* "pandas/lib/src/sparse.pyx":127 - * - * if self.length != y.length: - * raise Exception('Indices must reference same underlying length') # <<<<<<<<<<<<<< - * - * xindices = self.indices - */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; - } - __pyx_L3:; - - /* "pandas/lib/src/sparse.pyx":129 - * raise Exception('Indices must reference same underlying length') - * - * xindices = self.indices # <<<<<<<<<<<<<< - * yindices = y.indices - * - */ - __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->indices); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices); - __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xindices, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_6 < 0)) { - PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xindices, (PyObject*)__pyx_v_xindices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9); - } - } - __pyx_bstride_0_xindices = __pyx_bstruct_xindices.strides[0]; - __pyx_bshape_0_xindices = __pyx_bstruct_xindices.shape[0]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->indices)); - __Pyx_DECREF(((PyObject *)__pyx_v_xindices)); - __pyx_v_xindices = ((PyArrayObject *)__pyx_v_self->indices); - - /* "pandas/lib/src/sparse.pyx":130 - * - * xindices = self.indices - * yindices = y.indices # <<<<<<<<<<<<<< - * - * for xi from 0 <= xi < self.npoints: - */ - __pyx_t_5 = ((PyArrayObject *)__pyx_v_y->indices); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices); - __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_yindices, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_6 < 0)) { - PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_yindices, (PyObject*)__pyx_v_yindices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7); - } - } - __pyx_bstride_0_yindices = __pyx_bstruct_yindices.strides[0]; - __pyx_bshape_0_yindices = __pyx_bstruct_yindices.shape[0]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_y->indices)); - __Pyx_DECREF(((PyObject *)__pyx_v_yindices)); - __pyx_v_yindices = ((PyArrayObject *)__pyx_v_y->indices); - - /* "pandas/lib/src/sparse.pyx":132 - * yindices = y.indices - * - * for xi from 0 <= xi < self.npoints: # <<<<<<<<<<<<<< - * xind = xindices[xi] - * - */ - __pyx_t_10 = __pyx_v_self->npoints; - for (__pyx_v_xi = 0; __pyx_v_xi < __pyx_t_10; __pyx_v_xi++) { - - /* "pandas/lib/src/sparse.pyx":133 - * - * for xi from 0 <= xi < self.npoints: - * xind = xindices[xi] # <<<<<<<<<<<<<< - * - * while yi < y.npoints and yindices[yi] < xind: - */ - __pyx_t_11 = __pyx_v_xi; - __pyx_t_6 = -1; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_bshape_0_xindices; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_xindices)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_xind = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xindices.buf, __pyx_t_11, __pyx_bstride_0_xindices)); - - /* "pandas/lib/src/sparse.pyx":135 - * xind = xindices[xi] - * - * while yi < y.npoints and yindices[yi] < xind: # <<<<<<<<<<<<<< - * yi += 1 - * - */ - while (1) { - __pyx_t_4 = (__pyx_v_yi < __pyx_v_y->npoints); - if (__pyx_t_4) { - __pyx_t_12 = __pyx_v_yi; - __pyx_t_6 = -1; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_bshape_0_yindices; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_yindices)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yindices.buf, __pyx_t_12, __pyx_bstride_0_yindices)) < __pyx_v_xind); - __pyx_t_14 = __pyx_t_13; - } else { - __pyx_t_14 = __pyx_t_4; - } - if (!__pyx_t_14) break; - - /* "pandas/lib/src/sparse.pyx":136 - * - * while yi < y.npoints and yindices[yi] < xind: - * yi += 1 # <<<<<<<<<<<<<< - * - * if yi >= y.npoints: - */ - __pyx_v_yi = (__pyx_v_yi + 1); - } - - /* "pandas/lib/src/sparse.pyx":138 - * yi += 1 - * - * if yi >= y.npoints: # <<<<<<<<<<<<<< - * break - * - */ - __pyx_t_14 = (__pyx_v_yi >= __pyx_v_y->npoints); - if (__pyx_t_14) { - - /* "pandas/lib/src/sparse.pyx":139 - * - * if yi >= y.npoints: - * break # <<<<<<<<<<<<<< - * - * # TODO: would a two-pass algorithm be faster? - */ - goto __pyx_L5_break; - goto __pyx_L8; - } - __pyx_L8:; - - /* "pandas/lib/src/sparse.pyx":142 - * - * # TODO: would a two-pass algorithm be faster? - * if yindices[yi] == xind: # <<<<<<<<<<<<<< - * new_list.append(xind) - * - */ - __pyx_t_15 = __pyx_v_yi; - __pyx_t_6 = -1; - if (__pyx_t_15 < 0) { - __pyx_t_15 += __pyx_bshape_0_yindices; - if (unlikely(__pyx_t_15 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_yindices)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_14 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yindices.buf, __pyx_t_15, __pyx_bstride_0_yindices)) == __pyx_v_xind); - if (__pyx_t_14) { - - /* "pandas/lib/src/sparse.pyx":143 - * # TODO: would a two-pass algorithm be faster? - * if yindices[yi] == xind: - * new_list.append(xind) # <<<<<<<<<<<<<< - * - * return IntIndex(self.length, new_list) - */ - if (unlikely(__pyx_v_new_list == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_xind); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyList_Append(__pyx_v_new_list, __pyx_t_3); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L9; - } - __pyx_L9:; - } - __pyx_L5_break:; - - /* "pandas/lib/src/sparse.pyx":145 - * new_list.append(xind) - * - * return IntIndex(self.length, new_list) # <<<<<<<<<<<<<< - * - * cpdef IntIndex make_union(self, SparseIndex y_): - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_new_list)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_new_list)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_new_list)); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pandas_3lib_6sparse_IntIndex)), ((PyObject *)__pyx_t_1), NULL); 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_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_r = ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - - __pyx_r = ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.intersect"); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_xindices); - __Pyx_DECREF((PyObject *)__pyx_v_yindices); - __Pyx_XDECREF(__pyx_v_new_list); - __Pyx_DECREF((PyObject *)__pyx_v_y); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":115 - * return BlockIndex(self.length, locs, lens) - * - * cpdef IntIndex intersect(self, SparseIndex y_): # <<<<<<<<<<<<<< - * cdef: - * pyst out_length, xi, yi = 0 - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_7intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_y_); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_7intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_y_) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("intersect"); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "y_", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_v_y_; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_6pandas_3lib_6sparse_IntIndex *)((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->__pyx_vtab)->intersect(((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_1), 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.intersect"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":147 - * return IntIndex(self.length, new_list) - * - * cpdef IntIndex make_union(self, SparseIndex y_): # <<<<<<<<<<<<<< - * cdef: - * pyst out_length, i, xi, yi - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_8make_union(PyObject *__pyx_v_self, PyObject *__pyx_v_y_); /*proto*/ -static struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_f_6pandas_3lib_6sparse_8IntIndex_make_union(struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_v_self, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_y_, int __pyx_skip_dispatch) { - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_xi; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_yi; - __pyx_t_5numpy_int32_t __pyx_v_xind; - PyArrayObject *__pyx_v_xindices; - PyArrayObject *__pyx_v_yindices; - PyObject *__pyx_v_new_list = 0; - struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_v_x; - struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_v_y; - PyObject *__pyx_v_yind; - Py_buffer __pyx_bstruct_yindices; - Py_ssize_t __pyx_bstride_0_yindices = 0; - Py_ssize_t __pyx_bshape_0_yindices = 0; - Py_buffer __pyx_bstruct_xindices; - Py_ssize_t __pyx_bstride_0_xindices = 0; - Py_ssize_t __pyx_bshape_0_xindices = 0; - struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyArrayObject *__pyx_t_5 = NULL; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_10; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_11; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_12; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_13; - __Pyx_RefNannySetupContext("make_union"); - __pyx_v_xindices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_yindices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_x = ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_y = ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_yind = Py_None; __Pyx_INCREF(Py_None); - __pyx_bstruct_xindices.buf = NULL; - __pyx_bstruct_yindices.buf = NULL; - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overriden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__make_union); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_3lib_6sparse_8IntIndex_8make_union)) { - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)__pyx_v_y_)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_y_)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_y_)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pandas_3lib_6sparse_IntIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_t_3); - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "pandas/lib/src/sparse.pyx":152 - * int32_t xind - * ndarray[int32_t, ndim=1] xindices, yindices - * list new_list = [] # <<<<<<<<<<<<<< - * IntIndex x, y - * - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_v_new_list = __pyx_t_1; - __pyx_t_1 = 0; - - /* "pandas/lib/src/sparse.pyx":155 - * IntIndex x, y - * - * x = self # <<<<<<<<<<<<<< - * - * # if is one already, returns self - */ - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_DECREF(((PyObject *)__pyx_v_x)); - __pyx_v_x = __pyx_v_self; - - /* "pandas/lib/src/sparse.pyx":158 - * - * # if is one already, returns self - * y = y_.to_int_index() # <<<<<<<<<<<<<< - * - * if self.length != y.length: - */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_y_), __pyx_n_s__to_int_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pandas_3lib_6sparse_IntIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_y)); - __pyx_v_y = ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "pandas/lib/src/sparse.pyx":160 - * y = y_.to_int_index() - * - * if self.length != y.length: # <<<<<<<<<<<<<< - * raise Exception('Indices must reference same underlying length') - * - */ - __pyx_t_4 = (__pyx_v_self->length != __pyx_v_y->length); - if (__pyx_t_4) { - - /* "pandas/lib/src/sparse.pyx":161 - * - * if self.length != y.length: - * raise Exception('Indices must reference same underlying length') # <<<<<<<<<<<<<< - * - * xindices = self.indices - */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; - } - __pyx_L3:; - - /* "pandas/lib/src/sparse.pyx":163 - * raise Exception('Indices must reference same underlying length') - * - * xindices = self.indices # <<<<<<<<<<<<<< - * yindices = y.indices - * - */ - __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->indices); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices); - __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xindices, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_6 < 0)) { - PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xindices, (PyObject*)__pyx_v_xindices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9); - } - } - __pyx_bstride_0_xindices = __pyx_bstruct_xindices.strides[0]; - __pyx_bshape_0_xindices = __pyx_bstruct_xindices.shape[0]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->indices)); - __Pyx_DECREF(((PyObject *)__pyx_v_xindices)); - __pyx_v_xindices = ((PyArrayObject *)__pyx_v_self->indices); - - /* "pandas/lib/src/sparse.pyx":164 - * - * xindices = self.indices - * yindices = y.indices # <<<<<<<<<<<<<< - * - * xi = yi = 0 - */ - __pyx_t_5 = ((PyArrayObject *)__pyx_v_y->indices); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices); - __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_yindices, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_6 < 0)) { - PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_yindices, (PyObject*)__pyx_v_yindices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7); - } - } - __pyx_bstride_0_yindices = __pyx_bstruct_yindices.strides[0]; - __pyx_bshape_0_yindices = __pyx_bstruct_yindices.shape[0]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_y->indices)); - __Pyx_DECREF(((PyObject *)__pyx_v_yindices)); - __pyx_v_yindices = ((PyArrayObject *)__pyx_v_y->indices); - - /* "pandas/lib/src/sparse.pyx":166 - * yindices = y.indices - * - * xi = yi = 0 # <<<<<<<<<<<<<< - * while True: - * if xi == x.npoints: - */ - __pyx_v_xi = 0; - __pyx_v_yi = 0; - - /* "pandas/lib/src/sparse.pyx":167 - * - * xi = yi = 0 - * while True: # <<<<<<<<<<<<<< - * if xi == x.npoints: - * while yi < y.npoints: - */ - while (1) { - if (!1) break; - - /* "pandas/lib/src/sparse.pyx":168 - * xi = yi = 0 - * while True: - * if xi == x.npoints: # <<<<<<<<<<<<<< - * while yi < y.npoints: - * new_list.append(yindices[yi]) - */ - __pyx_t_4 = (__pyx_v_xi == __pyx_v_x->npoints); - if (__pyx_t_4) { - - /* "pandas/lib/src/sparse.pyx":169 - * while True: - * if xi == x.npoints: - * while yi < y.npoints: # <<<<<<<<<<<<<< - * new_list.append(yindices[yi]) - * yi += 1 - */ - while (1) { - __pyx_t_4 = (__pyx_v_yi < __pyx_v_y->npoints); - if (!__pyx_t_4) break; - - /* "pandas/lib/src/sparse.pyx":170 - * if xi == x.npoints: - * while yi < y.npoints: - * new_list.append(yindices[yi]) # <<<<<<<<<<<<<< - * yi += 1 - * break - */ - if (unlikely(__pyx_v_new_list == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_10 = __pyx_v_yi; - __pyx_t_6 = -1; - if (__pyx_t_10 < 0) { - __pyx_t_10 += __pyx_bshape_0_yindices; - if (unlikely(__pyx_t_10 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_yindices)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = __Pyx_PyInt_to_py_npy_int32((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yindices.buf, __pyx_t_10, __pyx_bstride_0_yindices))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyList_Append(__pyx_v_new_list, __pyx_t_3); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "pandas/lib/src/sparse.pyx":171 - * while yi < y.npoints: - * new_list.append(yindices[yi]) - * yi += 1 # <<<<<<<<<<<<<< - * break - * elif yi == y.npoints: - */ - __pyx_v_yi = (__pyx_v_yi + 1); - } - - /* "pandas/lib/src/sparse.pyx":172 - * new_list.append(yindices[yi]) - * yi += 1 - * break # <<<<<<<<<<<<<< - * elif yi == y.npoints: - * while xi < x.npoints: - */ - goto __pyx_L5_break; - goto __pyx_L6; - } - - /* "pandas/lib/src/sparse.pyx":173 - * yi += 1 - * break - * elif yi == y.npoints: # <<<<<<<<<<<<<< - * while xi < x.npoints: - * new_list.append(xindices[xi]) - */ - __pyx_t_4 = (__pyx_v_yi == __pyx_v_y->npoints); - if (__pyx_t_4) { - - /* "pandas/lib/src/sparse.pyx":174 - * break - * elif yi == y.npoints: - * while xi < x.npoints: # <<<<<<<<<<<<<< - * new_list.append(xindices[xi]) - * xi += 1 - */ - while (1) { - __pyx_t_4 = (__pyx_v_xi < __pyx_v_x->npoints); - if (!__pyx_t_4) break; - - /* "pandas/lib/src/sparse.pyx":175 - * elif yi == y.npoints: - * while xi < x.npoints: - * new_list.append(xindices[xi]) # <<<<<<<<<<<<<< - * xi += 1 - * break - */ - if (unlikely(__pyx_v_new_list == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_11 = __pyx_v_xi; - __pyx_t_6 = -1; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_bshape_0_xindices; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_xindices)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = __Pyx_PyInt_to_py_npy_int32((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xindices.buf, __pyx_t_11, __pyx_bstride_0_xindices))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyList_Append(__pyx_v_new_list, __pyx_t_3); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "pandas/lib/src/sparse.pyx":176 - * while xi < x.npoints: - * new_list.append(xindices[xi]) - * xi += 1 # <<<<<<<<<<<<<< - * break - * - */ - __pyx_v_xi = (__pyx_v_xi + 1); - } - - /* "pandas/lib/src/sparse.pyx":177 - * new_list.append(xindices[xi]) - * xi += 1 - * break # <<<<<<<<<<<<<< - * - * xind = xindices[xi] - */ - goto __pyx_L5_break; - goto __pyx_L6; - } - __pyx_L6:; - - /* "pandas/lib/src/sparse.pyx":179 - * break - * - * xind = xindices[xi] # <<<<<<<<<<<<<< - * yind = yindices[yi] - * - */ - __pyx_t_12 = __pyx_v_xi; - __pyx_t_6 = -1; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_bshape_0_xindices; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_xindices)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_xind = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xindices.buf, __pyx_t_12, __pyx_bstride_0_xindices)); - - /* "pandas/lib/src/sparse.pyx":180 - * - * xind = xindices[xi] - * yind = yindices[yi] # <<<<<<<<<<<<<< - * - * if xind == yind: - */ - __pyx_t_13 = __pyx_v_yi; - __pyx_t_6 = -1; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_bshape_0_yindices; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_yindices)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = __Pyx_PyInt_to_py_npy_int32((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yindices.buf, __pyx_t_13, __pyx_bstride_0_yindices))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_yind); - __pyx_v_yind = __pyx_t_3; - __pyx_t_3 = 0; - - /* "pandas/lib/src/sparse.pyx":182 - * yind = yindices[yi] - * - * if xind == yind: # <<<<<<<<<<<<<< - * new_list.append(xind) - * xi += 1 - */ - __pyx_t_3 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_xind); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_v_yind, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_4) { - - /* "pandas/lib/src/sparse.pyx":183 - * - * if xind == yind: - * new_list.append(xind) # <<<<<<<<<<<<<< - * xi += 1 - * yi += 1 - */ - if (unlikely(__pyx_v_new_list == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_xind); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyList_Append(__pyx_v_new_list, __pyx_t_1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "pandas/lib/src/sparse.pyx":184 - * if xind == yind: - * new_list.append(xind) - * xi += 1 # <<<<<<<<<<<<<< - * yi += 1 - * elif xind < yind: - */ - __pyx_v_xi = (__pyx_v_xi + 1); - - /* "pandas/lib/src/sparse.pyx":185 - * new_list.append(xind) - * xi += 1 - * yi += 1 # <<<<<<<<<<<<<< - * elif xind < yind: - * new_list.append(xind) - */ - __pyx_v_yi = (__pyx_v_yi + 1); - goto __pyx_L11; - } - - /* "pandas/lib/src/sparse.pyx":186 - * xi += 1 - * yi += 1 - * elif xind < yind: # <<<<<<<<<<<<<< - * new_list.append(xind) - * xi += 1 - */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_xind); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_v_yind, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_4) { - - /* "pandas/lib/src/sparse.pyx":187 - * yi += 1 - * elif xind < yind: - * new_list.append(xind) # <<<<<<<<<<<<<< - * xi += 1 - * else: - */ - if (unlikely(__pyx_v_new_list == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_xind); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyList_Append(__pyx_v_new_list, __pyx_t_3); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "pandas/lib/src/sparse.pyx":188 - * elif xind < yind: - * new_list.append(xind) - * xi += 1 # <<<<<<<<<<<<<< - * else: - * new_list.append(yind) - */ - __pyx_v_xi = (__pyx_v_xi + 1); - goto __pyx_L11; - } - /*else*/ { - - /* "pandas/lib/src/sparse.pyx":190 - * xi += 1 - * else: - * new_list.append(yind) # <<<<<<<<<<<<<< - * yi += 1 - * - */ - if (unlikely(__pyx_v_new_list == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_6 = PyList_Append(__pyx_v_new_list, __pyx_v_yind); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "pandas/lib/src/sparse.pyx":191 - * else: - * new_list.append(yind) - * yi += 1 # <<<<<<<<<<<<<< - * - * return IntIndex(x.length, new_list) - */ - __pyx_v_yi = (__pyx_v_yi + 1); - } - __pyx_L11:; - } - __pyx_L5_break:; - - /* "pandas/lib/src/sparse.pyx":193 - * yi += 1 - * - * return IntIndex(x.length, new_list) # <<<<<<<<<<<<<< - * - * @cython.wraparound(False) - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_x->length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_new_list)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_new_list)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_new_list)); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pandas_3lib_6sparse_IntIndex)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_r = ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - - __pyx_r = ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.make_union"); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_xindices); - __Pyx_DECREF((PyObject *)__pyx_v_yindices); - __Pyx_XDECREF(__pyx_v_new_list); - __Pyx_DECREF((PyObject *)__pyx_v_x); - __Pyx_DECREF((PyObject *)__pyx_v_y); - __Pyx_DECREF(__pyx_v_yind); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":147 - * return IntIndex(self.length, new_list) - * - * cpdef IntIndex make_union(self, SparseIndex y_): # <<<<<<<<<<<<<< - * cdef: - * pyst out_length, i, xi, yi - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_8make_union(PyObject *__pyx_v_self, PyObject *__pyx_v_y_); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_8make_union(PyObject *__pyx_v_self, PyObject *__pyx_v_y_) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("make_union"); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "y_", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_v_y_; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_6pandas_3lib_6sparse_IntIndex *)((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->__pyx_vtab)->make_union(((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_1), 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.make_union"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":196 - * - * @cython.wraparound(False) - * cpdef lookup(self, pyst index): # <<<<<<<<<<<<<< - * cdef: - * pyst res, n, cum_len = 0 - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_9lookup(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_8IntIndex_lookup(struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_v_self, __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_index, int __pyx_skip_dispatch) { - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_res; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_cum_len; - PyArrayObject *__pyx_v_inds; - Py_buffer __pyx_bstruct_inds; - Py_ssize_t __pyx_bstride_0_inds = 0; - Py_ssize_t __pyx_bshape_0_inds = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyArrayObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_9; - int __pyx_t_10; - __Pyx_RefNannySetupContext("lookup"); - __pyx_v_inds = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_inds.buf = NULL; - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overriden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__lookup); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_3lib_6sparse_8IntIndex_9lookup)) { - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "pandas/lib/src/sparse.pyx":198 - * cpdef lookup(self, pyst index): - * cdef: - * pyst res, n, cum_len = 0 # <<<<<<<<<<<<<< - * ndarray[int32_t, ndim=1] inds - * - */ - __pyx_v_cum_len = 0; - - /* "pandas/lib/src/sparse.pyx":201 - * ndarray[int32_t, ndim=1] inds - * - * inds = self.indices # <<<<<<<<<<<<<< - * res = inds.searchsorted(index) - * if res == self.npoints: - */ - __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->indices); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inds); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_inds, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_5 < 0)) { - PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_inds, (PyObject*)__pyx_v_inds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8); - } - } - __pyx_bstride_0_inds = __pyx_bstruct_inds.strides[0]; - __pyx_bshape_0_inds = __pyx_bstruct_inds.shape[0]; - if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->indices)); - __Pyx_DECREF(((PyObject *)__pyx_v_inds)); - __pyx_v_inds = ((PyArrayObject *)__pyx_v_self->indices); - - /* "pandas/lib/src/sparse.pyx":202 - * - * inds = self.indices - * res = inds.searchsorted(index) # <<<<<<<<<<<<<< - * if res == self.npoints: - * return -1 - */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_inds), __pyx_n_s__searchsorted); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_res = __pyx_t_9; - - /* "pandas/lib/src/sparse.pyx":203 - * inds = self.indices - * res = inds.searchsorted(index) - * if res == self.npoints: # <<<<<<<<<<<<<< - * return -1 - * elif inds[res] == index: - */ - __pyx_t_10 = (__pyx_v_res == __pyx_v_self->npoints); - if (__pyx_t_10) { - - /* "pandas/lib/src/sparse.pyx":204 - * res = inds.searchsorted(index) - * if res == self.npoints: - * return -1 # <<<<<<<<<<<<<< - * elif inds[res] == index: - * return res - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_neg_1); - __pyx_r = __pyx_int_neg_1; - goto __pyx_L0; - goto __pyx_L3; - } - - /* "pandas/lib/src/sparse.pyx":205 - * if res == self.npoints: - * return -1 - * elif inds[res] == index: # <<<<<<<<<<<<<< - * return res - * else: - */ - __pyx_t_9 = __pyx_v_res; - __pyx_t_5 = -1; - if (__pyx_t_9 < 0) { - __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_inds)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_10 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_inds.buf, __pyx_t_9, __pyx_bstride_0_inds)) == __pyx_v_index); - if (__pyx_t_10) { - - /* "pandas/lib/src/sparse.pyx":206 - * return -1 - * elif inds[res] == index: - * return res # <<<<<<<<<<<<<< - * else: - * return -1 - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_res); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - goto __pyx_L3; - } - /*else*/ { - - /* "pandas/lib/src/sparse.pyx":208 - * return res - * else: - * return -1 # <<<<<<<<<<<<<< - * - * cpdef ndarray reindex(self, ndarray[float64_t, ndim=1] values, - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_neg_1); - __pyx_r = __pyx_int_neg_1; - goto __pyx_L0; - } - __pyx_L3:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inds); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.lookup"); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inds); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_inds); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":196 - * - * @cython.wraparound(False) - * cpdef lookup(self, pyst index): # <<<<<<<<<<<<<< - * cdef: - * pyst res, n, cum_len = 0 - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_9lookup(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_9lookup(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) { - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_index; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("lookup"); - assert(__pyx_arg_index); { - __pyx_v_index = __Pyx_PyIndex_AsSsize_t(__pyx_arg_index); if (unlikely((__pyx_v_index == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.lookup"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_6pandas_3lib_6sparse_IntIndex *)((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->__pyx_vtab)->lookup(((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self), __pyx_v_index, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.lookup"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":210 - * return -1 - * - * cpdef ndarray reindex(self, ndarray[float64_t, ndim=1] values, # <<<<<<<<<<<<<< - * float64_t fill_value, SparseIndex other_): - * cdef: - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_10reindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyArrayObject *__pyx_f_6pandas_3lib_6sparse_8IntIndex_reindex(struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_v_self, PyArrayObject *__pyx_v_values, __pyx_t_5numpy_float64_t __pyx_v_fill_value, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_other_, int __pyx_skip_dispatch) { - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_i; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_j; - struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_v_other; - PyArrayObject *__pyx_v_result; - PyArrayObject *__pyx_v_sinds; - PyArrayObject *__pyx_v_oinds; - Py_buffer __pyx_bstruct_sinds; - Py_ssize_t __pyx_bstride_0_sinds = 0; - Py_ssize_t __pyx_bshape_0_sinds = 0; - Py_buffer __pyx_bstruct_oinds; - Py_ssize_t __pyx_bstride_0_oinds = 0; - Py_ssize_t __pyx_bshape_0_oinds = 0; - Py_buffer __pyx_bstruct_values; - Py_ssize_t __pyx_bstride_0_values = 0; - Py_ssize_t __pyx_bshape_0_values = 0; - Py_buffer __pyx_bstruct_result; - Py_ssize_t __pyx_bstride_0_result = 0; - Py_ssize_t __pyx_bshape_0_result = 0; - PyArrayObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyArrayObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_12; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_13; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_18; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_19; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_20; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_21; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_22; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_23; - __Pyx_RefNannySetupContext("reindex"); - __pyx_v_other = ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_sinds = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_oinds = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_result.buf = NULL; - __pyx_bstruct_sinds.buf = NULL; - __pyx_bstruct_oinds.buf = NULL; - __pyx_bstruct_values.buf = NULL; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_values = __pyx_bstruct_values.strides[0]; - __pyx_bshape_0_values = __pyx_bstruct_values.shape[0]; - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overriden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__reindex); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_3lib_6sparse_8IntIndex_10reindex)) { - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_fill_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_INCREF(((PyObject *)__pyx_v_values)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_values)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_values)); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_v_other_)); - PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_other_)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_other_)); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "pandas/lib/src/sparse.pyx":213 - * float64_t fill_value, SparseIndex other_): - * cdef: - * pyst i = 0, j = 0 # <<<<<<<<<<<<<< - * IntIndex other - * ndarray[float64_t, ndim=1] result - */ - __pyx_v_i = 0; - __pyx_v_j = 0; - - /* "pandas/lib/src/sparse.pyx":218 - * ndarray[int32_t, ndim=1] sinds, oinds - * - * other = other_.to_int_index() # <<<<<<<<<<<<<< - * - * oinds = other.indices - */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_other_), __pyx_n_s__to_int_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6pandas_3lib_6sparse_IntIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_other)); - __pyx_v_other = ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "pandas/lib/src/sparse.pyx":220 - * other = other_.to_int_index() - * - * oinds = other.indices # <<<<<<<<<<<<<< - * sinds = self.indices - * - */ - __pyx_t_4 = ((PyArrayObject *)__pyx_v_other->indices); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_oinds); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_oinds, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_5 < 0)) { - PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_oinds, (PyObject*)__pyx_v_oinds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8); - } - } - __pyx_bstride_0_oinds = __pyx_bstruct_oinds.strides[0]; - __pyx_bshape_0_oinds = __pyx_bstruct_oinds.shape[0]; - if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_other->indices)); - __Pyx_DECREF(((PyObject *)__pyx_v_oinds)); - __pyx_v_oinds = ((PyArrayObject *)__pyx_v_other->indices); - - /* "pandas/lib/src/sparse.pyx":221 - * - * oinds = other.indices - * sinds = self.indices # <<<<<<<<<<<<<< - * - * result = np.empty(other.npoints, dtype=np.float64) - */ - __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->indices); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sinds); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_sinds, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_5 < 0)) { - PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_sinds, (PyObject*)__pyx_v_sinds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6); - } - } - __pyx_bstride_0_sinds = __pyx_bstruct_sinds.strides[0]; - __pyx_bshape_0_sinds = __pyx_bstruct_sinds.shape[0]; - if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->indices)); - __Pyx_DECREF(((PyObject *)__pyx_v_sinds)); - __pyx_v_sinds = ((PyArrayObject *)__pyx_v_self->indices); - - /* "pandas/lib/src/sparse.pyx":223 - * sinds = self.indices - * - * result = np.empty(other.npoints, dtype=np.float64) # <<<<<<<<<<<<<< - * result.fill(fill_value) - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_other->npoints); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float64); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_11 = ((PyArrayObject *)__pyx_t_10); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_5 < 0)) { - PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8); - } - } - __pyx_bstride_0_result = __pyx_bstruct_result.strides[0]; - __pyx_bshape_0_result = __pyx_bstruct_result.shape[0]; - if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_11 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = ((PyArrayObject *)__pyx_t_10); - __pyx_t_10 = 0; - - /* "pandas/lib/src/sparse.pyx":224 - * - * result = np.empty(other.npoints, dtype=np.float64) - * result.fill(fill_value) # <<<<<<<<<<<<<< - * - * for 0 <= i < other.npoints: - */ - __pyx_t_10 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__fill); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_fill_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "pandas/lib/src/sparse.pyx":226 - * result.fill(fill_value) - * - * for 0 <= i < other.npoints: # <<<<<<<<<<<<<< - * while oinds[i] > sinds[j] and j < self.npoints: - * j += 1 - */ - __pyx_t_12 = __pyx_v_other->npoints; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_12; __pyx_v_i++) { - - /* "pandas/lib/src/sparse.pyx":227 - * - * for 0 <= i < other.npoints: - * while oinds[i] > sinds[j] and j < self.npoints: # <<<<<<<<<<<<<< - * j += 1 - * - */ - while (1) { - __pyx_t_13 = __pyx_v_i; - __pyx_t_5 = -1; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_bshape_0_oinds; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_oinds)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_14 = __pyx_v_j; - __pyx_t_5 = -1; - if (__pyx_t_14 < 0) { - __pyx_t_14 += __pyx_bshape_0_sinds; - if (unlikely(__pyx_t_14 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_sinds)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_oinds.buf, __pyx_t_13, __pyx_bstride_0_oinds)) > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_sinds.buf, __pyx_t_14, __pyx_bstride_0_sinds))); - if (__pyx_t_15) { - __pyx_t_16 = (__pyx_v_j < __pyx_v_self->npoints); - __pyx_t_17 = __pyx_t_16; - } else { - __pyx_t_17 = __pyx_t_15; - } - if (!__pyx_t_17) break; - - /* "pandas/lib/src/sparse.pyx":228 - * for 0 <= i < other.npoints: - * while oinds[i] > sinds[j] and j < self.npoints: - * j += 1 # <<<<<<<<<<<<<< - * - * if j == self.npoints: - */ - __pyx_v_j = (__pyx_v_j + 1); - } - - /* "pandas/lib/src/sparse.pyx":230 - * j += 1 - * - * if j == self.npoints: # <<<<<<<<<<<<<< - * break - * - */ - __pyx_t_17 = (__pyx_v_j == __pyx_v_self->npoints); - if (__pyx_t_17) { - - /* "pandas/lib/src/sparse.pyx":231 - * - * if j == self.npoints: - * break # <<<<<<<<<<<<<< - * - * if oinds[i] < sinds[j]: - */ - goto __pyx_L4_break; - goto __pyx_L7; - } - __pyx_L7:; - - /* "pandas/lib/src/sparse.pyx":233 - * break - * - * if oinds[i] < sinds[j]: # <<<<<<<<<<<<<< - * continue - * elif oinds[i] == sinds[j]: - */ - __pyx_t_18 = __pyx_v_i; - __pyx_t_5 = -1; - if (__pyx_t_18 < 0) { - __pyx_t_18 += __pyx_bshape_0_oinds; - if (unlikely(__pyx_t_18 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_oinds)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_19 = __pyx_v_j; - __pyx_t_5 = -1; - if (__pyx_t_19 < 0) { - __pyx_t_19 += __pyx_bshape_0_sinds; - if (unlikely(__pyx_t_19 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_19 >= __pyx_bshape_0_sinds)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_17 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_oinds.buf, __pyx_t_18, __pyx_bstride_0_oinds)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_sinds.buf, __pyx_t_19, __pyx_bstride_0_sinds))); - if (__pyx_t_17) { - - /* "pandas/lib/src/sparse.pyx":234 - * - * if oinds[i] < sinds[j]: - * continue # <<<<<<<<<<<<<< - * elif oinds[i] == sinds[j]: - * result[i] = values[j] - */ - goto __pyx_L3_continue; - goto __pyx_L8; - } - - /* "pandas/lib/src/sparse.pyx":235 - * if oinds[i] < sinds[j]: - * continue - * elif oinds[i] == sinds[j]: # <<<<<<<<<<<<<< - * result[i] = values[j] - * j += 1 - */ - __pyx_t_20 = __pyx_v_i; - __pyx_t_5 = -1; - if (__pyx_t_20 < 0) { - __pyx_t_20 += __pyx_bshape_0_oinds; - if (unlikely(__pyx_t_20 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_20 >= __pyx_bshape_0_oinds)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_21 = __pyx_v_j; - __pyx_t_5 = -1; - if (__pyx_t_21 < 0) { - __pyx_t_21 += __pyx_bshape_0_sinds; - if (unlikely(__pyx_t_21 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_21 >= __pyx_bshape_0_sinds)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_17 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_oinds.buf, __pyx_t_20, __pyx_bstride_0_oinds)) == (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_sinds.buf, __pyx_t_21, __pyx_bstride_0_sinds))); - if (__pyx_t_17) { - - /* "pandas/lib/src/sparse.pyx":236 - * continue - * elif oinds[i] == sinds[j]: - * result[i] = values[j] # <<<<<<<<<<<<<< - * j += 1 - * - */ - __pyx_t_22 = __pyx_v_j; - __pyx_t_5 = -1; - if (__pyx_t_22 < 0) { - __pyx_t_22 += __pyx_bshape_0_values; - if (unlikely(__pyx_t_22 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_22 >= __pyx_bshape_0_values)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_23 = __pyx_v_i; - __pyx_t_5 = -1; - if (__pyx_t_23 < 0) { - __pyx_t_23 += __pyx_bshape_0_result; - if (unlikely(__pyx_t_23 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_23 >= __pyx_bshape_0_result)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_result.buf, __pyx_t_23, __pyx_bstride_0_result) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_values.buf, __pyx_t_22, __pyx_bstride_0_values)); - - /* "pandas/lib/src/sparse.pyx":237 - * elif oinds[i] == sinds[j]: - * result[i] = values[j] - * j += 1 # <<<<<<<<<<<<<< - * - * return result - */ - __pyx_v_j = (__pyx_v_j + 1); - goto __pyx_L8; - } - __pyx_L8:; - __pyx_L3_continue:; - } - __pyx_L4_break:; - - /* "pandas/lib/src/sparse.pyx":239 - * j += 1 - * - * return result # <<<<<<<<<<<<<< - * - * cpdef put(self, ndarray[float64_t, ndim=1] values, - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyArrayObject *)__pyx_v_result); - goto __pyx_L0; - - __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sinds); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_oinds); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.reindex"); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sinds); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_oinds); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_other); - __Pyx_DECREF((PyObject *)__pyx_v_result); - __Pyx_DECREF((PyObject *)__pyx_v_sinds); - __Pyx_DECREF((PyObject *)__pyx_v_oinds); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":210 - * return -1 - * - * cpdef ndarray reindex(self, ndarray[float64_t, ndim=1] values, # <<<<<<<<<<<<<< - * float64_t fill_value, SparseIndex other_): - * cdef: - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_10reindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_10reindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_values = 0; - __pyx_t_5numpy_float64_t __pyx_v_fill_value; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_other_ = 0; - Py_buffer __pyx_bstruct_values; - Py_ssize_t __pyx_bstride_0_values = 0; - Py_ssize_t __pyx_bshape_0_values = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__fill_value,&__pyx_n_s__other_,0}; - __Pyx_RefNannySetupContext("reindex"); - 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__values); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("reindex", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other_); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("reindex", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "reindex") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_values = ((PyArrayObject *)values[0]); - __pyx_v_fill_value = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fill_value == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_other_ = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[2]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_values = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_fill_value = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_fill_value == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_other_ = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 2)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("reindex", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.reindex"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_values.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other_), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "other_", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_values = __pyx_bstruct_values.strides[0]; - __pyx_bshape_0_values = __pyx_bstruct_values.shape[0]; - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_values); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_v_fill_value; - __pyx_t_3 = ((PyObject *)__pyx_v_other_); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_6pandas_3lib_6sparse_IntIndex *)((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->__pyx_vtab)->reindex(((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self), ((PyArrayObject *)__pyx_t_1), __pyx_t_2, ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_3), 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __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_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 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_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_values); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.reindex"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":241 - * return result - * - * cpdef put(self, ndarray[float64_t, ndim=1] values, # <<<<<<<<<<<<<< - * ndarray[int32_t, ndim=1] indices, object to_put): - * pass - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_11put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_8IntIndex_put(struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_v_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indices, PyObject *__pyx_v_to_put, int __pyx_skip_dispatch) { - Py_buffer __pyx_bstruct_indices; - Py_ssize_t __pyx_bstride_0_indices = 0; - Py_ssize_t __pyx_bshape_0_indices = 0; - Py_buffer __pyx_bstruct_values; - Py_ssize_t __pyx_bstride_0_values = 0; - Py_ssize_t __pyx_bshape_0_values = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("put"); - __pyx_bstruct_values.buf = NULL; - __pyx_bstruct_indices.buf = NULL; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_values = __pyx_bstruct_values.strides[0]; - __pyx_bshape_0_values = __pyx_bstruct_values.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0]; - __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0]; - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overriden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__put); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_3lib_6sparse_8IntIndex_11put)) { - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)__pyx_v_values)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_values)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_values)); - __Pyx_INCREF(((PyObject *)__pyx_v_indices)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_indices)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_indices)); - __Pyx_INCREF(__pyx_v_to_put); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_to_put); - __Pyx_GIVEREF(__pyx_v_to_put); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "pandas/lib/src/sparse.pyx":243 - * cpdef put(self, ndarray[float64_t, ndim=1] values, - * ndarray[int32_t, ndim=1] indices, object to_put): - * pass # <<<<<<<<<<<<<< - * - * cpdef take(self, ndarray[float64_t, ndim=1] values, - */ - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.put"); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":241 - * return result - * - * cpdef put(self, ndarray[float64_t, ndim=1] values, # <<<<<<<<<<<<<< - * ndarray[int32_t, ndim=1] indices, object to_put): - * pass - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_11put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_11put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_values = 0; - PyArrayObject *__pyx_v_indices = 0; - PyObject *__pyx_v_to_put = 0; - Py_buffer __pyx_bstruct_indices; - Py_ssize_t __pyx_bstride_0_indices = 0; - Py_ssize_t __pyx_bshape_0_indices = 0; - Py_buffer __pyx_bstruct_values; - Py_ssize_t __pyx_bstride_0_values = 0; - Py_ssize_t __pyx_bshape_0_values = 0; - PyObject *__pyx_r = NULL; - 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__values,&__pyx_n_s__indices,&__pyx_n_s__to_put,0}; - __Pyx_RefNannySetupContext("put"); - 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__values); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indices); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("put", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__to_put); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("put", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "put") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_values = ((PyArrayObject *)values[0]); - __pyx_v_indices = ((PyArrayObject *)values[1]); - __pyx_v_to_put = values[2]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_values = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_indices = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_to_put = PyTuple_GET_ITEM(__pyx_args, 2); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("put", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.put"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_values.buf = NULL; - __pyx_bstruct_indices.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_5numpy_ndarray, 1, "indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_values = __pyx_bstruct_values.strides[0]; - __pyx_bshape_0_values = __pyx_bstruct_values.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0]; - __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0]; - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_values); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_indices); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __pyx_v_to_put; - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = ((struct __pyx_vtabstruct_6pandas_3lib_6sparse_IntIndex *)((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->__pyx_vtab)->put(((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self), ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_2), __pyx_t_3, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __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(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 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); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.put"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":245 - * pass - * - * cpdef take(self, ndarray[float64_t, ndim=1] values, # <<<<<<<<<<<<<< - * ndarray[int32_t, ndim=1] indices): - * pass - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_12take(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_8IntIndex_take(struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_v_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indices, int __pyx_skip_dispatch) { - Py_buffer __pyx_bstruct_indices; - Py_ssize_t __pyx_bstride_0_indices = 0; - Py_ssize_t __pyx_bshape_0_indices = 0; - Py_buffer __pyx_bstruct_values; - Py_ssize_t __pyx_bstride_0_values = 0; - Py_ssize_t __pyx_bshape_0_values = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("take"); - __pyx_bstruct_values.buf = NULL; - __pyx_bstruct_indices.buf = NULL; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_values = __pyx_bstruct_values.strides[0]; - __pyx_bshape_0_values = __pyx_bstruct_values.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0]; - __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0]; - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overriden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__take); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_3lib_6sparse_8IntIndex_12take)) { - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)__pyx_v_values)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_values)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_values)); - __Pyx_INCREF(((PyObject *)__pyx_v_indices)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_indices)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_indices)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "pandas/lib/src/sparse.pyx":247 - * cpdef take(self, ndarray[float64_t, ndim=1] values, - * ndarray[int32_t, ndim=1] indices): - * pass # <<<<<<<<<<<<<< - * - * cpdef get_blocks(ndarray[int32_t, ndim=1] indices): - */ - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.take"); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":245 - * pass - * - * cpdef take(self, ndarray[float64_t, ndim=1] values, # <<<<<<<<<<<<<< - * ndarray[int32_t, ndim=1] indices): - * pass - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_12take(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_12take(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_values = 0; - PyArrayObject *__pyx_v_indices = 0; - Py_buffer __pyx_bstruct_indices; - Py_ssize_t __pyx_bstride_0_indices = 0; - Py_ssize_t __pyx_bshape_0_indices = 0; - Py_buffer __pyx_bstruct_values; - Py_ssize_t __pyx_bstride_0_values = 0; - Py_ssize_t __pyx_bshape_0_values = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indices,0}; - __Pyx_RefNannySetupContext("take"); - 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__indices); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("take", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "take") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_values = ((PyArrayObject *)values[0]); - __pyx_v_indices = ((PyArrayObject *)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_indices = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("take", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.take"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_values.buf = NULL; - __pyx_bstruct_indices.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_5numpy_ndarray, 1, "indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_values = __pyx_bstruct_values.strides[0]; - __pyx_bshape_0_values = __pyx_bstruct_values.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0]; - __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0]; - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_values); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_indices); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((struct __pyx_vtabstruct_6pandas_3lib_6sparse_IntIndex *)((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->__pyx_vtab)->take(((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self), ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_2), 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __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); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.take"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":73 - * ''' - * cdef readonly: - * pyst length, npoints # <<<<<<<<<<<<<< - * ndarray indices - * - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_6length___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_6length___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.length.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_7npoints___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_7npoints___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->npoints); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pandas.lib.sparse.IntIndex.npoints.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":74 - * cdef readonly: - * pyst length, npoints - * ndarray indices # <<<<<<<<<<<<<< - * - * def __init__(self, pyst length, indices): - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_7indices___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8IntIndex_7indices___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->indices)); - __pyx_r = ((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_v_self)->indices); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":249 - * pass - * - * cpdef get_blocks(ndarray[int32_t, ndim=1] indices): # <<<<<<<<<<<<<< - * cdef: - * pyst i, npoints - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_get_blocks(PyObject *__pyx_self, PyObject *__pyx_v_indices); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_get_blocks(PyArrayObject *__pyx_v_indices, int __pyx_skip_dispatch) { - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_i; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_npoints; - __pyx_t_5numpy_int32_t __pyx_v_block; - __pyx_t_5numpy_int32_t __pyx_v_length; - __pyx_t_5numpy_int32_t __pyx_v_cur; - __pyx_t_5numpy_int32_t __pyx_v_prev; - PyObject *__pyx_v_locs = 0; - PyObject *__pyx_v_lens = 0; - Py_buffer __pyx_bstruct_indices; - Py_ssize_t __pyx_bstride_0_indices = 0; - Py_ssize_t __pyx_bshape_0_indices = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - long __pyx_t_6; - int __pyx_t_7; - __pyx_t_5numpy_int32_t __pyx_t_8; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_9; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_10; - __Pyx_RefNannySetupContext("get_blocks"); - __pyx_bstruct_indices.buf = NULL; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0]; - __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0]; - - /* "pandas/lib/src/sparse.pyx":252 - * cdef: - * pyst i, npoints - * int32_t block, length = 1, cur, prev # <<<<<<<<<<<<<< - * list locs = [], lens = [] - * - */ - __pyx_v_length = 1; - - /* "pandas/lib/src/sparse.pyx":253 - * pyst i, npoints - * int32_t block, length = 1, cur, prev - * list locs = [], lens = [] # <<<<<<<<<<<<<< - * - * npoints = len(indices) - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_v_locs = __pyx_t_1; - __pyx_t_1 = 0; - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_v_lens = __pyx_t_1; - __pyx_t_1 = 0; - - /* "pandas/lib/src/sparse.pyx":255 - * list locs = [], lens = [] - * - * npoints = len(indices) # <<<<<<<<<<<<<< - * - * # just handle the special empty case separately - */ - __pyx_t_1 = ((PyObject *)__pyx_v_indices); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_npoints = __pyx_t_2; - - /* "pandas/lib/src/sparse.pyx":258 - * - * # just handle the special empty case separately - * if npoints == 0: # <<<<<<<<<<<<<< - * return [], [] - * - */ - __pyx_t_3 = (__pyx_v_npoints == 0); - if (__pyx_t_3) { - - /* "pandas/lib/src/sparse.pyx":259 - * # just handle the special empty case separately - * if npoints == 0: - * return [], [] # <<<<<<<<<<<<<< - * - * # TODO: two-pass algorithm faster? - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - __pyx_t_1 = 0; - __pyx_t_4 = 0; - __pyx_r = ((PyObject *)__pyx_t_5); - __pyx_t_5 = 0; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "pandas/lib/src/sparse.pyx":262 - * - * # TODO: two-pass algorithm faster? - * prev = block = indices[0] # <<<<<<<<<<<<<< - * for i from 1 <= i < npoints: - * cur = indices[i] - */ - __pyx_t_6 = 0; - __pyx_t_7 = -1; - if (__pyx_t_6 < 0) { - __pyx_t_6 += __pyx_bshape_0_indices; - if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_6 >= __pyx_bshape_0_indices)) __pyx_t_7 = 0; - if (unlikely(__pyx_t_7 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_7); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_8 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_indices.buf, __pyx_t_6, __pyx_bstride_0_indices)); - __pyx_v_prev = __pyx_t_8; - __pyx_v_block = __pyx_t_8; - - /* "pandas/lib/src/sparse.pyx":263 - * # TODO: two-pass algorithm faster? - * prev = block = indices[0] - * for i from 1 <= i < npoints: # <<<<<<<<<<<<<< - * cur = indices[i] - * if cur - prev > 1: - */ - __pyx_t_9 = __pyx_v_npoints; - for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_9; __pyx_v_i++) { - - /* "pandas/lib/src/sparse.pyx":264 - * prev = block = indices[0] - * for i from 1 <= i < npoints: - * cur = indices[i] # <<<<<<<<<<<<<< - * if cur - prev > 1: - * # new block - */ - __pyx_t_10 = __pyx_v_i; - __pyx_t_7 = -1; - if (__pyx_t_10 < 0) { - __pyx_t_10 += __pyx_bshape_0_indices; - if (unlikely(__pyx_t_10 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_indices)) __pyx_t_7 = 0; - if (unlikely(__pyx_t_7 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_7); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_cur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_indices.buf, __pyx_t_10, __pyx_bstride_0_indices)); - - /* "pandas/lib/src/sparse.pyx":265 - * for i from 1 <= i < npoints: - * cur = indices[i] - * if cur - prev > 1: # <<<<<<<<<<<<<< - * # new block - * locs.append(block) - */ - __pyx_t_3 = ((__pyx_v_cur - __pyx_v_prev) > 1); - if (__pyx_t_3) { - - /* "pandas/lib/src/sparse.pyx":267 - * if cur - prev > 1: - * # new block - * locs.append(block) # <<<<<<<<<<<<<< - * lens.append(length) - * block = cur - */ - if (unlikely(__pyx_v_locs == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_block); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyList_Append(__pyx_v_locs, __pyx_t_5); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "pandas/lib/src/sparse.pyx":268 - * # new block - * locs.append(block) - * lens.append(length) # <<<<<<<<<<<<<< - * block = cur - * length = 1 - */ - if (unlikely(__pyx_v_lens == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_length); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyList_Append(__pyx_v_lens, __pyx_t_5); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "pandas/lib/src/sparse.pyx":269 - * locs.append(block) - * lens.append(length) - * block = cur # <<<<<<<<<<<<<< - * length = 1 - * else: - */ - __pyx_v_block = __pyx_v_cur; - - /* "pandas/lib/src/sparse.pyx":270 - * lens.append(length) - * block = cur - * length = 1 # <<<<<<<<<<<<<< - * else: - * # same block, increment length - */ - __pyx_v_length = 1; - goto __pyx_L6; - } - /*else*/ { - - /* "pandas/lib/src/sparse.pyx":273 - * else: - * # same block, increment length - * length += 1 # <<<<<<<<<<<<<< - * - * prev = cur - */ - __pyx_v_length = (__pyx_v_length + 1); - } - __pyx_L6:; - - /* "pandas/lib/src/sparse.pyx":275 - * length += 1 - * - * prev = cur # <<<<<<<<<<<<<< - * - * locs.append(block) - */ - __pyx_v_prev = __pyx_v_cur; - } - - /* "pandas/lib/src/sparse.pyx":277 - * prev = cur - * - * locs.append(block) # <<<<<<<<<<<<<< - * lens.append(length) - * return locs, lens - */ - if (unlikely(__pyx_v_locs == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_block); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyList_Append(__pyx_v_locs, __pyx_t_5); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "pandas/lib/src/sparse.pyx":278 - * - * locs.append(block) - * lens.append(length) # <<<<<<<<<<<<<< - * return locs, lens - * - */ - if (unlikely(__pyx_v_lens == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_length); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyList_Append(__pyx_v_lens, __pyx_t_5); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "pandas/lib/src/sparse.pyx":279 - * locs.append(block) - * lens.append(length) - * return locs, lens # <<<<<<<<<<<<<< - * - * #------------------------------------------------------------------------------- - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(((PyObject *)__pyx_v_locs)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_locs)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_locs)); - __Pyx_INCREF(((PyObject *)__pyx_v_lens)); - PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_lens)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_lens)); - __pyx_r = ((PyObject *)__pyx_t_5); - __pyx_t_5 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.get_blocks"); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __pyx_L2:; - __Pyx_XDECREF(__pyx_v_locs); - __Pyx_XDECREF(__pyx_v_lens); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":249 - * pass - * - * cpdef get_blocks(ndarray[int32_t, ndim=1] indices): # <<<<<<<<<<<<<< - * cdef: - * pyst i, npoints - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_get_blocks(PyObject *__pyx_self, PyObject *__pyx_v_indices); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_get_blocks(PyObject *__pyx_self, PyObject *__pyx_v_indices) { - Py_buffer __pyx_bstruct_indices; - Py_ssize_t __pyx_bstride_0_indices = 0; - Py_ssize_t __pyx_bshape_0_indices = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("get_blocks"); - __pyx_self = __pyx_self; - __pyx_bstruct_indices.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_5numpy_ndarray, 1, "indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0]; - __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0]; - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_v_indices; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_6pandas_3lib_6sparse_get_blocks(((PyArrayObject *)__pyx_t_1), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.get_blocks"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":299 - * int32_t* locbuf, *lenbuf - * - * def __init__(self, length, blocs, blengths): # <<<<<<<<<<<<<< - * - * self.blocs = np.ascontiguousarray(blocs, dtype=np.int32) - */ - -static int __pyx_pf_6pandas_3lib_6sparse_10BlockIndex___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_6pandas_3lib_6sparse_10BlockIndex___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_length = 0; - PyObject *__pyx_v_blocs = 0; - PyObject *__pyx_v_blengths = 0; - int __pyx_r; - 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_t_6pandas_3lib_6sparse_pyst __pyx_t_6; - Py_ssize_t __pyx_t_7; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__length,&__pyx_n_s__blocs,&__pyx_n_s__blengths,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__length); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__blocs); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__blengths); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_length = values[0]; - __pyx_v_blocs = values[1]; - __pyx_v_blengths = values[2]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_length = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_blocs = PyTuple_GET_ITEM(__pyx_args, 1); - __pyx_v_blengths = 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[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.__init__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - - /* "pandas/lib/src/sparse.pyx":301 - * def __init__(self, length, blocs, blengths): - * - * self.blocs = np.ascontiguousarray(blocs, dtype=np.int32) # <<<<<<<<<<<<<< - * self.blengths = np.ascontiguousarray(blengths, dtype=np.int32) - * - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_v_blocs); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_blocs); - __Pyx_GIVEREF(__pyx_v_blocs); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_5); - __Pyx_GOTREF(((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blocs); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blocs)); - ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blocs = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; - - /* "pandas/lib/src/sparse.pyx":302 - * - * self.blocs = np.ascontiguousarray(blocs, dtype=np.int32) - * self.blengths = np.ascontiguousarray(blengths, dtype=np.int32) # <<<<<<<<<<<<<< - * - * # in case we need - */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(__pyx_v_blengths); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_blengths); - __Pyx_GIVEREF(__pyx_v_blengths); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_GOTREF(((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blengths); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blengths)); - ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blengths = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; - - /* "pandas/lib/src/sparse.pyx":305 - * - * # in case we need - * self.locbuf = self.blocs.data # <<<<<<<<<<<<<< - * self.lenbuf = self.blengths.data - * - */ - ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->locbuf = ((__pyx_t_5numpy_int32_t *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blocs->data); - - /* "pandas/lib/src/sparse.pyx":306 - * # in case we need - * self.locbuf = self.blocs.data - * self.lenbuf = self.blengths.data # <<<<<<<<<<<<<< - * - * self.length = length - */ - ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->lenbuf = ((__pyx_t_5numpy_int32_t *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blengths->data); - - /* "pandas/lib/src/sparse.pyx":308 - * self.lenbuf = self.blengths.data - * - * self.length = length # <<<<<<<<<<<<<< - * self.nblocks = len(self.blocs) - * self.npoints = self.blengths.sum() - */ - __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_length); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->length = __pyx_t_6; - - /* "pandas/lib/src/sparse.pyx":309 - * - * self.length = length - * self.nblocks = len(self.blocs) # <<<<<<<<<<<<<< - * self.npoints = self.blengths.sum() - * - */ - __pyx_t_4 = ((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blocs); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_7 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->nblocks = __pyx_t_7; - - /* "pandas/lib/src/sparse.pyx":310 - * self.length = length - * self.nblocks = len(self.blocs) - * self.npoints = self.blengths.sum() # <<<<<<<<<<<<<< - * - * # self.block_start = blocs - */ - __pyx_t_4 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blengths), __pyx_n_s__sum); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->npoints = __pyx_t_6; - - /* "pandas/lib/src/sparse.pyx":315 - * # self.block_end = blocs + blengths - * - * self.check_integrity() # <<<<<<<<<<<<<< - * - * def __reduce__(self): - */ - __pyx_t_1 = ((struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockIndex *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->__pyx_vtab)->check_integrity(((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.__init__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":317 - * self.check_integrity() - * - * def __reduce__(self): # <<<<<<<<<<<<<< - * args = (self.length, self.blocs, self.blengths) - * return (BlockIndex, args) - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_1__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_1__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_v_args; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__reduce__"); - __pyx_v_args = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); - - /* "pandas/lib/src/sparse.pyx":318 - * - * def __reduce__(self): - * args = (self.length, self.blocs, self.blengths) # <<<<<<<<<<<<<< - * return (BlockIndex, args) - * - */ - __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blocs)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blocs)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blocs)); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blengths)); - PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blengths)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blengths)); - __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_args)); - __pyx_v_args = __pyx_t_2; - __pyx_t_2 = 0; - - /* "pandas/lib/src/sparse.pyx":319 - * def __reduce__(self): - * args = (self.length, self.blocs, self.blengths) - * return (BlockIndex, args) # <<<<<<<<<<<<<< - * - * def __repr__(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6pandas_3lib_6sparse_BlockIndex))); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)__pyx_ptype_6pandas_3lib_6sparse_BlockIndex))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6pandas_3lib_6sparse_BlockIndex))); - __Pyx_INCREF(((PyObject *)__pyx_v_args)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_args)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); - __pyx_r = ((PyObject *)__pyx_t_2); - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.__reduce__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_args); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":321 - * return (BlockIndex, args) - * - * def __repr__(self): # <<<<<<<<<<<<<< - * output = 'BlockIndex\n' - * output += 'Block locations: %s\n' % repr(self.blocs) - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_2__repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_2__repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_v_output; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__repr__"); - __pyx_v_output = Py_None; __Pyx_INCREF(Py_None); - - /* "pandas/lib/src/sparse.pyx":322 - * - * def __repr__(self): - * output = 'BlockIndex\n' # <<<<<<<<<<<<<< - * output += 'Block locations: %s\n' % repr(self.blocs) - * output += 'Block lengths: %s' % repr(self.blengths) - */ - __Pyx_INCREF(((PyObject *)__pyx_n_s_6)); - __Pyx_DECREF(__pyx_v_output); - __pyx_v_output = ((PyObject *)__pyx_n_s_6); - - /* "pandas/lib/src/sparse.pyx":323 - * def __repr__(self): - * output = 'BlockIndex\n' - * output += 'Block locations: %s\n' % repr(self.blocs) # <<<<<<<<<<<<<< - * output += 'Block lengths: %s' % repr(self.blengths) - * - */ - __pyx_t_1 = ((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blocs); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_output, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_output); - __pyx_v_output = __pyx_t_2; - __pyx_t_2 = 0; - - /* "pandas/lib/src/sparse.pyx":324 - * output = 'BlockIndex\n' - * output += 'Block locations: %s\n' % repr(self.blocs) - * output += 'Block lengths: %s' % repr(self.blengths) # <<<<<<<<<<<<<< - * - * return output - */ - __pyx_t_2 = ((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blengths); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = PyObject_Repr(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_output, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_output); - __pyx_v_output = __pyx_t_1; - __pyx_t_1 = 0; - - /* "pandas/lib/src/sparse.pyx":326 - * output += 'Block lengths: %s' % repr(self.blengths) - * - * return output # <<<<<<<<<<<<<< - * - * cpdef check_integrity(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_output); - __pyx_r = __pyx_v_output; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.__repr__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_output); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":328 - * return output - * - * cpdef check_integrity(self): # <<<<<<<<<<<<<< - * ''' - * Check: - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_3check_integrity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_10BlockIndex_check_integrity(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_v_self, int __pyx_skip_dispatch) { - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_i; - PyArrayObject *__pyx_v_blocs; - PyArrayObject *__pyx_v_blengths; - Py_buffer __pyx_bstruct_blengths; - Py_ssize_t __pyx_bstride_0_blengths = 0; - Py_ssize_t __pyx_bshape_0_blengths = 0; - Py_buffer __pyx_bstruct_blocs; - Py_ssize_t __pyx_bstride_0_blocs = 0; - Py_ssize_t __pyx_bshape_0_blocs = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyArrayObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - int __pyx_t_10; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_11; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_12; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_13; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_14; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_15; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_16; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_17; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_18; - __Pyx_RefNannySetupContext("check_integrity"); - __pyx_v_blocs = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_blengths = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_blocs.buf = NULL; - __pyx_bstruct_blengths.buf = NULL; - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overriden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__check_integrity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_3check_integrity)) { - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "pandas/lib/src/sparse.pyx":339 - * ndarray[int32_t, ndim=1] blocs, blengths - * - * blocs = self.blocs # <<<<<<<<<<<<<< - * blengths = self.blengths - * - */ - __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->blocs); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_blocs); - __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_blocs, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_4 < 0)) { - PyErr_Fetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_blocs, (PyObject*)__pyx_v_blocs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_5, __pyx_t_6, __pyx_t_7); - } - } - __pyx_bstride_0_blocs = __pyx_bstruct_blocs.strides[0]; - __pyx_bshape_0_blocs = __pyx_bstruct_blocs.shape[0]; - if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->blocs)); - __Pyx_DECREF(((PyObject *)__pyx_v_blocs)); - __pyx_v_blocs = ((PyArrayObject *)__pyx_v_self->blocs); - - /* "pandas/lib/src/sparse.pyx":340 - * - * blocs = self.blocs - * blengths = self.blengths # <<<<<<<<<<<<<< - * - * if len(blocs) != len(blengths): - */ - __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->blengths); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_blengths); - __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_blengths, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_4 < 0)) { - PyErr_Fetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_blengths, (PyObject*)__pyx_v_blengths, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_7, __pyx_t_6, __pyx_t_5); - } - } - __pyx_bstride_0_blengths = __pyx_bstruct_blengths.strides[0]; - __pyx_bshape_0_blengths = __pyx_bstruct_blengths.shape[0]; - if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->blengths)); - __Pyx_DECREF(((PyObject *)__pyx_v_blengths)); - __pyx_v_blengths = ((PyArrayObject *)__pyx_v_self->blengths); - - /* "pandas/lib/src/sparse.pyx":342 - * blengths = self.blengths - * - * if len(blocs) != len(blengths): # <<<<<<<<<<<<<< - * raise ValueError('block bound arrays must be same length') - * - */ - __pyx_t_8 = PyObject_Length(((PyObject *)__pyx_v_blocs)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = PyObject_Length(((PyObject *)__pyx_v_blengths)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = (__pyx_t_8 != __pyx_t_9); - if (__pyx_t_10) { - - /* "pandas/lib/src/sparse.pyx":343 - * - * if len(blocs) != len(blengths): - * raise ValueError('block bound arrays must be same length') # <<<<<<<<<<<<<< - * - * for i from 0 <= i < self.nblocks: - */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; - } - __pyx_L3:; - - /* "pandas/lib/src/sparse.pyx":345 - * raise ValueError('block bound arrays must be same length') - * - * for i from 0 <= i < self.nblocks: # <<<<<<<<<<<<<< - * if i > 0: - * if blocs[i] <= blocs[i-1]: - */ - __pyx_t_11 = __pyx_v_self->nblocks; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_11; __pyx_v_i++) { - - /* "pandas/lib/src/sparse.pyx":346 - * - * for i from 0 <= i < self.nblocks: - * if i > 0: # <<<<<<<<<<<<<< - * if blocs[i] <= blocs[i-1]: - * raise ValueError('Locations not in ascending order') - */ - __pyx_t_10 = (__pyx_v_i > 0); - if (__pyx_t_10) { - - /* "pandas/lib/src/sparse.pyx":347 - * for i from 0 <= i < self.nblocks: - * if i > 0: - * if blocs[i] <= blocs[i-1]: # <<<<<<<<<<<<<< - * raise ValueError('Locations not in ascending order') - * - */ - __pyx_t_12 = __pyx_v_i; - __pyx_t_4 = -1; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_bshape_0_blocs; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_4 = 0; - } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_blocs)) __pyx_t_4 = 0; - if (unlikely(__pyx_t_4 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_4); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_13 = (__pyx_v_i - 1); - __pyx_t_4 = -1; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_bshape_0_blocs; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_4 = 0; - } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_blocs)) __pyx_t_4 = 0; - if (unlikely(__pyx_t_4 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_4); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_10 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_blocs.buf, __pyx_t_12, __pyx_bstride_0_blocs)) <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_blocs.buf, __pyx_t_13, __pyx_bstride_0_blocs))); - if (__pyx_t_10) { - - /* "pandas/lib/src/sparse.pyx":348 - * if i > 0: - * if blocs[i] <= blocs[i-1]: - * raise ValueError('Locations not in ascending order') # <<<<<<<<<<<<<< - * - * if i < self.nblocks - 1: - */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; - } - __pyx_L7:; - goto __pyx_L6; - } - __pyx_L6:; - - /* "pandas/lib/src/sparse.pyx":350 - * raise ValueError('Locations not in ascending order') - * - * if i < self.nblocks - 1: # <<<<<<<<<<<<<< - * if blocs[i] + blengths[i] > blocs[i + 1]: - * raise ValueError('Block %d overlaps' % i) - */ - __pyx_t_10 = (__pyx_v_i < (__pyx_v_self->nblocks - 1)); - if (__pyx_t_10) { - - /* "pandas/lib/src/sparse.pyx":351 - * - * if i < self.nblocks - 1: - * if blocs[i] + blengths[i] > blocs[i + 1]: # <<<<<<<<<<<<<< - * raise ValueError('Block %d overlaps' % i) - * else: - */ - __pyx_t_14 = __pyx_v_i; - __pyx_t_4 = -1; - if (__pyx_t_14 < 0) { - __pyx_t_14 += __pyx_bshape_0_blocs; - if (unlikely(__pyx_t_14 < 0)) __pyx_t_4 = 0; - } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_blocs)) __pyx_t_4 = 0; - if (unlikely(__pyx_t_4 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_4); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_15 = __pyx_v_i; - __pyx_t_4 = -1; - if (__pyx_t_15 < 0) { - __pyx_t_15 += __pyx_bshape_0_blengths; - if (unlikely(__pyx_t_15 < 0)) __pyx_t_4 = 0; - } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_blengths)) __pyx_t_4 = 0; - if (unlikely(__pyx_t_4 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_4); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_16 = (__pyx_v_i + 1); - __pyx_t_4 = -1; - if (__pyx_t_16 < 0) { - __pyx_t_16 += __pyx_bshape_0_blocs; - if (unlikely(__pyx_t_16 < 0)) __pyx_t_4 = 0; - } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_blocs)) __pyx_t_4 = 0; - if (unlikely(__pyx_t_4 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_4); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_10 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_blocs.buf, __pyx_t_14, __pyx_bstride_0_blocs)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_blengths.buf, __pyx_t_15, __pyx_bstride_0_blengths))) > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_blocs.buf, __pyx_t_16, __pyx_bstride_0_blocs))); - if (__pyx_t_10) { - - /* "pandas/lib/src/sparse.pyx":352 - * if i < self.nblocks - 1: - * if blocs[i] + blengths[i] > blocs[i + 1]: - * raise ValueError('Block %d overlaps' % i) # <<<<<<<<<<<<<< - * else: - * if blocs[i] + blengths[i] > self.length: - */ - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L9; - } - __pyx_L9:; - goto __pyx_L8; - } - /*else*/ { - - /* "pandas/lib/src/sparse.pyx":354 - * raise ValueError('Block %d overlaps' % i) - * else: - * if blocs[i] + blengths[i] > self.length: # <<<<<<<<<<<<<< - * raise ValueError('Block %d extends beyond end' % i) - * - */ - __pyx_t_17 = __pyx_v_i; - __pyx_t_4 = -1; - if (__pyx_t_17 < 0) { - __pyx_t_17 += __pyx_bshape_0_blocs; - if (unlikely(__pyx_t_17 < 0)) __pyx_t_4 = 0; - } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_blocs)) __pyx_t_4 = 0; - if (unlikely(__pyx_t_4 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_4); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_18 = __pyx_v_i; - __pyx_t_4 = -1; - if (__pyx_t_18 < 0) { - __pyx_t_18 += __pyx_bshape_0_blengths; - if (unlikely(__pyx_t_18 < 0)) __pyx_t_4 = 0; - } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_blengths)) __pyx_t_4 = 0; - if (unlikely(__pyx_t_4 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_4); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_10 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_blocs.buf, __pyx_t_17, __pyx_bstride_0_blocs)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_blengths.buf, __pyx_t_18, __pyx_bstride_0_blengths))) > __pyx_v_self->length); - if (__pyx_t_10) { - - /* "pandas/lib/src/sparse.pyx":355 - * else: - * if blocs[i] + blengths[i] > self.length: - * raise ValueError('Block %d extends beyond end' % i) # <<<<<<<<<<<<<< - * - * # no zero-length blocks - */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; - } - __pyx_L10:; - } - __pyx_L8:; - - /* "pandas/lib/src/sparse.pyx":358 - * - * # no zero-length blocks - * if self.blengths[i] == 0: # <<<<<<<<<<<<<< - * raise ValueError('Zero-length block %d' % i) - * - */ - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->blengths), __pyx_v_i, sizeof(__pyx_t_6pandas_3lib_6sparse_pyst), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_10) { - - /* "pandas/lib/src/sparse.pyx":359 - * # no zero-length blocks - * if self.blengths[i] == 0: - * raise ValueError('Zero-length block %d' % i) # <<<<<<<<<<<<<< - * - * def equals(self, other): - */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L11; - } - __pyx_L11:; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_blengths); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_blocs); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.check_integrity"); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_blengths); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_blocs); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_blocs); - __Pyx_DECREF((PyObject *)__pyx_v_blengths); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":328 - * return output - * - * cpdef check_integrity(self): # <<<<<<<<<<<<<< - * ''' - * Check: - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_3check_integrity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_6pandas_3lib_6sparse_10BlockIndex_3check_integrity[] = "\n Check:\n - Locations are in ascending order\n - No overlapping blocks\n - Blocks to not start after end of index, nor extend beyond end\n "; -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_3check_integrity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("check_integrity"); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockIndex *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->__pyx_vtab)->check_integrity(((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.check_integrity"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":361 - * raise ValueError('Zero-length block %d' % i) - * - * def equals(self, other): # <<<<<<<<<<<<<< - * if not isinstance(other, BlockIndex): - * return False - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_4equals(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_4equals(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { - PyObject *__pyx_v_same_length; - PyObject *__pyx_v_same_blocks; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("equals"); - __pyx_v_same_length = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_same_blocks = Py_None; __Pyx_INCREF(Py_None); - - /* "pandas/lib/src/sparse.pyx":362 - * - * def equals(self, other): - * if not isinstance(other, BlockIndex): # <<<<<<<<<<<<<< - * return False - * - */ - __pyx_t_1 = __pyx_v_other; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)((PyObject*)__pyx_ptype_6pandas_3lib_6sparse_BlockIndex)); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __Pyx_TypeCheck(__pyx_t_1, __pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = (!__pyx_t_3); - if (__pyx_t_4) { - - /* "pandas/lib/src/sparse.pyx":363 - * def equals(self, other): - * if not isinstance(other, BlockIndex): - * return False # <<<<<<<<<<<<<< - * - * if self is other: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - - /* "pandas/lib/src/sparse.pyx":365 - * return False - * - * if self is other: # <<<<<<<<<<<<<< - * return True - * - */ - __pyx_t_4 = (__pyx_v_self == __pyx_v_other); - if (__pyx_t_4) { - - /* "pandas/lib/src/sparse.pyx":366 - * - * if self is other: - * return True # <<<<<<<<<<<<<< - * - * same_length = self.length == other.length - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; - - /* "pandas/lib/src/sparse.pyx":368 - * return True - * - * same_length = self.length == other.length # <<<<<<<<<<<<<< - * same_blocks = (np.array_equal(self.blocs, other.blocs) and - * np.array_equal(self.blengths, other.blengths)) - */ - __pyx_t_2 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __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_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_same_length); - __pyx_v_same_length = __pyx_t_5; - __pyx_t_5 = 0; - - /* "pandas/lib/src/sparse.pyx":369 - * - * same_length = self.length == other.length - * same_blocks = (np.array_equal(self.blocs, other.blocs) and # <<<<<<<<<<<<<< - * np.array_equal(self.blengths, other.blengths)) - * return same_length and same_blocks - */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__array_equal); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__blocs); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blocs)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blocs)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blocs)); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_4) { - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "pandas/lib/src/sparse.pyx":370 - * same_length = self.length == other.length - * same_blocks = (np.array_equal(self.blocs, other.blocs) and - * np.array_equal(self.blengths, other.blengths)) # <<<<<<<<<<<<<< - * return same_length and same_blocks - * - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__array_equal); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__blengths); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blengths)); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blengths)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blengths)); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = __pyx_t_2; - __pyx_t_2 = 0; - } else { - __pyx_t_6 = __pyx_t_5; - __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_v_same_blocks); - __pyx_v_same_blocks = __pyx_t_6; - __pyx_t_6 = 0; - - /* "pandas/lib/src/sparse.pyx":371 - * same_blocks = (np.array_equal(self.blocs, other.blocs) and - * np.array_equal(self.blengths, other.blengths)) - * return same_length and same_blocks # <<<<<<<<<<<<<< - * - * def to_block_index(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_same_length); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_4) { - __Pyx_INCREF(__pyx_v_same_blocks); - __pyx_t_6 = __pyx_v_same_blocks; - } else { - __Pyx_INCREF(__pyx_v_same_length); - __pyx_t_6 = __pyx_v_same_length; - } - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.equals"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_same_length); - __Pyx_DECREF(__pyx_v_same_blocks); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":373 - * return same_length and same_blocks - * - * def to_block_index(self): # <<<<<<<<<<<<<< - * return self - * - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_5to_block_index(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_5to_block_index(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("to_block_index"); - - /* "pandas/lib/src/sparse.pyx":374 - * - * def to_block_index(self): - * return self # <<<<<<<<<<<<<< - * - * def to_int_index(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self); - __pyx_r = __pyx_v_self; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":376 - * return self - * - * def to_int_index(self): # <<<<<<<<<<<<<< - * cdef: - * pyst i = 0, j, b - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_6to_int_index(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_6to_int_index(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_i; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_j; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_b; - __pyx_t_5numpy_int32_t __pyx_v_offset; - PyArrayObject *__pyx_v_indices; - Py_buffer __pyx_bstruct_indices; - Py_ssize_t __pyx_bstride_0_indices = 0; - Py_ssize_t __pyx_bshape_0_indices = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_11; - __pyx_t_5numpy_int32_t __pyx_t_12; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_13; - __Pyx_RefNannySetupContext("to_int_index"); - __pyx_v_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_indices.buf = NULL; - - /* "pandas/lib/src/sparse.pyx":378 - * def to_int_index(self): - * cdef: - * pyst i = 0, j, b # <<<<<<<<<<<<<< - * int32_t offset - * ndarray[int32_t, ndim=1] indices - */ - __pyx_v_i = 0; - - /* "pandas/lib/src/sparse.pyx":382 - * ndarray[int32_t, ndim=1] indices - * - * indices = np.empty(self.npoints, dtype=np.int32) # <<<<<<<<<<<<<< - * - * for b from 0 <= b < self.nblocks: - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->npoints); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_7 < 0)) { - PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10); - } - } - __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0]; - __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0]; - if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_indices)); - __pyx_v_indices = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; - - /* "pandas/lib/src/sparse.pyx":384 - * indices = np.empty(self.npoints, dtype=np.int32) - * - * for b from 0 <= b < self.nblocks: # <<<<<<<<<<<<<< - * offset = self.locbuf[b] - * - */ - __pyx_t_11 = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->nblocks; - for (__pyx_v_b = 0; __pyx_v_b < __pyx_t_11; __pyx_v_b++) { - - /* "pandas/lib/src/sparse.pyx":385 - * - * for b from 0 <= b < self.nblocks: - * offset = self.locbuf[b] # <<<<<<<<<<<<<< - * - * for j from 0 <= j < self.lenbuf[b]: - */ - __pyx_v_offset = (((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->locbuf[__pyx_v_b]); - - /* "pandas/lib/src/sparse.pyx":387 - * offset = self.locbuf[b] - * - * for j from 0 <= j < self.lenbuf[b]: # <<<<<<<<<<<<<< - * indices[i] = offset + j - * i += 1 - */ - __pyx_t_12 = (((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->lenbuf[__pyx_v_b]); - for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_12; __pyx_v_j++) { - - /* "pandas/lib/src/sparse.pyx":388 - * - * for j from 0 <= j < self.lenbuf[b]: - * indices[i] = offset + j # <<<<<<<<<<<<<< - * i += 1 - * - */ - __pyx_t_13 = __pyx_v_i; - __pyx_t_7 = -1; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_bshape_0_indices; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_indices)) __pyx_t_7 = 0; - if (unlikely(__pyx_t_7 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_7); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_indices.buf, __pyx_t_13, __pyx_bstride_0_indices) = (__pyx_v_offset + __pyx_v_j); - - /* "pandas/lib/src/sparse.pyx":389 - * for j from 0 <= j < self.lenbuf[b]: - * indices[i] = offset + j - * i += 1 # <<<<<<<<<<<<<< - * - * return IntIndex(self.length, indices) - */ - __pyx_v_i = (__pyx_v_i + 1); - } - } - - /* "pandas/lib/src/sparse.pyx":391 - * i += 1 - * - * return IntIndex(self.length, indices) # <<<<<<<<<<<<<< - * - * cpdef BlockIndex intersect(self, SparseIndex other): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->length); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_v_indices)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_indices)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_indices)); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pandas_3lib_6sparse_IntIndex)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.to_int_index"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_indices); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":393 - * return IntIndex(self.length, indices) - * - * cpdef BlockIndex intersect(self, SparseIndex other): # <<<<<<<<<<<<<< - * ''' - * Intersect two BlockIndex objects - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_7intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_f_6pandas_3lib_6sparse_10BlockIndex_intersect(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_v_self, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_other, int __pyx_skip_dispatch) { - struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_v_y; - PyArrayObject *__pyx_v_xloc; - PyArrayObject *__pyx_v_xlen; - PyArrayObject *__pyx_v_yloc; - PyArrayObject *__pyx_v_ylen; - PyObject *__pyx_v_out_blocs = 0; - PyObject *__pyx_v_out_blengths = 0; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_xi; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_yi; - __pyx_t_5numpy_int32_t __pyx_v_cur_loc; - __pyx_t_5numpy_int32_t __pyx_v_cur_length; - __pyx_t_5numpy_int32_t __pyx_v_diff; - Py_buffer __pyx_bstruct_yloc; - Py_ssize_t __pyx_bstride_0_yloc = 0; - Py_ssize_t __pyx_bshape_0_yloc = 0; - Py_buffer __pyx_bstruct_xloc; - Py_ssize_t __pyx_bstride_0_xloc = 0; - Py_ssize_t __pyx_bshape_0_xloc = 0; - Py_buffer __pyx_bstruct_xlen; - Py_ssize_t __pyx_bstride_0_xlen = 0; - Py_ssize_t __pyx_bshape_0_xlen = 0; - Py_buffer __pyx_bstruct_ylen; - Py_ssize_t __pyx_bstride_0_ylen = 0; - Py_ssize_t __pyx_bshape_0_ylen = 0; - struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyArrayObject *__pyx_t_5 = NULL; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - int __pyx_t_10; - int __pyx_t_11; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_12; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_13; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_14; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_15; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_16; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_17; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_18; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_19; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_20; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_21; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_22; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_23; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_24; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_25; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_26; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_27; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_28; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_29; - __Pyx_RefNannySetupContext("intersect"); - __pyx_v_y = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_xloc = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_xlen = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_yloc = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_ylen = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_xloc.buf = NULL; - __pyx_bstruct_xlen.buf = NULL; - __pyx_bstruct_yloc.buf = NULL; - __pyx_bstruct_ylen.buf = NULL; - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overriden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__intersect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_7intersect)) { - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)__pyx_v_other)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_other)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_other)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pandas_3lib_6sparse_BlockIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_t_3); - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "pandas/lib/src/sparse.pyx":408 - * ndarray[int32_t, ndim=1] xloc, xlen, yloc, ylen - * - * list out_blocs = [] # <<<<<<<<<<<<<< - * list out_blengths = [] - * - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_v_out_blocs = __pyx_t_1; - __pyx_t_1 = 0; - - /* "pandas/lib/src/sparse.pyx":409 - * - * list out_blocs = [] - * list out_blengths = [] # <<<<<<<<<<<<<< - * - * pyst xi = 0, yi = 0 - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_v_out_blengths = __pyx_t_1; - __pyx_t_1 = 0; - - /* "pandas/lib/src/sparse.pyx":411 - * list out_blengths = [] - * - * pyst xi = 0, yi = 0 # <<<<<<<<<<<<<< - * int32_t cur_loc, cur_length, diff - * - */ - __pyx_v_xi = 0; - __pyx_v_yi = 0; - - /* "pandas/lib/src/sparse.pyx":414 - * int32_t cur_loc, cur_length, diff - * - * y = other.to_block_index() # <<<<<<<<<<<<<< - * - * if self.length != y.length: - */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_other), __pyx_n_s__to_block_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pandas_3lib_6sparse_BlockIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_y)); - __pyx_v_y = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "pandas/lib/src/sparse.pyx":416 - * y = other.to_block_index() - * - * if self.length != y.length: # <<<<<<<<<<<<<< - * raise Exception('Indices must reference same underlying length') - * - */ - __pyx_t_4 = (__pyx_v_self->length != __pyx_v_y->length); - if (__pyx_t_4) { - - /* "pandas/lib/src/sparse.pyx":417 - * - * if self.length != y.length: - * raise Exception('Indices must reference same underlying length') # <<<<<<<<<<<<<< - * - * xloc = self.blocs - */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; - } - __pyx_L3:; - - /* "pandas/lib/src/sparse.pyx":419 - * raise Exception('Indices must reference same underlying length') - * - * xloc = self.blocs # <<<<<<<<<<<<<< - * xlen = self.blengths - * yloc = y.blocs - */ - __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->blocs); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xloc); - __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xloc, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_6 < 0)) { - PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xloc, (PyObject*)__pyx_v_xloc, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9); - } - } - __pyx_bstride_0_xloc = __pyx_bstruct_xloc.strides[0]; - __pyx_bshape_0_xloc = __pyx_bstruct_xloc.shape[0]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->blocs)); - __Pyx_DECREF(((PyObject *)__pyx_v_xloc)); - __pyx_v_xloc = ((PyArrayObject *)__pyx_v_self->blocs); - - /* "pandas/lib/src/sparse.pyx":420 - * - * xloc = self.blocs - * xlen = self.blengths # <<<<<<<<<<<<<< - * yloc = y.blocs - * ylen = y.blengths - */ - __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->blengths); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xlen); - __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xlen, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_6 < 0)) { - PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xlen, (PyObject*)__pyx_v_xlen, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7); - } - } - __pyx_bstride_0_xlen = __pyx_bstruct_xlen.strides[0]; - __pyx_bshape_0_xlen = __pyx_bstruct_xlen.shape[0]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->blengths)); - __Pyx_DECREF(((PyObject *)__pyx_v_xlen)); - __pyx_v_xlen = ((PyArrayObject *)__pyx_v_self->blengths); - - /* "pandas/lib/src/sparse.pyx":421 - * xloc = self.blocs - * xlen = self.blengths - * yloc = y.blocs # <<<<<<<<<<<<<< - * ylen = y.blengths - * - */ - __pyx_t_5 = ((PyArrayObject *)__pyx_v_y->blocs); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yloc); - __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_yloc, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_6 < 0)) { - PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_yloc, (PyObject*)__pyx_v_yloc, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9); - } - } - __pyx_bstride_0_yloc = __pyx_bstruct_yloc.strides[0]; - __pyx_bshape_0_yloc = __pyx_bstruct_yloc.shape[0]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_y->blocs)); - __Pyx_DECREF(((PyObject *)__pyx_v_yloc)); - __pyx_v_yloc = ((PyArrayObject *)__pyx_v_y->blocs); - - /* "pandas/lib/src/sparse.pyx":422 - * xlen = self.blengths - * yloc = y.blocs - * ylen = y.blengths # <<<<<<<<<<<<<< - * - * while True: - */ - __pyx_t_5 = ((PyArrayObject *)__pyx_v_y->blengths); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ylen); - __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_ylen, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_6 < 0)) { - PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_ylen, (PyObject*)__pyx_v_ylen, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7); - } - } - __pyx_bstride_0_ylen = __pyx_bstruct_ylen.strides[0]; - __pyx_bshape_0_ylen = __pyx_bstruct_ylen.shape[0]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_y->blengths)); - __Pyx_DECREF(((PyObject *)__pyx_v_ylen)); - __pyx_v_ylen = ((PyArrayObject *)__pyx_v_y->blengths); - - /* "pandas/lib/src/sparse.pyx":424 - * ylen = y.blengths - * - * while True: # <<<<<<<<<<<<<< - * # we are done (or possibly never began) - * if xi >= self.nblocks or yi >= y.nblocks: - */ - while (1) { - if (!1) break; - - /* "pandas/lib/src/sparse.pyx":426 - * while True: - * # we are done (or possibly never began) - * if xi >= self.nblocks or yi >= y.nblocks: # <<<<<<<<<<<<<< - * break - * - */ - __pyx_t_4 = (__pyx_v_xi >= __pyx_v_self->nblocks); - if (!__pyx_t_4) { - __pyx_t_10 = (__pyx_v_yi >= __pyx_v_y->nblocks); - __pyx_t_11 = __pyx_t_10; - } else { - __pyx_t_11 = __pyx_t_4; - } - if (__pyx_t_11) { - - /* "pandas/lib/src/sparse.pyx":427 - * # we are done (or possibly never began) - * if xi >= self.nblocks or yi >= y.nblocks: - * break # <<<<<<<<<<<<<< - * - * # completely symmetric...would like to avoid code dup but oh well - */ - goto __pyx_L5_break; - goto __pyx_L6; - } - __pyx_L6:; - - /* "pandas/lib/src/sparse.pyx":430 - * - * # completely symmetric...would like to avoid code dup but oh well - * if xloc[xi] >= yloc[yi]: # <<<<<<<<<<<<<< - * cur_loc = xloc[xi] - * diff = xloc[xi] - yloc[yi] - */ - __pyx_t_12 = __pyx_v_xi; - __pyx_t_6 = -1; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_bshape_0_xloc; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_xloc)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_13 = __pyx_v_yi; - __pyx_t_6 = -1; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_bshape_0_yloc; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_yloc)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_11 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xloc.buf, __pyx_t_12, __pyx_bstride_0_xloc)) >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yloc.buf, __pyx_t_13, __pyx_bstride_0_yloc))); - if (__pyx_t_11) { - - /* "pandas/lib/src/sparse.pyx":431 - * # completely symmetric...would like to avoid code dup but oh well - * if xloc[xi] >= yloc[yi]: - * cur_loc = xloc[xi] # <<<<<<<<<<<<<< - * diff = xloc[xi] - yloc[yi] - * - */ - __pyx_t_14 = __pyx_v_xi; - __pyx_t_6 = -1; - if (__pyx_t_14 < 0) { - __pyx_t_14 += __pyx_bshape_0_xloc; - if (unlikely(__pyx_t_14 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_xloc)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_cur_loc = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xloc.buf, __pyx_t_14, __pyx_bstride_0_xloc)); - - /* "pandas/lib/src/sparse.pyx":432 - * if xloc[xi] >= yloc[yi]: - * cur_loc = xloc[xi] - * diff = xloc[xi] - yloc[yi] # <<<<<<<<<<<<<< - * - * if ylen[yi] <= diff: - */ - __pyx_t_15 = __pyx_v_xi; - __pyx_t_6 = -1; - if (__pyx_t_15 < 0) { - __pyx_t_15 += __pyx_bshape_0_xloc; - if (unlikely(__pyx_t_15 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_xloc)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_16 = __pyx_v_yi; - __pyx_t_6 = -1; - if (__pyx_t_16 < 0) { - __pyx_t_16 += __pyx_bshape_0_yloc; - if (unlikely(__pyx_t_16 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_yloc)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_diff = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xloc.buf, __pyx_t_15, __pyx_bstride_0_xloc)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yloc.buf, __pyx_t_16, __pyx_bstride_0_yloc))); - - /* "pandas/lib/src/sparse.pyx":434 - * diff = xloc[xi] - yloc[yi] - * - * if ylen[yi] <= diff: # <<<<<<<<<<<<<< - * # have to skip this block - * yi += 1 - */ - __pyx_t_17 = __pyx_v_yi; - __pyx_t_6 = -1; - if (__pyx_t_17 < 0) { - __pyx_t_17 += __pyx_bshape_0_ylen; - if (unlikely(__pyx_t_17 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_ylen)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_11 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_ylen.buf, __pyx_t_17, __pyx_bstride_0_ylen)) <= __pyx_v_diff); - if (__pyx_t_11) { - - /* "pandas/lib/src/sparse.pyx":436 - * if ylen[yi] <= diff: - * # have to skip this block - * yi += 1 # <<<<<<<<<<<<<< - * continue - * - */ - __pyx_v_yi = (__pyx_v_yi + 1); - - /* "pandas/lib/src/sparse.pyx":437 - * # have to skip this block - * yi += 1 - * continue # <<<<<<<<<<<<<< - * - * if ylen[yi] - diff < xlen[xi]: - */ - goto __pyx_L4_continue; - goto __pyx_L8; - } - __pyx_L8:; - - /* "pandas/lib/src/sparse.pyx":439 - * continue - * - * if ylen[yi] - diff < xlen[xi]: # <<<<<<<<<<<<<< - * # take end of y block, move onward - * cur_length = ylen[yi] - diff - */ - __pyx_t_18 = __pyx_v_yi; - __pyx_t_6 = -1; - if (__pyx_t_18 < 0) { - __pyx_t_18 += __pyx_bshape_0_ylen; - if (unlikely(__pyx_t_18 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_ylen)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_19 = __pyx_v_xi; - __pyx_t_6 = -1; - if (__pyx_t_19 < 0) { - __pyx_t_19 += __pyx_bshape_0_xlen; - if (unlikely(__pyx_t_19 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_19 >= __pyx_bshape_0_xlen)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_11 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_ylen.buf, __pyx_t_18, __pyx_bstride_0_ylen)) - __pyx_v_diff) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xlen.buf, __pyx_t_19, __pyx_bstride_0_xlen))); - if (__pyx_t_11) { - - /* "pandas/lib/src/sparse.pyx":441 - * if ylen[yi] - diff < xlen[xi]: - * # take end of y block, move onward - * cur_length = ylen[yi] - diff # <<<<<<<<<<<<<< - * yi += 1 - * else: - */ - __pyx_t_20 = __pyx_v_yi; - __pyx_t_6 = -1; - if (__pyx_t_20 < 0) { - __pyx_t_20 += __pyx_bshape_0_ylen; - if (unlikely(__pyx_t_20 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_20 >= __pyx_bshape_0_ylen)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_cur_length = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_ylen.buf, __pyx_t_20, __pyx_bstride_0_ylen)) - __pyx_v_diff); - - /* "pandas/lib/src/sparse.pyx":442 - * # take end of y block, move onward - * cur_length = ylen[yi] - diff - * yi += 1 # <<<<<<<<<<<<<< - * else: - * # take end of x block - */ - __pyx_v_yi = (__pyx_v_yi + 1); - goto __pyx_L9; - } - /*else*/ { - - /* "pandas/lib/src/sparse.pyx":445 - * else: - * # take end of x block - * cur_length = xlen[xi] # <<<<<<<<<<<<<< - * xi += 1 - * - */ - __pyx_t_21 = __pyx_v_xi; - __pyx_t_6 = -1; - if (__pyx_t_21 < 0) { - __pyx_t_21 += __pyx_bshape_0_xlen; - if (unlikely(__pyx_t_21 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_21 >= __pyx_bshape_0_xlen)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_cur_length = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xlen.buf, __pyx_t_21, __pyx_bstride_0_xlen)); - - /* "pandas/lib/src/sparse.pyx":446 - * # take end of x block - * cur_length = xlen[xi] - * xi += 1 # <<<<<<<<<<<<<< - * - * else: # xloc[xi] < yloc[yi] - */ - __pyx_v_xi = (__pyx_v_xi + 1); - } - __pyx_L9:; - goto __pyx_L7; - } - /*else*/ { - - /* "pandas/lib/src/sparse.pyx":449 - * - * else: # xloc[xi] < yloc[yi] - * cur_loc = yloc[yi] # <<<<<<<<<<<<<< - * diff = yloc[yi] - xloc[xi] - * - */ - __pyx_t_22 = __pyx_v_yi; - __pyx_t_6 = -1; - if (__pyx_t_22 < 0) { - __pyx_t_22 += __pyx_bshape_0_yloc; - if (unlikely(__pyx_t_22 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_22 >= __pyx_bshape_0_yloc)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_cur_loc = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yloc.buf, __pyx_t_22, __pyx_bstride_0_yloc)); - - /* "pandas/lib/src/sparse.pyx":450 - * else: # xloc[xi] < yloc[yi] - * cur_loc = yloc[yi] - * diff = yloc[yi] - xloc[xi] # <<<<<<<<<<<<<< - * - * if xlen[xi] <= diff: - */ - __pyx_t_23 = __pyx_v_yi; - __pyx_t_6 = -1; - if (__pyx_t_23 < 0) { - __pyx_t_23 += __pyx_bshape_0_yloc; - if (unlikely(__pyx_t_23 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_23 >= __pyx_bshape_0_yloc)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_24 = __pyx_v_xi; - __pyx_t_6 = -1; - if (__pyx_t_24 < 0) { - __pyx_t_24 += __pyx_bshape_0_xloc; - if (unlikely(__pyx_t_24 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_24 >= __pyx_bshape_0_xloc)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_diff = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yloc.buf, __pyx_t_23, __pyx_bstride_0_yloc)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xloc.buf, __pyx_t_24, __pyx_bstride_0_xloc))); - - /* "pandas/lib/src/sparse.pyx":452 - * diff = yloc[yi] - xloc[xi] - * - * if xlen[xi] <= diff: # <<<<<<<<<<<<<< - * # have to skip this block - * xi += 1 - */ - __pyx_t_25 = __pyx_v_xi; - __pyx_t_6 = -1; - if (__pyx_t_25 < 0) { - __pyx_t_25 += __pyx_bshape_0_xlen; - if (unlikely(__pyx_t_25 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_25 >= __pyx_bshape_0_xlen)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_11 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xlen.buf, __pyx_t_25, __pyx_bstride_0_xlen)) <= __pyx_v_diff); - if (__pyx_t_11) { - - /* "pandas/lib/src/sparse.pyx":454 - * if xlen[xi] <= diff: - * # have to skip this block - * xi += 1 # <<<<<<<<<<<<<< - * continue - * - */ - __pyx_v_xi = (__pyx_v_xi + 1); - - /* "pandas/lib/src/sparse.pyx":455 - * # have to skip this block - * xi += 1 - * continue # <<<<<<<<<<<<<< - * - * if xlen[xi] - diff < ylen[yi]: - */ - goto __pyx_L4_continue; - goto __pyx_L10; - } - __pyx_L10:; - - /* "pandas/lib/src/sparse.pyx":457 - * continue - * - * if xlen[xi] - diff < ylen[yi]: # <<<<<<<<<<<<<< - * # take end of x block, move onward - * cur_length = xlen[xi] - diff - */ - __pyx_t_26 = __pyx_v_xi; - __pyx_t_6 = -1; - if (__pyx_t_26 < 0) { - __pyx_t_26 += __pyx_bshape_0_xlen; - if (unlikely(__pyx_t_26 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_26 >= __pyx_bshape_0_xlen)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_27 = __pyx_v_yi; - __pyx_t_6 = -1; - if (__pyx_t_27 < 0) { - __pyx_t_27 += __pyx_bshape_0_ylen; - if (unlikely(__pyx_t_27 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_27 >= __pyx_bshape_0_ylen)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_11 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xlen.buf, __pyx_t_26, __pyx_bstride_0_xlen)) - __pyx_v_diff) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_ylen.buf, __pyx_t_27, __pyx_bstride_0_ylen))); - if (__pyx_t_11) { - - /* "pandas/lib/src/sparse.pyx":459 - * if xlen[xi] - diff < ylen[yi]: - * # take end of x block, move onward - * cur_length = xlen[xi] - diff # <<<<<<<<<<<<<< - * xi += 1 - * else: - */ - __pyx_t_28 = __pyx_v_xi; - __pyx_t_6 = -1; - if (__pyx_t_28 < 0) { - __pyx_t_28 += __pyx_bshape_0_xlen; - if (unlikely(__pyx_t_28 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_28 >= __pyx_bshape_0_xlen)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_cur_length = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xlen.buf, __pyx_t_28, __pyx_bstride_0_xlen)) - __pyx_v_diff); - - /* "pandas/lib/src/sparse.pyx":460 - * # take end of x block, move onward - * cur_length = xlen[xi] - diff - * xi += 1 # <<<<<<<<<<<<<< - * else: - * # take end of y block - */ - __pyx_v_xi = (__pyx_v_xi + 1); - goto __pyx_L11; - } - /*else*/ { - - /* "pandas/lib/src/sparse.pyx":463 - * else: - * # take end of y block - * cur_length = ylen[yi] # <<<<<<<<<<<<<< - * yi += 1 - * - */ - __pyx_t_29 = __pyx_v_yi; - __pyx_t_6 = -1; - if (__pyx_t_29 < 0) { - __pyx_t_29 += __pyx_bshape_0_ylen; - if (unlikely(__pyx_t_29 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_29 >= __pyx_bshape_0_ylen)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_cur_length = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_ylen.buf, __pyx_t_29, __pyx_bstride_0_ylen)); - - /* "pandas/lib/src/sparse.pyx":464 - * # take end of y block - * cur_length = ylen[yi] - * yi += 1 # <<<<<<<<<<<<<< - * - * out_blocs.append(cur_loc) - */ - __pyx_v_yi = (__pyx_v_yi + 1); - } - __pyx_L11:; - } - __pyx_L7:; - - /* "pandas/lib/src/sparse.pyx":466 - * yi += 1 - * - * out_blocs.append(cur_loc) # <<<<<<<<<<<<<< - * out_blengths.append(cur_length) - * - */ - if (unlikely(__pyx_v_out_blocs == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_cur_loc); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyList_Append(__pyx_v_out_blocs, __pyx_t_3); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "pandas/lib/src/sparse.pyx":467 - * - * out_blocs.append(cur_loc) - * out_blengths.append(cur_length) # <<<<<<<<<<<<<< - * - * return BlockIndex(self.length, out_blocs, out_blengths) - */ - if (unlikely(__pyx_v_out_blengths == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_cur_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyList_Append(__pyx_v_out_blengths, __pyx_t_3); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_L4_continue:; - } - __pyx_L5_break:; - - /* "pandas/lib/src/sparse.pyx":469 - * out_blengths.append(cur_length) - * - * return BlockIndex(self.length, out_blocs, out_blengths) # <<<<<<<<<<<<<< - * - * cpdef BlockIndex make_union(self, SparseIndex y): - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_out_blocs)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_out_blocs)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_out_blocs)); - __Pyx_INCREF(((PyObject *)__pyx_v_out_blengths)); - PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_out_blengths)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_out_blengths)); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pandas_3lib_6sparse_BlockIndex)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_r = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - - __pyx_r = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yloc); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xloc); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xlen); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ylen); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.intersect"); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yloc); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xloc); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xlen); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ylen); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_y); - __Pyx_DECREF((PyObject *)__pyx_v_xloc); - __Pyx_DECREF((PyObject *)__pyx_v_xlen); - __Pyx_DECREF((PyObject *)__pyx_v_yloc); - __Pyx_DECREF((PyObject *)__pyx_v_ylen); - __Pyx_XDECREF(__pyx_v_out_blocs); - __Pyx_XDECREF(__pyx_v_out_blengths); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":393 - * return IntIndex(self.length, indices) - * - * cpdef BlockIndex intersect(self, SparseIndex other): # <<<<<<<<<<<<<< - * ''' - * Intersect two BlockIndex objects - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_7intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static char __pyx_doc_6pandas_3lib_6sparse_10BlockIndex_7intersect[] = "\n Intersect two BlockIndex objects\n\n Parameters\n ----------\n\n Returns\n -------\n intersection : BlockIndex\n "; -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_7intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("intersect"); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_v_other; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockIndex *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->__pyx_vtab)->intersect(((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_1), 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.intersect"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":471 - * return BlockIndex(self.length, out_blocs, out_blengths) - * - * cpdef BlockIndex make_union(self, SparseIndex y): # <<<<<<<<<<<<<< - * ''' - * Combine together two BlockIndex objects, accepting indices if contained - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_8make_union(PyObject *__pyx_v_self, PyObject *__pyx_v_y); /*proto*/ -static struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_f_6pandas_3lib_6sparse_10BlockIndex_make_union(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_v_self, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_y, int __pyx_skip_dispatch) { - struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("make_union"); - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overriden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__make_union); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_8make_union)) { - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)__pyx_v_y)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_y)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_y)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pandas_3lib_6sparse_BlockIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_t_3); - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "pandas/lib/src/sparse.pyx":488 - * union : BlockIndex - * ''' - * return BlockUnion(self, y.to_block_index()).result # <<<<<<<<<<<<<< - * - * cpdef lookup(self, pyst index): - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_y), __pyx_n_s__to_block_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pandas_3lib_6sparse_BlockUnion)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockUnion *)__pyx_t_3)->__pyx_base.result)); - __pyx_r = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockUnion *)__pyx_t_3)->__pyx_base.result; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L0; - - __pyx_r = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.make_union"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":471 - * return BlockIndex(self.length, out_blocs, out_blengths) - * - * cpdef BlockIndex make_union(self, SparseIndex y): # <<<<<<<<<<<<<< - * ''' - * Combine together two BlockIndex objects, accepting indices if contained - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_8make_union(PyObject *__pyx_v_self, PyObject *__pyx_v_y); /*proto*/ -static char __pyx_doc_6pandas_3lib_6sparse_10BlockIndex_8make_union[] = "\n Combine together two BlockIndex objects, accepting indices if contained\n in one or the other\n\n Parameters\n ----------\n other : SparseIndex\n\n Notes\n -----\n union is a protected keyword in Cython, hence make_union\n\n Returns\n -------\n union : BlockIndex\n "; -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_8make_union(PyObject *__pyx_v_self, PyObject *__pyx_v_y) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("make_union"); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_v_y; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockIndex *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->__pyx_vtab)->make_union(((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_1), 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.make_union"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":490 - * return BlockUnion(self, y.to_block_index()).result - * - * cpdef lookup(self, pyst index): # <<<<<<<<<<<<<< - * ''' - * - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_9lookup(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_10BlockIndex_lookup(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_v_self, __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_index, int __pyx_skip_dispatch) { - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_i; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_cum_len; - PyArrayObject *__pyx_v_locs; - PyArrayObject *__pyx_v_lens; - Py_buffer __pyx_bstruct_lens; - Py_ssize_t __pyx_bstride_0_lens = 0; - Py_ssize_t __pyx_bshape_0_lens = 0; - Py_buffer __pyx_bstruct_locs; - Py_ssize_t __pyx_bstride_0_locs = 0; - Py_ssize_t __pyx_bshape_0_locs = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyArrayObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - long __pyx_t_10; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_11; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_12; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_13; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_17; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_18; - __Pyx_RefNannySetupContext("lookup"); - __pyx_v_locs = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_lens = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_locs.buf = NULL; - __pyx_bstruct_lens.buf = NULL; - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overriden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__lookup); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_9lookup)) { - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "pandas/lib/src/sparse.pyx":499 - * ndarray[int32_t, ndim=1] locs, lens - * - * locs = self.blocs # <<<<<<<<<<<<<< - * lens = self.blengths - * - */ - __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->blocs); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_locs); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_locs, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_5 < 0)) { - PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_locs, (PyObject*)__pyx_v_locs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8); - } - } - __pyx_bstride_0_locs = __pyx_bstruct_locs.strides[0]; - __pyx_bshape_0_locs = __pyx_bstruct_locs.shape[0]; - if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->blocs)); - __Pyx_DECREF(((PyObject *)__pyx_v_locs)); - __pyx_v_locs = ((PyArrayObject *)__pyx_v_self->blocs); - - /* "pandas/lib/src/sparse.pyx":500 - * - * locs = self.blocs - * lens = self.blengths # <<<<<<<<<<<<<< - * - * if self.nblocks == 0: - */ - __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->blengths); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_lens); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_lens, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_5 < 0)) { - PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_lens, (PyObject*)__pyx_v_lens, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6); - } - } - __pyx_bstride_0_lens = __pyx_bstruct_lens.strides[0]; - __pyx_bshape_0_lens = __pyx_bstruct_lens.shape[0]; - if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->blengths)); - __Pyx_DECREF(((PyObject *)__pyx_v_lens)); - __pyx_v_lens = ((PyArrayObject *)__pyx_v_self->blengths); - - /* "pandas/lib/src/sparse.pyx":502 - * lens = self.blengths - * - * if self.nblocks == 0: # <<<<<<<<<<<<<< - * return -1 - * elif index < locs[0]: - */ - __pyx_t_9 = (__pyx_v_self->nblocks == 0); - if (__pyx_t_9) { - - /* "pandas/lib/src/sparse.pyx":503 - * - * if self.nblocks == 0: - * return -1 # <<<<<<<<<<<<<< - * elif index < locs[0]: - * return -1 - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_neg_1); - __pyx_r = __pyx_int_neg_1; - goto __pyx_L0; - goto __pyx_L3; - } - - /* "pandas/lib/src/sparse.pyx":504 - * if self.nblocks == 0: - * return -1 - * elif index < locs[0]: # <<<<<<<<<<<<<< - * return -1 - * - */ - __pyx_t_10 = 0; - __pyx_t_5 = -1; - if (__pyx_t_10 < 0) { - __pyx_t_10 += __pyx_bshape_0_locs; - if (unlikely(__pyx_t_10 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_locs)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_9 = (__pyx_v_index < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_locs.buf, __pyx_t_10, __pyx_bstride_0_locs))); - if (__pyx_t_9) { - - /* "pandas/lib/src/sparse.pyx":505 - * return -1 - * elif index < locs[0]: - * return -1 # <<<<<<<<<<<<<< - * - * cum_len = 0 - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_neg_1); - __pyx_r = __pyx_int_neg_1; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "pandas/lib/src/sparse.pyx":507 - * return -1 - * - * cum_len = 0 # <<<<<<<<<<<<<< - * for i from 0 <= i < self.nblocks: - * if index >= locs[i] and index < locs[i] + lens[i]: - */ - __pyx_v_cum_len = 0; - - /* "pandas/lib/src/sparse.pyx":508 - * - * cum_len = 0 - * for i from 0 <= i < self.nblocks: # <<<<<<<<<<<<<< - * if index >= locs[i] and index < locs[i] + lens[i]: - * return cum_len + index - locs[i] - */ - __pyx_t_11 = __pyx_v_self->nblocks; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_11; __pyx_v_i++) { - - /* "pandas/lib/src/sparse.pyx":509 - * cum_len = 0 - * for i from 0 <= i < self.nblocks: - * if index >= locs[i] and index < locs[i] + lens[i]: # <<<<<<<<<<<<<< - * return cum_len + index - locs[i] - * cum_len += lens[i] - */ - __pyx_t_12 = __pyx_v_i; - __pyx_t_5 = -1; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_bshape_0_locs; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_locs)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_9 = (__pyx_v_index >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_locs.buf, __pyx_t_12, __pyx_bstride_0_locs))); - if (__pyx_t_9) { - __pyx_t_13 = __pyx_v_i; - __pyx_t_5 = -1; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_bshape_0_locs; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_locs)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_14 = __pyx_v_i; - __pyx_t_5 = -1; - if (__pyx_t_14 < 0) { - __pyx_t_14 += __pyx_bshape_0_lens; - if (unlikely(__pyx_t_14 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_lens)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_15 = (__pyx_v_index < ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_locs.buf, __pyx_t_13, __pyx_bstride_0_locs)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_lens.buf, __pyx_t_14, __pyx_bstride_0_lens)))); - __pyx_t_16 = __pyx_t_15; - } else { - __pyx_t_16 = __pyx_t_9; - } - if (__pyx_t_16) { - - /* "pandas/lib/src/sparse.pyx":510 - * for i from 0 <= i < self.nblocks: - * if index >= locs[i] and index < locs[i] + lens[i]: - * return cum_len + index - locs[i] # <<<<<<<<<<<<<< - * cum_len += lens[i] - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_17 = __pyx_v_i; - __pyx_t_5 = -1; - if (__pyx_t_17 < 0) { - __pyx_t_17 += __pyx_bshape_0_locs; - if (unlikely(__pyx_t_17 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_locs)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = PyInt_FromSsize_t(((__pyx_v_cum_len + __pyx_v_index) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_locs.buf, __pyx_t_17, __pyx_bstride_0_locs)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; - - /* "pandas/lib/src/sparse.pyx":511 - * if index >= locs[i] and index < locs[i] + lens[i]: - * return cum_len + index - locs[i] - * cum_len += lens[i] # <<<<<<<<<<<<<< - * - * return -1 - */ - __pyx_t_18 = __pyx_v_i; - __pyx_t_5 = -1; - if (__pyx_t_18 < 0) { - __pyx_t_18 += __pyx_bshape_0_lens; - if (unlikely(__pyx_t_18 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_lens)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_cum_len = (__pyx_v_cum_len + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_lens.buf, __pyx_t_18, __pyx_bstride_0_lens))); - } - - /* "pandas/lib/src/sparse.pyx":513 - * cum_len += lens[i] - * - * return -1 # <<<<<<<<<<<<<< - * - * cpdef ndarray reindex(self, ndarray[float64_t, ndim=1] values, - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_neg_1); - __pyx_r = __pyx_int_neg_1; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_lens); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_locs); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.lookup"); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_lens); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_locs); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_locs); - __Pyx_DECREF((PyObject *)__pyx_v_lens); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":490 - * return BlockUnion(self, y.to_block_index()).result - * - * cpdef lookup(self, pyst index): # <<<<<<<<<<<<<< - * ''' - * - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_9lookup(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/ -static char __pyx_doc_6pandas_3lib_6sparse_10BlockIndex_9lookup[] = "\n\n Returns -1 if not found\n "; -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_9lookup(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) { - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_index; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("lookup"); - assert(__pyx_arg_index); { - __pyx_v_index = __Pyx_PyIndex_AsSsize_t(__pyx_arg_index); if (unlikely((__pyx_v_index == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.lookup"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockIndex *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->__pyx_vtab)->lookup(((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self), __pyx_v_index, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.lookup"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":515 - * return -1 - * - * cpdef ndarray reindex(self, ndarray[float64_t, ndim=1] values, # <<<<<<<<<<<<<< - * float64_t fill_value, SparseIndex other_): - * cdef: - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_10reindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyArrayObject *__pyx_f_6pandas_3lib_6sparse_10BlockIndex_reindex(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_v_self, PyArrayObject *__pyx_v_values, __pyx_t_5numpy_float64_t __pyx_v_fill_value, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_other_, int __pyx_skip_dispatch) { - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_i; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_j; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_ocur; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_ocurlen; - struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_v_other; - PyArrayObject *__pyx_v_result; - PyArrayObject *__pyx_v_slocs; - PyArrayObject *__pyx_v_slens; - PyArrayObject *__pyx_v_olocs; - PyArrayObject *__pyx_v_olens; - Py_buffer __pyx_bstruct_olens; - Py_ssize_t __pyx_bstride_0_olens = 0; - Py_ssize_t __pyx_bshape_0_olens = 0; - Py_buffer __pyx_bstruct_olocs; - Py_ssize_t __pyx_bstride_0_olocs = 0; - Py_ssize_t __pyx_bshape_0_olocs = 0; - Py_buffer __pyx_bstruct_slocs; - Py_ssize_t __pyx_bstride_0_slocs = 0; - Py_ssize_t __pyx_bshape_0_slocs = 0; - Py_buffer __pyx_bstruct_values; - Py_ssize_t __pyx_bstride_0_values = 0; - Py_ssize_t __pyx_bshape_0_values = 0; - Py_buffer __pyx_bstruct_result; - Py_ssize_t __pyx_bstride_0_result = 0; - Py_ssize_t __pyx_bshape_0_result = 0; - Py_buffer __pyx_bstruct_slens; - Py_ssize_t __pyx_bstride_0_slens = 0; - Py_ssize_t __pyx_bshape_0_slens = 0; - PyArrayObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyArrayObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_12; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_13; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_14; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_15; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_16; - int __pyx_t_17; - __Pyx_RefNannySetupContext("reindex"); - __pyx_v_other = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_slocs = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_slens = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_olocs = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_olens = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_result.buf = NULL; - __pyx_bstruct_slocs.buf = NULL; - __pyx_bstruct_slens.buf = NULL; - __pyx_bstruct_olocs.buf = NULL; - __pyx_bstruct_olens.buf = NULL; - __pyx_bstruct_values.buf = NULL; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_values = __pyx_bstruct_values.strides[0]; - __pyx_bshape_0_values = __pyx_bstruct_values.shape[0]; - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overriden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__reindex); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_10reindex)) { - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_fill_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_INCREF(((PyObject *)__pyx_v_values)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_values)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_values)); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_v_other_)); - PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_other_)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_other_)); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "pandas/lib/src/sparse.pyx":518 - * float64_t fill_value, SparseIndex other_): - * cdef: - * pyst i = 0, j = 0, ocur, ocurlen # <<<<<<<<<<<<<< - * BlockIndex other - * ndarray[float64_t, ndim=1] result - */ - __pyx_v_i = 0; - __pyx_v_j = 0; - - /* "pandas/lib/src/sparse.pyx":523 - * ndarray[int32_t, ndim=1] slocs, slens, olocs, olens - * - * other = other_.to_block_index() # <<<<<<<<<<<<<< - * - * olocs = other.blocs - */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_other_), __pyx_n_s__to_block_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6pandas_3lib_6sparse_BlockIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_other)); - __pyx_v_other = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "pandas/lib/src/sparse.pyx":525 - * other = other_.to_block_index() - * - * olocs = other.blocs # <<<<<<<<<<<<<< - * olens = other.blengths - * slocs = self.blocs - */ - __pyx_t_4 = ((PyArrayObject *)__pyx_v_other->blocs); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_olocs); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_olocs, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_5 < 0)) { - PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_olocs, (PyObject*)__pyx_v_olocs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8); - } - } - __pyx_bstride_0_olocs = __pyx_bstruct_olocs.strides[0]; - __pyx_bshape_0_olocs = __pyx_bstruct_olocs.shape[0]; - if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_other->blocs)); - __Pyx_DECREF(((PyObject *)__pyx_v_olocs)); - __pyx_v_olocs = ((PyArrayObject *)__pyx_v_other->blocs); - - /* "pandas/lib/src/sparse.pyx":526 - * - * olocs = other.blocs - * olens = other.blengths # <<<<<<<<<<<<<< - * slocs = self.blocs - * slens = self.blengths - */ - __pyx_t_4 = ((PyArrayObject *)__pyx_v_other->blengths); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_olens); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_olens, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_5 < 0)) { - PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_olens, (PyObject*)__pyx_v_olens, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6); - } - } - __pyx_bstride_0_olens = __pyx_bstruct_olens.strides[0]; - __pyx_bshape_0_olens = __pyx_bstruct_olens.shape[0]; - if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_other->blengths)); - __Pyx_DECREF(((PyObject *)__pyx_v_olens)); - __pyx_v_olens = ((PyArrayObject *)__pyx_v_other->blengths); - - /* "pandas/lib/src/sparse.pyx":527 - * olocs = other.blocs - * olens = other.blengths - * slocs = self.blocs # <<<<<<<<<<<<<< - * slens = self.blengths - * - */ - __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->blocs); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_slocs); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_slocs, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_5 < 0)) { - PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_slocs, (PyObject*)__pyx_v_slocs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8); - } - } - __pyx_bstride_0_slocs = __pyx_bstruct_slocs.strides[0]; - __pyx_bshape_0_slocs = __pyx_bstruct_slocs.shape[0]; - if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->blocs)); - __Pyx_DECREF(((PyObject *)__pyx_v_slocs)); - __pyx_v_slocs = ((PyArrayObject *)__pyx_v_self->blocs); - - /* "pandas/lib/src/sparse.pyx":528 - * olens = other.blengths - * slocs = self.blocs - * slens = self.blengths # <<<<<<<<<<<<<< - * - * result = np.empty(other.npoints, dtype=np.float64) - */ - __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->blengths); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_slens); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_slens, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_5 < 0)) { - PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_slens, (PyObject*)__pyx_v_slens, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6); - } - } - __pyx_bstride_0_slens = __pyx_bstruct_slens.strides[0]; - __pyx_bshape_0_slens = __pyx_bstruct_slens.shape[0]; - if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->blengths)); - __Pyx_DECREF(((PyObject *)__pyx_v_slens)); - __pyx_v_slens = ((PyArrayObject *)__pyx_v_self->blengths); - - /* "pandas/lib/src/sparse.pyx":530 - * slens = self.blengths - * - * result = np.empty(other.npoints, dtype=np.float64) # <<<<<<<<<<<<<< - * - * for 0 <= i < other.nblocks: - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_other->npoints); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float64); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_11 = ((PyArrayObject *)__pyx_t_10); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_5 < 0)) { - PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8); - } - } - __pyx_bstride_0_result = __pyx_bstruct_result.strides[0]; - __pyx_bshape_0_result = __pyx_bstruct_result.shape[0]; - if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_11 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = ((PyArrayObject *)__pyx_t_10); - __pyx_t_10 = 0; - - /* "pandas/lib/src/sparse.pyx":532 - * result = np.empty(other.npoints, dtype=np.float64) - * - * for 0 <= i < other.nblocks: # <<<<<<<<<<<<<< - * ocur = olocs[i] - * ocurlen = olens[i] - */ - __pyx_t_12 = __pyx_v_other->nblocks; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_12; __pyx_v_i++) { - - /* "pandas/lib/src/sparse.pyx":533 - * - * for 0 <= i < other.nblocks: - * ocur = olocs[i] # <<<<<<<<<<<<<< - * ocurlen = olens[i] - * - */ - __pyx_t_13 = __pyx_v_i; - __pyx_t_5 = -1; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_bshape_0_olocs; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_olocs)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_ocur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_olocs.buf, __pyx_t_13, __pyx_bstride_0_olocs)); - - /* "pandas/lib/src/sparse.pyx":534 - * for 0 <= i < other.nblocks: - * ocur = olocs[i] - * ocurlen = olens[i] # <<<<<<<<<<<<<< - * - * while slocs[j] + slens[j] < ocur: - */ - __pyx_t_14 = __pyx_v_i; - __pyx_t_5 = -1; - if (__pyx_t_14 < 0) { - __pyx_t_14 += __pyx_bshape_0_olens; - if (unlikely(__pyx_t_14 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_olens)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_ocurlen = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_olens.buf, __pyx_t_14, __pyx_bstride_0_olens)); - - /* "pandas/lib/src/sparse.pyx":536 - * ocurlen = olens[i] - * - * while slocs[j] + slens[j] < ocur: # <<<<<<<<<<<<<< - * j += 1 - * - */ - while (1) { - __pyx_t_15 = __pyx_v_j; - __pyx_t_5 = -1; - if (__pyx_t_15 < 0) { - __pyx_t_15 += __pyx_bshape_0_slocs; - if (unlikely(__pyx_t_15 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_slocs)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_16 = __pyx_v_j; - __pyx_t_5 = -1; - if (__pyx_t_16 < 0) { - __pyx_t_16 += __pyx_bshape_0_slens; - if (unlikely(__pyx_t_16 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_slens)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_17 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_slocs.buf, __pyx_t_15, __pyx_bstride_0_slocs)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_slens.buf, __pyx_t_16, __pyx_bstride_0_slens))) < __pyx_v_ocur); - if (!__pyx_t_17) break; - - /* "pandas/lib/src/sparse.pyx":537 - * - * while slocs[j] + slens[j] < ocur: - * j += 1 # <<<<<<<<<<<<<< - * - * cpdef put(self, ndarray[float64_t, ndim=1] values, - */ - __pyx_v_j = (__pyx_v_j + 1); - } - } - - __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_olens); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_olocs); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_slocs); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_slens); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.reindex"); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_olens); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_olocs); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_slocs); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_slens); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_other); - __Pyx_DECREF((PyObject *)__pyx_v_result); - __Pyx_DECREF((PyObject *)__pyx_v_slocs); - __Pyx_DECREF((PyObject *)__pyx_v_slens); - __Pyx_DECREF((PyObject *)__pyx_v_olocs); - __Pyx_DECREF((PyObject *)__pyx_v_olens); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":515 - * return -1 - * - * cpdef ndarray reindex(self, ndarray[float64_t, ndim=1] values, # <<<<<<<<<<<<<< - * float64_t fill_value, SparseIndex other_): - * cdef: - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_10reindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_10reindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_values = 0; - __pyx_t_5numpy_float64_t __pyx_v_fill_value; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_other_ = 0; - Py_buffer __pyx_bstruct_values; - Py_ssize_t __pyx_bstride_0_values = 0; - Py_ssize_t __pyx_bshape_0_values = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__fill_value,&__pyx_n_s__other_,0}; - __Pyx_RefNannySetupContext("reindex"); - 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__values); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("reindex", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other_); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("reindex", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 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), "reindex") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_values = ((PyArrayObject *)values[0]); - __pyx_v_fill_value = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fill_value == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_other_ = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[2]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_values = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_fill_value = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_fill_value == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_other_ = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 2)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("reindex", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.reindex"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_values.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other_), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "other_", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_values = __pyx_bstruct_values.strides[0]; - __pyx_bshape_0_values = __pyx_bstruct_values.shape[0]; - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_values); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_v_fill_value; - __pyx_t_3 = ((PyObject *)__pyx_v_other_); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockIndex *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->__pyx_vtab)->reindex(((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self), ((PyArrayObject *)__pyx_t_1), __pyx_t_2, ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_3), 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __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_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 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_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_values); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.reindex"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":539 - * j += 1 - * - * cpdef put(self, ndarray[float64_t, ndim=1] values, # <<<<<<<<<<<<<< - * ndarray[int32_t, ndim=1] indices, object to_put): - * pass - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_11put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_10BlockIndex_put(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_v_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indices, PyObject *__pyx_v_to_put, int __pyx_skip_dispatch) { - Py_buffer __pyx_bstruct_indices; - Py_ssize_t __pyx_bstride_0_indices = 0; - Py_ssize_t __pyx_bshape_0_indices = 0; - Py_buffer __pyx_bstruct_values; - Py_ssize_t __pyx_bstride_0_values = 0; - Py_ssize_t __pyx_bshape_0_values = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("put"); - __pyx_bstruct_values.buf = NULL; - __pyx_bstruct_indices.buf = NULL; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_values = __pyx_bstruct_values.strides[0]; - __pyx_bshape_0_values = __pyx_bstruct_values.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0]; - __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0]; - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overriden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__put); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_11put)) { - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)__pyx_v_values)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_values)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_values)); - __Pyx_INCREF(((PyObject *)__pyx_v_indices)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_indices)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_indices)); - __Pyx_INCREF(__pyx_v_to_put); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_to_put); - __Pyx_GIVEREF(__pyx_v_to_put); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "pandas/lib/src/sparse.pyx":541 - * cpdef put(self, ndarray[float64_t, ndim=1] values, - * ndarray[int32_t, ndim=1] indices, object to_put): - * pass # <<<<<<<<<<<<<< - * - * cpdef take(self, ndarray[float64_t, ndim=1] values, - */ - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.put"); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":539 - * j += 1 - * - * cpdef put(self, ndarray[float64_t, ndim=1] values, # <<<<<<<<<<<<<< - * ndarray[int32_t, ndim=1] indices, object to_put): - * pass - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_11put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_11put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_values = 0; - PyArrayObject *__pyx_v_indices = 0; - PyObject *__pyx_v_to_put = 0; - Py_buffer __pyx_bstruct_indices; - Py_ssize_t __pyx_bstride_0_indices = 0; - Py_ssize_t __pyx_bshape_0_indices = 0; - Py_buffer __pyx_bstruct_values; - Py_ssize_t __pyx_bstride_0_values = 0; - Py_ssize_t __pyx_bshape_0_values = 0; - PyObject *__pyx_r = NULL; - 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__values,&__pyx_n_s__indices,&__pyx_n_s__to_put,0}; - __Pyx_RefNannySetupContext("put"); - 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__values); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indices); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("put", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__to_put); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("put", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "put") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_values = ((PyArrayObject *)values[0]); - __pyx_v_indices = ((PyArrayObject *)values[1]); - __pyx_v_to_put = values[2]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_values = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_indices = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_to_put = PyTuple_GET_ITEM(__pyx_args, 2); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("put", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.put"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_values.buf = NULL; - __pyx_bstruct_indices.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_5numpy_ndarray, 1, "indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_values = __pyx_bstruct_values.strides[0]; - __pyx_bshape_0_values = __pyx_bstruct_values.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0]; - __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0]; - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_values); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_indices); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __pyx_v_to_put; - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = ((struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockIndex *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->__pyx_vtab)->put(((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self), ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_2), __pyx_t_3, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __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(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 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); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.put"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":543 - * pass - * - * cpdef take(self, ndarray[float64_t, ndim=1] values, # <<<<<<<<<<<<<< - * ndarray[int32_t, ndim=1] indices): - * pass - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_12take(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_10BlockIndex_take(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_v_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indices, int __pyx_skip_dispatch) { - Py_buffer __pyx_bstruct_indices; - Py_ssize_t __pyx_bstride_0_indices = 0; - Py_ssize_t __pyx_bshape_0_indices = 0; - Py_buffer __pyx_bstruct_values; - Py_ssize_t __pyx_bstride_0_values = 0; - Py_ssize_t __pyx_bshape_0_values = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("take"); - __pyx_bstruct_values.buf = NULL; - __pyx_bstruct_indices.buf = NULL; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_values = __pyx_bstruct_values.strides[0]; - __pyx_bshape_0_values = __pyx_bstruct_values.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0]; - __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0]; - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overriden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__take); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_12take)) { - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)__pyx_v_values)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_values)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_values)); - __Pyx_INCREF(((PyObject *)__pyx_v_indices)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_indices)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_indices)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "pandas/lib/src/sparse.pyx":545 - * cpdef take(self, ndarray[float64_t, ndim=1] values, - * ndarray[int32_t, ndim=1] indices): - * pass # <<<<<<<<<<<<<< - * - * - */ - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.take"); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":543 - * pass - * - * cpdef take(self, ndarray[float64_t, ndim=1] values, # <<<<<<<<<<<<<< - * ndarray[int32_t, ndim=1] indices): - * pass - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_12take(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_12take(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_values = 0; - PyArrayObject *__pyx_v_indices = 0; - Py_buffer __pyx_bstruct_indices; - Py_ssize_t __pyx_bstride_0_indices = 0; - Py_ssize_t __pyx_bshape_0_indices = 0; - Py_buffer __pyx_bstruct_values; - Py_ssize_t __pyx_bstride_0_values = 0; - Py_ssize_t __pyx_bshape_0_values = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indices,0}; - __Pyx_RefNannySetupContext("take"); - 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__indices); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("take", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "take") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_values = ((PyArrayObject *)values[0]); - __pyx_v_indices = ((PyArrayObject *)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_indices = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("take", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.take"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_values.buf = NULL; - __pyx_bstruct_indices.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_5numpy_ndarray, 1, "indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_values = __pyx_bstruct_values.strides[0]; - __pyx_bshape_0_values = __pyx_bstruct_values.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indices, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_indices = __pyx_bstruct_indices.strides[0]; - __pyx_bshape_0_indices = __pyx_bstruct_indices.shape[0]; - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_values); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_indices); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockIndex *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->__pyx_vtab)->take(((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self), ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_2), 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __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); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.take"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":292 - * ''' - * cdef readonly: - * pyst nblocks, npoints, length # <<<<<<<<<<<<<< - * ndarray blocs, blengths - * - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_7nblocks___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_7nblocks___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->nblocks); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.nblocks.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_7npoints___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_7npoints___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->npoints); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.npoints.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_6length___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_6length___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pandas.lib.sparse.BlockIndex.length.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":293 - * cdef readonly: - * pyst nblocks, npoints, length - * ndarray blocs, blengths # <<<<<<<<<<<<<< - * - * cdef: - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_5blocs___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_5blocs___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blocs)); - __pyx_r = ((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blocs); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_8blengths___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_8blengths___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blengths)); - __pyx_r = ((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_self)->blengths); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":558 - * int32_t xi, yi # block indices - * - * def __init__(self, BlockIndex x, BlockIndex y): # <<<<<<<<<<<<<< - * self.x = x - * self.y = y - */ - -static int __pyx_pf_6pandas_3lib_6sparse_10BlockMerge___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_6pandas_3lib_6sparse_10BlockMerge___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_v_x = 0; - struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_v_y = 0; - int __pyx_r; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("__init__"); - 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__x); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_x = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)values[0]); - __pyx_v_y = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)values[1]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_x = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_y = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)PyTuple_GET_ITEM(__pyx_args, 1)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.BlockMerge.__init__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_6pandas_3lib_6sparse_BlockIndex, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_6pandas_3lib_6sparse_BlockIndex, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "pandas/lib/src/sparse.pyx":559 - * - * def __init__(self, BlockIndex x, BlockIndex y): - * self.x = x # <<<<<<<<<<<<<< - * self.y = y - * - */ - __Pyx_INCREF(((PyObject *)__pyx_v_x)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_x)); - __Pyx_GOTREF(((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->x); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->x)); - ((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->x = __pyx_v_x; - - /* "pandas/lib/src/sparse.pyx":560 - * def __init__(self, BlockIndex x, BlockIndex y): - * self.x = x - * self.y = y # <<<<<<<<<<<<<< - * - * if x.length != y.length: - */ - __Pyx_INCREF(((PyObject *)__pyx_v_y)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_y)); - __Pyx_GOTREF(((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->y); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->y)); - ((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->y = __pyx_v_y; - - /* "pandas/lib/src/sparse.pyx":562 - * self.y = y - * - * if x.length != y.length: # <<<<<<<<<<<<<< - * raise Exception('Indices must reference same underlying length') - * - */ - __pyx_t_1 = (__pyx_v_x->length != __pyx_v_y->length); - if (__pyx_t_1) { - - /* "pandas/lib/src/sparse.pyx":563 - * - * if x.length != y.length: - * raise Exception('Indices must reference same underlying length') # <<<<<<<<<<<<<< - * - * self.xstart = self.x.blocs - */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "pandas/lib/src/sparse.pyx":565 - * raise Exception('Indices must reference same underlying length') - * - * self.xstart = self.x.blocs # <<<<<<<<<<<<<< - * self.ystart = self.y.blocs - * - */ - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->x->blocs)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->x->blocs)); - __Pyx_GOTREF(((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->xstart); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->xstart)); - ((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->xstart = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->x->blocs; - - /* "pandas/lib/src/sparse.pyx":566 - * - * self.xstart = self.x.blocs - * self.ystart = self.y.blocs # <<<<<<<<<<<<<< - * - * self.xend = self.x.blocs + self.x.blengths - */ - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->y->blocs)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->y->blocs)); - __Pyx_GOTREF(((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->ystart); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->ystart)); - ((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->ystart = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->y->blocs; - - /* "pandas/lib/src/sparse.pyx":568 - * self.ystart = self.y.blocs - * - * self.xend = self.x.blocs + self.x.blengths # <<<<<<<<<<<<<< - * self.yend = self.y.blocs + self.y.blengths - * - */ - __pyx_t_2 = PyNumber_Add(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->x->blocs), ((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->x->blengths)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->xend); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->xend)); - ((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->xend = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "pandas/lib/src/sparse.pyx":569 - * - * self.xend = self.x.blocs + self.x.blengths - * self.yend = self.y.blocs + self.y.blengths # <<<<<<<<<<<<<< - * - * # self.xlen = self.x.blengths - */ - __pyx_t_2 = PyNumber_Add(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->y->blocs), ((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->y->blengths)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->yend); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->yend)); - ((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->yend = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "pandas/lib/src/sparse.pyx":574 - * # self.ylen = self.y.blengths - * - * self.xi = 0 # <<<<<<<<<<<<<< - * self.yi = 0 - * - */ - ((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->xi = 0; - - /* "pandas/lib/src/sparse.pyx":575 - * - * self.xi = 0 - * self.yi = 0 # <<<<<<<<<<<<<< - * - * self.result = self._make_merged_blocks() - */ - ((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->yi = 0; - - /* "pandas/lib/src/sparse.pyx":577 - * self.yi = 0 - * - * self.result = self._make_merged_blocks() # <<<<<<<<<<<<<< - * - * cdef _make_merged_blocks(self): - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockMerge *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->__pyx_vtab)->_make_merged_blocks(((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6pandas_3lib_6sparse_BlockIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->result); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->result)); - ((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self)->result = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_t_2); - __pyx_t_2 = 0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pandas.lib.sparse.BlockMerge.__init__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":579 - * self.result = self._make_merged_blocks() - * - * cdef _make_merged_blocks(self): # <<<<<<<<<<<<<< - * raise NotImplementedError - * - */ - -static PyObject *__pyx_f_6pandas_3lib_6sparse_10BlockMerge__make_merged_blocks(struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("_make_merged_blocks"); - - /* "pandas/lib/src/sparse.pyx":580 - * - * cdef _make_merged_blocks(self): - * raise NotImplementedError # <<<<<<<<<<<<<< - * - * cdef _set_current_indices(self, int32_t xi, int32_t yi, bint mode): - */ - __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("pandas.lib.sparse.BlockMerge._make_merged_blocks"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":582 - * raise NotImplementedError - * - * cdef _set_current_indices(self, int32_t xi, int32_t yi, bint mode): # <<<<<<<<<<<<<< - * if mode == 0: - * self.xi = xi - */ - -static PyObject *__pyx_f_6pandas_3lib_6sparse_10BlockMerge__set_current_indices(struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *__pyx_v_self, __pyx_t_5numpy_int32_t __pyx_v_xi, __pyx_t_5numpy_int32_t __pyx_v_yi, int __pyx_v_mode) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - __Pyx_RefNannySetupContext("_set_current_indices"); - - /* "pandas/lib/src/sparse.pyx":583 - * - * cdef _set_current_indices(self, int32_t xi, int32_t yi, bint mode): - * if mode == 0: # <<<<<<<<<<<<<< - * self.xi = xi - * self.yi = yi - */ - __pyx_t_1 = (__pyx_v_mode == 0); - if (__pyx_t_1) { - - /* "pandas/lib/src/sparse.pyx":584 - * cdef _set_current_indices(self, int32_t xi, int32_t yi, bint mode): - * if mode == 0: - * self.xi = xi # <<<<<<<<<<<<<< - * self.yi = yi - * else: - */ - __pyx_v_self->xi = __pyx_v_xi; - - /* "pandas/lib/src/sparse.pyx":585 - * if mode == 0: - * self.xi = xi - * self.yi = yi # <<<<<<<<<<<<<< - * else: - * self.xi = yi - */ - __pyx_v_self->yi = __pyx_v_yi; - goto __pyx_L3; - } - /*else*/ { - - /* "pandas/lib/src/sparse.pyx":587 - * self.yi = yi - * else: - * self.xi = yi # <<<<<<<<<<<<<< - * self.yi = xi - * - */ - __pyx_v_self->xi = __pyx_v_yi; - - /* "pandas/lib/src/sparse.pyx":588 - * else: - * self.xi = yi - * self.yi = xi # <<<<<<<<<<<<<< - * - * cdef class BlockIntersection(BlockMerge): - */ - __pyx_v_self->yi = __pyx_v_xi; - } - __pyx_L3:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":602 - * ''' - * - * cdef _make_merged_blocks(self): # <<<<<<<<<<<<<< - * cdef: - * ndarray[int32_t, ndim=1] xstart, xend, ystart, yend - */ - -static PyObject *__pyx_f_6pandas_3lib_6sparse_10BlockUnion__make_merged_blocks(struct __pyx_obj_6pandas_3lib_6sparse_BlockUnion *__pyx_v_self) { - PyArrayObject *__pyx_v_xstart; - PyArrayObject *__pyx_v_xend; - PyArrayObject *__pyx_v_ystart; - PyArrayObject *__pyx_v_yend; - __pyx_t_5numpy_int32_t __pyx_v_nstart; - __pyx_t_5numpy_int32_t __pyx_v_nend; - PyObject *__pyx_v_out_blocs = 0; - PyObject *__pyx_v_out_blengths = 0; - Py_buffer __pyx_bstruct_yend; - Py_ssize_t __pyx_bstride_0_yend = 0; - Py_ssize_t __pyx_bshape_0_yend = 0; - Py_buffer __pyx_bstruct_ystart; - Py_ssize_t __pyx_bstride_0_ystart = 0; - Py_ssize_t __pyx_bshape_0_ystart = 0; - Py_buffer __pyx_bstruct_xstart; - Py_ssize_t __pyx_bstride_0_xstart = 0; - Py_ssize_t __pyx_bshape_0_xstart = 0; - Py_buffer __pyx_bstruct_xend; - Py_ssize_t __pyx_bstride_0_xend = 0; - Py_ssize_t __pyx_bshape_0_xend = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyArrayObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - __pyx_t_5numpy_int32_t __pyx_t_10; - __pyx_t_5numpy_int32_t __pyx_t_11; - __pyx_t_5numpy_int32_t __pyx_t_12; - __pyx_t_5numpy_int32_t __pyx_t_13; - __pyx_t_5numpy_int32_t __pyx_t_14; - __pyx_t_5numpy_int32_t __pyx_t_15; - __pyx_t_5numpy_int32_t __pyx_t_16; - __pyx_t_5numpy_int32_t __pyx_t_17; - __pyx_t_5numpy_int32_t __pyx_t_18; - PyObject *__pyx_t_19 = NULL; - __Pyx_RefNannySetupContext("_make_merged_blocks"); - __pyx_v_xstart = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_xend = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_ystart = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_yend = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_xstart.buf = NULL; - __pyx_bstruct_xend.buf = NULL; - __pyx_bstruct_ystart.buf = NULL; - __pyx_bstruct_yend.buf = NULL; - - /* "pandas/lib/src/sparse.pyx":606 - * ndarray[int32_t, ndim=1] xstart, xend, ystart, yend - * int32_t nstart, nend, diff - * list out_blocs = [], out_blengths = [] # <<<<<<<<<<<<<< - * - * xstart = self.xstart - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_v_out_blocs = __pyx_t_1; - __pyx_t_1 = 0; - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_v_out_blengths = __pyx_t_1; - __pyx_t_1 = 0; - - /* "pandas/lib/src/sparse.pyx":608 - * list out_blocs = [], out_blengths = [] - * - * xstart = self.xstart # <<<<<<<<<<<<<< - * xend = self.xend - * ystart = self.ystart - */ - __pyx_t_2 = ((PyArrayObject *)__pyx_v_self->__pyx_base.xstart); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xstart); - __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xstart, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_3 < 0)) { - PyErr_Fetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xstart, (PyObject*)__pyx_v_xstart, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_4, __pyx_t_5, __pyx_t_6); - } - } - __pyx_bstride_0_xstart = __pyx_bstruct_xstart.strides[0]; - __pyx_bshape_0_xstart = __pyx_bstruct_xstart.shape[0]; - if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.xstart)); - __Pyx_DECREF(((PyObject *)__pyx_v_xstart)); - __pyx_v_xstart = ((PyArrayObject *)__pyx_v_self->__pyx_base.xstart); - - /* "pandas/lib/src/sparse.pyx":609 - * - * xstart = self.xstart - * xend = self.xend # <<<<<<<<<<<<<< - * ystart = self.ystart - * yend = self.yend - */ - __pyx_t_2 = ((PyArrayObject *)__pyx_v_self->__pyx_base.xend); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xend); - __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xend, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_3 < 0)) { - PyErr_Fetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xend, (PyObject*)__pyx_v_xend, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_6, __pyx_t_5, __pyx_t_4); - } - } - __pyx_bstride_0_xend = __pyx_bstruct_xend.strides[0]; - __pyx_bshape_0_xend = __pyx_bstruct_xend.shape[0]; - if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.xend)); - __Pyx_DECREF(((PyObject *)__pyx_v_xend)); - __pyx_v_xend = ((PyArrayObject *)__pyx_v_self->__pyx_base.xend); - - /* "pandas/lib/src/sparse.pyx":610 - * xstart = self.xstart - * xend = self.xend - * ystart = self.ystart # <<<<<<<<<<<<<< - * yend = self.yend - * - */ - __pyx_t_2 = ((PyArrayObject *)__pyx_v_self->__pyx_base.ystart); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ystart); - __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_ystart, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_3 < 0)) { - PyErr_Fetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_ystart, (PyObject*)__pyx_v_ystart, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_4, __pyx_t_5, __pyx_t_6); - } - } - __pyx_bstride_0_ystart = __pyx_bstruct_ystart.strides[0]; - __pyx_bshape_0_ystart = __pyx_bstruct_ystart.shape[0]; - if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.ystart)); - __Pyx_DECREF(((PyObject *)__pyx_v_ystart)); - __pyx_v_ystart = ((PyArrayObject *)__pyx_v_self->__pyx_base.ystart); - - /* "pandas/lib/src/sparse.pyx":611 - * xend = self.xend - * ystart = self.ystart - * yend = self.yend # <<<<<<<<<<<<<< - * - * while True: - */ - __pyx_t_2 = ((PyArrayObject *)__pyx_v_self->__pyx_base.yend); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yend); - __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_yend, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_3 < 0)) { - PyErr_Fetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_yend, (PyObject*)__pyx_v_yend, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_6, __pyx_t_5, __pyx_t_4); - } - } - __pyx_bstride_0_yend = __pyx_bstruct_yend.strides[0]; - __pyx_bshape_0_yend = __pyx_bstruct_yend.shape[0]; - if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.yend)); - __Pyx_DECREF(((PyObject *)__pyx_v_yend)); - __pyx_v_yend = ((PyArrayObject *)__pyx_v_self->__pyx_base.yend); - - /* "pandas/lib/src/sparse.pyx":613 - * yend = self.yend - * - * while True: # <<<<<<<<<<<<<< - * # we are done (or possibly never began) - * if self.xi >= self.x.nblocks and self.yi >= self.y.nblocks: - */ - while (1) { - if (!1) break; - - /* "pandas/lib/src/sparse.pyx":615 - * while True: - * # we are done (or possibly never began) - * if self.xi >= self.x.nblocks and self.yi >= self.y.nblocks: # <<<<<<<<<<<<<< - * break - * elif self.yi >= self.y.nblocks: - */ - __pyx_t_7 = (__pyx_v_self->__pyx_base.xi >= __pyx_v_self->__pyx_base.x->nblocks); - if (__pyx_t_7) { - __pyx_t_8 = (__pyx_v_self->__pyx_base.yi >= __pyx_v_self->__pyx_base.y->nblocks); - __pyx_t_9 = __pyx_t_8; - } else { - __pyx_t_9 = __pyx_t_7; - } - if (__pyx_t_9) { - - /* "pandas/lib/src/sparse.pyx":616 - * # we are done (or possibly never began) - * if self.xi >= self.x.nblocks and self.yi >= self.y.nblocks: - * break # <<<<<<<<<<<<<< - * elif self.yi >= self.y.nblocks: - * # through with y, just pass through x blocks - */ - goto __pyx_L4_break; - goto __pyx_L5; - } - - /* "pandas/lib/src/sparse.pyx":617 - * if self.xi >= self.x.nblocks and self.yi >= self.y.nblocks: - * break - * elif self.yi >= self.y.nblocks: # <<<<<<<<<<<<<< - * # through with y, just pass through x blocks - * nstart = xstart[self.xi] - */ - __pyx_t_9 = (__pyx_v_self->__pyx_base.yi >= __pyx_v_self->__pyx_base.y->nblocks); - if (__pyx_t_9) { - - /* "pandas/lib/src/sparse.pyx":619 - * elif self.yi >= self.y.nblocks: - * # through with y, just pass through x blocks - * nstart = xstart[self.xi] # <<<<<<<<<<<<<< - * nend = xend[self.xi] - * self.xi += 1 - */ - __pyx_t_10 = __pyx_v_self->__pyx_base.xi; - __pyx_t_3 = -1; - if (__pyx_t_10 < 0) { - __pyx_t_10 += __pyx_bshape_0_xstart; - if (unlikely(__pyx_t_10 < 0)) __pyx_t_3 = 0; - } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_xstart)) __pyx_t_3 = 0; - if (unlikely(__pyx_t_3 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_3); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_nstart = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xstart.buf, __pyx_t_10, __pyx_bstride_0_xstart)); - - /* "pandas/lib/src/sparse.pyx":620 - * # through with y, just pass through x blocks - * nstart = xstart[self.xi] - * nend = xend[self.xi] # <<<<<<<<<<<<<< - * self.xi += 1 - * elif self.xi >= self.x.nblocks: - */ - __pyx_t_11 = __pyx_v_self->__pyx_base.xi; - __pyx_t_3 = -1; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_bshape_0_xend; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_3 = 0; - } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_xend)) __pyx_t_3 = 0; - if (unlikely(__pyx_t_3 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_3); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_nend = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xend.buf, __pyx_t_11, __pyx_bstride_0_xend)); - - /* "pandas/lib/src/sparse.pyx":621 - * nstart = xstart[self.xi] - * nend = xend[self.xi] - * self.xi += 1 # <<<<<<<<<<<<<< - * elif self.xi >= self.x.nblocks: - * # through with x, just pass through y blocks - */ - __pyx_v_self->__pyx_base.xi = (__pyx_v_self->__pyx_base.xi + 1); - goto __pyx_L5; - } - - /* "pandas/lib/src/sparse.pyx":622 - * nend = xend[self.xi] - * self.xi += 1 - * elif self.xi >= self.x.nblocks: # <<<<<<<<<<<<<< - * # through with x, just pass through y blocks - * nstart = ystart[self.yi] - */ - __pyx_t_9 = (__pyx_v_self->__pyx_base.xi >= __pyx_v_self->__pyx_base.x->nblocks); - if (__pyx_t_9) { - - /* "pandas/lib/src/sparse.pyx":624 - * elif self.xi >= self.x.nblocks: - * # through with x, just pass through y blocks - * nstart = ystart[self.yi] # <<<<<<<<<<<<<< - * nend = yend[self.yi] - * self.yi += 1 - */ - __pyx_t_12 = __pyx_v_self->__pyx_base.yi; - __pyx_t_3 = -1; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_bshape_0_ystart; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_3 = 0; - } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_ystart)) __pyx_t_3 = 0; - if (unlikely(__pyx_t_3 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_3); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_nstart = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_ystart.buf, __pyx_t_12, __pyx_bstride_0_ystart)); - - /* "pandas/lib/src/sparse.pyx":625 - * # through with x, just pass through y blocks - * nstart = ystart[self.yi] - * nend = yend[self.yi] # <<<<<<<<<<<<<< - * self.yi += 1 - * else: - */ - __pyx_t_13 = __pyx_v_self->__pyx_base.yi; - __pyx_t_3 = -1; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_bshape_0_yend; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_3 = 0; - } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_yend)) __pyx_t_3 = 0; - if (unlikely(__pyx_t_3 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_3); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_nend = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yend.buf, __pyx_t_13, __pyx_bstride_0_yend)); - - /* "pandas/lib/src/sparse.pyx":626 - * nstart = ystart[self.yi] - * nend = yend[self.yi] - * self.yi += 1 # <<<<<<<<<<<<<< - * else: - * # find end of new block - */ - __pyx_v_self->__pyx_base.yi = (__pyx_v_self->__pyx_base.yi + 1); - goto __pyx_L5; - } - /*else*/ { - - /* "pandas/lib/src/sparse.pyx":629 - * else: - * # find end of new block - * if xstart[self.xi] < ystart[self.yi]: # <<<<<<<<<<<<<< - * nstart = xstart[self.xi] - * nend = self._find_next_block_end(0) - */ - __pyx_t_14 = __pyx_v_self->__pyx_base.xi; - __pyx_t_3 = -1; - if (__pyx_t_14 < 0) { - __pyx_t_14 += __pyx_bshape_0_xstart; - if (unlikely(__pyx_t_14 < 0)) __pyx_t_3 = 0; - } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_xstart)) __pyx_t_3 = 0; - if (unlikely(__pyx_t_3 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_3); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_15 = __pyx_v_self->__pyx_base.yi; - __pyx_t_3 = -1; - if (__pyx_t_15 < 0) { - __pyx_t_15 += __pyx_bshape_0_ystart; - if (unlikely(__pyx_t_15 < 0)) __pyx_t_3 = 0; - } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_ystart)) __pyx_t_3 = 0; - if (unlikely(__pyx_t_3 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_3); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_9 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xstart.buf, __pyx_t_14, __pyx_bstride_0_xstart)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_ystart.buf, __pyx_t_15, __pyx_bstride_0_ystart))); - if (__pyx_t_9) { - - /* "pandas/lib/src/sparse.pyx":630 - * # find end of new block - * if xstart[self.xi] < ystart[self.yi]: - * nstart = xstart[self.xi] # <<<<<<<<<<<<<< - * nend = self._find_next_block_end(0) - * else: - */ - __pyx_t_16 = __pyx_v_self->__pyx_base.xi; - __pyx_t_3 = -1; - if (__pyx_t_16 < 0) { - __pyx_t_16 += __pyx_bshape_0_xstart; - if (unlikely(__pyx_t_16 < 0)) __pyx_t_3 = 0; - } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_xstart)) __pyx_t_3 = 0; - if (unlikely(__pyx_t_3 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_3); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_nstart = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xstart.buf, __pyx_t_16, __pyx_bstride_0_xstart)); - - /* "pandas/lib/src/sparse.pyx":631 - * if xstart[self.xi] < ystart[self.yi]: - * nstart = xstart[self.xi] - * nend = self._find_next_block_end(0) # <<<<<<<<<<<<<< - * else: - * nstart = ystart[self.yi] - */ - __pyx_t_17 = ((struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockUnion *)__pyx_v_self->__pyx_base.__pyx_vtab)->_find_next_block_end(__pyx_v_self, 0); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_nend = __pyx_t_17; - goto __pyx_L6; - } - /*else*/ { - - /* "pandas/lib/src/sparse.pyx":633 - * nend = self._find_next_block_end(0) - * else: - * nstart = ystart[self.yi] # <<<<<<<<<<<<<< - * nend = self._find_next_block_end(1) - * - */ - __pyx_t_17 = __pyx_v_self->__pyx_base.yi; - __pyx_t_3 = -1; - if (__pyx_t_17 < 0) { - __pyx_t_17 += __pyx_bshape_0_ystart; - if (unlikely(__pyx_t_17 < 0)) __pyx_t_3 = 0; - } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_ystart)) __pyx_t_3 = 0; - if (unlikely(__pyx_t_3 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_3); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_nstart = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_ystart.buf, __pyx_t_17, __pyx_bstride_0_ystart)); - - /* "pandas/lib/src/sparse.pyx":634 - * else: - * nstart = ystart[self.yi] - * nend = self._find_next_block_end(1) # <<<<<<<<<<<<<< - * - * out_blocs.append(nstart) - */ - __pyx_t_18 = ((struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockUnion *)__pyx_v_self->__pyx_base.__pyx_vtab)->_find_next_block_end(__pyx_v_self, 1); if (unlikely(__pyx_t_18 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_nend = __pyx_t_18; - } - __pyx_L6:; - } - __pyx_L5:; - - /* "pandas/lib/src/sparse.pyx":636 - * nend = self._find_next_block_end(1) - * - * out_blocs.append(nstart) # <<<<<<<<<<<<<< - * out_blengths.append(nend - nstart) - * - */ - if (unlikely(__pyx_v_out_blocs == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_nstart); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyList_Append(__pyx_v_out_blocs, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "pandas/lib/src/sparse.pyx":637 - * - * out_blocs.append(nstart) - * out_blengths.append(nend - nstart) # <<<<<<<<<<<<<< - * - * return BlockIndex(self.x.length, out_blocs, out_blengths) - */ - if (unlikely(__pyx_v_out_blengths == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = __Pyx_PyInt_to_py_npy_int32((__pyx_v_nend - __pyx_v_nstart)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyList_Append(__pyx_v_out_blengths, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_L4_break:; - - /* "pandas/lib/src/sparse.pyx":639 - * out_blengths.append(nend - nstart) - * - * return BlockIndex(self.x.length, out_blocs, out_blengths) # <<<<<<<<<<<<<< - * - * cdef int32_t _find_next_block_end(self, bint mode) except -1: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.x->length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_19 = PyTuple_New(3); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_19)); - PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_v_out_blocs)); - PyTuple_SET_ITEM(__pyx_t_19, 1, ((PyObject *)__pyx_v_out_blocs)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_out_blocs)); - __Pyx_INCREF(((PyObject *)__pyx_v_out_blengths)); - PyTuple_SET_ITEM(__pyx_t_19, 2, ((PyObject *)__pyx_v_out_blengths)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_out_blengths)); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pandas_3lib_6sparse_BlockIndex)), ((PyObject *)__pyx_t_19), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_19); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yend); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ystart); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xstart); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xend); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.BlockUnion._make_merged_blocks"); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yend); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ystart); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xstart); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xend); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_xstart); - __Pyx_DECREF((PyObject *)__pyx_v_xend); - __Pyx_DECREF((PyObject *)__pyx_v_ystart); - __Pyx_DECREF((PyObject *)__pyx_v_yend); - __Pyx_XDECREF(__pyx_v_out_blocs); - __Pyx_XDECREF(__pyx_v_out_blengths); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":641 - * return BlockIndex(self.x.length, out_blocs, out_blengths) - * - * cdef int32_t _find_next_block_end(self, bint mode) except -1: # <<<<<<<<<<<<<< - * ''' - * Wow, this got complicated in a hurry - */ - -static __pyx_t_5numpy_int32_t __pyx_f_6pandas_3lib_6sparse_10BlockUnion__find_next_block_end(struct __pyx_obj_6pandas_3lib_6sparse_BlockUnion *__pyx_v_self, int __pyx_v_mode) { - PyArrayObject *__pyx_v_xstart; - PyArrayObject *__pyx_v_xend; - PyArrayObject *__pyx_v_ystart; - PyArrayObject *__pyx_v_yend; - __pyx_t_5numpy_int32_t __pyx_v_xi; - __pyx_t_5numpy_int32_t __pyx_v_yi; - __pyx_t_5numpy_int32_t __pyx_v_ynblocks; - __pyx_t_5numpy_int32_t __pyx_v_nend; - Py_buffer __pyx_bstruct_yend; - Py_ssize_t __pyx_bstride_0_yend = 0; - Py_ssize_t __pyx_bshape_0_yend = 0; - Py_buffer __pyx_bstruct_xstart; - Py_ssize_t __pyx_bstride_0_xstart = 0; - Py_ssize_t __pyx_bshape_0_xstart = 0; - Py_buffer __pyx_bstruct_xend; - Py_ssize_t __pyx_bstride_0_xend = 0; - Py_ssize_t __pyx_bshape_0_xend = 0; - Py_buffer __pyx_bstruct_ystart; - Py_ssize_t __pyx_bstride_0_ystart = 0; - Py_ssize_t __pyx_bshape_0_ystart = 0; - __pyx_t_5numpy_int32_t __pyx_r; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyArrayObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - __pyx_t_5numpy_int32_t __pyx_t_8; - __pyx_t_5numpy_int32_t __pyx_t_9; - __pyx_t_5numpy_int32_t __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - __pyx_t_5numpy_int32_t __pyx_t_13; - __pyx_t_5numpy_int32_t __pyx_t_14; - __Pyx_RefNannySetupContext("_find_next_block_end"); - __pyx_v_xstart = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_xend = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_ystart = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_yend = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_xstart.buf = NULL; - __pyx_bstruct_xend.buf = NULL; - __pyx_bstruct_ystart.buf = NULL; - __pyx_bstruct_yend.buf = NULL; - - /* "pandas/lib/src/sparse.pyx":652 - * int32_t xi, yi, xnblocks, ynblocks, nend - * - * if mode != 0 and mode != 1: # <<<<<<<<<<<<<< - * raise Exception('Mode must be 0 or 1') - * - */ - switch (__pyx_v_mode) { - case 0: - case 1: - __pyx_t_1 = 0; - break; - default: - __pyx_t_1 = 1; - break; - } - if (__pyx_t_1) { - - /* "pandas/lib/src/sparse.pyx":653 - * - * if mode != 0 and mode != 1: - * raise Exception('Mode must be 0 or 1') # <<<<<<<<<<<<<< - * - * # so symmetric code will work - */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; - } - __pyx_L3:; - - /* "pandas/lib/src/sparse.pyx":656 - * - * # so symmetric code will work - * if mode == 0: # <<<<<<<<<<<<<< - * xstart = self.xstart - * xend = self.xend - */ - __pyx_t_1 = (__pyx_v_mode == 0); - if (__pyx_t_1) { - - /* "pandas/lib/src/sparse.pyx":657 - * # so symmetric code will work - * if mode == 0: - * xstart = self.xstart # <<<<<<<<<<<<<< - * xend = self.xend - * xi = self.xi - */ - __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->__pyx_base.xstart); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xstart); - __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xstart, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_4 < 0)) { - PyErr_Fetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xstart, (PyObject*)__pyx_v_xstart, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_5, __pyx_t_6, __pyx_t_7); - } - } - __pyx_bstride_0_xstart = __pyx_bstruct_xstart.strides[0]; - __pyx_bshape_0_xstart = __pyx_bstruct_xstart.shape[0]; - if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.xstart)); - __Pyx_DECREF(((PyObject *)__pyx_v_xstart)); - __pyx_v_xstart = ((PyArrayObject *)__pyx_v_self->__pyx_base.xstart); - - /* "pandas/lib/src/sparse.pyx":658 - * if mode == 0: - * xstart = self.xstart - * xend = self.xend # <<<<<<<<<<<<<< - * xi = self.xi - * - */ - __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->__pyx_base.xend); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xend); - __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xend, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_4 < 0)) { - PyErr_Fetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xend, (PyObject*)__pyx_v_xend, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_7, __pyx_t_6, __pyx_t_5); - } - } - __pyx_bstride_0_xend = __pyx_bstruct_xend.strides[0]; - __pyx_bshape_0_xend = __pyx_bstruct_xend.shape[0]; - if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.xend)); - __Pyx_DECREF(((PyObject *)__pyx_v_xend)); - __pyx_v_xend = ((PyArrayObject *)__pyx_v_self->__pyx_base.xend); - - /* "pandas/lib/src/sparse.pyx":659 - * xstart = self.xstart - * xend = self.xend - * xi = self.xi # <<<<<<<<<<<<<< - * - * ystart = self.ystart - */ - __pyx_v_xi = __pyx_v_self->__pyx_base.xi; - - /* "pandas/lib/src/sparse.pyx":661 - * xi = self.xi - * - * ystart = self.ystart # <<<<<<<<<<<<<< - * yend = self.yend - * yi = self.yi - */ - __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->__pyx_base.ystart); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ystart); - __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_ystart, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_4 < 0)) { - PyErr_Fetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_ystart, (PyObject*)__pyx_v_ystart, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_5, __pyx_t_6, __pyx_t_7); - } - } - __pyx_bstride_0_ystart = __pyx_bstruct_ystart.strides[0]; - __pyx_bshape_0_ystart = __pyx_bstruct_ystart.shape[0]; - if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.ystart)); - __Pyx_DECREF(((PyObject *)__pyx_v_ystart)); - __pyx_v_ystart = ((PyArrayObject *)__pyx_v_self->__pyx_base.ystart); - - /* "pandas/lib/src/sparse.pyx":662 - * - * ystart = self.ystart - * yend = self.yend # <<<<<<<<<<<<<< - * yi = self.yi - * ynblocks = self.y.nblocks - */ - __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->__pyx_base.yend); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yend); - __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_yend, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_4 < 0)) { - PyErr_Fetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_yend, (PyObject*)__pyx_v_yend, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_7, __pyx_t_6, __pyx_t_5); - } - } - __pyx_bstride_0_yend = __pyx_bstruct_yend.strides[0]; - __pyx_bshape_0_yend = __pyx_bstruct_yend.shape[0]; - if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.yend)); - __Pyx_DECREF(((PyObject *)__pyx_v_yend)); - __pyx_v_yend = ((PyArrayObject *)__pyx_v_self->__pyx_base.yend); - - /* "pandas/lib/src/sparse.pyx":663 - * ystart = self.ystart - * yend = self.yend - * yi = self.yi # <<<<<<<<<<<<<< - * ynblocks = self.y.nblocks - * else: - */ - __pyx_v_yi = __pyx_v_self->__pyx_base.yi; - - /* "pandas/lib/src/sparse.pyx":664 - * yend = self.yend - * yi = self.yi - * ynblocks = self.y.nblocks # <<<<<<<<<<<<<< - * else: - * xstart = self.ystart - */ - __pyx_v_ynblocks = __pyx_v_self->__pyx_base.y->nblocks; - goto __pyx_L4; - } - /*else*/ { - - /* "pandas/lib/src/sparse.pyx":666 - * ynblocks = self.y.nblocks - * else: - * xstart = self.ystart # <<<<<<<<<<<<<< - * xend = self.yend - * xi = self.yi - */ - __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->__pyx_base.ystart); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xstart); - __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xstart, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_4 < 0)) { - PyErr_Fetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xstart, (PyObject*)__pyx_v_xstart, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_5, __pyx_t_6, __pyx_t_7); - } - } - __pyx_bstride_0_xstart = __pyx_bstruct_xstart.strides[0]; - __pyx_bshape_0_xstart = __pyx_bstruct_xstart.shape[0]; - if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.ystart)); - __Pyx_DECREF(((PyObject *)__pyx_v_xstart)); - __pyx_v_xstart = ((PyArrayObject *)__pyx_v_self->__pyx_base.ystart); - - /* "pandas/lib/src/sparse.pyx":667 - * else: - * xstart = self.ystart - * xend = self.yend # <<<<<<<<<<<<<< - * xi = self.yi - * - */ - __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->__pyx_base.yend); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xend); - __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xend, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_4 < 0)) { - PyErr_Fetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xend, (PyObject*)__pyx_v_xend, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_7, __pyx_t_6, __pyx_t_5); - } - } - __pyx_bstride_0_xend = __pyx_bstruct_xend.strides[0]; - __pyx_bshape_0_xend = __pyx_bstruct_xend.shape[0]; - if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.yend)); - __Pyx_DECREF(((PyObject *)__pyx_v_xend)); - __pyx_v_xend = ((PyArrayObject *)__pyx_v_self->__pyx_base.yend); - - /* "pandas/lib/src/sparse.pyx":668 - * xstart = self.ystart - * xend = self.yend - * xi = self.yi # <<<<<<<<<<<<<< - * - * ystart = self.xstart - */ - __pyx_v_xi = __pyx_v_self->__pyx_base.yi; - - /* "pandas/lib/src/sparse.pyx":670 - * xi = self.yi - * - * ystart = self.xstart # <<<<<<<<<<<<<< - * yend = self.xend - * yi = self.xi - */ - __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->__pyx_base.xstart); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ystart); - __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_ystart, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_4 < 0)) { - PyErr_Fetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_ystart, (PyObject*)__pyx_v_ystart, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_5, __pyx_t_6, __pyx_t_7); - } - } - __pyx_bstride_0_ystart = __pyx_bstruct_ystart.strides[0]; - __pyx_bshape_0_ystart = __pyx_bstruct_ystart.shape[0]; - if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.xstart)); - __Pyx_DECREF(((PyObject *)__pyx_v_ystart)); - __pyx_v_ystart = ((PyArrayObject *)__pyx_v_self->__pyx_base.xstart); - - /* "pandas/lib/src/sparse.pyx":671 - * - * ystart = self.xstart - * yend = self.xend # <<<<<<<<<<<<<< - * yi = self.xi - * ynblocks = self.x.nblocks - */ - __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->__pyx_base.xend); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yend); - __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_yend, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_4 < 0)) { - PyErr_Fetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_yend, (PyObject*)__pyx_v_yend, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_7, __pyx_t_6, __pyx_t_5); - } - } - __pyx_bstride_0_yend = __pyx_bstruct_yend.strides[0]; - __pyx_bshape_0_yend = __pyx_bstruct_yend.shape[0]; - if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.xend)); - __Pyx_DECREF(((PyObject *)__pyx_v_yend)); - __pyx_v_yend = ((PyArrayObject *)__pyx_v_self->__pyx_base.xend); - - /* "pandas/lib/src/sparse.pyx":672 - * ystart = self.xstart - * yend = self.xend - * yi = self.xi # <<<<<<<<<<<<<< - * ynblocks = self.x.nblocks - * - */ - __pyx_v_yi = __pyx_v_self->__pyx_base.xi; - - /* "pandas/lib/src/sparse.pyx":673 - * yend = self.xend - * yi = self.xi - * ynblocks = self.x.nblocks # <<<<<<<<<<<<<< - * - * nend = xend[xi] - */ - __pyx_v_ynblocks = __pyx_v_self->__pyx_base.x->nblocks; - } - __pyx_L4:; - - /* "pandas/lib/src/sparse.pyx":675 - * ynblocks = self.x.nblocks - * - * nend = xend[xi] # <<<<<<<<<<<<<< - * - * # print 'here xi=%d, yi=%d, mode=%d, nend=%d' % (self.xi, self.yi, - */ - __pyx_t_8 = __pyx_v_xi; - __pyx_t_4 = -1; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_bshape_0_xend; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_4 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_xend)) __pyx_t_4 = 0; - if (unlikely(__pyx_t_4 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_4); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_nend = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xend.buf, __pyx_t_8, __pyx_bstride_0_xend)); - - /* "pandas/lib/src/sparse.pyx":681 - * - * # done with y? - * if yi == ynblocks: # <<<<<<<<<<<<<< - * self._set_current_indices(xi + 1, yi, mode) - * return nend - */ - __pyx_t_1 = (__pyx_v_yi == __pyx_v_ynblocks); - if (__pyx_t_1) { - - /* "pandas/lib/src/sparse.pyx":682 - * # done with y? - * if yi == ynblocks: - * self._set_current_indices(xi + 1, yi, mode) # <<<<<<<<<<<<<< - * return nend - * elif nend < ystart[yi]: - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockUnion *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_current_indices(((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self), (__pyx_v_xi + 1), __pyx_v_yi, __pyx_v_mode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "pandas/lib/src/sparse.pyx":683 - * if yi == ynblocks: - * self._set_current_indices(xi + 1, yi, mode) - * return nend # <<<<<<<<<<<<<< - * elif nend < ystart[yi]: - * # block ends before y block - */ - __pyx_r = __pyx_v_nend; - goto __pyx_L0; - goto __pyx_L5; - } - - /* "pandas/lib/src/sparse.pyx":684 - * self._set_current_indices(xi + 1, yi, mode) - * return nend - * elif nend < ystart[yi]: # <<<<<<<<<<<<<< - * # block ends before y block - * self._set_current_indices(xi + 1, yi, mode) - */ - __pyx_t_9 = __pyx_v_yi; - __pyx_t_4 = -1; - if (__pyx_t_9 < 0) { - __pyx_t_9 += __pyx_bshape_0_ystart; - if (unlikely(__pyx_t_9 < 0)) __pyx_t_4 = 0; - } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_ystart)) __pyx_t_4 = 0; - if (unlikely(__pyx_t_4 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_4); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = (__pyx_v_nend < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_ystart.buf, __pyx_t_9, __pyx_bstride_0_ystart))); - if (__pyx_t_1) { - - /* "pandas/lib/src/sparse.pyx":686 - * elif nend < ystart[yi]: - * # block ends before y block - * self._set_current_indices(xi + 1, yi, mode) # <<<<<<<<<<<<<< - * return nend - * else: - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockUnion *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_current_indices(((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self), (__pyx_v_xi + 1), __pyx_v_yi, __pyx_v_mode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "pandas/lib/src/sparse.pyx":687 - * # block ends before y block - * self._set_current_indices(xi + 1, yi, mode) - * return nend # <<<<<<<<<<<<<< - * else: - * while yi < ynblocks and nend > yend[yi]: - */ - __pyx_r = __pyx_v_nend; - goto __pyx_L0; - goto __pyx_L5; - } - /*else*/ { - - /* "pandas/lib/src/sparse.pyx":689 - * return nend - * else: - * while yi < ynblocks and nend > yend[yi]: # <<<<<<<<<<<<<< - * yi += 1 - * - */ - while (1) { - __pyx_t_1 = (__pyx_v_yi < __pyx_v_ynblocks); - if (__pyx_t_1) { - __pyx_t_10 = __pyx_v_yi; - __pyx_t_4 = -1; - if (__pyx_t_10 < 0) { - __pyx_t_10 += __pyx_bshape_0_yend; - if (unlikely(__pyx_t_10 < 0)) __pyx_t_4 = 0; - } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_yend)) __pyx_t_4 = 0; - if (unlikely(__pyx_t_4 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_4); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_11 = (__pyx_v_nend > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yend.buf, __pyx_t_10, __pyx_bstride_0_yend))); - __pyx_t_12 = __pyx_t_11; - } else { - __pyx_t_12 = __pyx_t_1; - } - if (!__pyx_t_12) break; - - /* "pandas/lib/src/sparse.pyx":690 - * else: - * while yi < ynblocks and nend > yend[yi]: - * yi += 1 # <<<<<<<<<<<<<< - * - * self._set_current_indices(xi + 1, yi, mode) - */ - __pyx_v_yi = (__pyx_v_yi + 1); - } - - /* "pandas/lib/src/sparse.pyx":692 - * yi += 1 - * - * self._set_current_indices(xi + 1, yi, mode) # <<<<<<<<<<<<<< - * - * if yi == ynblocks: - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockUnion *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_current_indices(((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)__pyx_v_self), (__pyx_v_xi + 1), __pyx_v_yi, __pyx_v_mode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "pandas/lib/src/sparse.pyx":694 - * self._set_current_indices(xi + 1, yi, mode) - * - * if yi == ynblocks: # <<<<<<<<<<<<<< - * return nend - * - */ - __pyx_t_12 = (__pyx_v_yi == __pyx_v_ynblocks); - if (__pyx_t_12) { - - /* "pandas/lib/src/sparse.pyx":695 - * - * if yi == ynblocks: - * return nend # <<<<<<<<<<<<<< - * - * if nend < ystart[yi]: - */ - __pyx_r = __pyx_v_nend; - goto __pyx_L0; - goto __pyx_L8; - } - __pyx_L8:; - - /* "pandas/lib/src/sparse.pyx":697 - * return nend - * - * if nend < ystart[yi]: # <<<<<<<<<<<<<< - * # we're done, return the block end - * return nend - */ - __pyx_t_13 = __pyx_v_yi; - __pyx_t_4 = -1; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_bshape_0_ystart; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_4 = 0; - } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_ystart)) __pyx_t_4 = 0; - if (unlikely(__pyx_t_4 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_4); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_12 = (__pyx_v_nend < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_ystart.buf, __pyx_t_13, __pyx_bstride_0_ystart))); - if (__pyx_t_12) { - - /* "pandas/lib/src/sparse.pyx":699 - * if nend < ystart[yi]: - * # we're done, return the block end - * return nend # <<<<<<<<<<<<<< - * else: - * # merge blocks, continue searching - */ - __pyx_r = __pyx_v_nend; - goto __pyx_L0; - goto __pyx_L9; - } - /*else*/ { - - /* "pandas/lib/src/sparse.pyx":703 - * # merge blocks, continue searching - * # this also catches the case where blocks - * return self._find_next_block_end(1 - mode) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_14 = ((struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockUnion *)__pyx_v_self->__pyx_base.__pyx_vtab)->_find_next_block_end(__pyx_v_self, (1 - __pyx_v_mode)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_t_14; - goto __pyx_L0; - } - __pyx_L9:; - } - __pyx_L5:; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yend); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xstart); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xend); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ystart); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.BlockUnion._find_next_block_end"); - __pyx_r = -1; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yend); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xstart); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xend); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ystart); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_xstart); - __Pyx_DECREF((PyObject *)__pyx_v_xend); - __Pyx_DECREF((PyObject *)__pyx_v_ystart); - __Pyx_DECREF((PyObject *)__pyx_v_yend); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":712 - * # TODO: quantify performance boost to "templating" - * - * cpdef sparse_nanadd(ndarray x, SparseIndex xindex, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex): - * return sparse_nancombine(x, xindex, y, yindex, __add) - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_1sparse_nanadd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_nanadd(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex, int __pyx_skip_dispatch) { - 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("sparse_nanadd"); - - /* "pandas/lib/src/sparse.pyx":714 - * cpdef sparse_nanadd(ndarray x, SparseIndex xindex, - * ndarray y, SparseIndex yindex): - * return sparse_nancombine(x, xindex, y, yindex, __add) # <<<<<<<<<<<<<< - * - * cpdef sparse_nansub(ndarray x, SparseIndex xindex, - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = ((PyObject *)__pyx_f_6pandas_3lib_6sparse_sparse_nancombine(((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_2), ((PyArrayObject *)__pyx_t_3), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_4), __pyx_f_6pandas_3lib_6sparse___add)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_nanadd"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":712 - * # TODO: quantify performance boost to "templating" - * - * cpdef sparse_nanadd(ndarray x, SparseIndex xindex, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex): - * return sparse_nancombine(x, xindex, y, yindex, __add) - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_1sparse_nanadd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_1sparse_nanadd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_x = 0; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex = 0; - PyArrayObject *__pyx_v_y = 0; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex = 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; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__y,&__pyx_n_s__yindex,0}; - __Pyx_RefNannySetupContext("sparse_nanadd"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[4] = {0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_nanadd", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_nanadd", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_nanadd", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_nanadd") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_x = ((PyArrayObject *)values[0]); - __pyx_v_xindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[1]); - __pyx_v_y = ((PyArrayObject *)values[2]); - __pyx_v_yindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[3]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_x = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_xindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_yindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 3)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sparse_nanadd", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.sparse_nanadd"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = __pyx_f_6pandas_3lib_6sparse_sparse_nanadd(((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_2), ((PyArrayObject *)__pyx_t_3), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_4), 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_nanadd"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":716 - * return sparse_nancombine(x, xindex, y, yindex, __add) - * - * cpdef sparse_nansub(ndarray x, SparseIndex xindex, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex): - * return sparse_nancombine(x, xindex, y, yindex, __sub) - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_2sparse_nansub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_nansub(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex, int __pyx_skip_dispatch) { - 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("sparse_nansub"); - - /* "pandas/lib/src/sparse.pyx":718 - * cpdef sparse_nansub(ndarray x, SparseIndex xindex, - * ndarray y, SparseIndex yindex): - * return sparse_nancombine(x, xindex, y, yindex, __sub) # <<<<<<<<<<<<<< - * - * cpdef sparse_nanmul(ndarray x, SparseIndex xindex, - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = ((PyObject *)__pyx_f_6pandas_3lib_6sparse_sparse_nancombine(((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_2), ((PyArrayObject *)__pyx_t_3), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_4), __pyx_f_6pandas_3lib_6sparse___sub)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_nansub"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":716 - * return sparse_nancombine(x, xindex, y, yindex, __add) - * - * cpdef sparse_nansub(ndarray x, SparseIndex xindex, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex): - * return sparse_nancombine(x, xindex, y, yindex, __sub) - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_2sparse_nansub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_2sparse_nansub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_x = 0; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex = 0; - PyArrayObject *__pyx_v_y = 0; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex = 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; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__y,&__pyx_n_s__yindex,0}; - __Pyx_RefNannySetupContext("sparse_nansub"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[4] = {0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_nansub", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_nansub", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_nansub", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_nansub") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_x = ((PyArrayObject *)values[0]); - __pyx_v_xindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[1]); - __pyx_v_y = ((PyArrayObject *)values[2]); - __pyx_v_yindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[3]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_x = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_xindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_yindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 3)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sparse_nansub", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.sparse_nansub"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = __pyx_f_6pandas_3lib_6sparse_sparse_nansub(((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_2), ((PyArrayObject *)__pyx_t_3), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_4), 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_nansub"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":720 - * return sparse_nancombine(x, xindex, y, yindex, __sub) - * - * cpdef sparse_nanmul(ndarray x, SparseIndex xindex, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex): - * return sparse_nancombine(x, xindex, y, yindex, __mul) - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_3sparse_nanmul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_nanmul(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex, int __pyx_skip_dispatch) { - 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("sparse_nanmul"); - - /* "pandas/lib/src/sparse.pyx":722 - * cpdef sparse_nanmul(ndarray x, SparseIndex xindex, - * ndarray y, SparseIndex yindex): - * return sparse_nancombine(x, xindex, y, yindex, __mul) # <<<<<<<<<<<<<< - * - * cpdef sparse_nandiv(ndarray x, SparseIndex xindex, - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = ((PyObject *)__pyx_f_6pandas_3lib_6sparse_sparse_nancombine(((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_2), ((PyArrayObject *)__pyx_t_3), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_4), __pyx_f_6pandas_3lib_6sparse___mul)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_nanmul"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":720 - * return sparse_nancombine(x, xindex, y, yindex, __sub) - * - * cpdef sparse_nanmul(ndarray x, SparseIndex xindex, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex): - * return sparse_nancombine(x, xindex, y, yindex, __mul) - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_3sparse_nanmul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_3sparse_nanmul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_x = 0; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex = 0; - PyArrayObject *__pyx_v_y = 0; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex = 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; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__y,&__pyx_n_s__yindex,0}; - __Pyx_RefNannySetupContext("sparse_nanmul"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[4] = {0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_nanmul", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_nanmul", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_nanmul", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_nanmul") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_x = ((PyArrayObject *)values[0]); - __pyx_v_xindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[1]); - __pyx_v_y = ((PyArrayObject *)values[2]); - __pyx_v_yindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[3]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_x = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_xindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_yindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 3)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sparse_nanmul", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.sparse_nanmul"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = __pyx_f_6pandas_3lib_6sparse_sparse_nanmul(((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_2), ((PyArrayObject *)__pyx_t_3), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_4), 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_nanmul"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":724 - * return sparse_nancombine(x, xindex, y, yindex, __mul) - * - * cpdef sparse_nandiv(ndarray x, SparseIndex xindex, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex): - * return sparse_nancombine(x, xindex, y, yindex, __div) - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_4sparse_nandiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_nandiv(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex, int __pyx_skip_dispatch) { - 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("sparse_nandiv"); - - /* "pandas/lib/src/sparse.pyx":726 - * cpdef sparse_nandiv(ndarray x, SparseIndex xindex, - * ndarray y, SparseIndex yindex): - * return sparse_nancombine(x, xindex, y, yindex, __div) # <<<<<<<<<<<<<< - * - * cpdef sparse_nanpow(ndarray x, SparseIndex xindex, - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = ((PyObject *)__pyx_f_6pandas_3lib_6sparse_sparse_nancombine(((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_2), ((PyArrayObject *)__pyx_t_3), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_4), __pyx_f_6pandas_3lib_6sparse___div)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_nandiv"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":724 - * return sparse_nancombine(x, xindex, y, yindex, __mul) - * - * cpdef sparse_nandiv(ndarray x, SparseIndex xindex, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex): - * return sparse_nancombine(x, xindex, y, yindex, __div) - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_4sparse_nandiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_4sparse_nandiv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_x = 0; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex = 0; - PyArrayObject *__pyx_v_y = 0; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex = 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; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__y,&__pyx_n_s__yindex,0}; - __Pyx_RefNannySetupContext("sparse_nandiv"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[4] = {0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_nandiv", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_nandiv", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_nandiv", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_nandiv") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_x = ((PyArrayObject *)values[0]); - __pyx_v_xindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[1]); - __pyx_v_y = ((PyArrayObject *)values[2]); - __pyx_v_yindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[3]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_x = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_xindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_yindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 3)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sparse_nandiv", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.sparse_nandiv"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = __pyx_f_6pandas_3lib_6sparse_sparse_nandiv(((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_2), ((PyArrayObject *)__pyx_t_3), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_4), 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_nandiv"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":728 - * return sparse_nancombine(x, xindex, y, yindex, __div) - * - * cpdef sparse_nanpow(ndarray x, SparseIndex xindex, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex): - * return sparse_nancombine(x, xindex, y, yindex, __pow) - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_5sparse_nanpow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_nanpow(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex, int __pyx_skip_dispatch) { - 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("sparse_nanpow"); - - /* "pandas/lib/src/sparse.pyx":730 - * cpdef sparse_nanpow(ndarray x, SparseIndex xindex, - * ndarray y, SparseIndex yindex): - * return sparse_nancombine(x, xindex, y, yindex, __pow) # <<<<<<<<<<<<<< - * - * cdef inline tuple sparse_nancombine(ndarray x, SparseIndex xindex, - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = ((PyObject *)__pyx_f_6pandas_3lib_6sparse_sparse_nancombine(((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_2), ((PyArrayObject *)__pyx_t_3), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_4), __pyx_f_6pandas_3lib_6sparse___pow)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_nanpow"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":728 - * return sparse_nancombine(x, xindex, y, yindex, __div) - * - * cpdef sparse_nanpow(ndarray x, SparseIndex xindex, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex): - * return sparse_nancombine(x, xindex, y, yindex, __pow) - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_5sparse_nanpow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_5sparse_nanpow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_x = 0; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex = 0; - PyArrayObject *__pyx_v_y = 0; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex = 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; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__y,&__pyx_n_s__yindex,0}; - __Pyx_RefNannySetupContext("sparse_nanpow"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[4] = {0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_nanpow", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_nanpow", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_nanpow", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_nanpow") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_x = ((PyArrayObject *)values[0]); - __pyx_v_xindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[1]); - __pyx_v_y = ((PyArrayObject *)values[2]); - __pyx_v_yindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[3]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_x = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_xindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_yindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 3)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sparse_nanpow", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.sparse_nanpow"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = __pyx_f_6pandas_3lib_6sparse_sparse_nanpow(((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_2), ((PyArrayObject *)__pyx_t_3), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_4), 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_nanpow"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":732 - * return sparse_nancombine(x, xindex, y, yindex, __pow) - * - * cdef inline tuple sparse_nancombine(ndarray x, SparseIndex xindex, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex, - * double_func op): - */ - -static CYTHON_INLINE PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_nancombine(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex, __pyx_t_6pandas_3lib_6sparse_double_func __pyx_v_op) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("sparse_nancombine"); - - /* "pandas/lib/src/sparse.pyx":735 - * ndarray y, SparseIndex yindex, - * double_func op): - * if isinstance(xindex, BlockIndex): # <<<<<<<<<<<<<< - * return block_nanop(x, xindex.to_block_index(), - * y, yindex.to_block_index(), op) - */ - __pyx_t_1 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)((PyObject*)__pyx_ptype_6pandas_3lib_6sparse_BlockIndex)); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __Pyx_TypeCheck(__pyx_t_1, __pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "pandas/lib/src/sparse.pyx":736 - * double_func op): - * if isinstance(xindex, BlockIndex): - * return block_nanop(x, xindex.to_block_index(), # <<<<<<<<<<<<<< - * y, yindex.to_block_index(), op) - * elif isinstance(xindex, IntIndex): - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_xindex), __pyx_n_s__to_block_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6pandas_3lib_6sparse_BlockIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "pandas/lib/src/sparse.pyx":737 - * if isinstance(xindex, BlockIndex): - * return block_nanop(x, xindex.to_block_index(), - * y, yindex.to_block_index(), op) # <<<<<<<<<<<<<< - * elif isinstance(xindex, IntIndex): - * return int_nanop(x, xindex.to_int_index(), - */ - __pyx_t_1 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_yindex), __pyx_n_s__to_block_index); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_6pandas_3lib_6sparse_BlockIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = ((PyObject *)__pyx_f_6pandas_3lib_6sparse_block_nanop(((PyArrayObject *)__pyx_t_2), ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_t_4), ((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_t_6), __pyx_v_op)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_r = ((PyObject*)__pyx_t_5); - __pyx_t_5 = 0; - goto __pyx_L0; - goto __pyx_L3; - } - - /* "pandas/lib/src/sparse.pyx":738 - * return block_nanop(x, xindex.to_block_index(), - * y, yindex.to_block_index(), op) - * elif isinstance(xindex, IntIndex): # <<<<<<<<<<<<<< - * return int_nanop(x, xindex.to_int_index(), - * y, yindex.to_int_index(), op) - */ - __pyx_t_5 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = ((PyObject *)((PyObject*)__pyx_ptype_6pandas_3lib_6sparse_IntIndex)); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_3 = __Pyx_TypeCheck(__pyx_t_5, __pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__pyx_t_3) { - - /* "pandas/lib/src/sparse.pyx":739 - * y, yindex.to_block_index(), op) - * elif isinstance(xindex, IntIndex): - * return int_nanop(x, xindex.to_int_index(), # <<<<<<<<<<<<<< - * y, yindex.to_int_index(), op) - * - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_6 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_xindex), __pyx_n_s__to_int_index); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pandas_3lib_6sparse_IntIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "pandas/lib/src/sparse.pyx":740 - * elif isinstance(xindex, IntIndex): - * return int_nanop(x, xindex.to_int_index(), - * y, yindex.to_int_index(), op) # <<<<<<<<<<<<<< - * - * cpdef sparse_add(ndarray x, SparseIndex xindex, float64_t xfill, - */ - __pyx_t_5 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_yindex), __pyx_n_s__to_int_index); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6pandas_3lib_6sparse_IntIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = ((PyObject *)__pyx_f_6pandas_3lib_6sparse_int_nanop(((PyArrayObject *)__pyx_t_6), ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_t_1), ((PyArrayObject *)__pyx_t_5), ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_t_2), __pyx_v_op)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_nancombine"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":742 - * y, yindex.to_int_index(), op) - * - * cpdef sparse_add(ndarray x, SparseIndex xindex, float64_t xfill, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex, float64_t yfill): - * return sparse_combine(x, xindex, xfill, - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_6sparse_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_add(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - __Pyx_RefNannySetupContext("sparse_add"); - - /* "pandas/lib/src/sparse.pyx":744 - * cpdef sparse_add(ndarray x, SparseIndex xindex, float64_t xfill, - * ndarray y, SparseIndex yindex, float64_t yfill): - * return sparse_combine(x, xindex, xfill, # <<<<<<<<<<<<<< - * y, yindex, yfill, __add) - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __pyx_v_xfill; - - /* "pandas/lib/src/sparse.pyx":745 - * ndarray y, SparseIndex yindex, float64_t yfill): - * return sparse_combine(x, xindex, xfill, - * y, yindex, yfill, __add) # <<<<<<<<<<<<<< - * - * cpdef sparse_sub(ndarray x, SparseIndex xindex, float64_t xfill, - */ - __pyx_t_4 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = __pyx_v_yfill; - __pyx_t_7 = ((PyObject *)__pyx_f_6pandas_3lib_6sparse_sparse_combine(((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_2), __pyx_t_3, ((PyArrayObject *)__pyx_t_4), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_5), __pyx_t_6, __pyx_f_6pandas_3lib_6sparse___add)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 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_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_add"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":742 - * y, yindex.to_int_index(), op) - * - * cpdef sparse_add(ndarray x, SparseIndex xindex, float64_t xfill, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex, float64_t yfill): - * return sparse_combine(x, xindex, xfill, - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_6sparse_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_6sparse_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_x = 0; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex = 0; - __pyx_t_5numpy_float64_t __pyx_v_xfill; - PyArrayObject *__pyx_v_y = 0; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex = 0; - __pyx_t_5numpy_float64_t __pyx_v_yfill; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__xfill,&__pyx_n_s__y,&__pyx_n_s__yindex,&__pyx_n_s__yfill,0}; - __Pyx_RefNannySetupContext("sparse_add"); - __pyx_self = __pyx_self; - 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__x); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_add", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xfill); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_add", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_add", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_add", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yfill); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_add", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_x = ((PyArrayObject *)values[0]); - __pyx_v_xindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[1]); - __pyx_v_xfill = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_xfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = ((PyArrayObject *)values[3]); - __pyx_v_yindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[4]); - __pyx_v_yfill = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_x = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_xindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_xfill = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_xfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_yindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_yfill = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_yfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sparse_add", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.sparse_add"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __pyx_v_xfill; - __pyx_t_4 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = __pyx_f_6pandas_3lib_6sparse_sparse_add(((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_2), __pyx_t_3, ((PyArrayObject *)__pyx_t_4), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_5), __pyx_v_yfill, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_add"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":747 - * y, yindex, yfill, __add) - * - * cpdef sparse_sub(ndarray x, SparseIndex xindex, float64_t xfill, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex, float64_t yfill): - * return sparse_combine(x, xindex, xfill, - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_7sparse_sub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_sub(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - __Pyx_RefNannySetupContext("sparse_sub"); - - /* "pandas/lib/src/sparse.pyx":749 - * cpdef sparse_sub(ndarray x, SparseIndex xindex, float64_t xfill, - * ndarray y, SparseIndex yindex, float64_t yfill): - * return sparse_combine(x, xindex, xfill, # <<<<<<<<<<<<<< - * y, yindex, yfill, __sub) - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __pyx_v_xfill; - - /* "pandas/lib/src/sparse.pyx":750 - * ndarray y, SparseIndex yindex, float64_t yfill): - * return sparse_combine(x, xindex, xfill, - * y, yindex, yfill, __sub) # <<<<<<<<<<<<<< - * - * cpdef sparse_mul(ndarray x, SparseIndex xindex, float64_t xfill, - */ - __pyx_t_4 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = __pyx_v_yfill; - __pyx_t_7 = ((PyObject *)__pyx_f_6pandas_3lib_6sparse_sparse_combine(((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_2), __pyx_t_3, ((PyArrayObject *)__pyx_t_4), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_5), __pyx_t_6, __pyx_f_6pandas_3lib_6sparse___sub)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 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_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_sub"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":747 - * y, yindex, yfill, __add) - * - * cpdef sparse_sub(ndarray x, SparseIndex xindex, float64_t xfill, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex, float64_t yfill): - * return sparse_combine(x, xindex, xfill, - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_7sparse_sub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_7sparse_sub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_x = 0; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex = 0; - __pyx_t_5numpy_float64_t __pyx_v_xfill; - PyArrayObject *__pyx_v_y = 0; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex = 0; - __pyx_t_5numpy_float64_t __pyx_v_yfill; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__xfill,&__pyx_n_s__y,&__pyx_n_s__yindex,&__pyx_n_s__yfill,0}; - __Pyx_RefNannySetupContext("sparse_sub"); - __pyx_self = __pyx_self; - 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__x); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_sub", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xfill); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_sub", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_sub", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_sub", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yfill); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_sub", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_sub") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_x = ((PyArrayObject *)values[0]); - __pyx_v_xindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[1]); - __pyx_v_xfill = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_xfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = ((PyArrayObject *)values[3]); - __pyx_v_yindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[4]); - __pyx_v_yfill = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_x = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_xindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_xfill = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_xfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_yindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_yfill = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_yfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sparse_sub", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.sparse_sub"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __pyx_v_xfill; - __pyx_t_4 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = __pyx_f_6pandas_3lib_6sparse_sparse_sub(((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_2), __pyx_t_3, ((PyArrayObject *)__pyx_t_4), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_5), __pyx_v_yfill, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_sub"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":752 - * y, yindex, yfill, __sub) - * - * cpdef sparse_mul(ndarray x, SparseIndex xindex, float64_t xfill, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex, float64_t yfill): - * return sparse_combine(x, xindex, xfill, - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8sparse_mul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_mul(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - __Pyx_RefNannySetupContext("sparse_mul"); - - /* "pandas/lib/src/sparse.pyx":754 - * cpdef sparse_mul(ndarray x, SparseIndex xindex, float64_t xfill, - * ndarray y, SparseIndex yindex, float64_t yfill): - * return sparse_combine(x, xindex, xfill, # <<<<<<<<<<<<<< - * y, yindex, yfill, __mul) - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __pyx_v_xfill; - - /* "pandas/lib/src/sparse.pyx":755 - * ndarray y, SparseIndex yindex, float64_t yfill): - * return sparse_combine(x, xindex, xfill, - * y, yindex, yfill, __mul) # <<<<<<<<<<<<<< - * - * cpdef sparse_div(ndarray x, SparseIndex xindex, float64_t xfill, - */ - __pyx_t_4 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = __pyx_v_yfill; - __pyx_t_7 = ((PyObject *)__pyx_f_6pandas_3lib_6sparse_sparse_combine(((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_2), __pyx_t_3, ((PyArrayObject *)__pyx_t_4), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_5), __pyx_t_6, __pyx_f_6pandas_3lib_6sparse___mul)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 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_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_mul"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":752 - * y, yindex, yfill, __sub) - * - * cpdef sparse_mul(ndarray x, SparseIndex xindex, float64_t xfill, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex, float64_t yfill): - * return sparse_combine(x, xindex, xfill, - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8sparse_mul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_8sparse_mul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_x = 0; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex = 0; - __pyx_t_5numpy_float64_t __pyx_v_xfill; - PyArrayObject *__pyx_v_y = 0; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex = 0; - __pyx_t_5numpy_float64_t __pyx_v_yfill; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__xfill,&__pyx_n_s__y,&__pyx_n_s__yindex,&__pyx_n_s__yfill,0}; - __Pyx_RefNannySetupContext("sparse_mul"); - __pyx_self = __pyx_self; - 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__x); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_mul", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xfill); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_mul", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_mul", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_mul", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yfill); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_mul", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_mul") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_x = ((PyArrayObject *)values[0]); - __pyx_v_xindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[1]); - __pyx_v_xfill = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_xfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = ((PyArrayObject *)values[3]); - __pyx_v_yindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[4]); - __pyx_v_yfill = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_x = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_xindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_xfill = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_xfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_yindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_yfill = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_yfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sparse_mul", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.sparse_mul"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __pyx_v_xfill; - __pyx_t_4 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = __pyx_f_6pandas_3lib_6sparse_sparse_mul(((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_2), __pyx_t_3, ((PyArrayObject *)__pyx_t_4), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_5), __pyx_v_yfill, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_mul"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":757 - * y, yindex, yfill, __mul) - * - * cpdef sparse_div(ndarray x, SparseIndex xindex, float64_t xfill, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex, float64_t yfill): - * return sparse_combine(x, xindex, xfill, - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_9sparse_div(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_div(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - __Pyx_RefNannySetupContext("sparse_div"); - - /* "pandas/lib/src/sparse.pyx":759 - * cpdef sparse_div(ndarray x, SparseIndex xindex, float64_t xfill, - * ndarray y, SparseIndex yindex, float64_t yfill): - * return sparse_combine(x, xindex, xfill, # <<<<<<<<<<<<<< - * y, yindex, yfill, __div) - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __pyx_v_xfill; - - /* "pandas/lib/src/sparse.pyx":760 - * ndarray y, SparseIndex yindex, float64_t yfill): - * return sparse_combine(x, xindex, xfill, - * y, yindex, yfill, __div) # <<<<<<<<<<<<<< - * - * cpdef sparse_pow(ndarray x, SparseIndex xindex, float64_t xfill, - */ - __pyx_t_4 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = __pyx_v_yfill; - __pyx_t_7 = ((PyObject *)__pyx_f_6pandas_3lib_6sparse_sparse_combine(((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_2), __pyx_t_3, ((PyArrayObject *)__pyx_t_4), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_5), __pyx_t_6, __pyx_f_6pandas_3lib_6sparse___div)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 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_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_div"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":757 - * y, yindex, yfill, __mul) - * - * cpdef sparse_div(ndarray x, SparseIndex xindex, float64_t xfill, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex, float64_t yfill): - * return sparse_combine(x, xindex, xfill, - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_9sparse_div(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_9sparse_div(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_x = 0; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex = 0; - __pyx_t_5numpy_float64_t __pyx_v_xfill; - PyArrayObject *__pyx_v_y = 0; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex = 0; - __pyx_t_5numpy_float64_t __pyx_v_yfill; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__xfill,&__pyx_n_s__y,&__pyx_n_s__yindex,&__pyx_n_s__yfill,0}; - __Pyx_RefNannySetupContext("sparse_div"); - __pyx_self = __pyx_self; - 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__x); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_div", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xfill); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_div", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_div", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_div", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yfill); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_div", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_div") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_x = ((PyArrayObject *)values[0]); - __pyx_v_xindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[1]); - __pyx_v_xfill = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_xfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = ((PyArrayObject *)values[3]); - __pyx_v_yindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[4]); - __pyx_v_yfill = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_x = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_xindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_xfill = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_xfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_yindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_yfill = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_yfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sparse_div", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.sparse_div"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __pyx_v_xfill; - __pyx_t_4 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = __pyx_f_6pandas_3lib_6sparse_sparse_div(((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_2), __pyx_t_3, ((PyArrayObject *)__pyx_t_4), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_5), __pyx_v_yfill, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_div"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":762 - * y, yindex, yfill, __div) - * - * cpdef sparse_pow(ndarray x, SparseIndex xindex, float64_t xfill, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex, float64_t yfill): - * return sparse_combine(x, xindex, xfill, - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10sparse_pow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_pow(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - __Pyx_RefNannySetupContext("sparse_pow"); - - /* "pandas/lib/src/sparse.pyx":764 - * cpdef sparse_pow(ndarray x, SparseIndex xindex, float64_t xfill, - * ndarray y, SparseIndex yindex, float64_t yfill): - * return sparse_combine(x, xindex, xfill, # <<<<<<<<<<<<<< - * y, yindex, yfill, __pow) - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __pyx_v_xfill; - - /* "pandas/lib/src/sparse.pyx":765 - * ndarray y, SparseIndex yindex, float64_t yfill): - * return sparse_combine(x, xindex, xfill, - * y, yindex, yfill, __pow) # <<<<<<<<<<<<<< - * - * cdef inline tuple sparse_combine(ndarray x, SparseIndex xindex, float64_t xfill, - */ - __pyx_t_4 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = __pyx_v_yfill; - __pyx_t_7 = ((PyObject *)__pyx_f_6pandas_3lib_6sparse_sparse_combine(((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_2), __pyx_t_3, ((PyArrayObject *)__pyx_t_4), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_5), __pyx_t_6, __pyx_f_6pandas_3lib_6sparse___pow)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 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_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_pow"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":762 - * y, yindex, yfill, __div) - * - * cpdef sparse_pow(ndarray x, SparseIndex xindex, float64_t xfill, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex, float64_t yfill): - * return sparse_combine(x, xindex, xfill, - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10sparse_pow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_6pandas_3lib_6sparse_10sparse_pow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_x = 0; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex = 0; - __pyx_t_5numpy_float64_t __pyx_v_xfill; - PyArrayObject *__pyx_v_y = 0; - struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex = 0; - __pyx_t_5numpy_float64_t __pyx_v_yfill; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xindex,&__pyx_n_s__xfill,&__pyx_n_s__y,&__pyx_n_s__yindex,&__pyx_n_s__yfill,0}; - __Pyx_RefNannySetupContext("sparse_pow"); - __pyx_self = __pyx_self; - 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__x); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xindex); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_pow", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xfill); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_pow", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_pow", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yindex); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_pow", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yfill); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparse_pow", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_pow") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_x = ((PyArrayObject *)values[0]); - __pyx_v_xindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[1]); - __pyx_v_xfill = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_xfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = ((PyArrayObject *)values[3]); - __pyx_v_yindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)values[4]); - __pyx_v_yfill = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_x = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_xindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_xfill = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_xfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_yindex = ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_yfill = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_yfill == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sparse_pow", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.sparse_pow"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xindex), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "xindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_yindex), __pyx_ptype_6pandas_3lib_6sparse_SparseIndex, 1, "yindex", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __pyx_v_xfill; - __pyx_t_4 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = __pyx_f_6pandas_3lib_6sparse_sparse_pow(((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_2), __pyx_t_3, ((PyArrayObject *)__pyx_t_4), ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_5), __pyx_v_yfill, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_pow"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":767 - * y, yindex, yfill, __pow) - * - * cdef inline tuple sparse_combine(ndarray x, SparseIndex xindex, float64_t xfill, # <<<<<<<<<<<<<< - * ndarray y, SparseIndex yindex, float64_t yfill, - * double_func op): - */ - -static CYTHON_INLINE PyObject *__pyx_f_6pandas_3lib_6sparse_sparse_combine(PyArrayObject *__pyx_v_x, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, __pyx_t_6pandas_3lib_6sparse_double_func __pyx_v_op) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_8; - __Pyx_RefNannySetupContext("sparse_combine"); - - /* "pandas/lib/src/sparse.pyx":770 - * ndarray y, SparseIndex yindex, float64_t yfill, - * double_func op): - * if isinstance(xindex, BlockIndex): # <<<<<<<<<<<<<< - * return block_op(x, xindex.to_block_index(), xfill, - * y, yindex.to_block_index(), yfill, op) - */ - __pyx_t_1 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)((PyObject*)__pyx_ptype_6pandas_3lib_6sparse_BlockIndex)); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __Pyx_TypeCheck(__pyx_t_1, __pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "pandas/lib/src/sparse.pyx":771 - * double_func op): - * if isinstance(xindex, BlockIndex): - * return block_op(x, xindex.to_block_index(), xfill, # <<<<<<<<<<<<<< - * y, yindex.to_block_index(), yfill, op) - * elif isinstance(xindex, IntIndex): - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_xindex), __pyx_n_s__to_block_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6pandas_3lib_6sparse_BlockIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __pyx_v_xfill; - - /* "pandas/lib/src/sparse.pyx":772 - * if isinstance(xindex, BlockIndex): - * return block_op(x, xindex.to_block_index(), xfill, - * y, yindex.to_block_index(), yfill, op) # <<<<<<<<<<<<<< - * elif isinstance(xindex, IntIndex): - * return int_op(x, xindex.to_int_index(), xfill, - */ - __pyx_t_1 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_yindex), __pyx_n_s__to_block_index); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_6pandas_3lib_6sparse_BlockIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = __pyx_v_yfill; - __pyx_t_6 = ((PyObject *)__pyx_f_6pandas_3lib_6sparse_block_op(((PyArrayObject *)__pyx_t_2), ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_t_4), __pyx_t_5, ((PyArrayObject *)__pyx_t_1), ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_t_7), __pyx_t_8, __pyx_v_op)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __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(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_r = ((PyObject*)__pyx_t_6); - __pyx_t_6 = 0; - goto __pyx_L0; - goto __pyx_L3; - } - - /* "pandas/lib/src/sparse.pyx":773 - * return block_op(x, xindex.to_block_index(), xfill, - * y, yindex.to_block_index(), yfill, op) - * elif isinstance(xindex, IntIndex): # <<<<<<<<<<<<<< - * return int_op(x, xindex.to_int_index(), xfill, - * y, yindex.to_int_index(), yfill, op) - */ - __pyx_t_6 = ((PyObject *)__pyx_v_xindex); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_7 = ((PyObject *)((PyObject*)__pyx_ptype_6pandas_3lib_6sparse_IntIndex)); - __Pyx_INCREF(__pyx_t_7); - __pyx_t_3 = __Pyx_TypeCheck(__pyx_t_6, __pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_3) { - - /* "pandas/lib/src/sparse.pyx":774 - * y, yindex.to_block_index(), yfill, op) - * elif isinstance(xindex, IntIndex): - * return int_op(x, xindex.to_int_index(), xfill, # <<<<<<<<<<<<<< - * y, yindex.to_int_index(), yfill, op) - * - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_7 = ((PyObject *)__pyx_v_x); - __Pyx_INCREF(__pyx_t_7); - __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_xindex), __pyx_n_s__to_int_index); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pandas_3lib_6sparse_IntIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = __pyx_v_xfill; - - /* "pandas/lib/src/sparse.pyx":775 - * elif isinstance(xindex, IntIndex): - * return int_op(x, xindex.to_int_index(), xfill, - * y, yindex.to_int_index(), yfill, op) # <<<<<<<<<<<<<< - * - * # NaN-based arithmetic operation-- no handling of fill values - */ - __pyx_t_6 = ((PyObject *)__pyx_v_y); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_yindex), __pyx_n_s__to_int_index); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6pandas_3lib_6sparse_IntIndex))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __pyx_v_yfill; - __pyx_t_4 = ((PyObject *)__pyx_f_6pandas_3lib_6sparse_int_op(((PyArrayObject *)__pyx_t_7), ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_t_1), __pyx_t_8, ((PyArrayObject *)__pyx_t_6), ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_t_2), __pyx_t_5, __pyx_v_op)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("pandas.lib.sparse.sparse_combine"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":781 - * - * @cython.boundscheck(False) - * cdef inline tuple block_nanop(ndarray x_, BlockIndex xindex, # <<<<<<<<<<<<<< - * ndarray y_, BlockIndex yindex, - * double_func op): - */ - -static CYTHON_INLINE PyObject *__pyx_f_6pandas_3lib_6sparse_block_nanop(PyArrayObject *__pyx_v_x_, struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y_, struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_v_yindex, __pyx_t_6pandas_3lib_6sparse_double_func __pyx_v_op) { - struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_v_out_index; - int __pyx_v_xi; - int __pyx_v_yi; - int __pyx_v_out_i; - int __pyx_v_xbp; - int __pyx_v_ybp; - int __pyx_v_obp; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_xblock; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_yblock; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_outblock; - PyArrayObject *__pyx_v_x; - PyArrayObject *__pyx_v_y; - PyArrayObject *__pyx_v_out; - Py_buffer __pyx_bstruct_y; - Py_ssize_t __pyx_bstride_0_y = 0; - Py_ssize_t __pyx_bshape_0_y = 0; - Py_buffer __pyx_bstruct_x; - Py_ssize_t __pyx_bstride_0_x = 0; - Py_ssize_t __pyx_bshape_0_x = 0; - Py_buffer __pyx_bstruct_out; - Py_ssize_t __pyx_bstride_0_out = 0; - Py_ssize_t __pyx_bshape_0_out = 0; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyArrayObject *__pyx_t_10 = NULL; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - __Pyx_RefNannySetupContext("block_nanop"); - __pyx_v_out_index = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_x = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_out = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_x.buf = NULL; - __pyx_bstruct_y.buf = NULL; - __pyx_bstruct_out.buf = NULL; - - /* "pandas/lib/src/sparse.pyx":786 - * cdef: - * BlockIndex out_index - * int xi = 0, yi = 0, out_i = 0 # fp buf indices # <<<<<<<<<<<<<< - * int xbp = 0, ybp = 0, obp = 0 # block positions - * pyst xblock = 0, yblock = 0, outblock = 0 # block numbers - */ - __pyx_v_xi = 0; - __pyx_v_yi = 0; - __pyx_v_out_i = 0; - - /* "pandas/lib/src/sparse.pyx":787 - * BlockIndex out_index - * int xi = 0, yi = 0, out_i = 0 # fp buf indices - * int xbp = 0, ybp = 0, obp = 0 # block positions # <<<<<<<<<<<<<< - * pyst xblock = 0, yblock = 0, outblock = 0 # block numbers - * - */ - __pyx_v_xbp = 0; - __pyx_v_ybp = 0; - __pyx_v_obp = 0; - - /* "pandas/lib/src/sparse.pyx":788 - * int xi = 0, yi = 0, out_i = 0 # fp buf indices - * int xbp = 0, ybp = 0, obp = 0 # block positions - * pyst xblock = 0, yblock = 0, outblock = 0 # block numbers # <<<<<<<<<<<<<< - * - * ndarray[float64_t, ndim=1] x, y - */ - __pyx_v_xblock = 0; - __pyx_v_yblock = 0; - __pyx_v_outblock = 0; - - /* "pandas/lib/src/sparse.pyx":794 - * - * # suppress Cython compiler warnings due to inlining - * x = x_ # <<<<<<<<<<<<<< - * y = y_ - * - */ - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)((PyArrayObject *)__pyx_v_x_), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4); - } - } - __pyx_bstride_0_x = __pyx_bstruct_x.strides[0]; - __pyx_bshape_0_x = __pyx_bstruct_x.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_INCREF(((PyObject *)__pyx_v_x_)); - __Pyx_DECREF(((PyObject *)__pyx_v_x)); - __pyx_v_x = ((PyArrayObject *)__pyx_v_x_); - - /* "pandas/lib/src/sparse.pyx":795 - * # suppress Cython compiler warnings due to inlining - * x = x_ - * y = y_ # <<<<<<<<<<<<<< - * - * out_index = xindex.intersect(yindex) - */ - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)((PyArrayObject *)__pyx_v_y_), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_4, __pyx_t_3, __pyx_t_2); - } - } - __pyx_bstride_0_y = __pyx_bstruct_y.strides[0]; - __pyx_bshape_0_y = __pyx_bstruct_y.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_INCREF(((PyObject *)__pyx_v_y_)); - __Pyx_DECREF(((PyObject *)__pyx_v_y)); - __pyx_v_y = ((PyArrayObject *)__pyx_v_y_); - - /* "pandas/lib/src/sparse.pyx":797 - * y = y_ - * - * out_index = xindex.intersect(yindex) # <<<<<<<<<<<<<< - * out = np.empty(out_index.npoints, dtype=np.float64) - * - */ - __pyx_t_5 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_xindex->__pyx_vtab)->intersect(__pyx_v_xindex, ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_5), 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_out_index)); - __pyx_v_out_index = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_t_6); - __pyx_t_6 = 0; - - /* "pandas/lib/src/sparse.pyx":798 - * - * out_index = xindex.intersect(yindex) - * out = np.empty(out_index.npoints, dtype=np.float64) # <<<<<<<<<<<<<< - * - * # walk the two SparseVectors, adding matched locations... - */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_out_index->npoints); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - PyTuple_SET_ITEM(__pyx_t_7, 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[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__float64); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_5, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4); - } - } - __pyx_bstride_0_out = __pyx_bstruct_out.strides[0]; - __pyx_bshape_0_out = __pyx_bstruct_out.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_10 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_out)); - __pyx_v_out = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; - - /* "pandas/lib/src/sparse.pyx":801 - * - * # walk the two SparseVectors, adding matched locations... - * for out_i from 0 <= out_i < out_index.npoints: # <<<<<<<<<<<<<< - * - * # I have a feeling this is inefficient - */ - __pyx_t_11 = __pyx_v_out_index->npoints; - for (__pyx_v_out_i = 0; __pyx_v_out_i < __pyx_t_11; __pyx_v_out_i++) { - - /* "pandas/lib/src/sparse.pyx":806 - * - * # walk x - * while xindex.locbuf[xblock] + xbp < out_index.locbuf[outblock] + obp: # <<<<<<<<<<<<<< - * xbp += 1 - * xi += 1 - */ - while (1) { - __pyx_t_12 = (((__pyx_v_xindex->locbuf[__pyx_v_xblock]) + __pyx_v_xbp) < ((__pyx_v_out_index->locbuf[__pyx_v_outblock]) + __pyx_v_obp)); - if (!__pyx_t_12) break; - - /* "pandas/lib/src/sparse.pyx":807 - * # walk x - * while xindex.locbuf[xblock] + xbp < out_index.locbuf[outblock] + obp: - * xbp += 1 # <<<<<<<<<<<<<< - * xi += 1 - * if xbp == xindex.lenbuf[xblock]: - */ - __pyx_v_xbp = (__pyx_v_xbp + 1); - - /* "pandas/lib/src/sparse.pyx":808 - * while xindex.locbuf[xblock] + xbp < out_index.locbuf[outblock] + obp: - * xbp += 1 - * xi += 1 # <<<<<<<<<<<<<< - * if xbp == xindex.lenbuf[xblock]: - * xblock += 1 - */ - __pyx_v_xi = (__pyx_v_xi + 1); - - /* "pandas/lib/src/sparse.pyx":809 - * xbp += 1 - * xi += 1 - * if xbp == xindex.lenbuf[xblock]: # <<<<<<<<<<<<<< - * xblock += 1 - * xbp = 0 - */ - __pyx_t_12 = (__pyx_v_xbp == (__pyx_v_xindex->lenbuf[__pyx_v_xblock])); - if (__pyx_t_12) { - - /* "pandas/lib/src/sparse.pyx":810 - * xi += 1 - * if xbp == xindex.lenbuf[xblock]: - * xblock += 1 # <<<<<<<<<<<<<< - * xbp = 0 - * - */ - __pyx_v_xblock = (__pyx_v_xblock + 1); - - /* "pandas/lib/src/sparse.pyx":811 - * if xbp == xindex.lenbuf[xblock]: - * xblock += 1 - * xbp = 0 # <<<<<<<<<<<<<< - * - * # walk y - */ - __pyx_v_xbp = 0; - goto __pyx_L7; - } - __pyx_L7:; - } - - /* "pandas/lib/src/sparse.pyx":814 - * - * # walk y - * while yindex.locbuf[yblock] + ybp < out_index.locbuf[outblock] + obp: # <<<<<<<<<<<<<< - * ybp += 1 - * yi += 1 - */ - while (1) { - __pyx_t_12 = (((__pyx_v_yindex->locbuf[__pyx_v_yblock]) + __pyx_v_ybp) < ((__pyx_v_out_index->locbuf[__pyx_v_outblock]) + __pyx_v_obp)); - if (!__pyx_t_12) break; - - /* "pandas/lib/src/sparse.pyx":815 - * # walk y - * while yindex.locbuf[yblock] + ybp < out_index.locbuf[outblock] + obp: - * ybp += 1 # <<<<<<<<<<<<<< - * yi += 1 - * if ybp == yindex.lenbuf[yblock]: - */ - __pyx_v_ybp = (__pyx_v_ybp + 1); - - /* "pandas/lib/src/sparse.pyx":816 - * while yindex.locbuf[yblock] + ybp < out_index.locbuf[outblock] + obp: - * ybp += 1 - * yi += 1 # <<<<<<<<<<<<<< - * if ybp == yindex.lenbuf[yblock]: - * yblock += 1 - */ - __pyx_v_yi = (__pyx_v_yi + 1); - - /* "pandas/lib/src/sparse.pyx":817 - * ybp += 1 - * yi += 1 - * if ybp == yindex.lenbuf[yblock]: # <<<<<<<<<<<<<< - * yblock += 1 - * ybp = 0 - */ - __pyx_t_12 = (__pyx_v_ybp == (__pyx_v_yindex->lenbuf[__pyx_v_yblock])); - if (__pyx_t_12) { - - /* "pandas/lib/src/sparse.pyx":818 - * yi += 1 - * if ybp == yindex.lenbuf[yblock]: - * yblock += 1 # <<<<<<<<<<<<<< - * ybp = 0 - * - */ - __pyx_v_yblock = (__pyx_v_yblock + 1); - - /* "pandas/lib/src/sparse.pyx":819 - * if ybp == yindex.lenbuf[yblock]: - * yblock += 1 - * ybp = 0 # <<<<<<<<<<<<<< - * - * out[out_i] = op(x[xi], y[yi]) - */ - __pyx_v_ybp = 0; - goto __pyx_L10; - } - __pyx_L10:; - } - - /* "pandas/lib/src/sparse.pyx":821 - * ybp = 0 - * - * out[out_i] = op(x[xi], y[yi]) # <<<<<<<<<<<<<< - * - * # advance. strikes me as too complicated - */ - __pyx_t_1 = __pyx_v_xi; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_bshape_0_x; - __pyx_t_13 = __pyx_v_yi; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_y; - __pyx_t_14 = __pyx_v_out_i; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_out; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_14, __pyx_bstride_0_out) = __pyx_v_op((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_1, __pyx_bstride_0_x)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_13, __pyx_bstride_0_y))); - - /* "pandas/lib/src/sparse.pyx":824 - * - * # advance. strikes me as too complicated - * xi += 1 # <<<<<<<<<<<<<< - * yi += 1 - * - */ - __pyx_v_xi = (__pyx_v_xi + 1); - - /* "pandas/lib/src/sparse.pyx":825 - * # advance. strikes me as too complicated - * xi += 1 - * yi += 1 # <<<<<<<<<<<<<< - * - * xbp += 1 - */ - __pyx_v_yi = (__pyx_v_yi + 1); - - /* "pandas/lib/src/sparse.pyx":827 - * yi += 1 - * - * xbp += 1 # <<<<<<<<<<<<<< - * if xbp == xindex.lenbuf[xblock]: - * xblock += 1 - */ - __pyx_v_xbp = (__pyx_v_xbp + 1); - - /* "pandas/lib/src/sparse.pyx":828 - * - * xbp += 1 - * if xbp == xindex.lenbuf[xblock]: # <<<<<<<<<<<<<< - * xblock += 1 - * xbp = 0 - */ - __pyx_t_12 = (__pyx_v_xbp == (__pyx_v_xindex->lenbuf[__pyx_v_xblock])); - if (__pyx_t_12) { - - /* "pandas/lib/src/sparse.pyx":829 - * xbp += 1 - * if xbp == xindex.lenbuf[xblock]: - * xblock += 1 # <<<<<<<<<<<<<< - * xbp = 0 - * - */ - __pyx_v_xblock = (__pyx_v_xblock + 1); - - /* "pandas/lib/src/sparse.pyx":830 - * if xbp == xindex.lenbuf[xblock]: - * xblock += 1 - * xbp = 0 # <<<<<<<<<<<<<< - * - * ybp += 1 - */ - __pyx_v_xbp = 0; - goto __pyx_L11; - } - __pyx_L11:; - - /* "pandas/lib/src/sparse.pyx":832 - * xbp = 0 - * - * ybp += 1 # <<<<<<<<<<<<<< - * if ybp == yindex.lenbuf[yblock]: - * yblock += 1 - */ - __pyx_v_ybp = (__pyx_v_ybp + 1); - - /* "pandas/lib/src/sparse.pyx":833 - * - * ybp += 1 - * if ybp == yindex.lenbuf[yblock]: # <<<<<<<<<<<<<< - * yblock += 1 - * ybp = 0 - */ - __pyx_t_12 = (__pyx_v_ybp == (__pyx_v_yindex->lenbuf[__pyx_v_yblock])); - if (__pyx_t_12) { - - /* "pandas/lib/src/sparse.pyx":834 - * ybp += 1 - * if ybp == yindex.lenbuf[yblock]: - * yblock += 1 # <<<<<<<<<<<<<< - * ybp = 0 - * - */ - __pyx_v_yblock = (__pyx_v_yblock + 1); - - /* "pandas/lib/src/sparse.pyx":835 - * if ybp == yindex.lenbuf[yblock]: - * yblock += 1 - * ybp = 0 # <<<<<<<<<<<<<< - * - * obp += 1 - */ - __pyx_v_ybp = 0; - goto __pyx_L12; - } - __pyx_L12:; - - /* "pandas/lib/src/sparse.pyx":837 - * ybp = 0 - * - * obp += 1 # <<<<<<<<<<<<<< - * if obp == out_index.lenbuf[outblock]: - * outblock += 1 - */ - __pyx_v_obp = (__pyx_v_obp + 1); - - /* "pandas/lib/src/sparse.pyx":838 - * - * obp += 1 - * if obp == out_index.lenbuf[outblock]: # <<<<<<<<<<<<<< - * outblock += 1 - * obp = 0 - */ - __pyx_t_12 = (__pyx_v_obp == (__pyx_v_out_index->lenbuf[__pyx_v_outblock])); - if (__pyx_t_12) { - - /* "pandas/lib/src/sparse.pyx":839 - * obp += 1 - * if obp == out_index.lenbuf[outblock]: - * outblock += 1 # <<<<<<<<<<<<<< - * obp = 0 - * - */ - __pyx_v_outblock = (__pyx_v_outblock + 1); - - /* "pandas/lib/src/sparse.pyx":840 - * if obp == out_index.lenbuf[outblock]: - * outblock += 1 - * obp = 0 # <<<<<<<<<<<<<< - * - * return out, out_index - */ - __pyx_v_obp = 0; - goto __pyx_L13; - } - __pyx_L13:; - } - - /* "pandas/lib/src/sparse.pyx":842 - * obp = 0 - * - * return out, out_index # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - __Pyx_INCREF(((PyObject *)__pyx_v_out)); - PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_out)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_out)); - __Pyx_INCREF(((PyObject *)__pyx_v_out_index)); - PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_v_out_index)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_out_index)); - __pyx_r = __pyx_t_9; - __pyx_t_9 = 0; - goto __pyx_L0; - - __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.block_nanop"); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_out_index); - __Pyx_DECREF((PyObject *)__pyx_v_x); - __Pyx_DECREF((PyObject *)__pyx_v_y); - __Pyx_DECREF((PyObject *)__pyx_v_out); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":845 - * - * @cython.boundscheck(False) - * cdef inline tuple int_nanop(ndarray x_, IntIndex xindex, # <<<<<<<<<<<<<< - * ndarray y_, IntIndex yindex, - * double_func op): - */ - -static CYTHON_INLINE PyObject *__pyx_f_6pandas_3lib_6sparse_int_nanop(PyArrayObject *__pyx_v_x_, struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_v_xindex, PyArrayObject *__pyx_v_y_, struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_v_yindex, __pyx_t_6pandas_3lib_6sparse_double_func __pyx_v_op) { - struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_v_out_index; - int __pyx_v_xi; - int __pyx_v_yi; - int __pyx_v_out_i; - PyArrayObject *__pyx_v_xindices; - PyArrayObject *__pyx_v_yindices; - PyArrayObject *__pyx_v_out_indices; - PyArrayObject *__pyx_v_x; - PyArrayObject *__pyx_v_y; - PyArrayObject *__pyx_v_out; - Py_buffer __pyx_bstruct_out_indices; - Py_ssize_t __pyx_bstride_0_out_indices = 0; - Py_ssize_t __pyx_bshape_0_out_indices = 0; - Py_buffer __pyx_bstruct_yindices; - Py_ssize_t __pyx_bstride_0_yindices = 0; - Py_ssize_t __pyx_bshape_0_yindices = 0; - Py_buffer __pyx_bstruct_y; - Py_ssize_t __pyx_bstride_0_y = 0; - Py_ssize_t __pyx_bshape_0_y = 0; - Py_buffer __pyx_bstruct_x; - Py_ssize_t __pyx_bstride_0_x = 0; - Py_ssize_t __pyx_bshape_0_x = 0; - Py_buffer __pyx_bstruct_xindices; - Py_ssize_t __pyx_bstride_0_xindices = 0; - Py_ssize_t __pyx_bshape_0_xindices = 0; - Py_buffer __pyx_bstruct_out; - Py_ssize_t __pyx_bstride_0_out = 0; - Py_ssize_t __pyx_bshape_0_out = 0; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyArrayObject *__pyx_t_10 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_12; - int __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_RefNannySetupContext("int_nanop"); - __pyx_v_out_index = ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_xindices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_yindices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_out_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_x = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_out = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_xindices.buf = NULL; - __pyx_bstruct_yindices.buf = NULL; - __pyx_bstruct_out_indices.buf = NULL; - __pyx_bstruct_x.buf = NULL; - __pyx_bstruct_y.buf = NULL; - __pyx_bstruct_out.buf = NULL; - - /* "pandas/lib/src/sparse.pyx":850 - * cdef: - * IntIndex out_index - * int xi = 0, yi = 0, out_i = 0 # fp buf indices # <<<<<<<<<<<<<< - * ndarray[int32_t, ndim=1] xindices, yindices, out_indices - * ndarray[float64_t, ndim=1] x, y - */ - __pyx_v_xi = 0; - __pyx_v_yi = 0; - __pyx_v_out_i = 0; - - /* "pandas/lib/src/sparse.pyx":856 - * - * # suppress Cython compiler warnings due to inlining - * x = x_ # <<<<<<<<<<<<<< - * y = y_ - * - */ - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)((PyArrayObject *)__pyx_v_x_), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4); - } - } - __pyx_bstride_0_x = __pyx_bstruct_x.strides[0]; - __pyx_bshape_0_x = __pyx_bstruct_x.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_INCREF(((PyObject *)__pyx_v_x_)); - __Pyx_DECREF(((PyObject *)__pyx_v_x)); - __pyx_v_x = ((PyArrayObject *)__pyx_v_x_); - - /* "pandas/lib/src/sparse.pyx":857 - * # suppress Cython compiler warnings due to inlining - * x = x_ - * y = y_ # <<<<<<<<<<<<<< - * - * # need to do this first to know size of result array - */ - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)((PyArrayObject *)__pyx_v_y_), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_4, __pyx_t_3, __pyx_t_2); - } - } - __pyx_bstride_0_y = __pyx_bstruct_y.strides[0]; - __pyx_bshape_0_y = __pyx_bstruct_y.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_INCREF(((PyObject *)__pyx_v_y_)); - __Pyx_DECREF(((PyObject *)__pyx_v_y)); - __pyx_v_y = ((PyArrayObject *)__pyx_v_y_); - - /* "pandas/lib/src/sparse.pyx":860 - * - * # need to do this first to know size of result array - * out_index = xindex.intersect(yindex) # <<<<<<<<<<<<<< - * out = np.empty(out_index.npoints, dtype=np.float64) - * - */ - __pyx_t_5 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_6pandas_3lib_6sparse_IntIndex *)__pyx_v_xindex->__pyx_vtab)->intersect(__pyx_v_xindex, ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_5), 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_out_index)); - __pyx_v_out_index = ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_t_6); - __pyx_t_6 = 0; - - /* "pandas/lib/src/sparse.pyx":861 - * # need to do this first to know size of result array - * out_index = xindex.intersect(yindex) - * out = np.empty(out_index.npoints, dtype=np.float64) # <<<<<<<<<<<<<< - * - * xindices = xindex.indices - */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_out_index->npoints); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - PyTuple_SET_ITEM(__pyx_t_7, 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[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__float64); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_5, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4); - } - } - __pyx_bstride_0_out = __pyx_bstruct_out.strides[0]; - __pyx_bshape_0_out = __pyx_bstruct_out.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_10 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_out)); - __pyx_v_out = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; - - /* "pandas/lib/src/sparse.pyx":863 - * out = np.empty(out_index.npoints, dtype=np.float64) - * - * xindices = xindex.indices # <<<<<<<<<<<<<< - * yindices = yindex.indices - * out_indices = out_index.indices - */ - __pyx_t_11 = ((PyArrayObject *)__pyx_v_xindex->indices); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xindices, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xindices, (PyObject*)__pyx_v_xindices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_4, __pyx_t_3, __pyx_t_2); - } - } - __pyx_bstride_0_xindices = __pyx_bstruct_xindices.strides[0]; - __pyx_bshape_0_xindices = __pyx_bstruct_xindices.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_11 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_xindex->indices)); - __Pyx_DECREF(((PyObject *)__pyx_v_xindices)); - __pyx_v_xindices = ((PyArrayObject *)__pyx_v_xindex->indices); - - /* "pandas/lib/src/sparse.pyx":864 - * - * xindices = xindex.indices - * yindices = yindex.indices # <<<<<<<<<<<<<< - * out_indices = out_index.indices - * - */ - __pyx_t_11 = ((PyArrayObject *)__pyx_v_yindex->indices); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_yindices, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_yindices, (PyObject*)__pyx_v_yindices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4); - } - } - __pyx_bstride_0_yindices = __pyx_bstruct_yindices.strides[0]; - __pyx_bshape_0_yindices = __pyx_bstruct_yindices.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_11 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_yindex->indices)); - __Pyx_DECREF(((PyObject *)__pyx_v_yindices)); - __pyx_v_yindices = ((PyArrayObject *)__pyx_v_yindex->indices); - - /* "pandas/lib/src/sparse.pyx":865 - * xindices = xindex.indices - * yindices = yindex.indices - * out_indices = out_index.indices # <<<<<<<<<<<<<< - * - * # walk the two SparseVectors, adding matched locations... - */ - __pyx_t_11 = ((PyArrayObject *)__pyx_v_out_index->indices); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out_indices); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_out_indices, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_out_indices, (PyObject*)__pyx_v_out_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_4, __pyx_t_3, __pyx_t_2); - } - } - __pyx_bstride_0_out_indices = __pyx_bstruct_out_indices.strides[0]; - __pyx_bshape_0_out_indices = __pyx_bstruct_out_indices.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_11 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_out_index->indices)); - __Pyx_DECREF(((PyObject *)__pyx_v_out_indices)); - __pyx_v_out_indices = ((PyArrayObject *)__pyx_v_out_index->indices); - - /* "pandas/lib/src/sparse.pyx":868 - * - * # walk the two SparseVectors, adding matched locations... - * for out_i from 0 <= out_i < out_index.npoints: # <<<<<<<<<<<<<< - * - * # walk x - */ - __pyx_t_12 = __pyx_v_out_index->npoints; - for (__pyx_v_out_i = 0; __pyx_v_out_i < __pyx_t_12; __pyx_v_out_i++) { - - /* "pandas/lib/src/sparse.pyx":871 - * - * # walk x - * while xindices[xi] < out_indices[out_i]: # <<<<<<<<<<<<<< - * xi += 1 - * - */ - while (1) { - __pyx_t_1 = __pyx_v_xi; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_bshape_0_xindices; - __pyx_t_13 = __pyx_v_out_i; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_out_indices; - __pyx_t_14 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xindices.buf, __pyx_t_1, __pyx_bstride_0_xindices)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_out_indices.buf, __pyx_t_13, __pyx_bstride_0_out_indices))); - if (!__pyx_t_14) break; - - /* "pandas/lib/src/sparse.pyx":872 - * # walk x - * while xindices[xi] < out_indices[out_i]: - * xi += 1 # <<<<<<<<<<<<<< - * - * # walk y - */ - __pyx_v_xi = (__pyx_v_xi + 1); - } - - /* "pandas/lib/src/sparse.pyx":875 - * - * # walk y - * while yindices[yi] < out_indices[out_i]: # <<<<<<<<<<<<<< - * yi += 1 - * - */ - while (1) { - __pyx_t_15 = __pyx_v_yi; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_yindices; - __pyx_t_16 = __pyx_v_out_i; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_out_indices; - __pyx_t_14 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yindices.buf, __pyx_t_15, __pyx_bstride_0_yindices)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_out_indices.buf, __pyx_t_16, __pyx_bstride_0_out_indices))); - if (!__pyx_t_14) break; - - /* "pandas/lib/src/sparse.pyx":876 - * # walk y - * while yindices[yi] < out_indices[out_i]: - * yi += 1 # <<<<<<<<<<<<<< - * - * out[out_i] = op(x[xi], y[yi]) - */ - __pyx_v_yi = (__pyx_v_yi + 1); - } - - /* "pandas/lib/src/sparse.pyx":878 - * yi += 1 - * - * out[out_i] = op(x[xi], y[yi]) # <<<<<<<<<<<<<< - * - * # advance - */ - __pyx_t_17 = __pyx_v_xi; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_0_x; - __pyx_t_18 = __pyx_v_yi; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_0_y; - __pyx_t_19 = __pyx_v_out_i; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_out; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_19, __pyx_bstride_0_out) = __pyx_v_op((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_17, __pyx_bstride_0_x)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_18, __pyx_bstride_0_y))); - - /* "pandas/lib/src/sparse.pyx":881 - * - * # advance - * xi += 1 # <<<<<<<<<<<<<< - * yi += 1 - * - */ - __pyx_v_xi = (__pyx_v_xi + 1); - - /* "pandas/lib/src/sparse.pyx":882 - * # advance - * xi += 1 - * yi += 1 # <<<<<<<<<<<<<< - * - * return out, out_index - */ - __pyx_v_yi = (__pyx_v_yi + 1); - } - - /* "pandas/lib/src/sparse.pyx":884 - * yi += 1 - * - * return out, out_index # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - __Pyx_INCREF(((PyObject *)__pyx_v_out)); - PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_out)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_out)); - __Pyx_INCREF(((PyObject *)__pyx_v_out_index)); - PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_v_out_index)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_out_index)); - __pyx_r = __pyx_t_9; - __pyx_t_9 = 0; - goto __pyx_L0; - - __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.int_nanop"); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_out_index); - __Pyx_DECREF((PyObject *)__pyx_v_xindices); - __Pyx_DECREF((PyObject *)__pyx_v_yindices); - __Pyx_DECREF((PyObject *)__pyx_v_out_indices); - __Pyx_DECREF((PyObject *)__pyx_v_x); - __Pyx_DECREF((PyObject *)__pyx_v_y); - __Pyx_DECREF((PyObject *)__pyx_v_out); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":888 - * - * @cython.boundscheck(False) - * cdef inline tuple block_op(ndarray x_, BlockIndex xindex, float64_t xfill, # <<<<<<<<<<<<<< - * ndarray y_, BlockIndex yindex, float64_t yfill, - * double_func op): - */ - -static CYTHON_INLINE PyObject *__pyx_f_6pandas_3lib_6sparse_block_op(PyArrayObject *__pyx_v_x_, struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y_, struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, __pyx_t_6pandas_3lib_6sparse_double_func __pyx_v_op) { - struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_v_out_index; - int __pyx_v_xi; - int __pyx_v_yi; - int __pyx_v_out_i; - int __pyx_v_xbp; - int __pyx_v_ybp; - __pyx_t_5numpy_int32_t __pyx_v_xloc; - __pyx_t_5numpy_int32_t __pyx_v_yloc; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_xblock; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_yblock; - PyArrayObject *__pyx_v_x; - PyArrayObject *__pyx_v_y; - PyArrayObject *__pyx_v_out; - Py_buffer __pyx_bstruct_y; - Py_ssize_t __pyx_bstride_0_y = 0; - Py_ssize_t __pyx_bshape_0_y = 0; - Py_buffer __pyx_bstruct_x; - Py_ssize_t __pyx_bstride_0_x = 0; - Py_ssize_t __pyx_bshape_0_x = 0; - Py_buffer __pyx_bstruct_out; - Py_ssize_t __pyx_bstride_0_out = 0; - Py_ssize_t __pyx_bshape_0_out = 0; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyArrayObject *__pyx_t_10 = NULL; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_11; - int __pyx_t_12; - int __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; - int __pyx_t_20; - int __pyx_t_21; - int __pyx_t_22; - __Pyx_RefNannySetupContext("block_op"); - __pyx_v_out_index = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_x = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_out = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_x.buf = NULL; - __pyx_bstruct_y.buf = NULL; - __pyx_bstruct_out.buf = NULL; - - /* "pandas/lib/src/sparse.pyx":897 - * cdef: - * BlockIndex out_index - * int xi = 0, yi = 0, out_i = 0 # fp buf indices # <<<<<<<<<<<<<< - * int xbp = 0, ybp = 0 # block positions - * int32_t xloc, yloc - */ - __pyx_v_xi = 0; - __pyx_v_yi = 0; - __pyx_v_out_i = 0; - - /* "pandas/lib/src/sparse.pyx":898 - * BlockIndex out_index - * int xi = 0, yi = 0, out_i = 0 # fp buf indices - * int xbp = 0, ybp = 0 # block positions # <<<<<<<<<<<<<< - * int32_t xloc, yloc - * pyst xblock = 0, yblock = 0 # block numbers - */ - __pyx_v_xbp = 0; - __pyx_v_ybp = 0; - - /* "pandas/lib/src/sparse.pyx":900 - * int xbp = 0, ybp = 0 # block positions - * int32_t xloc, yloc - * pyst xblock = 0, yblock = 0 # block numbers # <<<<<<<<<<<<<< - * - * ndarray[float64_t, ndim=1] x, y - */ - __pyx_v_xblock = 0; - __pyx_v_yblock = 0; - - /* "pandas/lib/src/sparse.pyx":906 - * - * # to suppress Cython warning - * x = x_ # <<<<<<<<<<<<<< - * y = y_ - * - */ - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)((PyArrayObject *)__pyx_v_x_), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4); - } - } - __pyx_bstride_0_x = __pyx_bstruct_x.strides[0]; - __pyx_bshape_0_x = __pyx_bstruct_x.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_INCREF(((PyObject *)__pyx_v_x_)); - __Pyx_DECREF(((PyObject *)__pyx_v_x)); - __pyx_v_x = ((PyArrayObject *)__pyx_v_x_); - - /* "pandas/lib/src/sparse.pyx":907 - * # to suppress Cython warning - * x = x_ - * y = y_ # <<<<<<<<<<<<<< - * - * out_index = xindex.make_union(yindex) - */ - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)((PyArrayObject *)__pyx_v_y_), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_4, __pyx_t_3, __pyx_t_2); - } - } - __pyx_bstride_0_y = __pyx_bstruct_y.strides[0]; - __pyx_bshape_0_y = __pyx_bstruct_y.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_INCREF(((PyObject *)__pyx_v_y_)); - __Pyx_DECREF(((PyObject *)__pyx_v_y)); - __pyx_v_y = ((PyArrayObject *)__pyx_v_y_); - - /* "pandas/lib/src/sparse.pyx":909 - * y = y_ - * - * out_index = xindex.make_union(yindex) # <<<<<<<<<<<<<< - * out = np.empty(out_index.npoints, dtype=np.float64) - * - */ - __pyx_t_5 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockIndex *)__pyx_v_xindex->__pyx_vtab)->make_union(__pyx_v_xindex, ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_5), 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_out_index)); - __pyx_v_out_index = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)__pyx_t_6); - __pyx_t_6 = 0; - - /* "pandas/lib/src/sparse.pyx":910 - * - * out_index = xindex.make_union(yindex) - * out = np.empty(out_index.npoints, dtype=np.float64) # <<<<<<<<<<<<<< - * - * # Wow, what a hack job. Need to do something about this - */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_out_index->npoints); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - PyTuple_SET_ITEM(__pyx_t_7, 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[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__float64); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_5, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4); - } - } - __pyx_bstride_0_out = __pyx_bstruct_out.strides[0]; - __pyx_bshape_0_out = __pyx_bstruct_out.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_10 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_out)); - __pyx_v_out = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; - - /* "pandas/lib/src/sparse.pyx":915 - * - * # walk the two SparseVectors, adding matched locations... - * for out_i from 0 <= out_i < out_index.npoints: # <<<<<<<<<<<<<< - * if yblock == yindex.nblocks: - * # use y fill value - */ - __pyx_t_11 = __pyx_v_out_index->npoints; - for (__pyx_v_out_i = 0; __pyx_v_out_i < __pyx_t_11; __pyx_v_out_i++) { - - /* "pandas/lib/src/sparse.pyx":916 - * # walk the two SparseVectors, adding matched locations... - * for out_i from 0 <= out_i < out_index.npoints: - * if yblock == yindex.nblocks: # <<<<<<<<<<<<<< - * # use y fill value - * out[out_i] = op(x[xi], yfill) - */ - __pyx_t_12 = (__pyx_v_yblock == __pyx_v_yindex->nblocks); - if (__pyx_t_12) { - - /* "pandas/lib/src/sparse.pyx":918 - * if yblock == yindex.nblocks: - * # use y fill value - * out[out_i] = op(x[xi], yfill) # <<<<<<<<<<<<<< - * xi += 1 - * - */ - __pyx_t_1 = __pyx_v_xi; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_bshape_0_x; - __pyx_t_13 = __pyx_v_out_i; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_out; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_13, __pyx_bstride_0_out) = __pyx_v_op((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_1, __pyx_bstride_0_x)), __pyx_v_yfill); - - /* "pandas/lib/src/sparse.pyx":919 - * # use y fill value - * out[out_i] = op(x[xi], yfill) - * xi += 1 # <<<<<<<<<<<<<< - * - * # advance x location - */ - __pyx_v_xi = (__pyx_v_xi + 1); - - /* "pandas/lib/src/sparse.pyx":922 - * - * # advance x location - * xbp += 1 # <<<<<<<<<<<<<< - * if xbp == xindex.lenbuf[xblock]: - * xblock += 1 - */ - __pyx_v_xbp = (__pyx_v_xbp + 1); - - /* "pandas/lib/src/sparse.pyx":923 - * # advance x location - * xbp += 1 - * if xbp == xindex.lenbuf[xblock]: # <<<<<<<<<<<<<< - * xblock += 1 - * xbp = 0 - */ - __pyx_t_12 = (__pyx_v_xbp == (__pyx_v_xindex->lenbuf[__pyx_v_xblock])); - if (__pyx_t_12) { - - /* "pandas/lib/src/sparse.pyx":924 - * xbp += 1 - * if xbp == xindex.lenbuf[xblock]: - * xblock += 1 # <<<<<<<<<<<<<< - * xbp = 0 - * continue - */ - __pyx_v_xblock = (__pyx_v_xblock + 1); - - /* "pandas/lib/src/sparse.pyx":925 - * if xbp == xindex.lenbuf[xblock]: - * xblock += 1 - * xbp = 0 # <<<<<<<<<<<<<< - * continue - * - */ - __pyx_v_xbp = 0; - goto __pyx_L6; - } - __pyx_L6:; - - /* "pandas/lib/src/sparse.pyx":926 - * xblock += 1 - * xbp = 0 - * continue # <<<<<<<<<<<<<< - * - * if xblock == xindex.nblocks: - */ - goto __pyx_L3_continue; - goto __pyx_L5; - } - __pyx_L5:; - - /* "pandas/lib/src/sparse.pyx":928 - * continue - * - * if xblock == xindex.nblocks: # <<<<<<<<<<<<<< - * # use x fill value - * out[out_i] = op(xfill, y[yi]) - */ - __pyx_t_12 = (__pyx_v_xblock == __pyx_v_xindex->nblocks); - if (__pyx_t_12) { - - /* "pandas/lib/src/sparse.pyx":930 - * if xblock == xindex.nblocks: - * # use x fill value - * out[out_i] = op(xfill, y[yi]) # <<<<<<<<<<<<<< - * yi += 1 - * - */ - __pyx_t_14 = __pyx_v_yi; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_y; - __pyx_t_15 = __pyx_v_out_i; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_out; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_15, __pyx_bstride_0_out) = __pyx_v_op(__pyx_v_xfill, (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_14, __pyx_bstride_0_y))); - - /* "pandas/lib/src/sparse.pyx":931 - * # use x fill value - * out[out_i] = op(xfill, y[yi]) - * yi += 1 # <<<<<<<<<<<<<< - * - * # advance y location - */ - __pyx_v_yi = (__pyx_v_yi + 1); - - /* "pandas/lib/src/sparse.pyx":934 - * - * # advance y location - * ybp += 1 # <<<<<<<<<<<<<< - * if ybp == yindex.lenbuf[yblock]: - * yblock += 1 - */ - __pyx_v_ybp = (__pyx_v_ybp + 1); - - /* "pandas/lib/src/sparse.pyx":935 - * # advance y location - * ybp += 1 - * if ybp == yindex.lenbuf[yblock]: # <<<<<<<<<<<<<< - * yblock += 1 - * ybp = 0 - */ - __pyx_t_12 = (__pyx_v_ybp == (__pyx_v_yindex->lenbuf[__pyx_v_yblock])); - if (__pyx_t_12) { - - /* "pandas/lib/src/sparse.pyx":936 - * ybp += 1 - * if ybp == yindex.lenbuf[yblock]: - * yblock += 1 # <<<<<<<<<<<<<< - * ybp = 0 - * continue - */ - __pyx_v_yblock = (__pyx_v_yblock + 1); - - /* "pandas/lib/src/sparse.pyx":937 - * if ybp == yindex.lenbuf[yblock]: - * yblock += 1 - * ybp = 0 # <<<<<<<<<<<<<< - * continue - * - */ - __pyx_v_ybp = 0; - goto __pyx_L8; - } - __pyx_L8:; - - /* "pandas/lib/src/sparse.pyx":938 - * yblock += 1 - * ybp = 0 - * continue # <<<<<<<<<<<<<< - * - * yloc = yindex.locbuf[yblock] + ybp - */ - goto __pyx_L3_continue; - goto __pyx_L7; - } - __pyx_L7:; - - /* "pandas/lib/src/sparse.pyx":940 - * continue - * - * yloc = yindex.locbuf[yblock] + ybp # <<<<<<<<<<<<<< - * xloc = xindex.locbuf[xblock] + xbp - * - */ - __pyx_v_yloc = ((__pyx_v_yindex->locbuf[__pyx_v_yblock]) + __pyx_v_ybp); - - /* "pandas/lib/src/sparse.pyx":941 - * - * yloc = yindex.locbuf[yblock] + ybp - * xloc = xindex.locbuf[xblock] + xbp # <<<<<<<<<<<<<< - * - * # each index in the out_index had to come from either x, y, or both - */ - __pyx_v_xloc = ((__pyx_v_xindex->locbuf[__pyx_v_xblock]) + __pyx_v_xbp); - - /* "pandas/lib/src/sparse.pyx":944 - * - * # each index in the out_index had to come from either x, y, or both - * if xloc == yloc: # <<<<<<<<<<<<<< - * out[out_i] = op(x[xi], y[yi]) - * xi += 1 - */ - __pyx_t_12 = (__pyx_v_xloc == __pyx_v_yloc); - if (__pyx_t_12) { - - /* "pandas/lib/src/sparse.pyx":945 - * # each index in the out_index had to come from either x, y, or both - * if xloc == yloc: - * out[out_i] = op(x[xi], y[yi]) # <<<<<<<<<<<<<< - * xi += 1 - * yi += 1 - */ - __pyx_t_16 = __pyx_v_xi; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_x; - __pyx_t_17 = __pyx_v_yi; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_0_y; - __pyx_t_18 = __pyx_v_out_i; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_0_out; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_18, __pyx_bstride_0_out) = __pyx_v_op((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_16, __pyx_bstride_0_x)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_17, __pyx_bstride_0_y))); - - /* "pandas/lib/src/sparse.pyx":946 - * if xloc == yloc: - * out[out_i] = op(x[xi], y[yi]) - * xi += 1 # <<<<<<<<<<<<<< - * yi += 1 - * - */ - __pyx_v_xi = (__pyx_v_xi + 1); - - /* "pandas/lib/src/sparse.pyx":947 - * out[out_i] = op(x[xi], y[yi]) - * xi += 1 - * yi += 1 # <<<<<<<<<<<<<< - * - * # advance both locations - */ - __pyx_v_yi = (__pyx_v_yi + 1); - - /* "pandas/lib/src/sparse.pyx":950 - * - * # advance both locations - * xbp += 1 # <<<<<<<<<<<<<< - * if xbp == xindex.lenbuf[xblock]: - * xblock += 1 - */ - __pyx_v_xbp = (__pyx_v_xbp + 1); - - /* "pandas/lib/src/sparse.pyx":951 - * # advance both locations - * xbp += 1 - * if xbp == xindex.lenbuf[xblock]: # <<<<<<<<<<<<<< - * xblock += 1 - * xbp = 0 - */ - __pyx_t_12 = (__pyx_v_xbp == (__pyx_v_xindex->lenbuf[__pyx_v_xblock])); - if (__pyx_t_12) { - - /* "pandas/lib/src/sparse.pyx":952 - * xbp += 1 - * if xbp == xindex.lenbuf[xblock]: - * xblock += 1 # <<<<<<<<<<<<<< - * xbp = 0 - * - */ - __pyx_v_xblock = (__pyx_v_xblock + 1); - - /* "pandas/lib/src/sparse.pyx":953 - * if xbp == xindex.lenbuf[xblock]: - * xblock += 1 - * xbp = 0 # <<<<<<<<<<<<<< - * - * ybp += 1 - */ - __pyx_v_xbp = 0; - goto __pyx_L10; - } - __pyx_L10:; - - /* "pandas/lib/src/sparse.pyx":955 - * xbp = 0 - * - * ybp += 1 # <<<<<<<<<<<<<< - * if ybp == yindex.lenbuf[yblock]: - * yblock += 1 - */ - __pyx_v_ybp = (__pyx_v_ybp + 1); - - /* "pandas/lib/src/sparse.pyx":956 - * - * ybp += 1 - * if ybp == yindex.lenbuf[yblock]: # <<<<<<<<<<<<<< - * yblock += 1 - * ybp = 0 - */ - __pyx_t_12 = (__pyx_v_ybp == (__pyx_v_yindex->lenbuf[__pyx_v_yblock])); - if (__pyx_t_12) { - - /* "pandas/lib/src/sparse.pyx":957 - * ybp += 1 - * if ybp == yindex.lenbuf[yblock]: - * yblock += 1 # <<<<<<<<<<<<<< - * ybp = 0 - * - */ - __pyx_v_yblock = (__pyx_v_yblock + 1); - - /* "pandas/lib/src/sparse.pyx":958 - * if ybp == yindex.lenbuf[yblock]: - * yblock += 1 - * ybp = 0 # <<<<<<<<<<<<<< - * - * elif xloc < yloc: - */ - __pyx_v_ybp = 0; - goto __pyx_L11; - } - __pyx_L11:; - goto __pyx_L9; - } - - /* "pandas/lib/src/sparse.pyx":960 - * ybp = 0 - * - * elif xloc < yloc: # <<<<<<<<<<<<<< - * # use y fill value - * out[out_i] = op(x[xi], yfill) - */ - __pyx_t_12 = (__pyx_v_xloc < __pyx_v_yloc); - if (__pyx_t_12) { - - /* "pandas/lib/src/sparse.pyx":962 - * elif xloc < yloc: - * # use y fill value - * out[out_i] = op(x[xi], yfill) # <<<<<<<<<<<<<< - * xi += 1 - * - */ - __pyx_t_19 = __pyx_v_xi; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_x; - __pyx_t_20 = __pyx_v_out_i; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_0_out; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_20, __pyx_bstride_0_out) = __pyx_v_op((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_19, __pyx_bstride_0_x)), __pyx_v_yfill); - - /* "pandas/lib/src/sparse.pyx":963 - * # use y fill value - * out[out_i] = op(x[xi], yfill) - * xi += 1 # <<<<<<<<<<<<<< - * - * # advance x location - */ - __pyx_v_xi = (__pyx_v_xi + 1); - - /* "pandas/lib/src/sparse.pyx":966 - * - * # advance x location - * xbp += 1 # <<<<<<<<<<<<<< - * if xbp == xindex.lenbuf[xblock]: - * xblock += 1 - */ - __pyx_v_xbp = (__pyx_v_xbp + 1); - - /* "pandas/lib/src/sparse.pyx":967 - * # advance x location - * xbp += 1 - * if xbp == xindex.lenbuf[xblock]: # <<<<<<<<<<<<<< - * xblock += 1 - * xbp = 0 - */ - __pyx_t_12 = (__pyx_v_xbp == (__pyx_v_xindex->lenbuf[__pyx_v_xblock])); - if (__pyx_t_12) { - - /* "pandas/lib/src/sparse.pyx":968 - * xbp += 1 - * if xbp == xindex.lenbuf[xblock]: - * xblock += 1 # <<<<<<<<<<<<<< - * xbp = 0 - * else: - */ - __pyx_v_xblock = (__pyx_v_xblock + 1); - - /* "pandas/lib/src/sparse.pyx":969 - * if xbp == xindex.lenbuf[xblock]: - * xblock += 1 - * xbp = 0 # <<<<<<<<<<<<<< - * else: - * # use x fill value - */ - __pyx_v_xbp = 0; - goto __pyx_L12; - } - __pyx_L12:; - goto __pyx_L9; - } - /*else*/ { - - /* "pandas/lib/src/sparse.pyx":972 - * else: - * # use x fill value - * out[out_i] = op(xfill, y[yi]) # <<<<<<<<<<<<<< - * yi += 1 - * - */ - __pyx_t_21 = __pyx_v_yi; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_0_y; - __pyx_t_22 = __pyx_v_out_i; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_out; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_22, __pyx_bstride_0_out) = __pyx_v_op(__pyx_v_xfill, (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_21, __pyx_bstride_0_y))); - - /* "pandas/lib/src/sparse.pyx":973 - * # use x fill value - * out[out_i] = op(xfill, y[yi]) - * yi += 1 # <<<<<<<<<<<<<< - * - * # advance y location - */ - __pyx_v_yi = (__pyx_v_yi + 1); - - /* "pandas/lib/src/sparse.pyx":976 - * - * # advance y location - * ybp += 1 # <<<<<<<<<<<<<< - * if ybp == yindex.lenbuf[yblock]: - * yblock += 1 - */ - __pyx_v_ybp = (__pyx_v_ybp + 1); - - /* "pandas/lib/src/sparse.pyx":977 - * # advance y location - * ybp += 1 - * if ybp == yindex.lenbuf[yblock]: # <<<<<<<<<<<<<< - * yblock += 1 - * ybp = 0 - */ - __pyx_t_12 = (__pyx_v_ybp == (__pyx_v_yindex->lenbuf[__pyx_v_yblock])); - if (__pyx_t_12) { - - /* "pandas/lib/src/sparse.pyx":978 - * ybp += 1 - * if ybp == yindex.lenbuf[yblock]: - * yblock += 1 # <<<<<<<<<<<<<< - * ybp = 0 - * - */ - __pyx_v_yblock = (__pyx_v_yblock + 1); - - /* "pandas/lib/src/sparse.pyx":979 - * if ybp == yindex.lenbuf[yblock]: - * yblock += 1 - * ybp = 0 # <<<<<<<<<<<<<< - * - * return out, out_index - */ - __pyx_v_ybp = 0; - goto __pyx_L13; - } - __pyx_L13:; - } - __pyx_L9:; - __pyx_L3_continue:; - } - - /* "pandas/lib/src/sparse.pyx":981 - * ybp = 0 - * - * return out, out_index # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - __Pyx_INCREF(((PyObject *)__pyx_v_out)); - PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_out)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_out)); - __Pyx_INCREF(((PyObject *)__pyx_v_out_index)); - PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_v_out_index)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_out_index)); - __pyx_r = __pyx_t_9; - __pyx_t_9 = 0; - goto __pyx_L0; - - __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.block_op"); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_out_index); - __Pyx_DECREF((PyObject *)__pyx_v_x); - __Pyx_DECREF((PyObject *)__pyx_v_y); - __Pyx_DECREF((PyObject *)__pyx_v_out); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":985 - * - * @cython.boundscheck(False) - * cdef inline tuple int_op(ndarray x_, IntIndex xindex, float64_t xfill, # <<<<<<<<<<<<<< - * ndarray y_, IntIndex yindex, float64_t yfill, - * double_func op): - */ - -static CYTHON_INLINE PyObject *__pyx_f_6pandas_3lib_6sparse_int_op(PyArrayObject *__pyx_v_x_, struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_v_xindex, __pyx_t_5numpy_float64_t __pyx_v_xfill, PyArrayObject *__pyx_v_y_, struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_v_yindex, __pyx_t_5numpy_float64_t __pyx_v_yfill, __pyx_t_6pandas_3lib_6sparse_double_func __pyx_v_op) { - struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_v_out_index; - int __pyx_v_xi; - int __pyx_v_yi; - int __pyx_v_out_i; - __pyx_t_5numpy_int32_t __pyx_v_xloc; - __pyx_t_5numpy_int32_t __pyx_v_yloc; - PyArrayObject *__pyx_v_xindices; - PyArrayObject *__pyx_v_yindices; - PyArrayObject *__pyx_v_out_indices; - PyArrayObject *__pyx_v_x; - PyArrayObject *__pyx_v_y; - PyArrayObject *__pyx_v_out; - Py_buffer __pyx_bstruct_out_indices; - Py_ssize_t __pyx_bstride_0_out_indices = 0; - Py_ssize_t __pyx_bshape_0_out_indices = 0; - Py_buffer __pyx_bstruct_xindices; - Py_ssize_t __pyx_bstride_0_xindices = 0; - Py_ssize_t __pyx_bshape_0_xindices = 0; - Py_buffer __pyx_bstruct_yindices; - Py_ssize_t __pyx_bstride_0_yindices = 0; - Py_ssize_t __pyx_bshape_0_yindices = 0; - Py_buffer __pyx_bstruct_y; - Py_ssize_t __pyx_bstride_0_y = 0; - Py_ssize_t __pyx_bshape_0_y = 0; - Py_buffer __pyx_bstruct_x; - Py_ssize_t __pyx_bstride_0_x = 0; - Py_ssize_t __pyx_bshape_0_x = 0; - Py_buffer __pyx_bstruct_out; - Py_ssize_t __pyx_bstride_0_out = 0; - Py_ssize_t __pyx_bshape_0_out = 0; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyArrayObject *__pyx_t_10 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_12; - int __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; - int __pyx_t_20; - int __pyx_t_21; - int __pyx_t_22; - int __pyx_t_23; - int __pyx_t_24; - int __pyx_t_25; - __Pyx_RefNannySetupContext("int_op"); - __pyx_v_out_index = ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_xindices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_yindices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_out_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_x = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_out = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_xindices.buf = NULL; - __pyx_bstruct_yindices.buf = NULL; - __pyx_bstruct_out_indices.buf = NULL; - __pyx_bstruct_x.buf = NULL; - __pyx_bstruct_y.buf = NULL; - __pyx_bstruct_out.buf = NULL; - - /* "pandas/lib/src/sparse.pyx":990 - * cdef: - * IntIndex out_index - * int xi = 0, yi = 0, out_i = 0 # fp buf indices # <<<<<<<<<<<<<< - * int32_t xloc, yloc - * ndarray[int32_t, ndim=1] xindices, yindices, out_indices - */ - __pyx_v_xi = 0; - __pyx_v_yi = 0; - __pyx_v_out_i = 0; - - /* "pandas/lib/src/sparse.pyx":997 - * - * # suppress Cython compiler warnings due to inlining - * x = x_ # <<<<<<<<<<<<<< - * y = y_ - * - */ - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)((PyArrayObject *)__pyx_v_x_), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4); - } - } - __pyx_bstride_0_x = __pyx_bstruct_x.strides[0]; - __pyx_bshape_0_x = __pyx_bstruct_x.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_INCREF(((PyObject *)__pyx_v_x_)); - __Pyx_DECREF(((PyObject *)__pyx_v_x)); - __pyx_v_x = ((PyArrayObject *)__pyx_v_x_); - - /* "pandas/lib/src/sparse.pyx":998 - * # suppress Cython compiler warnings due to inlining - * x = x_ - * y = y_ # <<<<<<<<<<<<<< - * - * # need to do this first to know size of result array - */ - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)((PyArrayObject *)__pyx_v_y_), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_4, __pyx_t_3, __pyx_t_2); - } - } - __pyx_bstride_0_y = __pyx_bstruct_y.strides[0]; - __pyx_bshape_0_y = __pyx_bstruct_y.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_INCREF(((PyObject *)__pyx_v_y_)); - __Pyx_DECREF(((PyObject *)__pyx_v_y)); - __pyx_v_y = ((PyArrayObject *)__pyx_v_y_); - - /* "pandas/lib/src/sparse.pyx":1001 - * - * # need to do this first to know size of result array - * out_index = xindex.make_union(yindex) # <<<<<<<<<<<<<< - * out = np.empty(out_index.npoints, dtype=np.float64) - * - */ - __pyx_t_5 = ((PyObject *)__pyx_v_yindex); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_6pandas_3lib_6sparse_IntIndex *)__pyx_v_xindex->__pyx_vtab)->make_union(__pyx_v_xindex, ((struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *)__pyx_t_5), 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_out_index)); - __pyx_v_out_index = ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)__pyx_t_6); - __pyx_t_6 = 0; - - /* "pandas/lib/src/sparse.pyx":1002 - * # need to do this first to know size of result array - * out_index = xindex.make_union(yindex) - * out = np.empty(out_index.npoints, dtype=np.float64) # <<<<<<<<<<<<<< - * - * xindices = xindex.indices - */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_out_index->npoints); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - PyTuple_SET_ITEM(__pyx_t_7, 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[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__float64); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_5, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4); - } - } - __pyx_bstride_0_out = __pyx_bstruct_out.strides[0]; - __pyx_bshape_0_out = __pyx_bstruct_out.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_10 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_out)); - __pyx_v_out = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; - - /* "pandas/lib/src/sparse.pyx":1004 - * out = np.empty(out_index.npoints, dtype=np.float64) - * - * xindices = xindex.indices # <<<<<<<<<<<<<< - * yindices = yindex.indices - * out_indices = out_index.indices - */ - __pyx_t_11 = ((PyArrayObject *)__pyx_v_xindex->indices); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xindices, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xindices, (PyObject*)__pyx_v_xindices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_4, __pyx_t_3, __pyx_t_2); - } - } - __pyx_bstride_0_xindices = __pyx_bstruct_xindices.strides[0]; - __pyx_bshape_0_xindices = __pyx_bstruct_xindices.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_11 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_xindex->indices)); - __Pyx_DECREF(((PyObject *)__pyx_v_xindices)); - __pyx_v_xindices = ((PyArrayObject *)__pyx_v_xindex->indices); - - /* "pandas/lib/src/sparse.pyx":1005 - * - * xindices = xindex.indices - * yindices = yindex.indices # <<<<<<<<<<<<<< - * out_indices = out_index.indices - * - */ - __pyx_t_11 = ((PyArrayObject *)__pyx_v_yindex->indices); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_yindices, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_yindices, (PyObject*)__pyx_v_yindices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4); - } - } - __pyx_bstride_0_yindices = __pyx_bstruct_yindices.strides[0]; - __pyx_bshape_0_yindices = __pyx_bstruct_yindices.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_11 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_yindex->indices)); - __Pyx_DECREF(((PyObject *)__pyx_v_yindices)); - __pyx_v_yindices = ((PyArrayObject *)__pyx_v_yindex->indices); - - /* "pandas/lib/src/sparse.pyx":1006 - * xindices = xindex.indices - * yindices = yindex.indices - * out_indices = out_index.indices # <<<<<<<<<<<<<< - * - * # walk the two SparseVectors, adding matched locations... - */ - __pyx_t_11 = ((PyArrayObject *)__pyx_v_out_index->indices); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out_indices); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_out_indices, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_out_indices, (PyObject*)__pyx_v_out_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_4, __pyx_t_3, __pyx_t_2); - } - } - __pyx_bstride_0_out_indices = __pyx_bstruct_out_indices.strides[0]; - __pyx_bshape_0_out_indices = __pyx_bstruct_out_indices.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_11 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_out_index->indices)); - __Pyx_DECREF(((PyObject *)__pyx_v_out_indices)); - __pyx_v_out_indices = ((PyArrayObject *)__pyx_v_out_index->indices); - - /* "pandas/lib/src/sparse.pyx":1009 - * - * # walk the two SparseVectors, adding matched locations... - * for out_i from 0 <= out_i < out_index.npoints: # <<<<<<<<<<<<<< - * if xi == xindex.npoints: - * # use x fill value - */ - __pyx_t_12 = __pyx_v_out_index->npoints; - for (__pyx_v_out_i = 0; __pyx_v_out_i < __pyx_t_12; __pyx_v_out_i++) { - - /* "pandas/lib/src/sparse.pyx":1010 - * # walk the two SparseVectors, adding matched locations... - * for out_i from 0 <= out_i < out_index.npoints: - * if xi == xindex.npoints: # <<<<<<<<<<<<<< - * # use x fill value - * out[out_i] = op(xfill, y[yi]) - */ - __pyx_t_13 = (__pyx_v_xi == __pyx_v_xindex->npoints); - if (__pyx_t_13) { - - /* "pandas/lib/src/sparse.pyx":1012 - * if xi == xindex.npoints: - * # use x fill value - * out[out_i] = op(xfill, y[yi]) # <<<<<<<<<<<<<< - * yi += 1 - * continue - */ - __pyx_t_1 = __pyx_v_yi; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_bshape_0_y; - __pyx_t_14 = __pyx_v_out_i; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_out; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_14, __pyx_bstride_0_out) = __pyx_v_op(__pyx_v_xfill, (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_1, __pyx_bstride_0_y))); - - /* "pandas/lib/src/sparse.pyx":1013 - * # use x fill value - * out[out_i] = op(xfill, y[yi]) - * yi += 1 # <<<<<<<<<<<<<< - * continue - * - */ - __pyx_v_yi = (__pyx_v_yi + 1); - - /* "pandas/lib/src/sparse.pyx":1014 - * out[out_i] = op(xfill, y[yi]) - * yi += 1 - * continue # <<<<<<<<<<<<<< - * - * if yi == yindex.npoints: - */ - goto __pyx_L3_continue; - goto __pyx_L5; - } - __pyx_L5:; - - /* "pandas/lib/src/sparse.pyx":1016 - * continue - * - * if yi == yindex.npoints: # <<<<<<<<<<<<<< - * # use y fill value - * out[out_i] = op(x[xi], yfill) - */ - __pyx_t_13 = (__pyx_v_yi == __pyx_v_yindex->npoints); - if (__pyx_t_13) { - - /* "pandas/lib/src/sparse.pyx":1018 - * if yi == yindex.npoints: - * # use y fill value - * out[out_i] = op(x[xi], yfill) # <<<<<<<<<<<<<< - * xi += 1 - * continue - */ - __pyx_t_15 = __pyx_v_xi; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_x; - __pyx_t_16 = __pyx_v_out_i; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_out; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_16, __pyx_bstride_0_out) = __pyx_v_op((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_15, __pyx_bstride_0_x)), __pyx_v_yfill); - - /* "pandas/lib/src/sparse.pyx":1019 - * # use y fill value - * out[out_i] = op(x[xi], yfill) - * xi += 1 # <<<<<<<<<<<<<< - * continue - * - */ - __pyx_v_xi = (__pyx_v_xi + 1); - - /* "pandas/lib/src/sparse.pyx":1020 - * out[out_i] = op(x[xi], yfill) - * xi += 1 - * continue # <<<<<<<<<<<<<< - * - * xloc = xindices[xi] - */ - goto __pyx_L3_continue; - goto __pyx_L6; - } - __pyx_L6:; - - /* "pandas/lib/src/sparse.pyx":1022 - * continue - * - * xloc = xindices[xi] # <<<<<<<<<<<<<< - * yloc = yindices[yi] - * - */ - __pyx_t_17 = __pyx_v_xi; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_0_xindices; - __pyx_v_xloc = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_xindices.buf, __pyx_t_17, __pyx_bstride_0_xindices)); - - /* "pandas/lib/src/sparse.pyx":1023 - * - * xloc = xindices[xi] - * yloc = yindices[yi] # <<<<<<<<<<<<<< - * - * # each index in the out_index had to come from either x, y, or both - */ - __pyx_t_18 = __pyx_v_yi; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_0_yindices; - __pyx_v_yloc = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_yindices.buf, __pyx_t_18, __pyx_bstride_0_yindices)); - - /* "pandas/lib/src/sparse.pyx":1026 - * - * # each index in the out_index had to come from either x, y, or both - * if xloc == yloc: # <<<<<<<<<<<<<< - * out[out_i] = op(x[xi], y[yi]) - * xi += 1 - */ - __pyx_t_13 = (__pyx_v_xloc == __pyx_v_yloc); - if (__pyx_t_13) { - - /* "pandas/lib/src/sparse.pyx":1027 - * # each index in the out_index had to come from either x, y, or both - * if xloc == yloc: - * out[out_i] = op(x[xi], y[yi]) # <<<<<<<<<<<<<< - * xi += 1 - * yi += 1 - */ - __pyx_t_19 = __pyx_v_xi; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_x; - __pyx_t_20 = __pyx_v_yi; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_0_y; - __pyx_t_21 = __pyx_v_out_i; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_0_out; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_21, __pyx_bstride_0_out) = __pyx_v_op((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_19, __pyx_bstride_0_x)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_20, __pyx_bstride_0_y))); - - /* "pandas/lib/src/sparse.pyx":1028 - * if xloc == yloc: - * out[out_i] = op(x[xi], y[yi]) - * xi += 1 # <<<<<<<<<<<<<< - * yi += 1 - * elif xloc < yloc: - */ - __pyx_v_xi = (__pyx_v_xi + 1); - - /* "pandas/lib/src/sparse.pyx":1029 - * out[out_i] = op(x[xi], y[yi]) - * xi += 1 - * yi += 1 # <<<<<<<<<<<<<< - * elif xloc < yloc: - * # use y fill value - */ - __pyx_v_yi = (__pyx_v_yi + 1); - goto __pyx_L7; - } - - /* "pandas/lib/src/sparse.pyx":1030 - * xi += 1 - * yi += 1 - * elif xloc < yloc: # <<<<<<<<<<<<<< - * # use y fill value - * out[out_i] = op(x[xi], yfill) - */ - __pyx_t_13 = (__pyx_v_xloc < __pyx_v_yloc); - if (__pyx_t_13) { - - /* "pandas/lib/src/sparse.pyx":1032 - * elif xloc < yloc: - * # use y fill value - * out[out_i] = op(x[xi], yfill) # <<<<<<<<<<<<<< - * xi += 1 - * else: - */ - __pyx_t_22 = __pyx_v_xi; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_x; - __pyx_t_23 = __pyx_v_out_i; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_0_out; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_23, __pyx_bstride_0_out) = __pyx_v_op((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_22, __pyx_bstride_0_x)), __pyx_v_yfill); - - /* "pandas/lib/src/sparse.pyx":1033 - * # use y fill value - * out[out_i] = op(x[xi], yfill) - * xi += 1 # <<<<<<<<<<<<<< - * else: - * # use x fill value - */ - __pyx_v_xi = (__pyx_v_xi + 1); - goto __pyx_L7; - } - /*else*/ { - - /* "pandas/lib/src/sparse.pyx":1036 - * else: - * # use x fill value - * out[out_i] = op(xfill, y[yi]) # <<<<<<<<<<<<<< - * yi += 1 - * - */ - __pyx_t_24 = __pyx_v_yi; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_0_y; - __pyx_t_25 = __pyx_v_out_i; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_0_out; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_out.buf, __pyx_t_25, __pyx_bstride_0_out) = __pyx_v_op(__pyx_v_xfill, (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_24, __pyx_bstride_0_y))); - - /* "pandas/lib/src/sparse.pyx":1037 - * # use x fill value - * out[out_i] = op(xfill, y[yi]) - * yi += 1 # <<<<<<<<<<<<<< - * - * return out, out_index - */ - __pyx_v_yi = (__pyx_v_yi + 1); - } - __pyx_L7:; - __pyx_L3_continue:; - } - - /* "pandas/lib/src/sparse.pyx":1039 - * yi += 1 - * - * return out, out_index # <<<<<<<<<<<<<< - * - * #------------------------------------------------------------------------------- - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - __Pyx_INCREF(((PyObject *)__pyx_v_out)); - PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_out)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_out)); - __Pyx_INCREF(((PyObject *)__pyx_v_out_index)); - PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_v_out_index)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_out_index)); - __pyx_r = __pyx_t_9; - __pyx_t_9 = 0; - goto __pyx_L0; - - __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.int_op"); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xindices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_yindices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_out_index); - __Pyx_DECREF((PyObject *)__pyx_v_xindices); - __Pyx_DECREF((PyObject *)__pyx_v_yindices); - __Pyx_DECREF((PyObject *)__pyx_v_out_indices); - __Pyx_DECREF((PyObject *)__pyx_v_x); - __Pyx_DECREF((PyObject *)__pyx_v_y); - __Pyx_DECREF((PyObject *)__pyx_v_out); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":1044 - * # Indexing operations - * - * def get_reindexer(ndarray[object, ndim=1] values, dict index_map): # <<<<<<<<<<<<<< - * cdef object idx - * cdef Py_ssize_t i - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_11get_reindexer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6pandas_3lib_6sparse_11get_reindexer = {__Pyx_NAMESTR("get_reindexer"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_11get_reindexer, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_6pandas_3lib_6sparse_11get_reindexer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_values = 0; - PyObject *__pyx_v_index_map = 0; - PyObject *__pyx_v_idx; - Py_ssize_t __pyx_v_i; - int __pyx_v_new_length; - PyArrayObject *__pyx_v_indexer; - Py_buffer __pyx_bstruct_values; - Py_ssize_t __pyx_bstride_0_values = 0; - Py_ssize_t __pyx_bshape_0_values = 0; - Py_buffer __pyx_bstruct_indexer; - Py_ssize_t __pyx_bstride_0_indexer = 0; - Py_ssize_t __pyx_bshape_0_indexer = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - 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; - int __pyx_t_12; - int __pyx_t_13; - __pyx_t_5numpy_int32_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__index_map,0}; - __Pyx_RefNannySetupContext("get_reindexer"); - __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__index_map); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("get_reindexer", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_reindexer") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_values = ((PyArrayObject *)values[0]); - __pyx_v_index_map = ((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_index_map = ((PyObject*)PyTuple_GET_ITEM(__pyx_args, 1)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get_reindexer", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.get_reindexer"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_indexer = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_indexer.buf = NULL; - __pyx_bstruct_values.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index_map), (&PyDict_Type), 1, "index_map", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_values = __pyx_bstruct_values.strides[0]; - __pyx_bshape_0_values = __pyx_bstruct_values.shape[0]; - - /* "pandas/lib/src/sparse.pyx":1047 - * cdef object idx - * cdef Py_ssize_t i - * cdef int new_length = len(values) # <<<<<<<<<<<<<< - * cdef ndarray[int32_t, ndim=1] indexer - * - */ - __pyx_t_1 = ((PyObject *)__pyx_v_values); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_new_length = __pyx_t_2; - - /* "pandas/lib/src/sparse.pyx":1050 - * cdef ndarray[int32_t, ndim=1] indexer - * - * indexer = np.empty(new_length, dtype=np.int32) # <<<<<<<<<<<<<< - * - * for i from 0 <= i < new_length: - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_new_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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[0]; __pyx_lineno = 1050; __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[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __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[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = ((PyArrayObject *)__pyx_t_6); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indexer); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_indexer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_8 < 0)) { - PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indexer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); - } - } - __pyx_bstride_0_indexer = __pyx_bstruct_indexer.strides[0]; - __pyx_bshape_0_indexer = __pyx_bstruct_indexer.shape[0]; - if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_indexer)); - __pyx_v_indexer = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; - - /* "pandas/lib/src/sparse.pyx":1052 - * indexer = np.empty(new_length, dtype=np.int32) - * - * for i from 0 <= i < new_length: # <<<<<<<<<<<<<< - * idx = values[i] - * if idx in index_map: - */ - __pyx_t_8 = __pyx_v_new_length; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) { - - /* "pandas/lib/src/sparse.pyx":1053 - * - * for i from 0 <= i < new_length: - * idx = values[i] # <<<<<<<<<<<<<< - * if idx in index_map: - * indexer[i] = index_map[idx] - */ - __pyx_t_2 = __pyx_v_i; - __pyx_t_12 = -1; - if (__pyx_t_2 < 0) { - __pyx_t_2 += __pyx_bshape_0_values; - if (unlikely(__pyx_t_2 < 0)) __pyx_t_12 = 0; - } else if (unlikely(__pyx_t_2 >= __pyx_bshape_0_values)) __pyx_t_12 = 0; - if (unlikely(__pyx_t_12 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_12); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_values.buf, __pyx_t_2, __pyx_bstride_0_values); - __Pyx_INCREF((PyObject*)__pyx_t_6); - __Pyx_DECREF(__pyx_v_idx); - __pyx_v_idx = __pyx_t_6; - __pyx_t_6 = 0; - - /* "pandas/lib/src/sparse.pyx":1054 - * for i from 0 <= i < new_length: - * idx = values[i] - * if idx in index_map: # <<<<<<<<<<<<<< - * indexer[i] = index_map[idx] - * else: - */ - if (unlikely(__pyx_v_index_map == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_13 = ((PyDict_Contains(((PyObject *)__pyx_v_index_map), __pyx_v_idx))); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_13) { - - /* "pandas/lib/src/sparse.pyx":1055 - * idx = values[i] - * if idx in index_map: - * indexer[i] = index_map[idx] # <<<<<<<<<<<<<< - * else: - * indexer[i] = -1 - */ - __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_index_map), __pyx_v_idx); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_14 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_6); if (unlikely((__pyx_t_14 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_15 = __pyx_v_i; - __pyx_t_12 = -1; - if (__pyx_t_15 < 0) { - __pyx_t_15 += __pyx_bshape_0_indexer; - if (unlikely(__pyx_t_15 < 0)) __pyx_t_12 = 0; - } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_indexer)) __pyx_t_12 = 0; - if (unlikely(__pyx_t_12 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_12); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_indexer.buf, __pyx_t_15, __pyx_bstride_0_indexer) = __pyx_t_14; - goto __pyx_L8; - } - /*else*/ { - - /* "pandas/lib/src/sparse.pyx":1057 - * indexer[i] = index_map[idx] - * else: - * indexer[i] = -1 # <<<<<<<<<<<<<< - * - * return indexer - */ - __pyx_t_16 = __pyx_v_i; - __pyx_t_12 = -1; - if (__pyx_t_16 < 0) { - __pyx_t_16 += __pyx_bshape_0_indexer; - if (unlikely(__pyx_t_16 < 0)) __pyx_t_12 = 0; - } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_indexer)) __pyx_t_12 = 0; - if (unlikely(__pyx_t_12 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_12); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_indexer.buf, __pyx_t_16, __pyx_bstride_0_indexer) = -1; - } - __pyx_L8:; - } - - /* "pandas/lib/src/sparse.pyx":1059 - * indexer[i] = -1 - * - * return indexer # <<<<<<<<<<<<<< - * - * def reindex_block(ndarray[float64_t, ndim=1] values, - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_indexer)); - __pyx_r = ((PyObject *)__pyx_v_indexer); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indexer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.get_reindexer"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indexer); - __pyx_L2:; - __Pyx_DECREF(__pyx_v_idx); - __Pyx_DECREF((PyObject *)__pyx_v_indexer); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":1061 - * return indexer - * - * def reindex_block(ndarray[float64_t, ndim=1] values, # <<<<<<<<<<<<<< - * BlockIndex sparse_index, - * ndarray[int32_t, ndim=1] indexer): - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_12reindex_block(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6pandas_3lib_6sparse_12reindex_block = {__Pyx_NAMESTR("reindex_block"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_12reindex_block, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_6pandas_3lib_6sparse_12reindex_block(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_values = 0; - struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *__pyx_v_sparse_index = 0; - PyArrayObject *__pyx_v_indexer = 0; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_i; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_v_length; - PyArrayObject *__pyx_v_out; - Py_buffer __pyx_bstruct_indexer; - Py_ssize_t __pyx_bstride_0_indexer = 0; - Py_ssize_t __pyx_bshape_0_indexer = 0; - Py_buffer __pyx_bstruct_values; - Py_ssize_t __pyx_bstride_0_values = 0; - Py_ssize_t __pyx_bshape_0_values = 0; - Py_buffer __pyx_bstruct_out; - Py_ssize_t __pyx_bstride_0_out = 0; - Py_ssize_t __pyx_bshape_0_out = 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; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_11; - __pyx_t_6pandas_3lib_6sparse_pyst __pyx_t_12; - int __pyx_t_13; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__sparse_index,&__pyx_n_s__indexer,0}; - __Pyx_RefNannySetupContext("reindex_block"); - __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__values); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sparse_index); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("reindex_block", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("reindex_block", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "reindex_block") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_values = ((PyArrayObject *)values[0]); - __pyx_v_sparse_index = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)values[1]); - __pyx_v_indexer = ((PyArrayObject *)values[2]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_values = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_sparse_index = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_indexer = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("reindex_block", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.reindex_block"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_v_out = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_out.buf = NULL; - __pyx_bstruct_values.buf = NULL; - __pyx_bstruct_indexer.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sparse_index), __pyx_ptype_6pandas_3lib_6sparse_BlockIndex, 1, "sparse_index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_values = __pyx_bstruct_values.strides[0]; - __pyx_bshape_0_values = __pyx_bstruct_values.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indexer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_indexer = __pyx_bstruct_indexer.strides[0]; - __pyx_bshape_0_indexer = __pyx_bstruct_indexer.shape[0]; - - /* "pandas/lib/src/sparse.pyx":1068 - * ndarray[float64_t, ndim=1] out - * - * out = np.empty(length, dtype=np.float64) # <<<<<<<<<<<<<< - * - * 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[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __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[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); - __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_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_out, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_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_out = __pyx_bstruct_out.strides[0]; - __pyx_bshape_0_out = __pyx_bstruct_out.shape[0]; - if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_out)); - __pyx_v_out = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; - - /* "pandas/lib/src/sparse.pyx":1070 - * out = np.empty(length, dtype=np.float64) - * - * for i from 0 <= i < length: # <<<<<<<<<<<<<< - * if indexer[i] == -1: - * pass - */ - __pyx_t_11 = __pyx_v_length; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_11; __pyx_v_i++) { - - /* "pandas/lib/src/sparse.pyx":1071 - * - * for i from 0 <= i < length: - * if indexer[i] == -1: # <<<<<<<<<<<<<< - * pass - * - */ - __pyx_t_12 = __pyx_v_i; - __pyx_t_7 = -1; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_bshape_0_indexer; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_indexer)) __pyx_t_7 = 0; - if (unlikely(__pyx_t_7 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_7); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_indexer.buf, __pyx_t_12, __pyx_bstride_0_indexer)) == -1); - if (__pyx_t_13) { - goto __pyx_L8; - } - __pyx_L8:; - } - - __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_indexer); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.reindex_block"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indexer); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_out); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pandas/lib/src/sparse.pyx":1091 - * - * - * def reindex_integer(ndarray[float64_t, ndim=1] values, # <<<<<<<<<<<<<< - * IntIndex sparse_index, - * ndarray[int32_t, ndim=1] indexer): - */ - -static PyObject *__pyx_pf_6pandas_3lib_6sparse_13reindex_integer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_6pandas_3lib_6sparse_13reindex_integer = {__Pyx_NAMESTR("reindex_integer"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_13reindex_integer, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_6pandas_3lib_6sparse_13reindex_integer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_values = 0; - struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *__pyx_v_sparse_index = 0; - PyArrayObject *__pyx_v_indexer = 0; - Py_buffer __pyx_bstruct_values; - Py_ssize_t __pyx_bstride_0_values = 0; - Py_ssize_t __pyx_bshape_0_values = 0; - Py_buffer __pyx_bstruct_indexer; - Py_ssize_t __pyx_bstride_0_indexer = 0; - Py_ssize_t __pyx_bshape_0_indexer = 0; - PyObject *__pyx_r = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__sparse_index,&__pyx_n_s__indexer,0}; - __Pyx_RefNannySetupContext("reindex_integer"); - __pyx_self = __pyx_self; - 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__values); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sparse_index); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("reindex_integer", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("reindex_integer", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "reindex_integer") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_values = ((PyArrayObject *)values[0]); - __pyx_v_sparse_index = ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)values[1]); - __pyx_v_indexer = ((PyArrayObject *)values[2]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_values = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_sparse_index = ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_indexer = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("reindex_integer", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("pandas.lib.sparse.reindex_integer"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_values.buf = NULL; - __pyx_bstruct_indexer.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sparse_index), __pyx_ptype_6pandas_3lib_6sparse_IntIndex, 1, "sparse_index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_values = __pyx_bstruct_values.strides[0]; - __pyx_bshape_0_values = __pyx_bstruct_values.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indexer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_indexer = __pyx_bstruct_indexer.strides[0]; - __pyx_bshape_0_indexer = __pyx_bstruct_indexer.shape[0]; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indexer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("pandas.lib.sparse.reindex_integer"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indexer); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "numpy.pxd":188 - * # experimental exception made for __getbuffer__ and __releasebuffer__ - * # -- the details of this may change. - * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< - * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fullfill the PEP. - */ - -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_v_copy_shape; - int __pyx_v_i; - int __pyx_v_ndim; - int __pyx_v_endian_detector; - int __pyx_v_little_endian; - int __pyx_v_t; - char *__pyx_v_f; - PyArray_Descr *__pyx_v_descr = 0; - int __pyx_v_offset; - int __pyx_v_hasfields; - int __pyx_r; - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - 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); - - /* "numpy.pxd":194 - * # of flags - * cdef int copy_shape, i, ndim - * cdef int endian_detector = 1 # <<<<<<<<<<<<<< - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * - */ - __pyx_v_endian_detector = 1; - - /* "numpy.pxd":195 - * cdef int copy_shape, i, ndim - * cdef int endian_detector = 1 - * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< - * - * ndim = PyArray_NDIM(self) - */ - __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - - /* "numpy.pxd":197 - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * - * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - */ - __pyx_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "numpy.pxd":199 - * ndim = PyArray_NDIM(self) - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * copy_shape = 1 - * else: - */ - __pyx_t_2 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); - if (__pyx_t_2) { - - /* "numpy.pxd":200 - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * copy_shape = 1 # <<<<<<<<<<<<<< - * else: - * copy_shape = 0 - */ - __pyx_v_copy_shape = 1; - goto __pyx_L5; - } - /*else*/ { - - /* "numpy.pxd":202 - * copy_shape = 1 - * else: - * copy_shape = 0 # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - */ - __pyx_v_copy_shape = 0; - } - __pyx_L5:; - - /* "numpy.pxd":204 - * copy_shape = 0 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") - */ - __pyx_t_2 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); - if (__pyx_t_2) { - - /* "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") - * - */ - __pyx_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_t_1), NPY_C_CONTIGUOUS)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __pyx_t_3; - } else { - __pyx_t_4 = __pyx_t_2; - } - if (__pyx_t_4) { - - /* "numpy.pxd":206 - * 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_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "numpy.pxd":208 - * 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_4 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); - if (__pyx_t_4) { - - /* "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") - * - */ - __pyx_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_t_1), NPY_F_CONTIGUOUS)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __pyx_t_2; - } else { - __pyx_t_3 = __pyx_t_4; - } - if (__pyx_t_3) { - - /* "numpy.pxd":210 - * 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_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; - } - __pyx_L7:; - - /* "numpy.pxd":212 - * raise ValueError(u"ndarray is not Fortran contiguous") - * - * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< - * info.ndim = ndim - * if copy_shape: - */ - __pyx_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "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 - */ - __pyx_v_info->ndim = __pyx_v_ndim; - - /* "numpy.pxd":214 - * info.buf = PyArray_DATA(self) - * info.ndim = ndim - * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. - */ - if (__pyx_v_copy_shape) { - - /* "numpy.pxd":217 - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. - * info.strides = 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))); - - /* "numpy.pxd":218 - * # as one block, strides first. - * info.strides = 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); - - /* "numpy.pxd":219 - * info.strides = 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_5 = __pyx_v_ndim; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; - - /* "numpy.pxd":220 - * 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_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_t_1))[__pyx_v_i]); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "numpy.pxd":221 - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] - * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< - * else: - * info.strides = PyArray_STRIDES(self) - */ - __pyx_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_t_1))[__pyx_v_i]); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - goto __pyx_L8; - } - /*else*/ { - - /* "numpy.pxd":223 - * info.shape[i] = PyArray_DIMS(self)[i] - * else: - * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL - */ - __pyx_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_t_1))); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "numpy.pxd":224 - * else: - * info.strides = PyArray_STRIDES(self) - * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) - */ - __pyx_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_t_1))); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_L8:; - - /* "numpy.pxd":225 - * info.strides = PyArray_STRIDES(self) - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * info.itemsize = PyArray_ITEMSIZE(self) - * info.readonly = not PyArray_ISWRITEABLE(self) - */ - __pyx_v_info->suboffsets = NULL; - - /* "numpy.pxd":226 - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< - * info.readonly = not PyArray_ISWRITEABLE(self) - * - */ - __pyx_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "numpy.pxd":227 - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) - * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< - * - * cdef int t - */ - __pyx_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_t_1))); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "numpy.pxd":230 - * - * cdef int t - * cdef char* f = NULL # <<<<<<<<<<<<<< - * cdef dtype descr = self.descr - * cdef list stack - */ - __pyx_v_f = NULL; - - /* "numpy.pxd":231 - * cdef int t - * cdef char* f = NULL - * cdef dtype descr = self.descr # <<<<<<<<<<<<<< - * cdef list stack - * cdef int offset - */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; - - /* "numpy.pxd":235 - * cdef int offset - * - * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< - * - * if not hasfields and not copy_shape: - */ - __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - - /* "numpy.pxd":237 - * cdef bint hasfields = PyDataType_HASFIELDS(descr) - * - * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< - * # do not call releasebuffer - * info.obj = None - */ - __pyx_t_3 = (!__pyx_v_hasfields); - if (__pyx_t_3) { - __pyx_t_4 = (!__pyx_v_copy_shape); - __pyx_t_2 = __pyx_t_4; - } else { - __pyx_t_2 = __pyx_t_3; - } - if (__pyx_t_2) { - - /* "numpy.pxd":239 - * 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*/ { - - /* "numpy.pxd":242 - * 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:; - - /* "numpy.pxd":244 - * info.obj = self - * - * if not hasfields: # <<<<<<<<<<<<<< - * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - */ - __pyx_t_2 = (!__pyx_v_hasfields); - if (__pyx_t_2) { - - /* "numpy.pxd":245 - * - * if not hasfields: - * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): - */ - __pyx_v_t = __pyx_v_descr->type_num; - - /* "numpy.pxd":246 - * 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_2 = (__pyx_v_descr->byteorder == '>'); - if (__pyx_t_2) { - __pyx_t_3 = __pyx_v_little_endian; - } else { - __pyx_t_3 = __pyx_t_2; - } - if (!__pyx_t_3) { - - /* "numpy.pxd":247 - * 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_2 = (__pyx_v_descr->byteorder == '<'); - if (__pyx_t_2) { - __pyx_t_4 = (!__pyx_v_little_endian); - __pyx_t_7 = __pyx_t_4; - } else { - __pyx_t_7 = __pyx_t_2; - } - __pyx_t_2 = __pyx_t_7; - } else { - __pyx_t_2 = __pyx_t_3; - } - if (__pyx_t_2) { - - /* "numpy.pxd":248 - * 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_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L13; - } - __pyx_L13:; - - /* "numpy.pxd":249 - * (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_2 = (__pyx_v_t == NPY_BYTE); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__b; - goto __pyx_L14; - } - - /* "numpy.pxd":250 - * 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_2 = (__pyx_v_t == NPY_UBYTE); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__B; - goto __pyx_L14; - } - - /* "numpy.pxd":251 - * 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_2 = (__pyx_v_t == NPY_SHORT); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__h; - goto __pyx_L14; - } - - /* "numpy.pxd":252 - * 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_2 = (__pyx_v_t == NPY_USHORT); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__H; - goto __pyx_L14; - } - - /* "numpy.pxd":253 - * 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_2 = (__pyx_v_t == NPY_INT); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__i; - goto __pyx_L14; - } - - /* "numpy.pxd":254 - * 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_2 = (__pyx_v_t == NPY_UINT); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__I; - goto __pyx_L14; - } - - /* "numpy.pxd":255 - * 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_2 = (__pyx_v_t == NPY_LONG); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__l; - goto __pyx_L14; - } - - /* "numpy.pxd":256 - * 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_2 = (__pyx_v_t == NPY_ULONG); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__L; - goto __pyx_L14; - } - - /* "numpy.pxd":257 - * 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_2 = (__pyx_v_t == NPY_LONGLONG); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__q; - goto __pyx_L14; - } - - /* "numpy.pxd":258 - * 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_2 = (__pyx_v_t == NPY_ULONGLONG); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__Q; - goto __pyx_L14; - } - - /* "numpy.pxd":259 - * 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_2 = (__pyx_v_t == NPY_FLOAT); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__f; - goto __pyx_L14; - } - - /* "numpy.pxd":260 - * 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_2 = (__pyx_v_t == NPY_DOUBLE); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__d; - goto __pyx_L14; - } - - /* "numpy.pxd":261 - * 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_2 = (__pyx_v_t == NPY_LONGDOUBLE); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__g; - goto __pyx_L14; - } - - /* "numpy.pxd":262 - * 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_2 = (__pyx_v_t == NPY_CFLOAT); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__Zf; - goto __pyx_L14; - } - - /* "numpy.pxd":263 - * 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_2 = (__pyx_v_t == NPY_CDOUBLE); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__Zd; - goto __pyx_L14; - } - - /* "numpy.pxd":264 - * 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_2 = (__pyx_v_t == NPY_CLONGDOUBLE); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__Zg; - goto __pyx_L14; - } - - /* "numpy.pxd":265 - * 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_2 = (__pyx_v_t == NPY_OBJECT); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__O; - goto __pyx_L14; - } - /*else*/ { - - /* "numpy.pxd":267 - * elif t == NPY_OBJECT: f = "O" - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * info.format = f - * return - */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_28), __pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_8, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L14:; - - /* "numpy.pxd":268 - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * info.format = f # <<<<<<<<<<<<<< - * return - * else: - */ - __pyx_v_info->format = __pyx_v_f; - - /* "numpy.pxd":269 - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * info.format = f - * return # <<<<<<<<<<<<<< - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L12; - } - /*else*/ { - - /* "numpy.pxd":271 - * return - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment - * offset = 0 - */ - __pyx_v_info->format = ((char *)malloc(255)); - - /* "numpy.pxd":272 - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< - * offset = 0 - * f = _util_dtypestring(descr, info.format + 1, - */ - (__pyx_v_info->format[0]) = '^'; - - /* "numpy.pxd":273 - * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment - * offset = 0 # <<<<<<<<<<<<<< - * f = _util_dtypestring(descr, info.format + 1, - * info.format + _buffer_format_string_len, - */ - __pyx_v_offset = 0; - - /* "numpy.pxd":276 - * f = _util_dtypestring(descr, info.format + 1, - * info.format + _buffer_format_string_len, - * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string - * - */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_9; - - /* "numpy.pxd":277 - * 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_1); - __Pyx_XDECREF(__pyx_t_8); - __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_RefNannyFinishContext(); - return __pyx_r; -} - -/* "numpy.pxd":279 - * f[0] = 0 # Terminate format string - * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - */ - -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - __Pyx_RefNannySetupContext("__releasebuffer__"); - - /* "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): - */ - __pyx_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "numpy.pxd":281 - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) # <<<<<<<<<<<<<< - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) - */ - free(__pyx_v_info->format); - goto __pyx_L5; - } - __pyx_L5:; - - /* "numpy.pxd":282 - * 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_2 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); - if (__pyx_t_2) { - - /* "numpy.pxd":283 - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) # <<<<<<<<<<<<<< - * # info.shape was stored after info.strides in the same block - * - */ - free(__pyx_v_info->strides); - goto __pyx_L6; - } - __pyx_L6:; - - __Pyx_RefNannyFinishContext(); -} - -/* "numpy.pxd":756 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, 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"); - - /* "numpy.pxd":757 - * - * cdef inline object PyArray_MultiIterNew1(a): - * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew2(a, b): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 757; __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; -} - -/* "numpy.pxd":759 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, 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"); - - /* "numpy.pxd":760 - * - * cdef inline object PyArray_MultiIterNew2(a, b): - * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 760; __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; -} - -/* "numpy.pxd":762 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, 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"); - - /* "numpy.pxd":763 - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 763; __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; -} - -/* "numpy.pxd":765 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, 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"); - - /* "numpy.pxd":766 - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 766; __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; -} - -/* "numpy.pxd":768 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, 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"); - - /* "numpy.pxd":769 - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< - * - * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __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; -} - -/* "numpy.pxd":771 - * return PyArray_MultiIterNew(5, a, b, c, d, 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; - long __pyx_t_10; - char *__pyx_t_11; - __Pyx_RefNannySetupContext("_util_dtypestring"); - __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); - - /* "numpy.pxd":778 - * cdef int delta_offset - * cdef tuple i - * cdef int endian_detector = 1 # <<<<<<<<<<<<<< - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * cdef tuple fields - */ - __pyx_v_endian_detector = 1; - - /* "numpy.pxd":779 - * cdef tuple i - * cdef int endian_detector = 1 - * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< - * cdef tuple fields - * - */ - __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - - /* "numpy.pxd":782 - * cdef tuple fields - * - * for childname in descr.names: # <<<<<<<<<<<<<< - * fields = descr.fields[childname] - * child, new_offset = fields - */ - if (unlikely(__pyx_v_descr->names == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); - 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; - - /* "numpy.pxd":783 - * - * for childname in descr.names: - * fields = descr.fields[childname] # <<<<<<<<<<<<<< - * child, new_offset = fields - * - */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "numpy.pxd":784 - * 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[1]; __pyx_lineno = 784; __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[1]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "numpy.pxd":786 - * child, new_offset = fields - * - * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - - /* "numpy.pxd":787 - * - * if (end - f) - (new_offset - offset[0]) < 15: - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< - * - * if ((child.byteorder == '>' and little_endian) or - */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "numpy.pxd":789 - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; - } else { - __pyx_t_7 = __pyx_t_6; - } - if (!__pyx_t_7) { - - /* "numpy.pxd":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 - */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; - } else { - __pyx_t_9 = __pyx_t_6; - } - __pyx_t_6 = __pyx_t_9; - } else { - __pyx_t_6 = __pyx_t_7; - } - if (__pyx_t_6) { - - /* "numpy.pxd":791 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * # One could encode it in the format string and have Cython - * # complain instead, BUT: < and > in format strings also imply - */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "numpy.pxd":801 - * - * # Output padding bytes - * while offset[0] < new_offset: # <<<<<<<<<<<<<< - * f[0] = 120 # "x"; pad byte - * f += 1 - */ - while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; - - /* "numpy.pxd":802 - * # Output padding bytes - * while offset[0] < new_offset: - * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< - * f += 1 - * offset[0] += 1 - */ - (__pyx_v_f[0]) = 120; - - /* "numpy.pxd":803 - * while offset[0] < new_offset: - * f[0] = 120 # "x"; pad byte - * f += 1 # <<<<<<<<<<<<<< - * offset[0] += 1 - * - */ - __pyx_v_f = (__pyx_v_f + 1); - - /* "numpy.pxd":804 - * f[0] = 120 # "x"; pad byte - * f += 1 - * offset[0] += 1 # <<<<<<<<<<<<<< - * - * offset[0] += child.itemsize - */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); - } - - /* "numpy.pxd":806 - * offset[0] += 1 - * - * offset[0] += child.itemsize # <<<<<<<<<<<<<< - * - * if not PyDataType_HASFIELDS(child): - */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); - - /* "numpy.pxd":808 - * offset[0] += child.itemsize - * - * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< - * t = child.type_num - * if end - f < 5: - */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { - - /* "numpy.pxd":809 - * - * if not PyDataType_HASFIELDS(child): - * t = child.type_num # <<<<<<<<<<<<<< - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") - */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __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; - - /* "numpy.pxd":810 - * if not PyDataType_HASFIELDS(child): - * t = child.type_num - * if end - f < 5: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short.") - * - */ - __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { - - /* "numpy.pxd":811 - * t = child.type_num - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< - * - * # Until ticket #99 is fixed, use integers to avoid warnings - */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_33), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; - } - __pyx_L10:; - - /* "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" - */ - __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 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]) = 98; - goto __pyx_L11; - } - - /* "numpy.pxd":815 - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - */ - __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 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[1]; __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[1]; __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]) = 66; - goto __pyx_L11; - } - - /* "numpy.pxd":816 - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - */ - __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 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[1]; __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[1]; __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]) = 104; - goto __pyx_L11; - } - - /* "numpy.pxd":817 - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - */ - __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 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[1]; __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[1]; __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]) = 72; - goto __pyx_L11; - } - - /* "numpy.pxd":818 - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - */ - __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 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[1]; __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[1]; __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]) = 105; - goto __pyx_L11; - } - - /* "numpy.pxd":819 - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - */ - __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 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[1]; __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[1]; __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]) = 73; - goto __pyx_L11; - } - - /* "numpy.pxd":820 - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - */ - __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 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[1]; __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[1]; __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]) = 108; - goto __pyx_L11; - } - - /* "numpy.pxd":821 - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 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[1]; __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[1]; __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]) = 76; - goto __pyx_L11; - } - - /* "numpy.pxd":822 - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 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[1]; __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[1]; __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]) = 113; - goto __pyx_L11; - } - - /* "numpy.pxd":823 - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 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[1]; __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[1]; __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]) = 81; - goto __pyx_L11; - } - - /* "numpy.pxd":824 - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - */ - __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 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[1]; __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[1]; __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]) = 102; - goto __pyx_L11; - } - - /* "numpy.pxd":825 - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - */ - __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 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[1]; __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[1]; __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]) = 100; - goto __pyx_L11; - } - - /* "numpy.pxd":826 - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 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[1]; __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[1]; __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]) = 103; - goto __pyx_L11; - } - - /* "numpy.pxd":827 - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - */ - __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 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[1]; __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[1]; __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]) = 102; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; - } - - /* "numpy.pxd":828 - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - * elif t == NPY_OBJECT: f[0] = 79 #"O" - */ - __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 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[1]; __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[1]; __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]) = 100; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; - } - - /* "numpy.pxd":829 - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - */ - __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 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[1]; __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[1]; __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]) = 90; - (__pyx_v_f[1]) = 103; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; - } - - /* "numpy.pxd":830 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - */ - __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 79; - goto __pyx_L11; - } - /*else*/ { - - /* "numpy.pxd":832 - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * f += 1 - * else: - */ - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_28), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L11:; - - /* "numpy.pxd":833 - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * f += 1 # <<<<<<<<<<<<<< - * else: - * # Cython ignores struct boundary information ("T{...}"), - */ - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L9; - } - /*else*/ { - - /* "numpy.pxd":837 - * # Cython ignores struct boundary information ("T{...}"), - * # so don't output it - * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< - * return f - * - */ - __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_11; - } - __pyx_L9:; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "numpy.pxd":838 - * # 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_RefNannyFinishContext(); - return __pyx_r; -} - -/* "numpy.pxd":953 - * - * - * 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; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("set_array_base"); - - /* "numpy.pxd":955 - * cdef inline void set_array_base(ndarray arr, object base): - * cdef PyObject* baseptr - * if base is None: # <<<<<<<<<<<<<< - * baseptr = NULL - * else: - */ - __pyx_t_1 = (__pyx_v_base == Py_None); - if (__pyx_t_1) { - - /* "numpy.pxd":956 - * cdef PyObject* baseptr - * if base is None: - * baseptr = NULL # <<<<<<<<<<<<<< - * else: - * Py_INCREF(base) # important to do this before decref below! - */ - __pyx_v_baseptr = NULL; - goto __pyx_L3; - } - /*else*/ { - - /* "numpy.pxd":958 - * baseptr = NULL - * else: - * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< - * baseptr = base - * Py_XDECREF(arr.base) - */ - __pyx_t_2 = __pyx_v_base; - __Pyx_INCREF(__pyx_t_2); - Py_INCREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "numpy.pxd":959 - * else: - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base # <<<<<<<<<<<<<< - * Py_XDECREF(arr.base) - * arr.base = baseptr - */ - __pyx_v_baseptr = ((PyObject *)__pyx_v_base); - } - __pyx_L3:; - - /* "numpy.pxd":960 - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base - * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< - * arr.base = baseptr - * - */ - Py_XDECREF(__pyx_v_arr->base); - - /* "numpy.pxd":961 - * baseptr = base - * Py_XDECREF(arr.base) - * arr.base = baseptr # <<<<<<<<<<<<<< - * - * cdef inline object get_array_base(ndarray arr): - */ - __pyx_v_arr->base = __pyx_v_baseptr; - - __Pyx_RefNannyFinishContext(); -} - -/* "numpy.pxd":963 - * 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"); - - /* "numpy.pxd":964 - * - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: # <<<<<<<<<<<<<< - * return None - * else: - */ - __pyx_t_1 = (__pyx_v_arr->base == NULL); - if (__pyx_t_1) { - - /* "numpy.pxd":965 - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: - * return None # <<<<<<<<<<<<<< - * else: - * return arr.base - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; - goto __pyx_L0; - goto __pyx_L3; - } - /*else*/ { - - /* "numpy.pxd":967 - * return None - * else: - * return arr.base # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); - __pyx_r = ((PyObject *)__pyx_v_arr->base); - goto __pyx_L0; - } - __pyx_L3:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_tp_new_6pandas_3lib_6sparse_SparseIndex(PyTypeObject *t, PyObject *a, PyObject *k) { - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; - return o; -} - -static void __pyx_tp_dealloc_6pandas_3lib_6sparse_SparseIndex(PyObject *o) { - (*Py_TYPE(o)->tp_free)(o); -} - -static PyMethodDef __pyx_methods_6pandas_3lib_6sparse_SparseIndex[] = { - {0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_SparseIndex = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_SparseIndex = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_SparseIndex = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_SparseIndex = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6pandas_3lib_6sparse_SparseIndex = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("pandas.lib.sparse.SparseIndex"), /*tp_name*/ - sizeof(struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6pandas_3lib_6sparse_SparseIndex, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_SparseIndex, /*tp_as_number*/ - &__pyx_tp_as_sequence_SparseIndex, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_SparseIndex, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_SparseIndex, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ - __Pyx_DOCSTR("\n Abstract superclass for sparse index types\n "), /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_6pandas_3lib_6sparse_SparseIndex, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pf_6pandas_3lib_6sparse_11SparseIndex___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6pandas_3lib_6sparse_SparseIndex, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_6pandas_3lib_6sparse_IntIndex __pyx_vtable_6pandas_3lib_6sparse_IntIndex; - -static PyObject *__pyx_tp_new_6pandas_3lib_6sparse_IntIndex(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *p; - PyObject *o = __pyx_tp_new_6pandas_3lib_6sparse_SparseIndex(t, a, k); - if (!o) return 0; - p = ((struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)o); - p->__pyx_vtab = __pyx_vtabptr_6pandas_3lib_6sparse_IntIndex; - p->indices = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_6pandas_3lib_6sparse_IntIndex(PyObject *o) { - struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *p = (struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)o; - Py_XDECREF(((PyObject *)p->indices)); - __pyx_tp_dealloc_6pandas_3lib_6sparse_SparseIndex(o); -} - -static int __pyx_tp_traverse_6pandas_3lib_6sparse_IntIndex(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *p = (struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)o; - if (__pyx_ptype_6pandas_3lib_6sparse_SparseIndex->tp_traverse) { - e = __pyx_ptype_6pandas_3lib_6sparse_SparseIndex->tp_traverse(o, v, a); if (e) return e; - } - if (p->indices) { - e = (*v)(((PyObject*)p->indices), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_6pandas_3lib_6sparse_IntIndex(PyObject *o) { - struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *p = (struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *)o; - PyObject* tmp; - if (__pyx_ptype_6pandas_3lib_6sparse_SparseIndex->tp_clear) { - __pyx_ptype_6pandas_3lib_6sparse_SparseIndex->tp_clear(o); - } - tmp = ((PyObject*)p->indices); - p->indices = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_6pandas_3lib_6sparse_8IntIndex_length(PyObject *o, void *x) { - return __pyx_pf_6pandas_3lib_6sparse_8IntIndex_6length___get__(o); -} - -static PyObject *__pyx_getprop_6pandas_3lib_6sparse_8IntIndex_npoints(PyObject *o, void *x) { - return __pyx_pf_6pandas_3lib_6sparse_8IntIndex_7npoints___get__(o); -} - -static PyObject *__pyx_getprop_6pandas_3lib_6sparse_8IntIndex_indices(PyObject *o, void *x) { - return __pyx_pf_6pandas_3lib_6sparse_8IntIndex_7indices___get__(o); -} - -static PyMethodDef __pyx_methods_6pandas_3lib_6sparse_IntIndex[] = { - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_8IntIndex_1__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("check_integrity"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_8IntIndex_3check_integrity, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pandas_3lib_6sparse_8IntIndex_3check_integrity)}, - {__Pyx_NAMESTR("equals"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_8IntIndex_4equals, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("to_int_index"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_8IntIndex_5to_int_index, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("to_block_index"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_8IntIndex_6to_block_index, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("intersect"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_8IntIndex_7intersect, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("make_union"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_8IntIndex_8make_union, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("lookup"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_8IntIndex_9lookup, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("reindex"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_8IntIndex_10reindex, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("put"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_8IntIndex_11put, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("take"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_8IntIndex_12take, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_6pandas_3lib_6sparse_IntIndex[] = { - {(char *)"length", __pyx_getprop_6pandas_3lib_6sparse_8IntIndex_length, 0, 0, 0}, - {(char *)"npoints", __pyx_getprop_6pandas_3lib_6sparse_8IntIndex_npoints, 0, 0, 0}, - {(char *)"indices", __pyx_getprop_6pandas_3lib_6sparse_8IntIndex_indices, 0, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_IntIndex = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_IntIndex = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_IntIndex = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_IntIndex = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6pandas_3lib_6sparse_IntIndex = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("pandas.lib.sparse.IntIndex"), /*tp_name*/ - sizeof(struct __pyx_obj_6pandas_3lib_6sparse_IntIndex), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6pandas_3lib_6sparse_IntIndex, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - __pyx_pf_6pandas_3lib_6sparse_8IntIndex_2__repr__, /*tp_repr*/ - &__pyx_tp_as_number_IntIndex, /*tp_as_number*/ - &__pyx_tp_as_sequence_IntIndex, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_IntIndex, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_IntIndex, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("\n Object for holding exact integer sparse indexing information\n\n Parameters\n ----------\n length : integer\n indices : array-like\n Contains integers corresponding to\n "), /*tp_doc*/ - __pyx_tp_traverse_6pandas_3lib_6sparse_IntIndex, /*tp_traverse*/ - __pyx_tp_clear_6pandas_3lib_6sparse_IntIndex, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_6pandas_3lib_6sparse_IntIndex, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_6pandas_3lib_6sparse_IntIndex, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pf_6pandas_3lib_6sparse_8IntIndex___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6pandas_3lib_6sparse_IntIndex, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockIndex __pyx_vtable_6pandas_3lib_6sparse_BlockIndex; - -static PyObject *__pyx_tp_new_6pandas_3lib_6sparse_BlockIndex(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *p; - PyObject *o = __pyx_tp_new_6pandas_3lib_6sparse_SparseIndex(t, a, k); - if (!o) return 0; - p = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)o); - p->__pyx_vtab = __pyx_vtabptr_6pandas_3lib_6sparse_BlockIndex; - p->blocs = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - p->blengths = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - p->__weakref__ = 0; - return o; -} - -static void __pyx_tp_dealloc_6pandas_3lib_6sparse_BlockIndex(PyObject *o) { - struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *p = (struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)o; - if (p->__weakref__) PyObject_ClearWeakRefs(o); - Py_XDECREF(((PyObject *)p->blocs)); - Py_XDECREF(((PyObject *)p->blengths)); - __pyx_tp_dealloc_6pandas_3lib_6sparse_SparseIndex(o); -} - -static int __pyx_tp_traverse_6pandas_3lib_6sparse_BlockIndex(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *p = (struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)o; - if (__pyx_ptype_6pandas_3lib_6sparse_SparseIndex->tp_traverse) { - e = __pyx_ptype_6pandas_3lib_6sparse_SparseIndex->tp_traverse(o, v, a); if (e) return e; - } - if (p->blocs) { - e = (*v)(((PyObject*)p->blocs), a); if (e) return e; - } - if (p->blengths) { - e = (*v)(((PyObject*)p->blengths), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_6pandas_3lib_6sparse_BlockIndex(PyObject *o) { - struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *p = (struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)o; - PyObject* tmp; - if (__pyx_ptype_6pandas_3lib_6sparse_SparseIndex->tp_clear) { - __pyx_ptype_6pandas_3lib_6sparse_SparseIndex->tp_clear(o); - } - tmp = ((PyObject*)p->blocs); - p->blocs = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->blengths); - p->blengths = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_6pandas_3lib_6sparse_10BlockIndex_nblocks(PyObject *o, void *x) { - return __pyx_pf_6pandas_3lib_6sparse_10BlockIndex_7nblocks___get__(o); -} - -static PyObject *__pyx_getprop_6pandas_3lib_6sparse_10BlockIndex_npoints(PyObject *o, void *x) { - return __pyx_pf_6pandas_3lib_6sparse_10BlockIndex_7npoints___get__(o); -} - -static PyObject *__pyx_getprop_6pandas_3lib_6sparse_10BlockIndex_length(PyObject *o, void *x) { - return __pyx_pf_6pandas_3lib_6sparse_10BlockIndex_6length___get__(o); -} - -static PyObject *__pyx_getprop_6pandas_3lib_6sparse_10BlockIndex_blocs(PyObject *o, void *x) { - return __pyx_pf_6pandas_3lib_6sparse_10BlockIndex_5blocs___get__(o); -} - -static PyObject *__pyx_getprop_6pandas_3lib_6sparse_10BlockIndex_blengths(PyObject *o, void *x) { - return __pyx_pf_6pandas_3lib_6sparse_10BlockIndex_8blengths___get__(o); -} - -static PyMethodDef __pyx_methods_6pandas_3lib_6sparse_BlockIndex[] = { - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_1__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("check_integrity"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_3check_integrity, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pandas_3lib_6sparse_10BlockIndex_3check_integrity)}, - {__Pyx_NAMESTR("equals"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_4equals, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("to_block_index"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_5to_block_index, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("to_int_index"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_6to_int_index, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("intersect"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_7intersect, METH_O, __Pyx_DOCSTR(__pyx_doc_6pandas_3lib_6sparse_10BlockIndex_7intersect)}, - {__Pyx_NAMESTR("make_union"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_8make_union, METH_O, __Pyx_DOCSTR(__pyx_doc_6pandas_3lib_6sparse_10BlockIndex_8make_union)}, - {__Pyx_NAMESTR("lookup"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_9lookup, METH_O, __Pyx_DOCSTR(__pyx_doc_6pandas_3lib_6sparse_10BlockIndex_9lookup)}, - {__Pyx_NAMESTR("reindex"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_10reindex, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("put"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_11put, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("take"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_10BlockIndex_12take, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_6pandas_3lib_6sparse_BlockIndex[] = { - {(char *)"nblocks", __pyx_getprop_6pandas_3lib_6sparse_10BlockIndex_nblocks, 0, 0, 0}, - {(char *)"npoints", __pyx_getprop_6pandas_3lib_6sparse_10BlockIndex_npoints, 0, 0, 0}, - {(char *)"length", __pyx_getprop_6pandas_3lib_6sparse_10BlockIndex_length, 0, 0, 0}, - {(char *)"blocs", __pyx_getprop_6pandas_3lib_6sparse_10BlockIndex_blocs, 0, 0, 0}, - {(char *)"blengths", __pyx_getprop_6pandas_3lib_6sparse_10BlockIndex_blengths, 0, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_BlockIndex = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_BlockIndex = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_BlockIndex = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_BlockIndex = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6pandas_3lib_6sparse_BlockIndex = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("pandas.lib.sparse.BlockIndex"), /*tp_name*/ - sizeof(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6pandas_3lib_6sparse_BlockIndex, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - __pyx_pf_6pandas_3lib_6sparse_10BlockIndex_2__repr__, /*tp_repr*/ - &__pyx_tp_as_number_BlockIndex, /*tp_as_number*/ - &__pyx_tp_as_sequence_BlockIndex, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_BlockIndex, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_BlockIndex, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("\n Object for holding block-based sparse indexing information\n\n Parameters\n ----------\n "), /*tp_doc*/ - __pyx_tp_traverse_6pandas_3lib_6sparse_BlockIndex, /*tp_traverse*/ - __pyx_tp_clear_6pandas_3lib_6sparse_BlockIndex, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_6pandas_3lib_6sparse_BlockIndex, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_6pandas_3lib_6sparse_BlockIndex, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pf_6pandas_3lib_6sparse_10BlockIndex___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6pandas_3lib_6sparse_BlockIndex, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockMerge __pyx_vtable_6pandas_3lib_6sparse_BlockMerge; - -static PyObject *__pyx_tp_new_6pandas_3lib_6sparse_BlockMerge(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *p; - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; - p = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)o); - p->__pyx_vtab = __pyx_vtabptr_6pandas_3lib_6sparse_BlockMerge; - p->x = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)Py_None); Py_INCREF(Py_None); - p->y = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)Py_None); Py_INCREF(Py_None); - p->result = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)Py_None); Py_INCREF(Py_None); - p->xstart = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - p->xlen = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - p->xend = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - p->ystart = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - p->ylen = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - p->yend = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_6pandas_3lib_6sparse_BlockMerge(PyObject *o) { - struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *p = (struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)o; - Py_XDECREF(((PyObject *)p->x)); - Py_XDECREF(((PyObject *)p->y)); - Py_XDECREF(((PyObject *)p->result)); - Py_XDECREF(((PyObject *)p->xstart)); - Py_XDECREF(((PyObject *)p->xlen)); - Py_XDECREF(((PyObject *)p->xend)); - Py_XDECREF(((PyObject *)p->ystart)); - Py_XDECREF(((PyObject *)p->ylen)); - Py_XDECREF(((PyObject *)p->yend)); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_6pandas_3lib_6sparse_BlockMerge(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *p = (struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)o; - if (p->x) { - e = (*v)(((PyObject*)p->x), a); if (e) return e; - } - if (p->y) { - e = (*v)(((PyObject*)p->y), a); if (e) return e; - } - if (p->result) { - e = (*v)(((PyObject*)p->result), a); if (e) return e; - } - if (p->xstart) { - e = (*v)(((PyObject*)p->xstart), a); if (e) return e; - } - if (p->xlen) { - e = (*v)(((PyObject*)p->xlen), a); if (e) return e; - } - if (p->xend) { - e = (*v)(((PyObject*)p->xend), a); if (e) return e; - } - if (p->ystart) { - e = (*v)(((PyObject*)p->ystart), a); if (e) return e; - } - if (p->ylen) { - e = (*v)(((PyObject*)p->ylen), a); if (e) return e; - } - if (p->yend) { - e = (*v)(((PyObject*)p->yend), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_6pandas_3lib_6sparse_BlockMerge(PyObject *o) { - struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *p = (struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *)o; - PyObject* tmp; - tmp = ((PyObject*)p->x); - p->x = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->y); - p->y = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->result); - p->result = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->xstart); - p->xstart = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->xlen); - p->xlen = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->xend); - p->xend = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->ystart); - p->ystart = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->ylen); - p->ylen = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->yend); - p->yend = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_6pandas_3lib_6sparse_BlockMerge[] = { - {0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_BlockMerge = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_BlockMerge = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_BlockMerge = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_BlockMerge = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6pandas_3lib_6sparse_BlockMerge = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("pandas.lib.sparse.BlockMerge"), /*tp_name*/ - sizeof(struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6pandas_3lib_6sparse_BlockMerge, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_BlockMerge, /*tp_as_number*/ - &__pyx_tp_as_sequence_BlockMerge, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_BlockMerge, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_BlockMerge, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("\n Object-oriented approach makes sharing state between recursive functions a\n lot easier and reduces code duplication\n "), /*tp_doc*/ - __pyx_tp_traverse_6pandas_3lib_6sparse_BlockMerge, /*tp_traverse*/ - __pyx_tp_clear_6pandas_3lib_6sparse_BlockMerge, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_6pandas_3lib_6sparse_BlockMerge, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pf_6pandas_3lib_6sparse_10BlockMerge___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6pandas_3lib_6sparse_BlockMerge, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockIntersection __pyx_vtable_6pandas_3lib_6sparse_BlockIntersection; - -static PyObject *__pyx_tp_new_6pandas_3lib_6sparse_BlockIntersection(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_6pandas_3lib_6sparse_BlockIntersection *p; - PyObject *o = __pyx_tp_new_6pandas_3lib_6sparse_BlockMerge(t, a, k); - if (!o) return 0; - p = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockIntersection *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockMerge*)__pyx_vtabptr_6pandas_3lib_6sparse_BlockIntersection; - return o; -} - -static PyMethodDef __pyx_methods_6pandas_3lib_6sparse_BlockIntersection[] = { - {0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_BlockIntersection = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_BlockIntersection = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_BlockIntersection = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_BlockIntersection = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6pandas_3lib_6sparse_BlockIntersection = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("pandas.lib.sparse.BlockIntersection"), /*tp_name*/ - sizeof(struct __pyx_obj_6pandas_3lib_6sparse_BlockIntersection), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6pandas_3lib_6sparse_BlockMerge, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_BlockIntersection, /*tp_as_number*/ - &__pyx_tp_as_sequence_BlockIntersection, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_BlockIntersection, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_BlockIntersection, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("\n not done yet\n "), /*tp_doc*/ - __pyx_tp_traverse_6pandas_3lib_6sparse_BlockMerge, /*tp_traverse*/ - __pyx_tp_clear_6pandas_3lib_6sparse_BlockMerge, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_6pandas_3lib_6sparse_BlockIntersection, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6pandas_3lib_6sparse_BlockIntersection, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockUnion __pyx_vtable_6pandas_3lib_6sparse_BlockUnion; - -static PyObject *__pyx_tp_new_6pandas_3lib_6sparse_BlockUnion(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_6pandas_3lib_6sparse_BlockUnion *p; - PyObject *o = __pyx_tp_new_6pandas_3lib_6sparse_BlockMerge(t, a, k); - if (!o) return 0; - p = ((struct __pyx_obj_6pandas_3lib_6sparse_BlockUnion *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6pandas_3lib_6sparse_BlockMerge*)__pyx_vtabptr_6pandas_3lib_6sparse_BlockUnion; - return o; -} - -static PyMethodDef __pyx_methods_6pandas_3lib_6sparse_BlockUnion[] = { - {0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_BlockUnion = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_BlockUnion = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_BlockUnion = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_BlockUnion = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6pandas_3lib_6sparse_BlockUnion = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("pandas.lib.sparse.BlockUnion"), /*tp_name*/ - sizeof(struct __pyx_obj_6pandas_3lib_6sparse_BlockUnion), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6pandas_3lib_6sparse_BlockMerge, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_BlockUnion, /*tp_as_number*/ - &__pyx_tp_as_sequence_BlockUnion, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_BlockUnion, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_BlockUnion, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("\n Object-oriented approach makes sharing state between recursive functions a\n lot easier and reduces code duplication\n "), /*tp_doc*/ - __pyx_tp_traverse_6pandas_3lib_6sparse_BlockMerge, /*tp_traverse*/ - __pyx_tp_clear_6pandas_3lib_6sparse_BlockMerge, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_6pandas_3lib_6sparse_BlockUnion, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_6pandas_3lib_6sparse_BlockUnion, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static PyMethodDef __pyx_methods[] = { - {__Pyx_NAMESTR("get_blocks"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_get_blocks, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("sparse_nanadd"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_1sparse_nanadd, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("sparse_nansub"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_2sparse_nansub, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("sparse_nanmul"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_3sparse_nanmul, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("sparse_nandiv"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_4sparse_nandiv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("sparse_nanpow"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_5sparse_nanpow, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("sparse_add"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_6sparse_add, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("sparse_sub"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_7sparse_sub, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("sparse_mul"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_8sparse_mul, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("sparse_div"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_9sparse_div, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("sparse_pow"), (PyCFunction)__pyx_pf_6pandas_3lib_6sparse_10sparse_pow, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - __Pyx_NAMESTR("sparse"), - 0, /* m_doc */ - -1, /* m_size */ - __pyx_methods /* m_methods */, - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 1}, - {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0}, - {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0}, - {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, - {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0}, - {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1}, - {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0}, - {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, - {&__pyx_n_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 1}, - {&__pyx_kp_u_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 1, 0, 0}, - {&__pyx_kp_u_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 1, 0, 0}, - {&__pyx_kp_u_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 1, 0, 0}, - {&__pyx_kp_u_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 1, 0, 0}, - {&__pyx_kp_u_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 1, 0, 0}, - {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, - {&__pyx_kp_u_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 1, 0, 0}, - {&__pyx_n_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 1}, - {&__pyx_n_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 1}, - {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, - {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, - {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, - {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1}, - {&__pyx_n_s__NaN, __pyx_k__NaN, sizeof(__pyx_k__NaN), 0, 0, 1, 1}, - {&__pyx_n_s__NotImplementedError, __pyx_k__NotImplementedError, sizeof(__pyx_k__NotImplementedError), 0, 0, 1, 1}, - {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, - {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, - {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, - {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, - {&__pyx_n_s___make_merged_blocks, __pyx_k___make_merged_blocks, sizeof(__pyx_k___make_merged_blocks), 0, 0, 1, 1}, - {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1}, - {&__pyx_n_s__array_equal, __pyx_k__array_equal, sizeof(__pyx_k__array_equal), 0, 0, 1, 1}, - {&__pyx_n_s__ascontiguousarray, __pyx_k__ascontiguousarray, sizeof(__pyx_k__ascontiguousarray), 0, 0, 1, 1}, - {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, - {&__pyx_n_s__blengths, __pyx_k__blengths, sizeof(__pyx_k__blengths), 0, 0, 1, 1}, - {&__pyx_n_s__blocs, __pyx_k__blocs, sizeof(__pyx_k__blocs), 0, 0, 1, 1}, - {&__pyx_n_s__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__check_integrity, __pyx_k__check_integrity, sizeof(__pyx_k__check_integrity), 0, 0, 1, 1}, - {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 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__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, - {&__pyx_n_s__fill, __pyx_k__fill, sizeof(__pyx_k__fill), 0, 0, 1, 1}, - {&__pyx_n_s__fill_value, __pyx_k__fill_value, sizeof(__pyx_k__fill_value), 0, 0, 1, 1}, - {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1}, - {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, - {&__pyx_n_s__get_reindexer, __pyx_k__get_reindexer, sizeof(__pyx_k__get_reindexer), 0, 0, 1, 1}, - {&__pyx_n_s__index_map, __pyx_k__index_map, sizeof(__pyx_k__index_map), 0, 0, 1, 1}, - {&__pyx_n_s__indexer, __pyx_k__indexer, sizeof(__pyx_k__indexer), 0, 0, 1, 1}, - {&__pyx_n_s__indices, __pyx_k__indices, sizeof(__pyx_k__indices), 0, 0, 1, 1}, - {&__pyx_n_s__inf, __pyx_k__inf, sizeof(__pyx_k__inf), 0, 0, 1, 1}, - {&__pyx_n_s__int32, __pyx_k__int32, sizeof(__pyx_k__int32), 0, 0, 1, 1}, - {&__pyx_n_s__intersect, __pyx_k__intersect, sizeof(__pyx_k__intersect), 0, 0, 1, 1}, - {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, - {&__pyx_n_s__lenbuf, __pyx_k__lenbuf, sizeof(__pyx_k__lenbuf), 0, 0, 1, 1}, - {&__pyx_n_s__length, __pyx_k__length, sizeof(__pyx_k__length), 0, 0, 1, 1}, - {&__pyx_n_s__locbuf, __pyx_k__locbuf, sizeof(__pyx_k__locbuf), 0, 0, 1, 1}, - {&__pyx_n_s__lookup, __pyx_k__lookup, sizeof(__pyx_k__lookup), 0, 0, 1, 1}, - {&__pyx_n_s__make_union, __pyx_k__make_union, sizeof(__pyx_k__make_union), 0, 0, 1, 1}, - {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, - {&__pyx_n_s__nblocks, __pyx_k__nblocks, sizeof(__pyx_k__nblocks), 0, 0, 1, 1}, - {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, - {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, - {&__pyx_n_s__npoints, __pyx_k__npoints, sizeof(__pyx_k__npoints), 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__operator, __pyx_k__operator, sizeof(__pyx_k__operator), 0, 0, 1, 1}, - {&__pyx_n_s__other_, __pyx_k__other_, sizeof(__pyx_k__other_), 0, 0, 1, 1}, - {&__pyx_n_s__put, __pyx_k__put, sizeof(__pyx_k__put), 0, 0, 1, 1}, - {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, - {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, - {&__pyx_n_s__reindex, __pyx_k__reindex, sizeof(__pyx_k__reindex), 0, 0, 1, 1}, - {&__pyx_n_s__reindex_block, __pyx_k__reindex_block, sizeof(__pyx_k__reindex_block), 0, 0, 1, 1}, - {&__pyx_n_s__reindex_integer, __pyx_k__reindex_integer, sizeof(__pyx_k__reindex_integer), 0, 0, 1, 1}, - {&__pyx_n_s__result, __pyx_k__result, sizeof(__pyx_k__result), 0, 0, 1, 1}, - {&__pyx_n_s__searchsorted, __pyx_k__searchsorted, sizeof(__pyx_k__searchsorted), 0, 0, 1, 1}, - {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, - {&__pyx_n_s__sparse_index, __pyx_k__sparse_index, sizeof(__pyx_k__sparse_index), 0, 0, 1, 1}, - {&__pyx_n_s__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__sum, __pyx_k__sum, sizeof(__pyx_k__sum), 0, 0, 1, 1}, - {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1}, - {&__pyx_n_s__take, __pyx_k__take, sizeof(__pyx_k__take), 0, 0, 1, 1}, - {&__pyx_n_s__to_block_index, __pyx_k__to_block_index, sizeof(__pyx_k__to_block_index), 0, 0, 1, 1}, - {&__pyx_n_s__to_int_index, __pyx_k__to_int_index, sizeof(__pyx_k__to_int_index), 0, 0, 1, 1}, - {&__pyx_n_s__to_put, __pyx_k__to_put, sizeof(__pyx_k__to_put), 0, 0, 1, 1}, - {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, - {&__pyx_n_s__values, __pyx_k__values, sizeof(__pyx_k__values), 0, 0, 1, 1}, - {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, - {&__pyx_n_s__xend, __pyx_k__xend, sizeof(__pyx_k__xend), 0, 0, 1, 1}, - {&__pyx_n_s__xfill, __pyx_k__xfill, sizeof(__pyx_k__xfill), 0, 0, 1, 1}, - {&__pyx_n_s__xi, __pyx_k__xi, sizeof(__pyx_k__xi), 0, 0, 1, 1}, - {&__pyx_n_s__xindex, __pyx_k__xindex, sizeof(__pyx_k__xindex), 0, 0, 1, 1}, - {&__pyx_n_s__xstart, __pyx_k__xstart, sizeof(__pyx_k__xstart), 0, 0, 1, 1}, - {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, - {&__pyx_n_s__yend, __pyx_k__yend, sizeof(__pyx_k__yend), 0, 0, 1, 1}, - {&__pyx_n_s__yfill, __pyx_k__yfill, sizeof(__pyx_k__yfill), 0, 0, 1, 1}, - {&__pyx_n_s__yi, __pyx_k__yi, sizeof(__pyx_k__yi), 0, 0, 1, 1}, - {&__pyx_n_s__yindex, __pyx_k__yindex, sizeof(__pyx_k__yindex), 0, 0, 1, 1}, - {&__pyx_n_s__ystart, __pyx_k__ystart, sizeof(__pyx_k__ystart), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __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 = 343; __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 = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); - - /* "pandas/lib/src/sparse.pyx":127 - * - * if self.length != y.length: - * raise Exception('Indices must reference same underlying length') # <<<<<<<<<<<<<< - * - * xindices = self.indices - */ - __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); - PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); - - /* "pandas/lib/src/sparse.pyx":161 - * - * if self.length != y.length: - * raise Exception('Indices must reference same underlying length') # <<<<<<<<<<<<<< - * - * xindices = self.indices - */ - __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); - PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); - - /* "pandas/lib/src/sparse.pyx":343 - * - * if len(blocs) != len(blengths): - * raise ValueError('block bound arrays must be same length') # <<<<<<<<<<<<<< - * - * for i from 0 <= i < self.nblocks: - */ - __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); - PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_s_9)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); - - /* "pandas/lib/src/sparse.pyx":348 - * if i > 0: - * if blocs[i] <= blocs[i-1]: - * raise ValueError('Locations not in ascending order') # <<<<<<<<<<<<<< - * - * if i < self.nblocks - 1: - */ - __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_11)); - PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_11)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); - - /* "pandas/lib/src/sparse.pyx":417 - * - * if self.length != y.length: - * raise Exception('Indices must reference same underlying length') # <<<<<<<<<<<<<< - * - * xloc = self.blocs - */ - __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); - PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_s_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); - - /* "pandas/lib/src/sparse.pyx":563 - * - * if x.length != y.length: - * raise Exception('Indices must reference same underlying length') # <<<<<<<<<<<<<< - * - * self.xstart = self.x.blocs - */ - __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); - PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_s_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); - - /* "pandas/lib/src/sparse.pyx":653 - * - * if mode != 0 and mode != 1: - * raise Exception('Mode must be 0 or 1') # <<<<<<<<<<<<<< - * - * # so symmetric code will work - */ - __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_20)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_19)); - PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_s_19)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); - - /* "numpy.pxd":206 - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - */ - __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_23)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_22)); - PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_kp_u_22)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_22)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); - - /* "numpy.pxd":210 - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< - * - * info.buf = PyArray_DATA(self) - */ - __pyx_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_25)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_24)); - PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_kp_u_24)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_24)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25)); - - /* "numpy.pxd":248 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" - */ - __pyx_k_tuple_27 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_27)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_26)); - PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_kp_u_26)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_26)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27)); - - /* "numpy.pxd":787 - * - * if (end - f) - (new_offset - offset[0]) < 15: - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< - * - * if ((child.byteorder == '>' and little_endian) or - */ - __pyx_k_tuple_30 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_30)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_29)); - PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, ((PyObject *)__pyx_kp_u_29)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_29)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30)); - - /* "numpy.pxd":791 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * # One could encode it in the format string and have Cython - * # complain instead, BUT: < and > in format strings also imply - */ - __pyx_k_tuple_31 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_31)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_26)); - PyTuple_SET_ITEM(__pyx_k_tuple_31, 0, ((PyObject *)__pyx_kp_u_26)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_26)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31)); - - /* "numpy.pxd":811 - * t = child.type_num - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< - * - * # Until ticket #99 is fixed, use integers to avoid warnings - */ - __pyx_k_tuple_33 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_33)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_32)); - PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, ((PyObject *)__pyx_kp_u_32)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_32)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33)); - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - return 0; - __pyx_L1_error:; - return -1; -} - -#if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC initsparse(void); /*proto*/ -PyMODINIT_FUNC initsparse(void) -#else -PyMODINIT_FUNC PyInit_sparse(void); /*proto*/ -PyMODINIT_FUNC PyInit_sparse(void) -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_3; - #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_sparse(void)", __LINE__, __FILE__); - #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #ifdef __pyx_binding_PyCFunctionType_USED - if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ - PyEval_InitThreads(); - #endif - #endif - /*--- Module creation code ---*/ - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("sparse"), __pyx_methods, 0, 0, PYTHON_API_VERSION); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); - #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - /*--- Initialize various global constants etc. ---*/ - if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_module_is_main_pandas__lib__sparse) { - if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - } - /*--- Builtin init code ---*/ - if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /*--- Constants init code ---*/ - if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /*--- Global init code ---*/ - /*--- Function export code ---*/ - /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_6pandas_3lib_6sparse_SparseIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "SparseIndex", (PyObject *)&__pyx_type_6pandas_3lib_6sparse_SparseIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6pandas_3lib_6sparse_SparseIndex = &__pyx_type_6pandas_3lib_6sparse_SparseIndex; - __pyx_vtabptr_6pandas_3lib_6sparse_IntIndex = &__pyx_vtable_6pandas_3lib_6sparse_IntIndex; - __pyx_vtable_6pandas_3lib_6sparse_IntIndex.intersect = (struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *(*)(struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, int __pyx_skip_dispatch))__pyx_f_6pandas_3lib_6sparse_8IntIndex_intersect; - __pyx_vtable_6pandas_3lib_6sparse_IntIndex.make_union = (struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *(*)(struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, int __pyx_skip_dispatch))__pyx_f_6pandas_3lib_6sparse_8IntIndex_make_union; - __pyx_vtable_6pandas_3lib_6sparse_IntIndex.lookup = (PyObject *(*)(struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *, __pyx_t_6pandas_3lib_6sparse_pyst, int __pyx_skip_dispatch))__pyx_f_6pandas_3lib_6sparse_8IntIndex_lookup; - __pyx_vtable_6pandas_3lib_6sparse_IntIndex.reindex = (PyArrayObject *(*)(struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *, PyArrayObject *, __pyx_t_5numpy_float64_t, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, int __pyx_skip_dispatch))__pyx_f_6pandas_3lib_6sparse_8IntIndex_reindex; - __pyx_vtable_6pandas_3lib_6sparse_IntIndex.put = (PyObject *(*)(struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *, PyArrayObject *, PyArrayObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_6pandas_3lib_6sparse_8IntIndex_put; - __pyx_vtable_6pandas_3lib_6sparse_IntIndex.take = (PyObject *(*)(struct __pyx_obj_6pandas_3lib_6sparse_IntIndex *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_6pandas_3lib_6sparse_8IntIndex_take; - __pyx_type_6pandas_3lib_6sparse_IntIndex.tp_base = __pyx_ptype_6pandas_3lib_6sparse_SparseIndex; - if (PyType_Ready(&__pyx_type_6pandas_3lib_6sparse_IntIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_6pandas_3lib_6sparse_IntIndex.tp_dict, __pyx_vtabptr_6pandas_3lib_6sparse_IntIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "IntIndex", (PyObject *)&__pyx_type_6pandas_3lib_6sparse_IntIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6pandas_3lib_6sparse_IntIndex = &__pyx_type_6pandas_3lib_6sparse_IntIndex; - __pyx_vtabptr_6pandas_3lib_6sparse_BlockIndex = &__pyx_vtable_6pandas_3lib_6sparse_BlockIndex; - __pyx_vtable_6pandas_3lib_6sparse_BlockIndex.check_integrity = (PyObject *(*)(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *, int __pyx_skip_dispatch))__pyx_f_6pandas_3lib_6sparse_10BlockIndex_check_integrity; - __pyx_vtable_6pandas_3lib_6sparse_BlockIndex.intersect = (struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *(*)(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, int __pyx_skip_dispatch))__pyx_f_6pandas_3lib_6sparse_10BlockIndex_intersect; - __pyx_vtable_6pandas_3lib_6sparse_BlockIndex.make_union = (struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *(*)(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, int __pyx_skip_dispatch))__pyx_f_6pandas_3lib_6sparse_10BlockIndex_make_union; - __pyx_vtable_6pandas_3lib_6sparse_BlockIndex.lookup = (PyObject *(*)(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *, __pyx_t_6pandas_3lib_6sparse_pyst, int __pyx_skip_dispatch))__pyx_f_6pandas_3lib_6sparse_10BlockIndex_lookup; - __pyx_vtable_6pandas_3lib_6sparse_BlockIndex.reindex = (PyArrayObject *(*)(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *, PyArrayObject *, __pyx_t_5numpy_float64_t, struct __pyx_obj_6pandas_3lib_6sparse_SparseIndex *, int __pyx_skip_dispatch))__pyx_f_6pandas_3lib_6sparse_10BlockIndex_reindex; - __pyx_vtable_6pandas_3lib_6sparse_BlockIndex.put = (PyObject *(*)(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *, PyArrayObject *, PyArrayObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_6pandas_3lib_6sparse_10BlockIndex_put; - __pyx_vtable_6pandas_3lib_6sparse_BlockIndex.take = (PyObject *(*)(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_6pandas_3lib_6sparse_10BlockIndex_take; - __pyx_type_6pandas_3lib_6sparse_BlockIndex.tp_base = __pyx_ptype_6pandas_3lib_6sparse_SparseIndex; - if (PyType_Ready(&__pyx_type_6pandas_3lib_6sparse_BlockIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_6pandas_3lib_6sparse_BlockIndex.tp_dict, __pyx_vtabptr_6pandas_3lib_6sparse_BlockIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "BlockIndex", (PyObject *)&__pyx_type_6pandas_3lib_6sparse_BlockIndex) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_type_6pandas_3lib_6sparse_BlockIndex.tp_weaklistoffset == 0) __pyx_type_6pandas_3lib_6sparse_BlockIndex.tp_weaklistoffset = offsetof(struct __pyx_obj_6pandas_3lib_6sparse_BlockIndex, __weakref__); - __pyx_ptype_6pandas_3lib_6sparse_BlockIndex = &__pyx_type_6pandas_3lib_6sparse_BlockIndex; - __pyx_vtabptr_6pandas_3lib_6sparse_BlockMerge = &__pyx_vtable_6pandas_3lib_6sparse_BlockMerge; - __pyx_vtable_6pandas_3lib_6sparse_BlockMerge._make_merged_blocks = (PyObject *(*)(struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *))__pyx_f_6pandas_3lib_6sparse_10BlockMerge__make_merged_blocks; - __pyx_vtable_6pandas_3lib_6sparse_BlockMerge._set_current_indices = (PyObject *(*)(struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *, __pyx_t_5numpy_int32_t, __pyx_t_5numpy_int32_t, int))__pyx_f_6pandas_3lib_6sparse_10BlockMerge__set_current_indices; - if (PyType_Ready(&__pyx_type_6pandas_3lib_6sparse_BlockMerge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_6pandas_3lib_6sparse_BlockMerge.tp_dict, __pyx_vtabptr_6pandas_3lib_6sparse_BlockMerge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "BlockMerge", (PyObject *)&__pyx_type_6pandas_3lib_6sparse_BlockMerge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6pandas_3lib_6sparse_BlockMerge = &__pyx_type_6pandas_3lib_6sparse_BlockMerge; - __pyx_vtabptr_6pandas_3lib_6sparse_BlockIntersection = &__pyx_vtable_6pandas_3lib_6sparse_BlockIntersection; - __pyx_vtable_6pandas_3lib_6sparse_BlockIntersection.__pyx_base = *__pyx_vtabptr_6pandas_3lib_6sparse_BlockMerge; - __pyx_type_6pandas_3lib_6sparse_BlockIntersection.tp_base = __pyx_ptype_6pandas_3lib_6sparse_BlockMerge; - if (PyType_Ready(&__pyx_type_6pandas_3lib_6sparse_BlockIntersection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_6pandas_3lib_6sparse_BlockIntersection.tp_dict, __pyx_vtabptr_6pandas_3lib_6sparse_BlockIntersection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "BlockIntersection", (PyObject *)&__pyx_type_6pandas_3lib_6sparse_BlockIntersection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6pandas_3lib_6sparse_BlockIntersection = &__pyx_type_6pandas_3lib_6sparse_BlockIntersection; - __pyx_vtabptr_6pandas_3lib_6sparse_BlockUnion = &__pyx_vtable_6pandas_3lib_6sparse_BlockUnion; - __pyx_vtable_6pandas_3lib_6sparse_BlockUnion.__pyx_base = *__pyx_vtabptr_6pandas_3lib_6sparse_BlockMerge; - __pyx_vtable_6pandas_3lib_6sparse_BlockUnion.__pyx_base._make_merged_blocks = (PyObject *(*)(struct __pyx_obj_6pandas_3lib_6sparse_BlockMerge *))__pyx_f_6pandas_3lib_6sparse_10BlockUnion__make_merged_blocks; - __pyx_vtable_6pandas_3lib_6sparse_BlockUnion._find_next_block_end = (__pyx_t_5numpy_int32_t (*)(struct __pyx_obj_6pandas_3lib_6sparse_BlockUnion *, int))__pyx_f_6pandas_3lib_6sparse_10BlockUnion__find_next_block_end; - __pyx_type_6pandas_3lib_6sparse_BlockUnion.tp_base = __pyx_ptype_6pandas_3lib_6sparse_BlockMerge; - if (PyType_Ready(&__pyx_type_6pandas_3lib_6sparse_BlockUnion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_6pandas_3lib_6sparse_BlockUnion.tp_dict, __pyx_vtabptr_6pandas_3lib_6sparse_BlockUnion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "BlockUnion", (PyObject *)&__pyx_type_6pandas_3lib_6sparse_BlockUnion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6pandas_3lib_6sparse_BlockUnion = &__pyx_type_6pandas_3lib_6sparse_BlockUnion; - /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /*--- Function import code ---*/ - /*--- Execution code ---*/ - - /* "pandas/lib/src/sparse.pyx":6 - * cimport cython - * - * import numpy as np # <<<<<<<<<<<<<< - * import operator - * import sys - */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "pandas/lib/src/sparse.pyx":7 - * - * import numpy as np - * import operator # <<<<<<<<<<<<<< - * import sys - * - */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__operator), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__operator, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "pandas/lib/src/sparse.pyx":8 - * import numpy as np - * import operator - * import sys # <<<<<<<<<<<<<< - * - * ctypedef Py_ssize_t pyst - */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "pandas/lib/src/sparse.pyx":15 - * # Preamble stuff - * - * cdef float64_t NaN = np.NaN # <<<<<<<<<<<<<< - * cdef float64_t INF = np.inf - * - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__NaN); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_6pandas_3lib_6sparse_NaN = __pyx_t_3; - - /* "pandas/lib/src/sparse.pyx":16 - * - * cdef float64_t NaN = np.NaN - * cdef float64_t INF = np.inf # <<<<<<<<<<<<<< - * - * cdef inline int int_max(int a, int b): return a if a >= b else b - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__inf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_6pandas_3lib_6sparse_INF = __pyx_t_3; - - /* "pandas/lib/src/sparse.pyx":1044 - * # Indexing operations - * - * def get_reindexer(ndarray[object, ndim=1] values, dict index_map): # <<<<<<<<<<<<<< - * cdef object idx - * cdef Py_ssize_t i - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_3lib_6sparse_11get_reindexer, NULL, __pyx_n_s_34); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_reindexer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "pandas/lib/src/sparse.pyx":1061 - * return indexer - * - * def reindex_block(ndarray[float64_t, ndim=1] values, # <<<<<<<<<<<<<< - * BlockIndex sparse_index, - * ndarray[int32_t, ndim=1] indexer): - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_3lib_6sparse_12reindex_block, NULL, __pyx_n_s_34); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__reindex_block, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "pandas/lib/src/sparse.pyx":1091 - * - * - * def reindex_integer(ndarray[float64_t, ndim=1] values, # <<<<<<<<<<<<<< - * IntIndex sparse_index, - * ndarray[int32_t, ndim=1] indexer): - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_3lib_6sparse_13reindex_integer, NULL, __pyx_n_s_34); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__reindex_integer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "pandas/lib/src/sparse.pyx":1 - * from numpy cimport ndarray, int32_t, float64_t # <<<<<<<<<<<<<< - * cimport numpy as np - * - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - - /* "numpy.pxd":963 - * arr.base = baseptr - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * if arr.base is NULL: - * return None - */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - if (__pyx_m) { - __Pyx_AddTraceback("init pandas.lib.sparse"); - Py_DECREF(__pyx_m); __pyx_m = 0; - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init pandas.lib.sparse"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if PY_MAJOR_VERSION < 3 - return; - #else - return __pyx_m; - #endif -} - -/* Runtime support code */ - -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { - PyObject *result; - result = PyObject_GetAttr(dict, name); - if (!result) - PyErr_SetObject(PyExc_NameError, name); - return result; -} - -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *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 CYTHON_INLINE int __Pyx_CheckKeywordStrings( - PyObject *kwdict, - const char* function_name, - int kw_allowed) -{ - PyObject* key = 0; - Py_ssize_t pos = 0; - while (PyDict_Next(kwdict, &pos, &key, 0)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) - #endif - goto invalid_keyword_type; - } - if ((!kw_allowed) && unlikely(key)) - goto invalid_keyword; - return 1; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%s() keywords must be strings", function_name); - return 0; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%s() got an unexpected keyword argument '%s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif - return 0; -} - -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} - -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} - - -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - 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 , */ - 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 void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); - #endif -} - -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { - values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - } - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%s() got an unexpected keyword argument '%s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (likely(PyObject_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} - -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - #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(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "too many values to unpack (expected %d)", (int)expected); - #else - "too many values to unpack (expected %zd)", expected); - #endif -} - -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, Py_ssize_t expected) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - __Pyx_RaiseTooManyValuesError(expected); - return -1; - } - else if (!PyErr_Occurred()) - return 0; - else - 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 CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { - if (obj == Py_None) { - __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_RaiseBufferFallbackError(void) { - PyErr_Format(PyExc_ValueError, - "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); -} - -static void __Pyx_RaiseBufferIndexError(int axis) { - PyErr_Format(PyExc_IndexError, - "Out of bounds on buffer access (axis %d)", axis); -} - - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (!type) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (Py_TYPE(obj) == type) return 1; - } - else { - if (PyObject_TypeCheck(obj, type)) return 1; - } - PyErr_Format(PyExc_TypeError, - "Argument '%s' has incorrect type (expected %s, got %s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; -} - - -static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable"); -} - -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); - } else { - __Pyx_RaiseTooManyValuesError(index); - } -} - -#if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { - #if PY_VERSION_HEX >= 0x02060000 - if (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_1__releasebuffer__(obj, view); - Py_DECREF(obj); - view->obj = NULL; - } -} - -#endif - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { - PyObject *py_import = 0; - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); - if (!py_import) - goto bad; - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; - } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, NULL); -bad: - Py_XDECREF(empty_list); - Py_XDECREF(py_import); - Py_XDECREF(empty_dict); - return module; -} - -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32 val) { - const npy_int32 neg_one = (npy_int32)-1, const_zero = (npy_int32)0; - const int is_unsigned = const_zero < neg_one; - if ((sizeof(npy_int32) == sizeof(char)) || - (sizeof(npy_int32) == sizeof(short))) { - return PyInt_FromLong((long)val); - } else if ((sizeof(npy_int32) == sizeof(int)) || - (sizeof(npy_int32) == sizeof(long))) { - if (is_unsigned) - return PyLong_FromUnsignedLong((unsigned long)val); - else - return PyInt_FromLong((long)val); - } else if (sizeof(npy_int32) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); - else - return PyLong_FromLongLong((PY_LONG_LONG)val); - } else { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - return _PyLong_FromByteArray(bytes, sizeof(npy_int32), - little, !is_unsigned); - } -} - -static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject* x) { - const npy_int32 neg_one = (npy_int32)-1, const_zero = (npy_int32)0; - const int is_unsigned = const_zero < neg_one; - if (sizeof(npy_int32) == sizeof(char)) { - if (is_unsigned) - return (npy_int32)__Pyx_PyInt_AsUnsignedChar(x); - else - return (npy_int32)__Pyx_PyInt_AsSignedChar(x); - } else if (sizeof(npy_int32) == sizeof(short)) { - if (is_unsigned) - return (npy_int32)__Pyx_PyInt_AsUnsignedShort(x); - else - return (npy_int32)__Pyx_PyInt_AsSignedShort(x); - } else if (sizeof(npy_int32) == sizeof(int)) { - if (is_unsigned) - return (npy_int32)__Pyx_PyInt_AsUnsignedInt(x); - else - return (npy_int32)__Pyx_PyInt_AsSignedInt(x); - } else if (sizeof(npy_int32) == sizeof(long)) { - if (is_unsigned) - return (npy_int32)__Pyx_PyInt_AsUnsignedLong(x); - else - return (npy_int32)__Pyx_PyInt_AsSignedLong(x); - } else if (sizeof(npy_int32) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return (npy_int32)__Pyx_PyInt_AsUnsignedLongLong(x); - else - return (npy_int32)__Pyx_PyInt_AsSignedLongLong(x); - } else { - npy_int32 val; - PyObject *v = __Pyx_PyNumber_Int(x); - #if PY_VERSION_HEX < 0x03000000 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (npy_int32)-1; - } -} - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return ::std::complex< float >(x, y); - } - #else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return x + y*(__pyx_t_float_complex)_Complex_I; - } - #endif -#else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - __pyx_t_float_complex z; - z.real = x; - z.imag = y; - return z; - } -#endif - -#if CYTHON_CCOMPLEX -#else - static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - return (a.real == b.real) && (a.imag == b.imag); - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - float denom = b.real * b.real + b.imag * b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { - __pyx_t_float_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { - return (a.real == 0) && (a.imag == 0); - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { - __pyx_t_float_complex z; - z.real = a.real; - z.imag = -a.imag; - return z; - } - #if 1 - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { - #if !defined(HAVE_HYPOT) || defined(_MSC_VER) - return sqrtf(z.real*z.real + z.imag*z.imag); - #else - return hypotf(z.real, z.imag); - #endif - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - float r, lnr, theta, z_r, z_theta; - if (b.imag == 0 && b.real == (int)b.real) { - if (b.real < 0) { - float denom = a.real * a.real + a.imag * a.imag; - a.real = a.real / denom; - a.imag = -a.imag / denom; - b.real = -b.real; - } - switch ((int)b.real) { - case 0: - z.real = 1; - z.imag = 0; - return z; - case 1: - return a; - case 2: - z = __Pyx_c_prodf(a, a); - return __Pyx_c_prodf(a, a); - case 3: - z = __Pyx_c_prodf(a, a); - return __Pyx_c_prodf(z, a); - case 4: - z = __Pyx_c_prodf(a, a); - return __Pyx_c_prodf(z, z); - } - } - if (a.imag == 0) { - if (a.real == 0) { - return a; - } - r = a.real; - theta = 0; - } else { - r = __Pyx_c_absf(a); - theta = atan2f(a.imag, a.real); - } - lnr = logf(r); - z_r = expf(lnr * b.real - theta * b.imag); - z_theta = theta * b.real + lnr * b.imag; - z.real = z_r * cosf(z_theta); - z.imag = z_r * sinf(z_theta); - return z; - } - #endif -#endif - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return ::std::complex< double >(x, y); - } - #else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return x + y*(__pyx_t_double_complex)_Complex_I; - } - #endif -#else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - __pyx_t_double_complex z; - z.real = x; - z.imag = y; - return z; - } -#endif - -#if CYTHON_CCOMPLEX -#else - static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { - return (a.real == b.real) && (a.imag == b.imag); - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - double denom = b.real * b.real + b.imag * b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { - __pyx_t_double_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { - return (a.real == 0) && (a.imag == 0); - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { - __pyx_t_double_complex z; - z.real = a.real; - z.imag = -a.imag; - return z; - } - #if 1 - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { - #if !defined(HAVE_HYPOT) || defined(_MSC_VER) - return sqrt(z.real*z.real + z.imag*z.imag); - #else - return hypot(z.real, z.imag); - #endif - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - double r, lnr, theta, z_r, z_theta; - if (b.imag == 0 && b.real == (int)b.real) { - if (b.real < 0) { - double denom = a.real * a.real + a.imag * a.imag; - a.real = a.real / denom; - a.imag = -a.imag / denom; - b.real = -b.real; - } - switch ((int)b.real) { - case 0: - z.real = 1; - z.imag = 0; - return z; - case 1: - return a; - case 2: - z = __Pyx_c_prod(a, a); - return __Pyx_c_prod(a, a); - case 3: - z = __Pyx_c_prod(a, a); - return __Pyx_c_prod(z, a); - case 4: - z = __Pyx_c_prod(a, a); - return __Pyx_c_prod(z, z); - } - } - if (a.imag == 0) { - if (a.real == 0) { - return a; - } - r = a.real; - theta = 0; - } else { - r = __Pyx_c_abs(a); - theta = atan2(a.imag, a.real); - } - lnr = log(r); - z_r = exp(lnr * b.real - theta * b.imag); - z_theta = theta * b.real + lnr * b.imag; - z.real = z_r * cos(z_theta); - z.imag = z_r * sin(z_theta); - return z; - } - #endif -#endif - -static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { - const unsigned char neg_one = (unsigned char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned char" : - "value too large to convert to unsigned char"); - } - return (unsigned char)-1; - } - return (unsigned char)val; - } - return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { - const unsigned short neg_one = (unsigned short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned short" : - "value too large to convert to unsigned short"); - } - return (unsigned short)-1; - } - return (unsigned short)val; - } - return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { - const unsigned int neg_one = (unsigned int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned int" : - "value too large to convert to unsigned int"); - } - return (unsigned int)-1; - } - return (unsigned int)val; - } - return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { - const char neg_one = (char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to char" : - "value too large to convert to char"); - } - return (char)-1; - } - return (char)val; - } - return (char)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { - const short neg_one = (short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to short" : - "value too large to convert to short"); - } - return (short)-1; - } - return (short)val; - } - return (short)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { - const int neg_one = (int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to int" : - "value too large to convert to int"); - } - return (int)-1; - } - return (int)val; - } - return (int)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { - const signed char neg_one = (signed char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed char" : - "value too large to convert to signed char"); - } - return (signed char)-1; - } - return (signed char)val; - } - return (signed char)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { - const signed short neg_one = (signed short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed short" : - "value too large to convert to signed short"); - } - return (signed short)-1; - } - return (signed short)val; - } - return (signed short)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { - const signed int neg_one = (signed int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed int" : - "value too large to convert to signed int"); - } - return (signed int)-1; - } - return (signed int)val; - } - return (signed int)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { - const int neg_one = (int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to int" : - "value too large to convert to int"); - } - return (int)-1; - } - return (int)val; - } - return (int)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { - const unsigned long neg_one = (unsigned long)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; - } - return (unsigned long)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; - } - return 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); - } -} - -static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) - PyObject *ob = PyCapsule_New(vtable, 0, 0); -#else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); -#endif - if (!ob) - goto bad; - if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; -} - -#ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - 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); - #if PY_VERSION_HEX < 0x02050000 - PyErr_Warn(NULL, warning); - #else - PyErr_WarnEx(NULL, warning, 0); - #endif - } - 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) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} - -static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { - PyNumberMethods *m; - const char *name = NULL; - PyObject *res = NULL; -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check(x) || PyLong_Check(x)) -#else - if (PyLong_Check(x)) -#endif - return Py_INCREF(x), x; - m = Py_TYPE(x)->tp_as_number; -#if PY_VERSION_HEX < 0x03000000 - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = PyNumber_Long(x); - } -#else - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Long(x); - } -#endif - if (res) { -#if PY_VERSION_HEX < 0x03000000 - if (!PyInt_Check(res) && !PyLong_Check(res)) { -#else - if (!PyLong_Check(res)) { -#endif - PyErr_Format(PyExc_TypeError, - "__%s__ returned non-%s (type %.200s)", - name, name, Py_TYPE(res)->tp_name); - Py_DECREF(res); - return NULL; - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} - -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject* x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} - -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { -#if PY_VERSION_HEX < 0x02050000 - if (ival <= LONG_MAX) - return PyInt_FromLong((long)ival); - else { - unsigned char *bytes = (unsigned char *) &ival; - int one = 1; int little = (int)*(unsigned char*)&one; - return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); - } -#else - return PyInt_FromSize_t(ival); -#endif -} - -static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { - unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); - if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { - return (size_t)-1; - } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to size_t"); - return (size_t)-1; - } - return (size_t)val; -} - - -#endif /* Py_PYTHON_H */ diff --git a/pandas/lib/src/tseries.c b/pandas/lib/src/tseries.c deleted file mode 100644 index 59d82b1a25806..0000000000000 --- a/pandas/lib/src/tseries.c +++ /dev/null @@ -1,20305 +0,0 @@ -/* Generated by Cython 0.14.1 on Wed May 18 00:22:53 2011 */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#else - -#include /* For offsetof */ -#ifndef offsetof -#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif - -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif - -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif - -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif - -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) -#endif - -#if PY_VERSION_HEX < 0x02050000 - typedef int Py_ssize_t; - #define PY_SSIZE_T_MAX INT_MAX - #define PY_SSIZE_T_MIN INT_MIN - #define PY_FORMAT_SIZE_T "" - #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) 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 PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#endif - -#if PY_VERSION_HEX < 0x02060000 - #define PyBytesObject PyStringObject - #define PyBytes_Type PyString_Type - #define PyBytes_Check PyString_Check - #define PyBytes_CheckExact PyString_CheckExact - #define PyBytes_FromString PyString_FromString - #define PyBytes_FromStringAndSize PyString_FromStringAndSize - #define PyBytes_FromFormat PyString_FromFormat - #define PyBytes_DecodeEscape PyString_DecodeEscape - #define PyBytes_AsString PyString_AsString - #define PyBytes_AsStringAndSize PyString_AsStringAndSize - #define PyBytes_Size PyString_Size - #define PyBytes_AS_STRING PyString_AS_STRING - #define PyBytes_GET_SIZE PyString_GET_SIZE - #define PyBytes_Repr PyString_Repr - #define PyBytes_Concat PyString_Concat - #define PyBytes_ConcatAndDel PyString_ConcatAndDel -#endif - -#if PY_VERSION_HEX < 0x02060000 - #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) - #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif - -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) - -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask -#endif - -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif - - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - -#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) - #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) - #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) - #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) -#else - #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ - (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ - (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ - (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) - #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ - (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ - (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ - (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) - #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ - (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ - (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ - (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) -#endif - -#if PY_MAJOR_VERSION >= 3 - #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) -#endif - -#if PY_VERSION_HEX < 0x02050000 - #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) - #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) - #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) -#else - #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) - #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) - #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) -#endif - -#if PY_VERSION_HEX < 0x02050000 - #define __Pyx_NAMESTR(n) ((char *)(n)) - #define __Pyx_DOCSTR(n) ((char *)(n)) -#else - #define __Pyx_NAMESTR(n) (n) - #define __Pyx_DOCSTR(n) (n) -#endif - -#ifdef __cplusplus -#define __PYX_EXTERN_C extern "C" -#else -#define __PYX_EXTERN_C extern -#endif - -#if defined(WIN32) || defined(MS_WINDOWS) -#define _USE_MATH_DEFINES -#endif -#include -#define __PYX_HAVE_API__tseries -#include "stdio.h" -#include "stdlib.h" -#include "numpy/arrayobject.h" -#include "numpy/ufuncobject.h" -#include "pythread.h" -#include "math.h" -#include "cobject.h" -#include "datetime.h" - -#ifdef PYREX_WITHOUT_ASSERTIONS -#define CYTHON_WITHOUT_ASSERTIONS -#endif - - -/* inline attribute */ -#ifndef CYTHON_INLINE - #if defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif - -/* unused attribute */ -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || defined(__INTEL_COMPILER) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif - -typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ - - -/* Type Conversion Predeclarations */ - -#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) -#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) - -#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); - -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); - -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) - - -#ifdef __GNUC__ -/* Test for GCC > 2.95 */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) -#else /* __GNUC__ > 2 ... */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ > 2 ... */ -#else /* __GNUC__ */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ */ - -static PyObject *__pyx_m; -static PyObject *__pyx_b; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - - -#if !defined(CYTHON_CCOMPLEX) - #if defined(__cplusplus) - #define CYTHON_CCOMPLEX 1 - #elif defined(_Complex_I) - #define CYTHON_CCOMPLEX 1 - #else - #define CYTHON_CCOMPLEX 0 - #endif -#endif - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - #include - #else - #include - #endif -#endif - -#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) - #undef _Complex_I - #define _Complex_I 1.0fj -#endif - -static const char *__pyx_f[] = { - "common.pyx", - "skiplist.pyx", - "io.pyx", - "isnull.pyx", - "groupby.pyx", - "moments.pyx", - "reindex.pyx", - "operators.pyx", - "numpy.pxd", - "tseries.pyx", - "bool.pxd", - "complex.pxd", -}; - -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); - -typedef __pyx_t_5numpy_double_t (*__pyx_t_7tseries_skiplist_f)(PyObject *, int, int); - -/* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":46 - * NIL = Node(np.inf, [], []) - * - * cdef class IndexableSkiplist: # <<<<<<<<<<<<<< - * ''' - * Sorted collection supporting O(lg n) insertion, removal, and - */ - -struct __pyx_obj_7tseries_IndexableSkiplist { - PyObject_HEAD - struct __pyx_vtabstruct_7tseries_IndexableSkiplist *__pyx_vtab; - int size; - int maxlevels; - struct __pyx_obj_7tseries_Node *head; -}; - -/* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":32 - * # TODO: optimize this, make less messy - * - * cdef class Node: # <<<<<<<<<<<<<< - * cdef public: - * double_t value - */ - -struct __pyx_obj_7tseries_Node { - PyObject_HEAD - __pyx_t_5numpy_double_t value; - PyObject *next; - PyObject *width; -}; - - -/* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":46 - * NIL = Node(np.inf, [], []) - * - * cdef class IndexableSkiplist: # <<<<<<<<<<<<<< - * ''' - * Sorted collection supporting O(lg n) insertion, removal, and - */ - -struct __pyx_vtabstruct_7tseries_IndexableSkiplist { - PyObject *(*get)(struct __pyx_obj_7tseries_IndexableSkiplist *, int, int __pyx_skip_dispatch); - PyObject *(*insert)(struct __pyx_obj_7tseries_IndexableSkiplist *, double, int __pyx_skip_dispatch); - PyObject *(*remove)(struct __pyx_obj_7tseries_IndexableSkiplist *, double, int __pyx_skip_dispatch); -}; -static struct __pyx_vtabstruct_7tseries_IndexableSkiplist *__pyx_vtabptr_7tseries_IndexableSkiplist; - -#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 PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ - -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); /*proto*/ - -/* Run-time type information about structs used with buffers */ -struct __Pyx_StructField_; - -typedef struct { - const char* name; /* for error messages only */ - struct __Pyx_StructField_* fields; - size_t size; /* sizeof(type) */ - char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ -} __Pyx_TypeInfo; - -typedef struct __Pyx_StructField_ { - __Pyx_TypeInfo* type; - const char* name; - size_t offset; -} __Pyx_StructField; - -typedef struct { - __Pyx_StructField* field; - size_t parent_offset; -} __Pyx_BufFmt_StackElem; - - -static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); -static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); -static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/ -#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) - -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 void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ - -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ - - -static CYTHON_INLINE 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) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) - -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { - 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, PyInt_FromSsize_t(i)); -} - -#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_Tuple_Fast(o, i) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) - -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { - 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, PyInt_FromSsize_t(i)); -} - - -#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_Fast(o, i) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) - -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { - 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, PyInt_FromSsize_t(i)); - } - return r; -} - -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ - -#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_SetItemInt_Fast(o, i, v) : \ - __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) { - 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 = PyInt_FromSsize_t(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_RaiseNoneIndexingError(void); - -#if PY_MAJOR_VERSION >= 3 -static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { - PyObject *value; - if (unlikely(d == Py_None)) { - __Pyx_RaiseNoneIndexingError(); - return NULL; - } - value = PyDict_GetItemWithError(d, key); - if (unlikely(!value)) { - if (!PyErr_Occurred()) - PyErr_SetObject(PyExc_KeyError, key); - return NULL; - } - Py_INCREF(value); - return value; -} -#else - #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) -#endif - -static CYTHON_INLINE 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(Py_ssize_t expected); - -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/ - -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*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 CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject *); - -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int64(npy_int64); - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - #define __Pyx_CREAL(z) ((z).real()) - #define __Pyx_CIMAG(z) ((z).imag()) - #else - #define __Pyx_CREAL(z) (__real__(z)) - #define __Pyx_CIMAG(z) (__imag__(z)) - #endif -#else - #define __Pyx_CREAL(z) ((z).real) - #define __Pyx_CIMAG(z) ((z).imag) -#endif - -#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX - #define __Pyx_SET_CREAL(z,x) ((z).real(x)) - #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) -#else - #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) - #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) -#endif - -static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); - -#if CYTHON_CCOMPLEX - #define __Pyx_c_eqf(a, b) ((a)==(b)) - #define __Pyx_c_sumf(a, b) ((a)+(b)) - #define __Pyx_c_difff(a, b) ((a)-(b)) - #define __Pyx_c_prodf(a, b) ((a)*(b)) - #define __Pyx_c_quotf(a, b) ((a)/(b)) - #define __Pyx_c_negf(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zerof(z) ((z)==(float)0) - #define __Pyx_c_conjf(z) (::std::conj(z)) - #if 1 - #define __Pyx_c_absf(z) (::std::abs(z)) - #define __Pyx_c_powf(a, b) (::std::pow(a, b)) - #endif - #else - #define __Pyx_c_is_zerof(z) ((z)==0) - #define __Pyx_c_conjf(z) (conjf(z)) - #if 1 - #define __Pyx_c_absf(z) (cabsf(z)) - #define __Pyx_c_powf(a, b) (cpowf(a, b)) - #endif - #endif -#else - static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); - static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); - #if 1 - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); - #endif -#endif - -static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); - -#if CYTHON_CCOMPLEX - #define __Pyx_c_eq(a, b) ((a)==(b)) - #define __Pyx_c_sum(a, b) ((a)+(b)) - #define __Pyx_c_diff(a, b) ((a)-(b)) - #define __Pyx_c_prod(a, b) ((a)*(b)) - #define __Pyx_c_quot(a, b) ((a)/(b)) - #define __Pyx_c_neg(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zero(z) ((z)==(double)0) - #define __Pyx_c_conj(z) (::std::conj(z)) - #if 1 - #define __Pyx_c_abs(z) (::std::abs(z)) - #define __Pyx_c_pow(a, b) (::std::pow(a, b)) - #endif - #else - #define __Pyx_c_is_zero(z) ((z)==0) - #define __Pyx_c_conj(z) (conj(z)) - #if 1 - #define __Pyx_c_abs(z) (cabs(z)) - #define __Pyx_c_pow(a, b) (cpow(a, b)) - #endif - #endif -#else - static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); - static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - #if 1 - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); - #endif -#endif - -static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); - -static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); - -static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); - -static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); - -static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); - -static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); - -static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); - -static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); - -static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); - -static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); - -static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); - -static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); - -static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); - -static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); - -static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); - -static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); - -static void __Pyx_WriteUnraisable(const char *name); /*proto*/ - -static CYTHON_INLINE npy_int64 __Pyx_PyInt_from_py_npy_int64(PyObject *); - -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 int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ - -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ - -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ -/* Module declarations from cpython.buffer */ - -/* Module declarations from cpython.ref */ - -/* Module declarations from libc.stdio */ - -/* Module declarations from cpython.object */ - -/* Module declarations from libc.stdlib */ - -/* Module declarations from numpy */ - -/* Module declarations from numpy */ - -static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; -static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; -static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; -static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; -static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ -/* Module declarations from cython */ - -/* Module declarations from cpython.version */ - -/* Module declarations from cpython.exc */ - -/* Module declarations from cpython.module */ - -/* Module declarations from cpython.mem */ - -/* Module declarations from cpython.tuple */ - -/* Module declarations from cpython.list */ - -/* Module declarations from cpython.sequence */ - -/* Module declarations from cpython.mapping */ - -/* Module declarations from cpython.iterator */ - -/* Module declarations from cpython.type */ - -/* Module declarations from cpython.number */ - -/* Module declarations from cpython.int */ - -/* Module declarations from __builtin__ */ - -/* Module declarations from cpython.bool */ - -static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0; -/* Module declarations from cpython.long */ - -/* Module declarations from cpython.float */ - -/* Module declarations from __builtin__ */ - -/* Module declarations from cpython.complex */ - -static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0; -/* Module declarations from cpython.string */ - -/* Module declarations from cpython.unicode */ - -/* Module declarations from cpython.dict */ - -/* Module declarations from cpython.instance */ - -/* Module declarations from cpython.function */ - -/* Module declarations from cpython.method */ - -/* Module declarations from cpython.weakref */ - -/* Module declarations from cpython.getargs */ - -/* Module declarations from cpython.pythread */ - -/* Module declarations from cpython.cobject */ - -/* Module declarations from cpython.oldbuffer */ - -/* Module declarations from cpython.set */ - -/* Module declarations from cpython.bytes */ - -/* Module declarations from cpython.pycapsule */ - -/* Module declarations from cpython */ - -/* 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 int __pyx_v_7tseries__EPOCH_ORD; -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___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 double __pyx_f_7tseries_Log2(double); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_7tseries__checknull(PyObject *); /*proto*/ -static PyObject *__pyx_f_7tseries_checknull(PyObject *, int __pyx_skip_dispatch); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_7tseries__isnan(PyObject *); /*proto*/ -static PyObject *__pyx_f_7tseries__roll_skiplist_op(PyArrayObject *, int, int, __pyx_t_7tseries_skiplist_f); /*proto*/ -static __pyx_t_5numpy_double_t __pyx_f_7tseries__get_median(PyObject *, int, int); /*proto*/ -static __pyx_t_5numpy_double_t __pyx_f_7tseries__get_max(PyObject *, int, int); /*proto*/ -static __pyx_t_5numpy_double_t __pyx_f_7tseries__get_min(PyObject *, int, int); /*proto*/ -static PyArrayObject *__pyx_f_7tseries__applyFunc(__pyx_t_7tseries_double_func, PyArrayObject *, PyArrayObject *, PyArrayObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_7tseries_gmtime(PyObject *); /*proto*/ -static PyObject *__pyx_f_7tseries_to_datetime(__pyx_t_5numpy_int64_t, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_7tseries_to_timestamp(PyObject *, int __pyx_skip_dispatch); /*proto*/ -static __Pyx_TypeInfo __Pyx_TypeInfo_object = { "Python object", NULL, sizeof(PyObject *), 'O' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn_npy_int8 = { "npy_int8", NULL, sizeof(npy_int8), 'I' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t = { "int8_t", NULL, sizeof(__pyx_t_5numpy_int8_t), 'I' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_double_t = { "double_t", NULL, sizeof(__pyx_t_5numpy_double_t), 'R' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), 'I' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t = { "int64_t", NULL, sizeof(__pyx_t_5numpy_int64_t), 'I' }; -#define __Pyx_MODULE_NAME "tseries" -static 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_KeyError; -static PyObject *__pyx_builtin_object; -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_4[] = "Not Found"; -static char __pyx_k_7[] = "Don't recognize method: %s"; -static char __pyx_k_10[] = "bad funcname requested of Cython code"; -static char __pyx_k_12[] = "ndarray is not C contiguous"; -static char __pyx_k_14[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_16[] = "Non-native byte order not supported"; -static char __pyx_k_18[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_19[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_22[] = "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__a[] = "a"; -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__k[] = "k"; -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__obj[] = "obj"; -static char __pyx_k__win[] = "win"; -static char __pyx_k___pad[] = "_pad"; -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__copy[] = "copy"; -static char __pyx_k__data[] = "data"; -static char __pyx_k__date[] = "date"; -static char __pyx_k__ewma[] = "ewma"; -static char __pyx_k__fill[] = "fill"; -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__size[] = "size"; -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__int64[] = "int64"; -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__append[] = "append"; -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__mapper[] = "mapper"; -static char __pyx_k__median[] = "median"; -static char __pyx_k__newMap[] = "newMap"; -static char __pyx_k__object[] = "object"; -static char __pyx_k__oldMap[] = "oldMap"; -static char __pyx_k__output[] = "output"; -static char __pyx_k__pydate[] = "pydate"; -static char __pyx_k__random[] = "random"; -static char __pyx_k__remove[] = "remove"; -static char __pyx_k__values[] = "values"; -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__groupby[] = "groupby"; -static char __pyx_k__object_[] = "object_"; -static char __pyx_k__strides[] = "strides"; -static char __pyx_k__tseries[] = "tseries"; -static char __pyx_k__BACKFILL[] = "BACKFILL"; -static char __pyx_k__KeyError[] = "KeyError"; -static char __pyx_k____main__[] = "__main__"; -static char __pyx_k____test__[] = "__test__"; -static char __pyx_k__datetime[] = "datetime"; -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__roll_max[] = "roll_max"; -static char __pyx_k__roll_min[] = "roll_min"; -static char __pyx_k__roll_sum[] = "roll_sum"; -static char __pyx_k__roll_var[] = "roll_var"; -static char __pyx_k__type_num[] = "type_num"; -static char __pyx_k__Exception[] = "Exception"; -static char __pyx_k___backfill[] = "_backfill"; -static char __pyx_k__byteorder[] = "byteorder"; -static char __pyx_k__isnullobj[] = "isnullobj"; -static char __pyx_k__maxlevels[] = "maxlevels"; -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__toordinal[] = "toordinal"; -static char __pyx_k__ValueError[] = "ValueError"; -static char __pyx_k__getFillVec[] = "getFillVec"; -static char __pyx_k__isAllDates[] = "isAllDates"; -static char __pyx_k__pydatetime[] = "pydatetime"; -static char __pyx_k__suboffsets[] = "suboffsets"; -static char __pyx_k__combineFunc[] = "combineFunc"; -static char __pyx_k__getMergeVec[] = "getMergeVec"; -static char __pyx_k__isAllDates2[] = "isAllDates2"; -static char __pyx_k__roll_median[] = "roll_median"; -static char __pyx_k__RuntimeError[] = "RuntimeError"; -static char __pyx_k__kth_smallest[] = "kth_smallest"; -static char __pyx_k__expected_size[] = "expected_size"; -static char __pyx_k__groupby_indices[] = "groupby_indices"; -static char __pyx_k__utcfromtimestamp[] = "utcfromtimestamp"; -static char __pyx_k__array_to_datetime[] = "array_to_datetime"; -static char __pyx_k__array_to_timestamp[] = "array_to_timestamp"; -static PyObject *__pyx_kp_s_1; -static PyObject *__pyx_kp_s_10; -static PyObject *__pyx_kp_u_12; -static PyObject *__pyx_kp_u_14; -static PyObject *__pyx_kp_u_16; -static PyObject *__pyx_kp_u_18; -static PyObject *__pyx_kp_u_19; -static PyObject *__pyx_kp_s_2; -static PyObject *__pyx_kp_u_22; -static PyObject *__pyx_kp_s_4; -static PyObject *__pyx_kp_s_7; -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__PAD; -static PyObject *__pyx_n_s__RuntimeError; -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____test__; -static PyObject *__pyx_n_s___backfill; -static PyObject *__pyx_n_s___pad; -static PyObject *__pyx_n_s__a; -static PyObject *__pyx_n_s__aMap; -static PyObject *__pyx_n_s__any; -static PyObject *__pyx_n_s__ao; -static PyObject *__pyx_n_s__append; -static PyObject *__pyx_n_s__array_to_datetime; -static PyObject *__pyx_n_s__array_to_timestamp; -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__combineFunc; -static PyObject *__pyx_n_s__copy; -static PyObject *__pyx_n_s__data; -static PyObject *__pyx_n_s__date; -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__ewma; -static PyObject *__pyx_n_s__expected_size; -static PyObject *__pyx_n_s__fields; -static PyObject *__pyx_n_s__fill; -static PyObject *__pyx_n_s__format; -static PyObject *__pyx_n_s__func; -static PyObject *__pyx_n_s__get; -static PyObject *__pyx_n_s__getFillVec; -static PyObject *__pyx_n_s__getMergeVec; -static PyObject *__pyx_n_s__groupby; -static PyObject *__pyx_n_s__groupby_indices; -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__int64; -static PyObject *__pyx_n_s__int8; -static PyObject *__pyx_n_s__isAllDates; -static PyObject *__pyx_n_s__isAllDates2; -static PyObject *__pyx_n_s__isnan; -static PyObject *__pyx_n_s__isnullobj; -static PyObject *__pyx_n_s__itemsize; -static PyObject *__pyx_n_s__k; -static PyObject *__pyx_n_s__kind; -static PyObject *__pyx_n_s__kth_smallest; -static PyObject *__pyx_n_s__mapper; -static PyObject *__pyx_n_s__maxlevels; -static PyObject *__pyx_n_s__median; -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__object_; -static PyObject *__pyx_n_s__oldIndex; -static PyObject *__pyx_n_s__oldMap; -static PyObject *__pyx_n_s__output; -static PyObject *__pyx_n_s__pydate; -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__roll_kurt; -static PyObject *__pyx_n_s__roll_max; -static PyObject *__pyx_n_s__roll_mean; -static PyObject *__pyx_n_s__roll_median; -static PyObject *__pyx_n_s__roll_min; -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__shape; -static PyObject *__pyx_n_s__size; -static PyObject *__pyx_n_s__strides; -static PyObject *__pyx_n_s__suboffsets; -static PyObject *__pyx_n_s__toordinal; -static PyObject *__pyx_n_s__tseries; -static PyObject *__pyx_n_s__type_num; -static PyObject *__pyx_n_s__utcfromtimestamp; -static PyObject *__pyx_n_s__value; -static PyObject *__pyx_n_s__values; -static PyObject *__pyx_n_s__width; -static PyObject *__pyx_n_s__win; -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; -static PyObject *__pyx_k_tuple_3; -static PyObject *__pyx_k_tuple_5; -static PyObject *__pyx_k_tuple_6; -static PyObject *__pyx_k_tuple_8; -static PyObject *__pyx_k_tuple_9; -static PyObject *__pyx_k_tuple_11; -static PyObject *__pyx_k_tuple_13; -static PyObject *__pyx_k_tuple_15; -static PyObject *__pyx_k_tuple_17; -static PyObject *__pyx_k_tuple_20; -static PyObject *__pyx_k_tuple_21; -static PyObject *__pyx_k_tuple_23; - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":16 - * 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"); - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":17 - * - * 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:*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":18 - * 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 = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(((PyObject *)__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, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__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; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":19 - * 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 = 19; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_3); - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":20 - * 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 = 20; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__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 = 20; __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_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":22 - * 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; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":23 - * - * 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; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":27 - * 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; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("is_contiguous"); - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":28 - * - * cdef int is_contiguous(ndarray arr): - * return np.PyArray_CHKFLAGS(arr, np.NPY_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * - * cdef int _contiguous_check(ndarray arr): - */ - __pyx_t_1 = ((PyObject *)__pyx_v_arr); - __Pyx_INCREF(__pyx_t_1); - __pyx_r = PyArray_CHKFLAGS(((PyArrayObject *)__pyx_t_1), NPY_C_CONTIGUOUS); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":30 - * 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; - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - __Pyx_RefNannySetupContext("_contiguous_check"); - - /* "/home/wesm/code/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!') - * - */ - __pyx_t_1 = ((PyObject *)__pyx_v_arr); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = (!__pyx_f_7tseries_is_contiguous(((PyArrayObject *)__pyx_t_1))); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":32 - * 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_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __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_1); - __Pyx_WriteUnraisable("tseries._contiguous_check"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":34 - * 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; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_int16_ptr"); - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":35 - * - * cdef int16_t *get_int16_ptr(ndarray arr): - * _contiguous_check(arr) # <<<<<<<<<<<<<< - * - * return arr.data - */ - __pyx_t_1 = ((PyObject *)__pyx_v_arr); - __Pyx_INCREF(__pyx_t_1); - __pyx_f_7tseries__contiguous_check(((PyArrayObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":37 - * _contiguous_check(arr) - * - * return 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; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":39 - * return 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; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_int32_ptr"); - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":40 - * - * cdef int32_t *get_int32_ptr(ndarray arr): - * _contiguous_check(arr) # <<<<<<<<<<<<<< - * - * return arr.data - */ - __pyx_t_1 = ((PyObject *)__pyx_v_arr); - __Pyx_INCREF(__pyx_t_1); - __pyx_f_7tseries__contiguous_check(((PyArrayObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":42 - * _contiguous_check(arr) - * - * return 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; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":44 - * return 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; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_int64_ptr"); - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":45 - * - * cdef int64_t *get_int64_ptr(ndarray arr): - * _contiguous_check(arr) # <<<<<<<<<<<<<< - * - * return arr.data - */ - __pyx_t_1 = ((PyObject *)__pyx_v_arr); - __Pyx_INCREF(__pyx_t_1); - __pyx_f_7tseries__contiguous_check(((PyArrayObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":47 - * _contiguous_check(arr) - * - * return 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; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":49 - * return 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; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_double_ptr"); - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":50 - * - * cdef double_t *get_double_ptr(ndarray arr): - * _contiguous_check(arr) # <<<<<<<<<<<<<< - * - * return arr.data - */ - __pyx_t_1 = ((PyObject *)__pyx_v_arr); - __Pyx_INCREF(__pyx_t_1); - __pyx_f_7tseries__contiguous_check(((PyArrayObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":52 - * _contiguous_check(arr) - * - * return 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; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":88 - * 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; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - __Pyx_RefNannySetupContext("map_indices"); - __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); - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":103 - * cdef object idx - * - * result = {} # <<<<<<<<<<<<<< - * - * iter = PyArray_IterNew(index) - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":105 - * result = {} - * - * iter = PyArray_IterNew(index) # <<<<<<<<<<<<<< - * length = PyArray_SIZE(index) - * - */ - __pyx_t_1 = ((PyObject *)__pyx_v_index); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyArray_IterNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_INCREF(((PyObject *)((PyArrayIterObject *)__pyx_t_2))); - __Pyx_DECREF(((PyObject *)__pyx_v_iter)); - __pyx_v_iter = ((PyArrayIterObject *)__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":106 - * - * iter = PyArray_IterNew(index) - * length = PyArray_SIZE(index) # <<<<<<<<<<<<<< - * - * for i from 0 <= i < length: - */ - __pyx_t_2 = ((PyObject *)__pyx_v_index); - __Pyx_INCREF(__pyx_t_2); - __pyx_v_length = PyArray_SIZE(((PyArrayObject *)__pyx_t_2)); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":108 - * length = PyArray_SIZE(index) - * - * for i from 0 <= i < length: # <<<<<<<<<<<<<< - * idx = PyArray_GETITEM(index, PyArray_ITER_DATA(iter)) - * result[idx] = i - */ - __pyx_t_3 = __pyx_v_length; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":109 - * - * for i from 0 <= i < length: - * idx = PyArray_GETITEM(index, PyArray_ITER_DATA(iter)) # <<<<<<<<<<<<<< - * result[idx] = i - * PyArray_ITER_NEXT(iter) - */ - __pyx_t_2 = ((PyObject *)__pyx_v_index); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = PyArray_GETITEM(((PyArrayObject *)__pyx_t_2), PyArray_ITER_DATA(__pyx_v_iter)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_idx); - __pyx_v_idx = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":110 - * 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 = 110; __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 = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":111 - * idx = PyArray_GETITEM(index, PyArray_ITER_DATA(iter)) - * result[idx] = i - * PyArray_ITER_NEXT(iter) # <<<<<<<<<<<<<< - * - * return result - */ - PyArray_ITER_NEXT(__pyx_v_iter); - } - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":113 - * 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_XDECREF(__pyx_t_2); - __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_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":88 - * 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; - PyObject *__pyx_t_2 = 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 = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_v_index; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_7tseries_map_indices(((PyArrayObject *)__pyx_t_1), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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_AddTraceback("tseries.map_indices"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":115 - * return result - * - * def isAllDates(ndarray index): # <<<<<<<<<<<<<< - * cdef int i, length - * cdef flatiter iter - */ - -static PyObject *__pyx_pf_7tseries_1isAllDates(PyObject *__pyx_self, PyObject *__pyx_v_index); /*proto*/ -static PyMethodDef __pyx_mdef_7tseries_1isAllDates = {__Pyx_NAMESTR("isAllDates"), (PyCFunction)__pyx_pf_7tseries_1isAllDates, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7tseries_1isAllDates(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; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("isAllDates"); - __pyx_self = __pyx_self; - __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 = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":120 - * cdef object date - * - * iter = PyArray_IterNew(index) # <<<<<<<<<<<<<< - * length = PyArray_SIZE(index) - * - */ - __pyx_t_1 = __pyx_v_index; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyArray_IterNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_INCREF(((PyObject *)((PyArrayIterObject *)__pyx_t_2))); - __Pyx_DECREF(((PyObject *)__pyx_v_iter)); - __pyx_v_iter = ((PyArrayIterObject *)__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":121 - * - * iter = PyArray_IterNew(index) - * length = PyArray_SIZE(index) # <<<<<<<<<<<<<< - * - * if length == 0: - */ - __pyx_t_2 = __pyx_v_index; - __Pyx_INCREF(__pyx_t_2); - __pyx_v_length = PyArray_SIZE(((PyArrayObject *)__pyx_t_2)); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":123 - * length = PyArray_SIZE(index) - * - * if length == 0: # <<<<<<<<<<<<<< - * return False - * - */ - __pyx_t_3 = (__pyx_v_length == 0); - if (__pyx_t_3) { - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":124 - * - * if length == 0: - * return False # <<<<<<<<<<<<<< - * - * for i from 0 <= i < length: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":126 - * return False - * - * for i from 0 <= i < length: # <<<<<<<<<<<<<< - * date = PyArray_GETITEM(index, PyArray_ITER_DATA(iter)) - * - */ - __pyx_t_4 = __pyx_v_length; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":127 - * - * for i from 0 <= i < length: - * date = PyArray_GETITEM(index, PyArray_ITER_DATA(iter)) # <<<<<<<<<<<<<< - * - * if not PyDateTime_Check(date): - */ - __pyx_t_2 = __pyx_v_index; - __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = PyArray_GETITEM(((PyArrayObject *)__pyx_t_2), PyArray_ITER_DATA(__pyx_v_iter)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_date); - __pyx_v_date = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":129 - * date = PyArray_GETITEM(index, PyArray_ITER_DATA(iter)) - * - * if not PyDateTime_Check(date): # <<<<<<<<<<<<<< - * return False - * PyArray_ITER_NEXT(iter) - */ - __pyx_t_3 = (!PyDateTime_Check(__pyx_v_date)); - if (__pyx_t_3) { - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":130 - * - * 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 = 130; __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:; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":131 - * if not PyDateTime_Check(date): - * return False - * PyArray_ITER_NEXT(iter) # <<<<<<<<<<<<<< - * - * return True - */ - PyArray_ITER_NEXT(__pyx_v_iter); - } - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":133 - * 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 = 133; __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_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("tseries.isAllDates"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_iter); - __Pyx_DECREF(__pyx_v_date); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":135 - * return True - * - * def isAllDates2(ndarray[object, ndim=1] arr): # <<<<<<<<<<<<<< - * ''' - * cannot use - */ - -static PyObject *__pyx_pf_7tseries_2isAllDates2(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/ -static char __pyx_doc_7tseries_2isAllDates2[] = "\n cannot use\n "; -static PyMethodDef __pyx_mdef_7tseries_2isAllDates2 = {__Pyx_NAMESTR("isAllDates2"), (PyCFunction)__pyx_pf_7tseries_2isAllDates2, METH_O, __Pyx_DOCSTR(__pyx_doc_7tseries_2isAllDates2)}; -static PyObject *__pyx_pf_7tseries_2isAllDates2(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; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - __Pyx_RefNannySetupContext("isAllDates2"); - __pyx_self = __pyx_self; - __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 = 135; __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 = 135; __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]; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":140 - * ''' - * - * cdef int i, size = len(arr) # <<<<<<<<<<<<<< - * cdef object date - * - */ - __pyx_t_1 = __pyx_v_arr; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_size = __pyx_t_2; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":143 - * cdef object date - * - * if size == 0: # <<<<<<<<<<<<<< - * return False - * - */ - __pyx_t_3 = (__pyx_v_size == 0); - if (__pyx_t_3) { - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":144 - * - * if size == 0: - * return False # <<<<<<<<<<<<<< - * - * for i from 0 <= i < size: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __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:; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":146 - * 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++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":147 - * - * 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 = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_arr.buf, __pyx_t_5, __pyx_bstride_0_arr); - __Pyx_INCREF((PyObject*)__pyx_t_1); - __Pyx_DECREF(__pyx_v_date); - __pyx_v_date = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":149 - * date = arr[i] - * - * if not PyDateTime_Check(date): # <<<<<<<<<<<<<< - * return False - * - */ - __pyx_t_3 = (!PyDateTime_Check(__pyx_v_date)); - if (__pyx_t_3) { - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":150 - * - * if not PyDateTime_Check(date): - * return False # <<<<<<<<<<<<<< - * - * return True - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - goto __pyx_L8; - } - __pyx_L8:; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":152 - * return False - * - * return True # <<<<<<<<<<<<<< - * - * cdef double __add(double a, double b): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_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_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":154 - * return True - * - * 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"); - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":155 - * - * 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; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":156 - * cdef double __add(double a, double b): - * return a + b - * cdef double __sub(double a, double b): # <<<<<<<<<<<<<< - * return a - b - * - */ - -static double __pyx_f_7tseries___sub(double __pyx_v_a, double __pyx_v_b) { - double __pyx_r; - __Pyx_RefNannySetupContext("__sub"); - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":157 - * return a + b - * cdef double __sub(double a, double b): - * return a - b # <<<<<<<<<<<<<< - * - * cdef double __div(double a, double b): - */ - __pyx_r = (__pyx_v_a - __pyx_v_b); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":159 - * return a - b - * - * cdef double __div(double a, double b): # <<<<<<<<<<<<<< - * if b == 0: - * return NaN - */ - -static double __pyx_f_7tseries___div(double __pyx_v_a, double __pyx_v_b) { - double __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("__div"); - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":160 - * - * cdef double __div(double a, double b): - * if b == 0: # <<<<<<<<<<<<<< - * return NaN - * else: - */ - __pyx_t_1 = (__pyx_v_b == 0.0); - if (__pyx_t_1) { - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":161 - * cdef double __div(double a, double b): - * if b == 0: - * return NaN # <<<<<<<<<<<<<< - * else: - * return a / b - */ - __pyx_r = __pyx_v_7tseries_NaN; - goto __pyx_L0; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":163 - * return NaN - * else: - * return a / b # <<<<<<<<<<<<<< - * - * cdef double __mul(double a, double b): - */ - if (unlikely(__pyx_v_b == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_r = (__pyx_v_a / __pyx_v_b); - goto __pyx_L0; - } - __pyx_L3:; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_WriteUnraisable("tseries.__div"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":165 - * 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"); - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":166 - * - * 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; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":167 - * 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"); - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":168 - * 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; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":169 - * 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"); - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":170 - * 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; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":171 - * 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"); - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":172 - * 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; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":173 - * cdef double __lt(double a, double b): - * return a < b - * cdef double __gt(double a, double b): # <<<<<<<<<<<<<< - * return a > b - * - */ - -static double __pyx_f_7tseries___gt(double __pyx_v_a, double __pyx_v_b) { - double __pyx_r; - __Pyx_RefNannySetupContext("__gt"); - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":174 - * return a < b - * cdef double __gt(double a, double b): - * return a > b # <<<<<<<<<<<<<< - * - * cdef double __pow(double a, double b): - */ - __pyx_r = (__pyx_v_a > __pyx_v_b); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":176 - * return a > b - * - * cdef double __pow(double a, double b): # <<<<<<<<<<<<<< - * # NaN - * if a != a or b != b: - */ - -static double __pyx_f_7tseries___pow(double __pyx_v_a, double __pyx_v_b) { - double __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - __Pyx_RefNannySetupContext("__pow"); - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":178 - * cdef double __pow(double a, double b): - * # NaN - * if a != a or b != b: # <<<<<<<<<<<<<< - * return NaN - * return a ** b - */ - __pyx_t_1 = (__pyx_v_a != __pyx_v_a); - if (!__pyx_t_1) { - __pyx_t_2 = (__pyx_v_b != __pyx_v_b); - __pyx_t_3 = __pyx_t_2; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (__pyx_t_3) { - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":179 - * # NaN - * if a != a or b != b: - * return NaN # <<<<<<<<<<<<<< - * return a ** b - * - */ - __pyx_r = __pyx_v_7tseries_NaN; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":180 - * if a != a or b != b: - * return NaN - * 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; -} - -/* "/home/wesm/code/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"); - - /* "/home/wesm/code/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.); - 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; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":38 - * list width - * - * def __init__(self, double_t value, list next, list 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) { - __pyx_t_5numpy_double_t __pyx_v_value; - PyObject *__pyx_v_next = 0; - PyObject *__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 = 38; __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 = 38; __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 = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_value = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_value == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_next = ((PyObject*)values[1]); - __pyx_v_width = ((PyObject*)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 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_next = ((PyObject*)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_width = ((PyObject*)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 = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("tseries.Node.__init__"); - __Pyx_RefNannyFinishContext(); - 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 = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_width), (&PyList_Type), 1, "width", 1))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":39 - * - * def __init__(self, double_t value, list next, list width): - * self.value = value # <<<<<<<<<<<<<< - * self.next = next - * self.width = width - */ - ((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->value = __pyx_v_value; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":40 - * def __init__(self, double_t value, list next, list width): - * self.value = value - * self.next = next # <<<<<<<<<<<<<< - * self.width = width - * - */ - __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":41 - * self.value = value - * self.next = next - * self.width = width # <<<<<<<<<<<<<< - * - * # Singleton terminator node - */ - __Pyx_INCREF(((PyObject *)__pyx_v_width)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_width)); - __Pyx_GOTREF(((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->width); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->width)); - ((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->width = __pyx_v_width; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("tseries.Node.__init__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":34 - * cdef class Node: - * cdef public: - * double_t value # <<<<<<<<<<<<<< - * list next - * list width - */ - -static PyObject *__pyx_pf_7tseries_4Node_5value___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_7tseries_4Node_5value___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __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.Node.value.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_7tseries_4Node_5value_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_7tseries_4Node_5value_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __pyx_t_5numpy_double_t __pyx_t_1; - __Pyx_RefNannySetupContext("__set__"); - __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->value = __pyx_t_1; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("tseries.Node.value.__set__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":35 - * cdef public: - * double_t value - * list next # <<<<<<<<<<<<<< - * list width - * - */ - -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_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_7tseries_4Node_4next_1__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 = 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)->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; -} - -static int __pyx_pf_7tseries_4Node_4next_2__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_7tseries_4Node_4next_2__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __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*)Py_None); - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":36 - * double_t value - * list next - * list width # <<<<<<<<<<<<<< - * - * def __init__(self, double_t value, list next, list width): - */ - -static PyObject *__pyx_pf_7tseries_4Node_5width___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_7tseries_4Node_5width___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)); - __pyx_r = ((PyObject *)((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->width); - 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_5width_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_7tseries_4Node_5width_1__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 = 36; __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); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->width)); - ((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->width = ((PyObject*)__pyx_v_value); - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("tseries.Node.width.__set__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_7tseries_4Node_5width_2__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_7tseries_4Node_5width_2__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->width); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->width)); - ((struct __pyx_obj_7tseries_Node *)__pyx_v_self)->width = ((PyObject*)Py_None); - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":55 - * 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; - 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 > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__expected_size); - if (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 = 55; __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 = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("tseries.IndexableSkiplist.__init__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":56 - * - * def __init__(self, expected_size=100): - * self.size = 0 # <<<<<<<<<<<<<< - * self.maxlevels = int(1 + Log2(expected_size)) - * self.head = Node(np.NaN, [NIL] * self.maxlevels, [1] * self.maxlevels) - */ - ((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->size = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":57 - * def __init__(self, expected_size=100): - * self.size = 0 - * self.maxlevels = int(1 + Log2(expected_size)) # <<<<<<<<<<<<<< - * self.head = Node(np.NaN, [NIL] * self.maxlevels, [1] * 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 = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->maxlevels = ((int)(1.0 + __pyx_f_7tseries_Log2(__pyx_t_1))); - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":58 - * self.size = 0 - * self.maxlevels = int(1 + Log2(expected_size)) - * self.head = Node(np.NaN, [NIL] * self.maxlevels, [1] * self.maxlevels) # <<<<<<<<<<<<<< - * - * 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 = 58; __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 = 58; __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 = 58; __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 = 58; __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 = 58; __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 = 58; __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; - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_int_1); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); - __Pyx_GIVEREF(__pyx_int_1); - __pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->maxlevels); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyNumber_Multiply(((PyObject *)__pyx_t_2), __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_3 = 0; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7tseries_Node)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_GIVEREF(__pyx_t_6); - __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_6); - __pyx_t_6 = 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_AddTraceback("tseries.IndexableSkiplist.__init__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":60 - * self.head = Node(np.NaN, [NIL] * self.maxlevels, [1] * self.maxlevels) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self.size - * - */ - -static Py_ssize_t __pyx_pf_7tseries_17IndexableSkiplist_1__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pf_7tseries_17IndexableSkiplist_1__len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannySetupContext("__len__"); - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":61 - * - * 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; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":63 - * return self.size - * - * def __getitem__(self, i): # <<<<<<<<<<<<<< - * return self.get(i) - * - */ - -static PyObject *__pyx_pf_7tseries_17IndexableSkiplist_2__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pf_7tseries_17IndexableSkiplist_2__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__getitem__"); - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":64 - * - * def __getitem__(self, i): - * return self.get(i) # <<<<<<<<<<<<<< - * - * cpdef get(self, int i): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = ((struct __pyx_vtabstruct_7tseries_IndexableSkiplist *)((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->__pyx_vtab)->get(((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self), __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __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_AddTraceback("tseries.IndexableSkiplist.__getitem__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":66 - * return self.get(i) - * - * cpdef get(self, int i): # <<<<<<<<<<<<<< - * cdef int level - * cdef Node node - */ - -static PyObject *__pyx_pf_7tseries_17IndexableSkiplist_3get(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/ -static PyObject *__pyx_f_7tseries_17IndexableSkiplist_get(struct __pyx_obj_7tseries_IndexableSkiplist *__pyx_v_self, int __pyx_v_i, int __pyx_skip_dispatch) { - int __pyx_v_level; - struct __pyx_obj_7tseries_Node *__pyx_v_node; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - __Pyx_RefNannySetupContext("get"); - __pyx_v_node = ((struct __pyx_obj_7tseries_Node *)Py_None); __Pyx_INCREF(Py_None); - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overriden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7tseries_17IndexableSkiplist_3get)) { - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __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[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":70 - * cdef Node node - * - * node = self.head # <<<<<<<<<<<<<< - * i += 1 - * - */ - __Pyx_INCREF(((PyObject *)__pyx_v_self->head)); - __Pyx_DECREF(((PyObject *)__pyx_v_node)); - __pyx_v_node = __pyx_v_self->head; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":71 - * - * node = self.head - * i += 1 # <<<<<<<<<<<<<< - * - * for level in range(self.maxlevels - 1, -1, -1): - */ - __pyx_v_i = (__pyx_v_i + 1); - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":73 - * i += 1 - * - * for level in range(self.maxlevels - 1, -1, -1): # <<<<<<<<<<<<<< - * while node.width[level] <= i: - * i -= node.width[level] - */ - for (__pyx_t_4 = (__pyx_v_self->maxlevels - 1); __pyx_t_4 > -1; __pyx_t_4-=1) { - __pyx_v_level = __pyx_t_4; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":74 - * - * 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_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_node->width), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; __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_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_5) break; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":75 - * for level in range(self.maxlevels - 1, -1, -1): - * while node.width[level] <= i: - * i -= node.width[level] # <<<<<<<<<<<<<< - * node = node.next[level] - * - */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_node->width), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_i = __pyx_t_6; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":76 - * while node.width[level] <= i: - * i -= node.width[level] - * node = node.next[level] # <<<<<<<<<<<<<< - * - * return node.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 = 76; __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 = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_node)); - __pyx_v_node = ((struct __pyx_obj_7tseries_Node *)__pyx_t_1); - __pyx_t_1 = 0; - } - } - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":78 - * node = node.next[level] - * - * return node.value # <<<<<<<<<<<<<< - * - * cpdef insert(self, double value): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_node->value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __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; - - __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.get"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_node); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":66 - * return self.get(i) - * - * cpdef get(self, int i): # <<<<<<<<<<<<<< - * cdef int level - * cdef Node node - */ - -static PyObject *__pyx_pf_7tseries_17IndexableSkiplist_3get(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/ -static PyObject *__pyx_pf_7tseries_17IndexableSkiplist_3get(PyObject *__pyx_v_self, PyObject *__pyx_arg_i) { - int __pyx_v_i; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __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 = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("tseries.IndexableSkiplist.get"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7tseries_IndexableSkiplist *)((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->__pyx_vtab)->get(((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self), __pyx_v_i, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __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.IndexableSkiplist.get"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":80 - * return node.value - * - * cpdef insert(self, double value): # <<<<<<<<<<<<<< - * cdef int level, steps, d - * cdef Node node, prevnode, newnode, next_at_level, tmp - */ - -static PyObject *__pyx_pf_7tseries_17IndexableSkiplist_4insert(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/ -static PyObject *__pyx_f_7tseries_17IndexableSkiplist_insert(struct __pyx_obj_7tseries_IndexableSkiplist *__pyx_v_self, double __pyx_v_value, int __pyx_skip_dispatch) { - 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; - int __pyx_t_4; - int __pyx_t_5; - double __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - __Pyx_RefNannySetupContext("insert"); - __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); - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overriden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__insert); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7tseries_17IndexableSkiplist_4insert)) { - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 80; __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[1]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":86 - * - * # 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_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 86; __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(__pyx_v_self->maxlevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 86; __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 = 86; __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 = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_chain)); - __pyx_v_chain = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":87 - * # 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 = 87; __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(__pyx_v_self->maxlevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 87; __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 = 87; __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 = 87; __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":88 - * chain = [None] * self.maxlevels - * steps_at_level = [0] * self.maxlevels - * node = self.head # <<<<<<<<<<<<<< - * - * for level in range(self.maxlevels - 1, -1, -1): - */ - __Pyx_INCREF(((PyObject *)__pyx_v_self->head)); - __Pyx_DECREF(((PyObject *)__pyx_v_node)); - __pyx_v_node = __pyx_v_self->head; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":90 - * node = self.head - * - * for level in range(self.maxlevels - 1, -1, -1): # <<<<<<<<<<<<<< - * next_at_level = node.next[level] - * - */ - for (__pyx_t_4 = (__pyx_v_self->maxlevels - 1); __pyx_t_4 > -1; __pyx_t_4-=1) { - __pyx_v_level = __pyx_t_4; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":91 - * - * 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 = 91; __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 = 91; __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":93 - * 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_5 = (__pyx_v_next_at_level->value <= __pyx_v_value); - if (!__pyx_t_5) break; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":94 - * - * 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 = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":95 - * 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_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_node->width), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 94; __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":94 - * - * 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_3, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":96 - * 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; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":97 - * node.width[level]) - * 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 = 97; __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 = 97; __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; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":99 - * 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 = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":102 - * - * # insert a link to the newnode at each level - * d = min(self.maxlevels, 1 - int(Log2(random()))) # <<<<<<<<<<<<<< - * newnode = Node(value, [None] * d, [None] * d) - * steps = 0 - */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__random); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyFloat_FromDouble(__pyx_f_7tseries_Log2(__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 102; __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[1]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_int_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_v_self->maxlevels; - __pyx_t_1 = PyInt_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_LT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_5) { - __Pyx_INCREF(__pyx_t_3); - __pyx_t_2 = __pyx_t_3; - } else { - __pyx_t_7 = PyInt_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __pyx_t_7; - __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __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 = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_d = __pyx_t_4; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":103 - * # insert a link to the newnode at each level - * d = min(self.maxlevels, 1 - int(Log2(random()))) - * newnode = Node(value, [None] * d, [None] * d) # <<<<<<<<<<<<<< - * steps = 0 - * - */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __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_7 = PyInt_FromLong(__pyx_v_d); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_t_3), __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __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_7); __pyx_t_7 = 0; - __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __Pyx_INCREF(Py_None); - PyList_SET_ITEM(__pyx_t_7, 0, Py_None); - __Pyx_GIVEREF(Py_None); - __pyx_t_3 = PyInt_FromLong(__pyx_v_d); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyNumber_Multiply(((PyObject *)__pyx_t_7), __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_2 = 0; - __pyx_t_1 = 0; - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7tseries_Node)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_newnode)); - __pyx_v_newnode = ((struct __pyx_obj_7tseries_Node *)__pyx_t_8); - __pyx_t_8 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":104 - * d = min(self.maxlevels, 1 - int(Log2(random()))) - * newnode = Node(value, [None] * d, [None] * d) - * steps = 0 # <<<<<<<<<<<<<< - * - * for level in range(d): - */ - __pyx_v_steps = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":106 - * steps = 0 - * - * for level in range(d): # <<<<<<<<<<<<<< - * prevnode = chain[level] - * newnode.next[level] = prevnode.next[level] - */ - __pyx_t_4 = __pyx_v_d; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_4; __pyx_t_9+=1) { - __pyx_v_level = __pyx_t_9; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":107 - * - * for level in range(d): - * prevnode = chain[level] # <<<<<<<<<<<<<< - * newnode.next[level] = prevnode.next[level] - * prevnode.next[level] = newnode - */ - __pyx_t_8 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_chain), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_7tseries_Node))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_prevnode)); - __pyx_v_prevnode = ((struct __pyx_obj_7tseries_Node *)__pyx_t_8); - __pyx_t_8 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":108 - * for level in range(d): - * prevnode = chain[level] - * newnode.next[level] = prevnode.next[level] # <<<<<<<<<<<<<< - * prevnode.next[level] = newnode - * newnode.width[level] = (prevnode.width[level] - steps) - */ - __pyx_t_8 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_prevnode->next), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_newnode->next), __pyx_v_level, __pyx_t_8, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":109 - * prevnode = chain[level] - * newnode.next[level] = prevnode.next[level] - * prevnode.next[level] = newnode # <<<<<<<<<<<<<< - * newnode.width[level] = (prevnode.width[level] - steps) - * prevnode.width[level] = steps + 1 - */ - 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 = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":110 - * newnode.next[level] = prevnode.next[level] - * prevnode.next[level] = newnode - * newnode.width[level] = (prevnode.width[level] - steps) # <<<<<<<<<<<<<< - * prevnode.width[level] = steps + 1 - * steps += steps_at_level[level] - */ - __pyx_t_8 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_prevnode->width), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = PyInt_FromLong(__pyx_v_steps); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyNumber_Subtract(__pyx_t_8, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_newnode->width), __pyx_v_level, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":111 - * prevnode.next[level] = newnode - * newnode.width[level] = (prevnode.width[level] - steps) - * prevnode.width[level] = steps + 1 # <<<<<<<<<<<<<< - * steps += steps_at_level[level] - * - */ - __pyx_t_1 = PyInt_FromLong((__pyx_v_steps + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_prevnode->width), __pyx_v_level, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":112 - * newnode.width[level] = (prevnode.width[level] - steps) - * prevnode.width[level] = steps + 1 - * steps += steps_at_level[level] # <<<<<<<<<<<<<< - * - * for level in range(d, self.maxlevels): - */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_steps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_steps_at_level), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_8); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_steps = __pyx_t_10; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":114 - * steps += steps_at_level[level] - * - * for level in range(d, self.maxlevels): # <<<<<<<<<<<<<< - * ( chain[level]).width[level] += 1 - * - */ - __pyx_t_4 = __pyx_v_self->maxlevels; - for (__pyx_t_9 = __pyx_v_d; __pyx_t_9 < __pyx_t_4; __pyx_t_9+=1) { - __pyx_v_level = __pyx_t_9; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":115 - * - * for level in range(d, self.maxlevels): - * ( chain[level]).width[level] += 1 # <<<<<<<<<<<<<< - * - * self.size += 1 - */ - __pyx_t_8 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_chain), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7tseries_Node *)__pyx_t_8)->width)); - __pyx_t_11 = ((struct __pyx_obj_7tseries_Node *)__pyx_t_8)->width; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_10 = __pyx_v_level; - __pyx_t_8 = __Pyx_GetItemInt_List(((PyObject *)__pyx_t_11), __pyx_t_10, sizeof(int), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__Pyx_SetItemInt(((PyObject *)__pyx_t_11), __pyx_t_10, __pyx_t_3, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":117 - * ( chain[level]).width[level] += 1 - * - * self.size += 1 # <<<<<<<<<<<<<< - * - * cpdef remove(self, double value): - */ - __pyx_v_self->size = (__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_8); - __Pyx_XDECREF(((PyObject *)__pyx_t_11)); - __Pyx_AddTraceback("tseries.IndexableSkiplist.insert"); - __pyx_r = 0; - __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_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":80 - * return node.value - * - * cpdef insert(self, double value): # <<<<<<<<<<<<<< - * cdef int level, steps, d - * cdef Node node, prevnode, newnode, next_at_level, tmp - */ - -static PyObject *__pyx_pf_7tseries_17IndexableSkiplist_4insert(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/ -static PyObject *__pyx_pf_7tseries_17IndexableSkiplist_4insert(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) { - double __pyx_v_value; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __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 = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("tseries.IndexableSkiplist.insert"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7tseries_IndexableSkiplist *)((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->__pyx_vtab)->insert(((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self), __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __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; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("tseries.IndexableSkiplist.insert"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":119 - * self.size += 1 - * - * cpdef remove(self, double value): # <<<<<<<<<<<<<< - * cdef int level, d - * cdef Node node, prevnode, tmpnode, next_at_level - */ - -static PyObject *__pyx_pf_7tseries_17IndexableSkiplist_5remove(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/ -static PyObject *__pyx_f_7tseries_17IndexableSkiplist_remove(struct __pyx_obj_7tseries_IndexableSkiplist *__pyx_v_self, double __pyx_v_value, int __pyx_skip_dispatch) { - 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; - int __pyx_t_4; - int __pyx_t_5; - Py_ssize_t __pyx_t_6; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - __Pyx_RefNannySetupContext("remove"); - __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); - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overriden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__remove); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7tseries_17IndexableSkiplist_5remove)) { - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 119; __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[1]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":125 - * - * # 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 = 125; __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(__pyx_v_self->maxlevels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __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 = 125; __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 = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_chain)); - __pyx_v_chain = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":126 - * # 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 *)__pyx_v_self->head)); - __Pyx_DECREF(((PyObject *)__pyx_v_node)); - __pyx_v_node = __pyx_v_self->head; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":128 - * node = self.head - * - * for level in range(self.maxlevels - 1, -1, -1): # <<<<<<<<<<<<<< - * next_at_level = node.next[level] - * while next_at_level.value < value: - */ - for (__pyx_t_4 = (__pyx_v_self->maxlevels - 1); __pyx_t_4 > -1; __pyx_t_4-=1) { - __pyx_v_level = __pyx_t_4; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":129 - * - * 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 = 129; __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 = 129; __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":130 - * 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_5 = (__pyx_v_next_at_level->value < __pyx_v_value); - if (!__pyx_t_5) break; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":131 - * 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; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":132 - * 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 = 132; __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 = 132; __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; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":134 - * 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 = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":136 - * chain[level] = node - * - * if value != ( ( ( chain[0]).next)[0]).value: # <<<<<<<<<<<<<< - * raise KeyError('Not Found') - * - */ - __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 = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)((struct __pyx_obj_7tseries_Node *)__pyx_t_3)->next), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = (__pyx_v_value != ((struct __pyx_obj_7tseries_Node *)__pyx_t_2)->value); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_5) { - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":137 - * - * if value != ( ( ( chain[0]).next)[0]).value: - * raise KeyError('Not Found') # <<<<<<<<<<<<<< - * - * # remove one link at each level - */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; - } - __pyx_L7:; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":140 - * - * # remove one link at each level - * d = len(( ( ( chain[0]).next)[0]).next) # <<<<<<<<<<<<<< - * - * for level in range(d): - */ - __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_chain), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)((struct __pyx_obj_7tseries_Node *)__pyx_t_2)->next), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __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 *)((struct __pyx_obj_7tseries_Node *)__pyx_t_3)->next); - __Pyx_INCREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(__pyx_t_2 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_6 = PyList_GET_SIZE(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_d = __pyx_t_6; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":142 - * d = len(( ( ( chain[0]).next)[0]).next) - * - * for level in range(d): # <<<<<<<<<<<<<< - * prevnode = chain[level] - * tmpnode = prevnode.next[level] - */ - __pyx_t_4 = __pyx_v_d; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_4; __pyx_t_7+=1) { - __pyx_v_level = __pyx_t_7; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":143 - * - * for level in range(d): - * prevnode = chain[level] # <<<<<<<<<<<<<< - * tmpnode = prevnode.next[level] - * prevnode.width[level] += tmpnode.width[level] - 1 - */ - __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_chain), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __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 = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_prevnode)); - __pyx_v_prevnode = ((struct __pyx_obj_7tseries_Node *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":144 - * 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_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_prevnode->next), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_tmpnode)); - __pyx_v_tmpnode = ((struct __pyx_obj_7tseries_Node *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":145 - * prevnode = chain[level] - * tmpnode = prevnode.next[level] - * prevnode.width[level] += tmpnode.width[level] - 1 # <<<<<<<<<<<<<< - * prevnode.next[level] = tmpnode.next[level] - * - */ - __Pyx_INCREF(((PyObject *)__pyx_v_prevnode->width)); - __pyx_t_8 = __pyx_v_prevnode->width; - __pyx_t_9 = __pyx_v_level; - __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_t_8), __pyx_t_9, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_tmpnode->width), __pyx_v_level, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; __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; - if (__Pyx_SetItemInt(((PyObject *)__pyx_t_8), __pyx_t_9, __pyx_t_3, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":146 - * 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 = 146; __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":148 - * prevnode.next[level] = tmpnode.next[level] - * - * for level in range(d, self.maxlevels): # <<<<<<<<<<<<<< - * tmpnode = chain[level] - * tmpnode.width[level] -= 1 - */ - __pyx_t_4 = __pyx_v_self->maxlevels; - for (__pyx_t_7 = __pyx_v_d; __pyx_t_7 < __pyx_t_4; __pyx_t_7+=1) { - __pyx_v_level = __pyx_t_7; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":149 - * - * 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 = 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_tmpnode)); - __pyx_v_tmpnode = ((struct __pyx_obj_7tseries_Node *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":150 - * for level in range(d, self.maxlevels): - * tmpnode = chain[level] - * tmpnode.width[level] -= 1 # <<<<<<<<<<<<<< - * - * self.size -= 1 - */ - __Pyx_INCREF(((PyObject *)__pyx_v_tmpnode->width)); - __pyx_t_8 = __pyx_v_tmpnode->width; - __pyx_t_9 = __pyx_v_level; - __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_t_8), __pyx_t_9, 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); - __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_SetItemInt(((PyObject *)__pyx_t_8), __pyx_t_9, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":152 - * tmpnode.width[level] -= 1 - * - * self.size -= 1 # <<<<<<<<<<<<<< - */ - __pyx_v_self->size = (__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(((PyObject *)__pyx_t_8)); - __Pyx_AddTraceback("tseries.IndexableSkiplist.remove"); - __pyx_r = 0; - __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_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":119 - * self.size += 1 - * - * cpdef remove(self, double value): # <<<<<<<<<<<<<< - * cdef int level, d - * cdef Node node, prevnode, tmpnode, next_at_level - */ - -static PyObject *__pyx_pf_7tseries_17IndexableSkiplist_5remove(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/ -static PyObject *__pyx_pf_7tseries_17IndexableSkiplist_5remove(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) { - double __pyx_v_value; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __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 = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("tseries.IndexableSkiplist.remove"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7tseries_IndexableSkiplist *)((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self)->__pyx_vtab)->remove(((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_self), __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __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; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("tseries.IndexableSkiplist.remove"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/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; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("_checknull"); - - /* "/home/wesm/code/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 = __pyx_v_val; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)((PyObject*)(&PyFloat_Type))); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __Pyx_TypeCheck(__pyx_t_1, __pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "/home/wesm/code/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_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!__pyx_t_3) { - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_7tseries_INF); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_val, __pyx_t_1, 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_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!__pyx_t_3) { - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_7tseries_NEGINF); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_val, __pyx_t_1, 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_1); __pyx_t_1 = 0; - __pyx_t_1 = __pyx_t_5; - __pyx_t_5 = 0; - } else { - __pyx_t_1 = __pyx_t_4; - __pyx_t_4 = 0; - } - __pyx_t_4 = __pyx_t_1; - __pyx_t_1 = 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*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/isnull.pyx":9 - * return val != val or val == INF or val == NEGINF - * else: - * return val is None # <<<<<<<<<<<<<< - * - * cpdef checknull(object val): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = (__pyx_v_val == Py_None); - __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_3); 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_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("tseries._checknull"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/isnull.pyx":11 - * return val is None - * - * cpdef checknull(object val): # <<<<<<<<<<<<<< - * return _checknull(val) - * - */ - -static PyObject *__pyx_pf_7tseries_3checknull(PyObject *__pyx_self, PyObject *__pyx_v_val); /*proto*/ -static PyObject *__pyx_f_7tseries_checknull(PyObject *__pyx_v_val, int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("checknull"); - - /* "/home/wesm/code/pandas/pandas/lib/src/isnull.pyx":12 - * - * cpdef checknull(object val): - * return _checknull(val) # <<<<<<<<<<<<<< - * - * def isnullobj(ndarray input): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_v_val; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_7tseries__checknull(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("tseries.checknull"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/isnull.pyx":11 - * return val is None - * - * cpdef checknull(object val): # <<<<<<<<<<<<<< - * return _checknull(val) - * - */ - -static PyObject *__pyx_pf_7tseries_3checknull(PyObject *__pyx_self, PyObject *__pyx_v_val); /*proto*/ -static PyObject *__pyx_pf_7tseries_3checknull(PyObject *__pyx_self, PyObject *__pyx_v_val) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("checknull"); - __pyx_self = __pyx_self; - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_v_val; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_7tseries_checknull(__pyx_t_1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("tseries.checknull"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/isnull.pyx":14 - * return _checknull(val) - * - * def isnullobj(ndarray input): # <<<<<<<<<<<<<< - * cdef int i, length - * cdef object val - */ - -static PyObject *__pyx_pf_7tseries_4isnullobj(PyObject *__pyx_self, PyObject *__pyx_v_input); /*proto*/ -static PyMethodDef __pyx_mdef_7tseries_4isnullobj = {__Pyx_NAMESTR("isnullobj"), (PyCFunction)__pyx_pf_7tseries_4isnullobj, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7tseries_4isnullobj(PyObject *__pyx_self, 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; - 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; - 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_self = __pyx_self; - __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; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/wesm/code/pandas/pandas/lib/src/isnull.pyx":20 - * cdef flatiter iter - * - * length = PyArray_SIZE(input) # <<<<<<<<<<<<<< - * - * result = np.zeros(length, dtype=np.int8) - */ - __pyx_t_1 = __pyx_v_input; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_length = PyArray_SIZE(((PyArrayObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/isnull.pyx":22 - * length = PyArray_SIZE(input) - * - * result = 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 = 22; __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 = 22; __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 = 22; __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 = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __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 = 22; __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 = 22; __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 = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __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 = 22; __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/isnull.pyx":24 - * result = np.zeros(length, dtype=np.int8) - * - * iter= PyArray_IterNew(input) # <<<<<<<<<<<<<< - * - * for i from 0 <= i < length: - */ - __pyx_t_5 = __pyx_v_input; - __Pyx_INCREF(__pyx_t_5); - __pyx_t_1 = PyArray_IterNew(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_flatiter))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_iter)); - __pyx_v_iter = ((PyArrayIterObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/isnull.pyx":26 - * 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++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/isnull.pyx":27 - * - * for i from 0 <= i < length: - * val = PyArray_GETITEM(input, PyArray_ITER_DATA(iter)) # <<<<<<<<<<<<<< - * - * if _checknull(val): - */ - __pyx_t_1 = __pyx_v_input; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_5 = PyArray_GETITEM(((PyArrayObject *)__pyx_t_1), PyArray_ITER_DATA(__pyx_v_iter)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_val); - __pyx_v_val = __pyx_t_5; - __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/isnull.pyx":29 - * 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 = 29; __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 = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_11) { - - /* "/home/wesm/code/pandas/pandas/lib/src/isnull.pyx":30 - * - * 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 = 30; __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_L7; - } - __pyx_L7:; - - /* "/home/wesm/code/pandas/pandas/lib/src/isnull.pyx":32 - * result[i] = 1 - * - * PyArray_ITER_NEXT(iter) # <<<<<<<<<<<<<< - * - * return result - */ - PyArray_ITER_NEXT(__pyx_v_iter); - } - - /* "/home/wesm/code/pandas/pandas/lib/src/isnull.pyx":34 - * PyArray_ITER_NEXT(iter) - * - * 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_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 = NULL; - 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_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/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"); - - /* "/home/wesm/code/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; -} - -/* "/home/wesm/code/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_5arrmap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7tseries_5arrmap = {__Pyx_NAMESTR("arrmap"), (PyCFunction)__pyx_pf_7tseries_5arrmap, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7tseries_5arrmap(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"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __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]; - - /* "/home/wesm/code/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]); - - /* "/home/wesm/code/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; - - /* "/home/wesm/code/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(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[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, ((PyObject *)__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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[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; - - /* "/home/wesm/code/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] = func(index[i]) - * - */ - __pyx_t_7 = __pyx_v_length; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":16 - * - * for i from 0 <= i < length: - * result[i] = 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 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_v_func, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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_5); - *__pyx_t_10 = __pyx_t_5; - __Pyx_GIVEREF(*__pyx_t_10); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":18 - * result[i] = 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_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/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_6groupby(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7tseries_6groupby = {__Pyx_NAMESTR("groupby"), (PyCFunction)__pyx_pf_7tseries_6groupby, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7tseries_6groupby(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; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - 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; - PyArrayObject *__pyx_t_12 = NULL; - int __pyx_t_13; - __pyx_t_5numpy_int8_t __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - 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 (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"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":30 - * cdef object idx, key - * - * length = len(index) # <<<<<<<<<<<<<< - * - * if output is None: - */ - __pyx_t_1 = __pyx_v_index; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_length = __pyx_t_2; - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":32 - * length = len(index) - * - * if output is None: # <<<<<<<<<<<<<< - * result = {} - * else: - */ - __pyx_t_3 = (__pyx_v_output == Py_None); - if (__pyx_t_3) { - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":33 - * - * if output is None: - * result = {} # <<<<<<<<<<<<<< - * else: - * result = output - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __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; - goto __pyx_L6; - } - /*else*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":35 - * result = {} - * else: - * result = 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:; - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":37 - * result = output - * - * index_buf = np.asarray(index) # <<<<<<<<<<<<<< - * mapped_index = arrmap(index_buf, mapper) - * mask = isnullobj(mapped_index) - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __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_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), 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(((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 = 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; - - /* "/home/wesm/code/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_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject *)__pyx_v_index_buf)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_index_buf)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_index_buf)); - __Pyx_INCREF(__pyx_v_mapper); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_mapper); - __Pyx_GIVEREF(__pyx_v_mapper); - __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), 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(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[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; - - /* "/home/wesm/code/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 = __Pyx_GetName(__pyx_m, __pyx_n_s__isnullobj); 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_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject *)__pyx_v_mapped_index)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_mapped_index)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_mapped_index)); - __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __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_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_mask, (PyObject*)__pyx_t_12, &__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_t_12 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_mask)); - __pyx_v_mask = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; - - /* "/home/wesm/code/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_5 = PyObject_GetAttr(((PyObject *)__pyx_v_mask), __pyx_n_s__astype); 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_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject*)&PyBool_Type)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject*)&PyBool_Type)); - __Pyx_GIVEREF(((PyObject*)&PyBool_Type)); - __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_index_buf), __pyx_t_4); if (!__pyx_t_1) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_nullkeys); - __pyx_v_nullkeys = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/wesm/code/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_2 = PyObject_Length(__pyx_v_nullkeys); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = (__pyx_t_2 > 0); - if (__pyx_t_3) { - - /* "/home/wesm/code/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_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__NaN); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_t_4, __pyx_v_nullkeys) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L7; - } - __pyx_L7:; - - /* "/home/wesm/code/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++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":45 - * - * for i from 0 <= i < length: - * if mask[i]: # <<<<<<<<<<<<<< - * continue - * - */ - __pyx_t_13 = __pyx_v_i; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_mask; - __pyx_t_14 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_bstruct_mask.buf, __pyx_t_13, __pyx_bstride_0_mask)); - if (__pyx_t_14) { - - /* "/home/wesm/code/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:; - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":48 - * continue - * - * key = mapped_index[i] # <<<<<<<<<<<<<< - * idx = index_buf[i] - * if key in result: - */ - __pyx_t_15 = __pyx_v_i; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_mapped_index; - __pyx_t_4 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_mapped_index.buf, __pyx_t_15, __pyx_bstride_0_mapped_index); - __Pyx_INCREF((PyObject*)__pyx_t_4); - __Pyx_DECREF(__pyx_v_key); - __pyx_v_key = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":49 - * - * key = mapped_index[i] - * idx = index_buf[i] # <<<<<<<<<<<<<< - * if key in result: - * members = result[key] - */ - __pyx_t_16 = __pyx_v_i; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_index_buf; - __pyx_t_4 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_index_buf.buf, __pyx_t_16, __pyx_bstride_0_index_buf); - __Pyx_INCREF((PyObject*)__pyx_t_4); - __Pyx_DECREF(__pyx_v_idx); - __pyx_v_idx = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/wesm/code/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(__pyx_v_result == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = ((PyDict_Contains(((PyObject *)__pyx_v_result), __pyx_v_key))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_3) { - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":51 - * idx = index_buf[i] - * if key in result: - * members = result[key] # <<<<<<<<<<<<<< - * members.append(idx) - * else: - */ - __pyx_t_4 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_v_key); if (!__pyx_t_4) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_4)->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_4); - __pyx_t_4 = 0; - - /* "/home/wesm/code/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_17 = PyList_Append(__pyx_v_members, __pyx_v_idx); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L11; - } - /*else*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":54 - * members.append(idx) - * else: - * result[key] = [idx] # <<<<<<<<<<<<<< - * - * return result - */ - __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_INCREF(__pyx_v_idx); - PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_idx); - __Pyx_GIVEREF(__pyx_v_idx); - if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_key, ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - } - __pyx_L11:; - __pyx_L8_continue:; - } - - /* "/home/wesm/code/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_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_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_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/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_7groupby_indices(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7tseries_7groupby_indices = {__Pyx_NAMESTR("groupby_indices"), (PyCFunction)__pyx_pf_7tseries_7groupby_indices, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7tseries_7groupby_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; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - 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; - PyArrayObject *__pyx_t_10 = NULL; - int __pyx_t_11; - int __pyx_t_12; - __pyx_t_5numpy_int8_t __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - 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"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __Pyx_INCREF(__pyx_v_index); - __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":67 - * cdef object key - * - * length = len(index) # <<<<<<<<<<<<<< - * - * result = {} - */ - __pyx_t_1 = __pyx_v_index; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_length = __pyx_t_2; - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":69 - * length = len(index) - * - * result = {} # <<<<<<<<<<<<<< - * index = np.asarray(index) - * mapped_index = arrmap(index, mapper) - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":70 - * - * result = {} - * index = np.asarray(index) # <<<<<<<<<<<<<< - * mapped_index = arrmap(index, mapper) - * - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __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_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), 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(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_index); - __pyx_v_index = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/wesm/code/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_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - __Pyx_INCREF(__pyx_v_mapper); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_mapper); - __Pyx_GIVEREF(__pyx_v_mapper); - __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), 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(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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; - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":73 - * mapped_index = arrmap(index, mapper) - * - * mask = isnullobj(mapped_index) # <<<<<<<<<<<<<< - * - * if mask.astype(bool).any(): - */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__isnullobj); 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_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject *)__pyx_v_mapped_index)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_mapped_index)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_mapped_index)); - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask); - __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_mask, (PyObject*)__pyx_t_10, &__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_t_10 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_mask)); - __pyx_v_mask = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; - - /* "/home/wesm/code/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_4 = PyObject_GetAttr(((PyObject *)__pyx_v_mask), __pyx_n_s__astype); 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_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject*)&PyBool_Type)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject*)&PyBool_Type)); - __Pyx_GIVEREF(((PyObject*)&PyBool_Type)); - __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __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_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_11) { - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":76 - * - * if mask.astype(bool).any(): - * null_list = [] # <<<<<<<<<<<<<< - * result[np.NaN] = null_list - * - */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(((PyObject *)__pyx_v_null_list)); - __pyx_v_null_list = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/wesm/code/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_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__NaN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_t_1, ((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_1); __pyx_t_1 = 0; - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/wesm/code/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++) { - - /* "/home/wesm/code/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_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) { - - /* "/home/wesm/code/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_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = PyList_Append(__pyx_v_null_list, __pyx_t_1); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L9; - } - __pyx_L9:; - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":82 - * if mask[i]: - * null_list.append(i) - * key = mapped_index[i] # <<<<<<<<<<<<<< - * if key in result: - * ( result[key]).append(i) - */ - __pyx_t_14 = __pyx_v_i; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_mapped_index; - __pyx_t_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_mapped_index.buf, __pyx_t_14, __pyx_bstride_0_mapped_index); - __Pyx_INCREF((PyObject*)__pyx_t_1); - __Pyx_DECREF(__pyx_v_key); - __pyx_v_key = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":83 - * null_list.append(i) - * key = mapped_index[i] - * if key in result: # <<<<<<<<<<<<<< - * ( result[key]).append(i) - * else: - */ - if (unlikely(__pyx_v_result == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_11 = ((PyDict_Contains(((PyObject *)__pyx_v_result), __pyx_v_key))); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_11) { - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":84 - * key = mapped_index[i] - * if key in result: - * ( result[key]).append(i) # <<<<<<<<<<<<<< - * else: - * result[key] = [i] - */ - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_v_key); if (!__pyx_t_1) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(((PyObject*)__pyx_t_1) == 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_3 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_15 = PyList_Append(((PyObject*)__pyx_t_1), __pyx_t_3); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L10; - } - /*else*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/groupby.pyx":86 - * ( result[key]).append(i) - * else: - * result[key] = [i] # <<<<<<<<<<<<<< - * - * return result - */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_key, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - } - __pyx_L10:; - } - - /* "/home/wesm/code/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_1); - __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_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":28 - * - * - * def kth_smallest(ndarray[double_t, ndim=1] a, int k): # <<<<<<<<<<<<<< - * cdef: - * int i,j,l,m,n - */ - -static PyObject *__pyx_pf_7tseries_8kth_smallest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7tseries_8kth_smallest = {__Pyx_NAMESTR("kth_smallest"), (PyCFunction)__pyx_pf_7tseries_8kth_smallest, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7tseries_8kth_smallest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_a = 0; - int __pyx_v_k; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_l; - int __pyx_v_m; - int __pyx_v_n; - __pyx_t_5numpy_double_t __pyx_v_x; - __pyx_t_5numpy_double_t __pyx_v_t; - Py_buffer __pyx_bstruct_a; - Py_ssize_t __pyx_bstride_0_a = 0; - Py_ssize_t __pyx_bshape_0_a = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__k,0}; - __Pyx_RefNannySetupContext("kth_smallest"); - __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__a); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("kth_smallest", 1, 2, 2, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __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), "kth_smallest") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_a = ((PyArrayObject *)values[0]); - __pyx_v_k = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_a = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_k = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("kth_smallest", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("tseries.kth_smallest"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_a.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_5numpy_ndarray, 1, "a", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_a, (PyObject*)__pyx_v_a, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_a = __pyx_bstruct_a.strides[0]; - __pyx_bshape_0_a = __pyx_bstruct_a.shape[0]; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":33 - * double_t x, t - * - * n = len(a) # <<<<<<<<<<<<<< - * - * l = 0 - */ - __pyx_t_1 = ((PyObject *)__pyx_v_a); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_n = __pyx_t_2; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":35 - * n = len(a) - * - * l = 0 # <<<<<<<<<<<<<< - * m = n-1 - * while (l= __pyx_bshape_0_a)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_x = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_a.buf, __pyx_t_4, __pyx_bstride_0_a)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":39 - * while (l= __pyx_bshape_0_a)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_a.buf, __pyx_t_5, __pyx_bstride_0_a)) < __pyx_v_x); - if (!__pyx_t_3) break; - __pyx_v_i = (__pyx_v_i + 1); - } - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":44 - * while 1: - * while a[i] < x: i += 1 - * while x < a[j]: j -= 1 # <<<<<<<<<<<<<< - * if i <= j: - * t = a[i] - */ - while (1) { - __pyx_t_6 = __pyx_v_j; - __pyx_t_7 = -1; - if (__pyx_t_6 < 0) { - __pyx_t_6 += __pyx_bshape_0_a; - if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_6 >= __pyx_bshape_0_a)) __pyx_t_7 = 0; - if (unlikely(__pyx_t_7 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_7); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = (__pyx_v_x < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_a.buf, __pyx_t_6, __pyx_bstride_0_a))); - if (!__pyx_t_3) break; - __pyx_v_j = (__pyx_v_j - 1); - } - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":45 - * while a[i] < x: i += 1 - * while x < a[j]: j -= 1 - * if i <= j: # <<<<<<<<<<<<<< - * t = a[i] - * a[i] = a[j] - */ - __pyx_t_3 = (__pyx_v_i <= __pyx_v_j); - if (__pyx_t_3) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":46 - * while x < a[j]: j -= 1 - * if i <= j: - * t = a[i] # <<<<<<<<<<<<<< - * a[i] = a[j] - * a[j] = t - */ - __pyx_t_7 = __pyx_v_i; - __pyx_t_8 = -1; - if (__pyx_t_7 < 0) { - __pyx_t_7 += __pyx_bshape_0_a; - if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_7 >= __pyx_bshape_0_a)) __pyx_t_8 = 0; - if (unlikely(__pyx_t_8 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_8); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_t = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_a.buf, __pyx_t_7, __pyx_bstride_0_a)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":47 - * if i <= j: - * t = a[i] - * a[i] = a[j] # <<<<<<<<<<<<<< - * a[j] = t - * i += 1; j -= 1 - */ - __pyx_t_8 = __pyx_v_j; - __pyx_t_9 = -1; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_bshape_0_a; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_a)) __pyx_t_9 = 0; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_9 = __pyx_v_i; - __pyx_t_10 = -1; - if (__pyx_t_9 < 0) { - __pyx_t_9 += __pyx_bshape_0_a; - if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0; - } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_a)) __pyx_t_10 = 0; - if (unlikely(__pyx_t_10 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_10); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_a.buf, __pyx_t_9, __pyx_bstride_0_a) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_a.buf, __pyx_t_8, __pyx_bstride_0_a)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":48 - * t = a[i] - * a[i] = a[j] - * a[j] = t # <<<<<<<<<<<<<< - * i += 1; j -= 1 - * - */ - __pyx_t_10 = __pyx_v_j; - __pyx_t_11 = -1; - if (__pyx_t_10 < 0) { - __pyx_t_10 += __pyx_bshape_0_a; - if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0; - } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_a)) __pyx_t_11 = 0; - if (unlikely(__pyx_t_11 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_11); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_a.buf, __pyx_t_10, __pyx_bstride_0_a) = __pyx_v_t; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":49 - * a[i] = a[j] - * a[j] = t - * i += 1; j -= 1 # <<<<<<<<<<<<<< - * - * if i > j: break - */ - __pyx_v_i = (__pyx_v_i + 1); - __pyx_v_j = (__pyx_v_j - 1); - goto __pyx_L14; - } - __pyx_L14:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":51 - * i += 1; j -= 1 - * - * if i > j: break # <<<<<<<<<<<<<< - * - * if j < k: l = i - */ - __pyx_t_3 = (__pyx_v_i > __pyx_v_j); - if (__pyx_t_3) { - goto __pyx_L9_break; - goto __pyx_L15; - } - __pyx_L15:; - } - __pyx_L9_break:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":53 - * if i > j: break - * - * if j < k: l = i # <<<<<<<<<<<<<< - * if k < i: m = j - * return a[k] - */ - __pyx_t_3 = (__pyx_v_j < __pyx_v_k); - if (__pyx_t_3) { - __pyx_v_l = __pyx_v_i; - goto __pyx_L16; - } - __pyx_L16:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":54 - * - * if j < k: l = i - * if k < i: m = j # <<<<<<<<<<<<<< - * return a[k] - * - */ - __pyx_t_3 = (__pyx_v_k < __pyx_v_i); - if (__pyx_t_3) { - __pyx_v_m = __pyx_v_j; - goto __pyx_L17; - } - __pyx_L17:; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":55 - * if j < k: l = i - * if k < i: m = j - * return a[k] # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_11 = __pyx_v_k; - __pyx_t_12 = -1; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_bshape_0_a; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0; - } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_a)) __pyx_t_12 = 0; - if (unlikely(__pyx_t_12 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_12); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_a.buf, __pyx_t_11, __pyx_bstride_0_a))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_a); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("tseries.kth_smallest"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_a); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":58 - * - * - * def median(ndarray arr): # <<<<<<<<<<<<<< - * ''' - * A faster median - */ - -static PyObject *__pyx_pf_7tseries_9median(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/ -static char __pyx_doc_7tseries_9median[] = "\n A faster median\n "; -static PyMethodDef __pyx_mdef_7tseries_9median = {__Pyx_NAMESTR("median"), (PyCFunction)__pyx_pf_7tseries_9median, METH_O, __Pyx_DOCSTR(__pyx_doc_7tseries_9median)}; -static PyObject *__pyx_pf_7tseries_9median(PyObject *__pyx_self, PyObject *__pyx_v_arr) { - int __pyx_v_n; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - long __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - __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[5]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":62 - * A faster median - * ''' - * cdef int n = len(arr) # <<<<<<<<<<<<<< - * - * if len(arr) == 0: - */ - __pyx_t_1 = __pyx_v_arr; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_n = __pyx_t_2; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":64 - * cdef int n = len(arr) - * - * if len(arr) == 0: # <<<<<<<<<<<<<< - * return np.NaN - * - */ - __pyx_t_1 = __pyx_v_arr; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_2 == 0); - if (__pyx_t_3) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":65 - * - * if len(arr) == 0: - * return np.NaN # <<<<<<<<<<<<<< - * - * arr = arr.copy() - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__NaN); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":67 - * return np.NaN - * - * arr = arr.copy() # <<<<<<<<<<<<<< - * - * if n % 2: - */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_arr, __pyx_n_s__copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":69 - * arr = arr.copy() - * - * if n % 2: # <<<<<<<<<<<<<< - * return kth_smallest(arr, n / 2) - * else: - */ - __pyx_t_5 = __Pyx_mod_long(__pyx_v_n, 2); - if (__pyx_t_5) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":70 - * - * if n % 2: - * return kth_smallest(arr, n / 2) # <<<<<<<<<<<<<< - * else: - * return (kth_smallest(arr, n / 2) + - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__kth_smallest); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyInt_FromLong(__Pyx_div_long(__pyx_v_n, 2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __Pyx_INCREF(__pyx_v_arr); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_arr); - __Pyx_GIVEREF(__pyx_v_arr); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - /*else*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":72 - * return kth_smallest(arr, n / 2) - * else: - * return (kth_smallest(arr, n / 2) + # <<<<<<<<<<<<<< - * kth_smallest(arr, n / 2 - 1)) / 2 - * - */ - __Pyx_XDECREF(__pyx_r); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":73 - * else: - * return (kth_smallest(arr, n / 2) + - * kth_smallest(arr, n / 2 - 1)) / 2 # <<<<<<<<<<<<<< - * - * #------------------------------------------------------------------------------- - */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__kth_smallest); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":72 - * return kth_smallest(arr, n / 2) - * else: - * return (kth_smallest(arr, n / 2) + # <<<<<<<<<<<<<< - * kth_smallest(arr, n / 2 - 1)) / 2 - * - */ - __pyx_t_6 = PyInt_FromLong(__Pyx_div_long(__pyx_v_n, 2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_v_arr); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_arr); - __Pyx_GIVEREF(__pyx_v_arr); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":73 - * else: - * return (kth_smallest(arr, n / 2) + - * kth_smallest(arr, n / 2 - 1)) / 2 # <<<<<<<<<<<<<< - * - * #------------------------------------------------------------------------------- - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__kth_smallest); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyInt_FromLong((__Pyx_div_long(__pyx_v_n, 2) - 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __Pyx_INCREF(__pyx_v_arr); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_arr); - __Pyx_GIVEREF(__pyx_v_arr); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Add(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_int_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } - __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_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("tseries.median"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_arr); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":78 - * # 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_10roll_sum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7tseries_10roll_sum = {__Pyx_NAMESTR("roll_sum"), (PyCFunction)__pyx_pf_7tseries_10roll_sum, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7tseries_10roll_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; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - 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[5]; __pyx_lineno = 78; __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[5]; __pyx_lineno = 78; __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[5]; __pyx_lineno = 78; __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[5]; __pyx_lineno = 79; __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[5]; __pyx_lineno = 79; __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[5]; __pyx_lineno = 79; __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[5]; __pyx_lineno = 79; __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[5]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("tseries.roll_sum"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __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[5]; __pyx_lineno = 78; __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[5]; __pyx_lineno = 78; __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]; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":80 - * 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.0; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":81 - * 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; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":82 - * 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 *)__pyx_v_input); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_N = __pyx_t_2; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":84 - * cdef int N = len(input) - * - * cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float) # <<<<<<<<<<<<<< - * - * if minp > N: - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __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 = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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 = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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[5]; __pyx_lineno = 84; __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[5]; __pyx_lineno = 84; __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":86 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":87 - * - * 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:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":89 - * 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++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":90 - * - * 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[5]; __pyx_lineno = 90; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":93 - * - * # Not NaN - * if val == val: # <<<<<<<<<<<<<< - * nobs += 1 - * sum_x += val - */ - __pyx_t_7 = (__pyx_v_val == __pyx_v_val); - if (__pyx_t_7) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":94 - * # Not NaN - * if val == val: - * nobs += 1 # <<<<<<<<<<<<<< - * sum_x += val - * - */ - __pyx_v_nobs = (__pyx_v_nobs + 1); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":95 - * if val == val: - * nobs += 1 - * sum_x += val # <<<<<<<<<<<<<< - * - * output[i] = NaN - */ - __pyx_v_sum_x = (__pyx_v_sum_x + __pyx_v_val); - goto __pyx_L9; - } - __pyx_L9:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":97 - * 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[5]; __pyx_lineno = 97; __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; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":99 - * 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++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":100 - * - * 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[5]; __pyx_lineno = 100; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":102 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":103 - * - * 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[5]; __pyx_lineno = 103; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":104 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":105 - * prev = input[i - win] - * if prev == prev: - * sum_x -= prev # <<<<<<<<<<<<<< - * nobs -= 1 - * - */ - __pyx_v_sum_x = (__pyx_v_sum_x - __pyx_v_prev); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":106 - * if prev == prev: - * sum_x -= prev - * nobs -= 1 # <<<<<<<<<<<<<< - * - * if val == val: - */ - __pyx_v_nobs = (__pyx_v_nobs - 1); - goto __pyx_L13; - } - __pyx_L13:; - goto __pyx_L12; - } - __pyx_L12:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":108 - * nobs -= 1 - * - * if val == val: # <<<<<<<<<<<<<< - * nobs += 1 - * sum_x += val - */ - __pyx_t_7 = (__pyx_v_val == __pyx_v_val); - if (__pyx_t_7) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":109 - * - * if val == val: - * nobs += 1 # <<<<<<<<<<<<<< - * sum_x += val - * - */ - __pyx_v_nobs = (__pyx_v_nobs + 1); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":110 - * if val == val: - * nobs += 1 - * sum_x += val # <<<<<<<<<<<<<< - * - * if nobs >= minp: - */ - __pyx_v_sum_x = (__pyx_v_sum_x + __pyx_v_val); - goto __pyx_L14; - } - __pyx_L14:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":112 - * sum_x += val - * - * if nobs >= minp: # <<<<<<<<<<<<<< - * output[i] = sum_x - * else: - */ - __pyx_t_7 = (__pyx_v_nobs >= __pyx_v_minp); - if (__pyx_t_7) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":113 - * - * 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[5]; __pyx_lineno = 113; __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*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":115 - * 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[5]; __pyx_lineno = 115; __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:; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":117 - * 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_1); - __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_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":122 - * # 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_11roll_mean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7tseries_11roll_mean = {__Pyx_NAMESTR("roll_mean"), (PyCFunction)__pyx_pf_7tseries_11roll_mean, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7tseries_11roll_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; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - 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[5]; __pyx_lineno = 122; __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[5]; __pyx_lineno = 122; __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[5]; __pyx_lineno = 122; __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[5]; __pyx_lineno = 123; __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[5]; __pyx_lineno = 123; __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[5]; __pyx_lineno = 123; __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[5]; __pyx_lineno = 123; __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[5]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("tseries.roll_mean"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __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[5]; __pyx_lineno = 122; __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[5]; __pyx_lineno = 122; __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]; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":124 - * 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.0; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":125 - * 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; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":126 - * 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 *)__pyx_v_input); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_N = __pyx_t_2; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":128 - * cdef int N = len(input) - * - * cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float) # <<<<<<<<<<<<<< - * - * if minp > N: - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __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 = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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 = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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[5]; __pyx_lineno = 128; __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[5]; __pyx_lineno = 128; __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":130 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":131 - * - * 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:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":133 - * 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++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":134 - * - * 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[5]; __pyx_lineno = 134; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":137 - * - * # Not NaN - * if val == val: # <<<<<<<<<<<<<< - * nobs += 1 - * sum_x += val - */ - __pyx_t_7 = (__pyx_v_val == __pyx_v_val); - if (__pyx_t_7) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":138 - * # Not NaN - * if val == val: - * nobs += 1 # <<<<<<<<<<<<<< - * sum_x += val - * - */ - __pyx_v_nobs = (__pyx_v_nobs + 1); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":139 - * if val == val: - * nobs += 1 - * sum_x += val # <<<<<<<<<<<<<< - * - * output[i] = NaN - */ - __pyx_v_sum_x = (__pyx_v_sum_x + __pyx_v_val); - goto __pyx_L9; - } - __pyx_L9:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":141 - * 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[5]; __pyx_lineno = 141; __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; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":143 - * 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++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":144 - * - * 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[5]; __pyx_lineno = 144; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":146 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":147 - * - * 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[5]; __pyx_lineno = 147; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":148 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":149 - * prev = input[i - win] - * if prev == prev: - * sum_x -= prev # <<<<<<<<<<<<<< - * nobs -= 1 - * - */ - __pyx_v_sum_x = (__pyx_v_sum_x - __pyx_v_prev); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":150 - * if prev == prev: - * sum_x -= prev - * nobs -= 1 # <<<<<<<<<<<<<< - * - * if val == val: - */ - __pyx_v_nobs = (__pyx_v_nobs - 1); - goto __pyx_L13; - } - __pyx_L13:; - goto __pyx_L12; - } - __pyx_L12:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":152 - * nobs -= 1 - * - * if val == val: # <<<<<<<<<<<<<< - * nobs += 1 - * sum_x += val - */ - __pyx_t_7 = (__pyx_v_val == __pyx_v_val); - if (__pyx_t_7) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":153 - * - * if val == val: - * nobs += 1 # <<<<<<<<<<<<<< - * sum_x += val - * - */ - __pyx_v_nobs = (__pyx_v_nobs + 1); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":154 - * if val == val: - * nobs += 1 - * sum_x += val # <<<<<<<<<<<<<< - * - * if nobs >= minp: - */ - __pyx_v_sum_x = (__pyx_v_sum_x + __pyx_v_val); - goto __pyx_L14; - } - __pyx_L14:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":156 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":157 - * - * 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[5]; __pyx_lineno = 157; __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[5]; __pyx_lineno = 157; __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*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":159 - * 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[5]; __pyx_lineno = 159; __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:; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":161 - * 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_1); - __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_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":166 - * # Exponentially weighted moving average - * - * def ewma(ndarray[double_t, ndim=1] input, double_t com): # <<<<<<<<<<<<<< - * ''' - * Compute exponentially-weighted moving average using center-of-mass. - */ - -static PyObject *__pyx_pf_7tseries_12ewma(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7tseries_12ewma[] = "\n Compute exponentially-weighted moving average using center-of-mass.\n\n Parameters\n ----------\n input : ndarray (float64 type)\n com : float64\n\n Returns\n -------\n y : ndarray\n "; -static PyMethodDef __pyx_mdef_7tseries_12ewma = {__Pyx_NAMESTR("ewma"), (PyCFunction)__pyx_pf_7tseries_12ewma, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7tseries_12ewma)}; -static PyObject *__pyx_pf_7tseries_12ewma(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_input = 0; - __pyx_t_5numpy_double_t __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; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; - __pyx_t_5numpy_double_t __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; - double __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[5]; __pyx_lineno = 166; __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[5]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_input = ((PyArrayObject *)values[0]); - __pyx_v_com = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_com == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 166; __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_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_com == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 166; __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[5]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("tseries.ewma"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __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[5]; __pyx_lineno = 166; __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[5]; __pyx_lineno = 166; __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]; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":182 - * 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 *)__pyx_v_input); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_N = __pyx_t_2; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":184 - * cdef int N = len(input) - * - * cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 184; __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 = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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 = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); 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_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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[5]; __pyx_lineno = 184; __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[5]; __pyx_lineno = 184; __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":187 - * - * - * neww = 1. / (1. + com) # <<<<<<<<<<<<<< - * oldw = 1. - neww - * adj = oldw - */ - __pyx_t_7 = (1. + __pyx_v_com); - if (unlikely(__pyx_t_7 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_neww = (1. / __pyx_t_7); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":188 - * - * neww = 1. / (1. + com) - * oldw = 1. - neww # <<<<<<<<<<<<<< - * adj = oldw - * - */ - __pyx_v_oldw = (1. - __pyx_v_neww); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":189 - * neww = 1. / (1. + com) - * oldw = 1. - neww - * adj = oldw # <<<<<<<<<<<<<< - * - * output[0] = neww * input[0] - */ - __pyx_v_adj = __pyx_v_oldw; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":191 - * 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[5]; __pyx_lineno = 191; __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[5]; __pyx_lineno = 191; __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))); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":193 - * 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++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":194 - * - * 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[5]; __pyx_lineno = 194; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":195 - * 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[5]; __pyx_lineno = 195; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":197 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":198 - * - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":199 - * 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[5]; __pyx_lineno = 199; __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*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":201 - * 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[5]; __pyx_lineno = 201; __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*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":203 - * 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[5]; __pyx_lineno = 203; __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:; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":205 - * 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++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":206 - * - * 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[5]; __pyx_lineno = 206; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":207 - * 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[5]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_7 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_output.buf, __pyx_t_18, __pyx_bstride_0_output)); - __pyx_t_20 = (1. - __pyx_v_adj); - if (unlikely(__pyx_t_20 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 207; __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[5]; __pyx_lineno = 207; __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_7 / __pyx_t_20); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":209 - * output[i] = output[i] / (1. - adj) - * - * if cur == cur: # <<<<<<<<<<<<<< - * adj *= oldw - * - */ - __pyx_t_14 = (__pyx_v_cur == __pyx_v_cur); - if (__pyx_t_14) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":210 - * - * if cur == cur: - * adj *= oldw # <<<<<<<<<<<<<< - * - * return output - */ - __pyx_v_adj = (__pyx_v_adj * __pyx_v_oldw); - goto __pyx_L12; - } - __pyx_L12:; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":212 - * 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_1); - __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_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":217 - * # 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_13roll_var(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7tseries_13roll_var = {__Pyx_NAMESTR("roll_var"), (PyCFunction)__pyx_pf_7tseries_13roll_var, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7tseries_13roll_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; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - 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[5]; __pyx_lineno = 217; __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[5]; __pyx_lineno = 217; __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[5]; __pyx_lineno = 217; __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[5]; __pyx_lineno = 218; __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[5]; __pyx_lineno = 218; __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[5]; __pyx_lineno = 218; __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[5]; __pyx_lineno = 218; __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[5]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("tseries.roll_var"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __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[5]; __pyx_lineno = 217; __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[5]; __pyx_lineno = 217; __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]; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":219 - * 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.0; - __pyx_v_sum_xx = 0.0; - __pyx_v_nobs = 0.0; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":221 - * 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 *)__pyx_v_input); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_N = __pyx_t_2; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":223 - * cdef int N = len(input) - * - * cdef ndarray[double_t, ndim=1] output = np.empty(N, dtype=float) # <<<<<<<<<<<<<< - * - * if minp > N: - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 223; __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 = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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 = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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[5]; __pyx_lineno = 223; __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[5]; __pyx_lineno = 223; __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":225 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":226 - * - * 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:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":228 - * 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++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":229 - * - * 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[5]; __pyx_lineno = 229; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":232 - * - * # Not NaN - * if val == val: # <<<<<<<<<<<<<< - * nobs += 1 - * sum_x += val - */ - __pyx_t_7 = (__pyx_v_val == __pyx_v_val); - if (__pyx_t_7) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":233 - * # Not NaN - * if val == val: - * nobs += 1 # <<<<<<<<<<<<<< - * sum_x += val - * sum_xx += val * val - */ - __pyx_v_nobs = (__pyx_v_nobs + 1.0); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":234 - * if val == val: - * nobs += 1 - * sum_x += val # <<<<<<<<<<<<<< - * sum_xx += val * val - * - */ - __pyx_v_sum_x = (__pyx_v_sum_x + __pyx_v_val); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":235 - * nobs += 1 - * sum_x += val - * sum_xx += val * val # <<<<<<<<<<<<<< - * - * output[i] = NaN - */ - __pyx_v_sum_xx = (__pyx_v_sum_xx + (__pyx_v_val * __pyx_v_val)); - goto __pyx_L9; - } - __pyx_L9:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":237 - * 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[5]; __pyx_lineno = 237; __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; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":239 - * 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++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":240 - * - * 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[5]; __pyx_lineno = 240; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":242 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":243 - * - * 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[5]; __pyx_lineno = 243; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":244 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":245 - * prev = input[i - win] - * if prev == prev: - * sum_x -= prev # <<<<<<<<<<<<<< - * sum_xx -= prev * prev - * nobs -= 1 - */ - __pyx_v_sum_x = (__pyx_v_sum_x - __pyx_v_prev); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":246 - * if prev == prev: - * sum_x -= prev - * sum_xx -= prev * prev # <<<<<<<<<<<<<< - * nobs -= 1 - * - */ - __pyx_v_sum_xx = (__pyx_v_sum_xx - (__pyx_v_prev * __pyx_v_prev)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":247 - * sum_x -= prev - * sum_xx -= prev * prev - * nobs -= 1 # <<<<<<<<<<<<<< - * - * if val == val: - */ - __pyx_v_nobs = (__pyx_v_nobs - 1.0); - goto __pyx_L13; - } - __pyx_L13:; - goto __pyx_L12; - } - __pyx_L12:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":249 - * nobs -= 1 - * - * if val == val: # <<<<<<<<<<<<<< - * nobs += 1 - * sum_x += val - */ - __pyx_t_7 = (__pyx_v_val == __pyx_v_val); - if (__pyx_t_7) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":250 - * - * if val == val: - * nobs += 1 # <<<<<<<<<<<<<< - * sum_x += val - * sum_xx += val * val - */ - __pyx_v_nobs = (__pyx_v_nobs + 1.0); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":251 - * if val == val: - * nobs += 1 - * sum_x += val # <<<<<<<<<<<<<< - * sum_xx += val * val - * - */ - __pyx_v_sum_x = (__pyx_v_sum_x + __pyx_v_val); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":252 - * nobs += 1 - * sum_x += val - * sum_xx += val * val # <<<<<<<<<<<<<< - * - * if nobs >= minp: - */ - __pyx_v_sum_xx = (__pyx_v_sum_xx + (__pyx_v_val * __pyx_v_val)); - goto __pyx_L14; - } - __pyx_L14:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":254 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":255 - * - * 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[5]; __pyx_lineno = 255; __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[5]; __pyx_lineno = 255; __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*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":257 - * 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[5]; __pyx_lineno = 257; __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:; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":259 - * 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_1); - __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_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":264 - * # Rolling skewness - * - * def roll_skew(ndarray[double_t, ndim=1] input, # <<<<<<<<<<<<<< - * int win, int minp): - * cdef double val, prev - */ - -static PyObject *__pyx_pf_7tseries_14roll_skew(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7tseries_14roll_skew = {__Pyx_NAMESTR("roll_skew"), (PyCFunction)__pyx_pf_7tseries_14roll_skew, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7tseries_14roll_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; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - 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[5]; __pyx_lineno = 264; __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[5]; __pyx_lineno = 264; __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[5]; __pyx_lineno = 264; __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[5]; __pyx_lineno = 265; __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[5]; __pyx_lineno = 265; __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[5]; __pyx_lineno = 265; __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[5]; __pyx_lineno = 265; __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[5]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("tseries.roll_skew"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __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[5]; __pyx_lineno = 264; __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[5]; __pyx_lineno = 264; __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]; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":267 - * 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.0; - __pyx_v_xx = 0.0; - __pyx_v_xxx = 0.0; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":268 - * 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; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":269 - * 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 *)__pyx_v_input); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_N = __pyx_t_2; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":271 - * 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_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 271; __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 = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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 = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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[5]; __pyx_lineno = 271; __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[5]; __pyx_lineno = 271; __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":276 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":277 - * - * 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:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":279 - * 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++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":280 - * - * 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[5]; __pyx_lineno = 280; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":283 - * - * # Not NaN - * if val == val: # <<<<<<<<<<<<<< - * nobs += 1 - * x += val - */ - __pyx_t_7 = (__pyx_v_val == __pyx_v_val); - if (__pyx_t_7) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":284 - * # Not NaN - * if val == val: - * nobs += 1 # <<<<<<<<<<<<<< - * x += val - * xx += val * val - */ - __pyx_v_nobs = (__pyx_v_nobs + 1); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":285 - * if val == val: - * nobs += 1 - * x += val # <<<<<<<<<<<<<< - * xx += val * val - * xxx += val * val * val - */ - __pyx_v_x = (__pyx_v_x + __pyx_v_val); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":286 - * nobs += 1 - * x += val - * xx += val * val # <<<<<<<<<<<<<< - * xxx += val * val * val - * - */ - __pyx_v_xx = (__pyx_v_xx + (__pyx_v_val * __pyx_v_val)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":287 - * x += val - * xx += val * val - * xxx += val * val * val # <<<<<<<<<<<<<< - * - * output[i] = NaN - */ - __pyx_v_xxx = (__pyx_v_xxx + ((__pyx_v_val * __pyx_v_val) * __pyx_v_val)); - goto __pyx_L9; - } - __pyx_L9:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":289 - * 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[5]; __pyx_lineno = 289; __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; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":291 - * 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++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":292 - * - * 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[5]; __pyx_lineno = 292; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":294 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":295 - * - * 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[5]; __pyx_lineno = 295; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":296 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":297 - * prev = input[i - win] - * if prev == prev: - * x -= prev # <<<<<<<<<<<<<< - * xx -= prev * prev - * xxx -= prev * prev * prev - */ - __pyx_v_x = (__pyx_v_x - __pyx_v_prev); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":298 - * if prev == prev: - * x -= prev - * xx -= prev * prev # <<<<<<<<<<<<<< - * xxx -= prev * prev * prev - * - */ - __pyx_v_xx = (__pyx_v_xx - (__pyx_v_prev * __pyx_v_prev)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":299 - * x -= prev - * xx -= prev * prev - * xxx -= prev * prev * prev # <<<<<<<<<<<<<< - * - * nobs -= 1 - */ - __pyx_v_xxx = (__pyx_v_xxx - ((__pyx_v_prev * __pyx_v_prev) * __pyx_v_prev)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":301 - * xxx -= prev * prev * prev - * - * nobs -= 1 # <<<<<<<<<<<<<< - * - * if val == val: - */ - __pyx_v_nobs = (__pyx_v_nobs - 1); - goto __pyx_L13; - } - __pyx_L13:; - goto __pyx_L12; - } - __pyx_L12:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":303 - * nobs -= 1 - * - * if val == val: # <<<<<<<<<<<<<< - * nobs += 1 - * x += val - */ - __pyx_t_7 = (__pyx_v_val == __pyx_v_val); - if (__pyx_t_7) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":304 - * - * if val == val: - * nobs += 1 # <<<<<<<<<<<<<< - * x += val - * xx += val * val - */ - __pyx_v_nobs = (__pyx_v_nobs + 1); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":305 - * if val == val: - * nobs += 1 - * x += val # <<<<<<<<<<<<<< - * xx += val * val - * xxx += val * val * val - */ - __pyx_v_x = (__pyx_v_x + __pyx_v_val); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":306 - * nobs += 1 - * x += val - * xx += val * val # <<<<<<<<<<<<<< - * xxx += val * val * val - * - */ - __pyx_v_xx = (__pyx_v_xx + (__pyx_v_val * __pyx_v_val)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":307 - * x += val - * xx += val * val - * xxx += val * val * val # <<<<<<<<<<<<<< - * - * if nobs >= minp: - */ - __pyx_v_xxx = (__pyx_v_xxx + ((__pyx_v_val * __pyx_v_val) * __pyx_v_val)); - goto __pyx_L14; - } - __pyx_L14:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":309 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":310 - * - * 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[5]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_A = (__pyx_v_x / __pyx_v_nobs); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":311 - * 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[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_B = ((__pyx_v_xx / __pyx_v_nobs) - (__pyx_v_A * __pyx_v_A)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":312 - * 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[5]; __pyx_lineno = 312; __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.0 * __pyx_v_A) * __pyx_v_B)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":314 - * 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); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":316 - * 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.))) * __pyx_v_C); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":317 - * - * 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[5]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":316 - * 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[5]; __pyx_lineno = 316; __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*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":319 - * ((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[5]; __pyx_lineno = 319; __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:; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":321 - * 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_1); - __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_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":327 - * - * - * def roll_kurt(ndarray[double_t, ndim=1] input, # <<<<<<<<<<<<<< - * int win, int minp): - * cdef double val, prev - */ - -static PyObject *__pyx_pf_7tseries_15roll_kurt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7tseries_15roll_kurt = {__Pyx_NAMESTR("roll_kurt"), (PyCFunction)__pyx_pf_7tseries_15roll_kurt, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7tseries_15roll_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; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - 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[5]; __pyx_lineno = 327; __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[5]; __pyx_lineno = 327; __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[5]; __pyx_lineno = 327; __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[5]; __pyx_lineno = 328; __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[5]; __pyx_lineno = 328; __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[5]; __pyx_lineno = 328; __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[5]; __pyx_lineno = 328; __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[5]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("tseries.roll_kurt"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __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[5]; __pyx_lineno = 327; __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[5]; __pyx_lineno = 327; __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]; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":330 - * 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.0; - __pyx_v_xx = 0.0; - __pyx_v_xxx = 0.0; - __pyx_v_xxxx = 0.0; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":331 - * 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; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":332 - * 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 *)__pyx_v_input); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_N = __pyx_t_2; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":334 - * 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_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 334; __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 = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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 = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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[5]; __pyx_lineno = 334; __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[5]; __pyx_lineno = 334; __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":339 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":340 - * - * 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:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":342 - * 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++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":343 - * - * 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[5]; __pyx_lineno = 343; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":346 - * - * # Not NaN - * if val == val: # <<<<<<<<<<<<<< - * nobs += 1 - * - */ - __pyx_t_7 = (__pyx_v_val == __pyx_v_val); - if (__pyx_t_7) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":347 - * # Not NaN - * if val == val: - * nobs += 1 # <<<<<<<<<<<<<< - * - * # seriously don't ask me why this is faster - */ - __pyx_v_nobs = (__pyx_v_nobs + 1); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":350 - * - * # seriously don't ask me why this is faster - * x += val # <<<<<<<<<<<<<< - * xx += val * val - * xxx += val * val * val - */ - __pyx_v_x = (__pyx_v_x + __pyx_v_val); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":351 - * # 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_xx + (__pyx_v_val * __pyx_v_val)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":352 - * x += val - * xx += val * val - * xxx += val * val * val # <<<<<<<<<<<<<< - * xxxx += val * val * val * val - * - */ - __pyx_v_xxx = (__pyx_v_xxx + ((__pyx_v_val * __pyx_v_val) * __pyx_v_val)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":353 - * xx += val * val - * xxx += val * val * val - * xxxx += val * val * val * val # <<<<<<<<<<<<<< - * - * output[i] = NaN - */ - __pyx_v_xxxx = (__pyx_v_xxxx + (((__pyx_v_val * __pyx_v_val) * __pyx_v_val) * __pyx_v_val)); - goto __pyx_L9; - } - __pyx_L9:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":355 - * 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[5]; __pyx_lineno = 355; __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; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":357 - * 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++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":358 - * - * 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[5]; __pyx_lineno = 358; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":360 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":361 - * - * 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[5]; __pyx_lineno = 361; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":362 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":363 - * prev = input[i - win] - * if prev == prev: - * x -= prev # <<<<<<<<<<<<<< - * xx -= prev * prev - * xxx -= prev * prev * prev - */ - __pyx_v_x = (__pyx_v_x - __pyx_v_prev); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":364 - * if prev == prev: - * x -= prev - * xx -= prev * prev # <<<<<<<<<<<<<< - * xxx -= prev * prev * prev - * xxxx -= prev * prev * prev * prev - */ - __pyx_v_xx = (__pyx_v_xx - (__pyx_v_prev * __pyx_v_prev)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":365 - * x -= prev - * xx -= prev * prev - * xxx -= prev * prev * prev # <<<<<<<<<<<<<< - * xxxx -= prev * prev * prev * prev - * - */ - __pyx_v_xxx = (__pyx_v_xxx - ((__pyx_v_prev * __pyx_v_prev) * __pyx_v_prev)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":366 - * xx -= prev * prev - * xxx -= prev * prev * prev - * xxxx -= prev * prev * prev * prev # <<<<<<<<<<<<<< - * - * nobs -= 1 - */ - __pyx_v_xxxx = (__pyx_v_xxxx - (((__pyx_v_prev * __pyx_v_prev) * __pyx_v_prev) * __pyx_v_prev)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":368 - * xxxx -= prev * prev * prev * prev - * - * nobs -= 1 # <<<<<<<<<<<<<< - * - * if val == val: - */ - __pyx_v_nobs = (__pyx_v_nobs - 1); - goto __pyx_L13; - } - __pyx_L13:; - goto __pyx_L12; - } - __pyx_L12:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":370 - * nobs -= 1 - * - * if val == val: # <<<<<<<<<<<<<< - * nobs += 1 - * x += val - */ - __pyx_t_7 = (__pyx_v_val == __pyx_v_val); - if (__pyx_t_7) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":371 - * - * if val == val: - * nobs += 1 # <<<<<<<<<<<<<< - * x += val - * xx += val * val - */ - __pyx_v_nobs = (__pyx_v_nobs + 1); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":372 - * if val == val: - * nobs += 1 - * x += val # <<<<<<<<<<<<<< - * xx += val * val - * xxx += val * val * val - */ - __pyx_v_x = (__pyx_v_x + __pyx_v_val); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":373 - * nobs += 1 - * x += val - * xx += val * val # <<<<<<<<<<<<<< - * xxx += val * val * val - * xxxx += val * val * val * val - */ - __pyx_v_xx = (__pyx_v_xx + (__pyx_v_val * __pyx_v_val)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":374 - * x += val - * xx += val * val - * xxx += val * val * val # <<<<<<<<<<<<<< - * xxxx += val * val * val * val - * - */ - __pyx_v_xxx = (__pyx_v_xxx + ((__pyx_v_val * __pyx_v_val) * __pyx_v_val)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":375 - * xx += val * val - * xxx += val * val * val - * xxxx += val * val * val * val # <<<<<<<<<<<<<< - * - * if nobs >= minp: - */ - __pyx_v_xxxx = (__pyx_v_xxxx + (((__pyx_v_val * __pyx_v_val) * __pyx_v_val) * __pyx_v_val)); - goto __pyx_L14; - } - __pyx_L14:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":377 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":378 - * - * 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[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_A = (__pyx_v_x / __pyx_v_nobs); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":379 - * 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); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":380 - * 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[5]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_B = ((__pyx_v_xx / __pyx_v_nobs) - __pyx_v_R); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":381 - * 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); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":382 - * 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[5]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_C = (((__pyx_v_xxx / __pyx_v_nobs) - __pyx_v_R) - ((3.0 * __pyx_v_A) * __pyx_v_B)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":383 - * 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); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":384 - * 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[5]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_D = ((((__pyx_v_xxxx / __pyx_v_nobs) - __pyx_v_R) - (((6.0 * __pyx_v_B) * __pyx_v_A) * __pyx_v_A)) - ((4.0 * __pyx_v_C) * __pyx_v_A)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":386 - * 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.) * __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[5]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_K = ((__pyx_t_15 / __pyx_t_16) - (3.0 * pow((__pyx_v_nobs - 1.), 2.0))); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":387 - * - * 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.) * (__pyx_v_nobs - 3.)); - if (unlikely(__pyx_t_16 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_K = (__pyx_v_K / __pyx_t_16); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":389 - * 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[5]; __pyx_lineno = 389; __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*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":391 - * 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[5]; __pyx_lineno = 391; __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:; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":393 - * 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_1); - __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_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":400 - * ctypedef double_t (* skiplist_f)(object sl, int n, int p) - * - * cdef _roll_skiplist_op(ndarray arg, int win, int minp, skiplist_f op): # <<<<<<<<<<<<<< - * cdef ndarray[double_t, ndim=1] input = arg - * cdef double val, prev, midpoint - */ - -static PyObject *__pyx_f_7tseries__roll_skiplist_op(PyArrayObject *__pyx_v_arg, int __pyx_v_win, int __pyx_v_minp, __pyx_t_7tseries_skiplist_f __pyx_v_op) { - PyArrayObject *__pyx_v_input = 0; - double __pyx_v_val; - double __pyx_v_prev; - 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; - int __pyx_t_15; - __Pyx_RefNannySetupContext("_roll_skiplist_op"); - __pyx_v_skiplist = ((struct __pyx_obj_7tseries_IndexableSkiplist *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_input.buf = NULL; - __pyx_bstruct_output.buf = NULL; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":401 - * - * cdef _roll_skiplist_op(ndarray arg, int win, int minp, skiplist_f op): - * cdef ndarray[double_t, ndim=1] input = arg # <<<<<<<<<<<<<< - * cdef double val, prev, midpoint - * cdef IndexableSkiplist skiplist - */ - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_input, (PyObject*)((PyArrayObject *)__pyx_v_arg), &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_input = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_input.buf = NULL; - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_input = __pyx_bstruct_input.strides[0]; - __pyx_bshape_0_input = __pyx_bstruct_input.shape[0]; - } - } - __Pyx_INCREF(((PyObject *)__pyx_v_arg)); - __pyx_v_input = ((PyArrayObject *)__pyx_v_arg); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":404 - * cdef double val, prev, midpoint - * cdef IndexableSkiplist skiplist - * cdef int nobs = 0, i # <<<<<<<<<<<<<< - * - * cdef int N = len(input) - */ - __pyx_v_nobs = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":406 - * 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[5]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_N = __pyx_t_1; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":407 - * - * 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[5]; __pyx_lineno = 407; __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 = 407; __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[5]; __pyx_lineno = 407; __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 = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __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[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __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[5]; __pyx_lineno = 407; __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":409 - * 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[5]; __pyx_lineno = 409; __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[5]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__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; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":411 - * skiplist = IndexableSkiplist(win) - * - * if minp > N: # <<<<<<<<<<<<<< - * minp = N + 1 - * - */ - __pyx_t_7 = (__pyx_v_minp > __pyx_v_N); - if (__pyx_t_7) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":412 - * - * if minp > N: - * minp = N + 1 # <<<<<<<<<<<<<< - * - * for i from 0 <= i < minp - 1: - */ - __pyx_v_minp = (__pyx_v_N + 1); - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":414 - * 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++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":415 - * - * 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[5]; __pyx_lineno = 415; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":418 - * - * # Not NaN - * if val == val: # <<<<<<<<<<<<<< - * nobs += 1 - * skiplist.insert(val) - */ - __pyx_t_7 = (__pyx_v_val == __pyx_v_val); - if (__pyx_t_7) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":419 - * # Not NaN - * if val == val: - * nobs += 1 # <<<<<<<<<<<<<< - * skiplist.insert(val) - * - */ - __pyx_v_nobs = (__pyx_v_nobs + 1); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":420 - * if val == val: - * nobs += 1 - * skiplist.insert(val) # <<<<<<<<<<<<<< - * - * output[i] = NaN - */ - __pyx_t_5 = ((struct __pyx_vtabstruct_7tseries_IndexableSkiplist *)__pyx_v_skiplist->__pyx_vtab)->insert(__pyx_v_skiplist, __pyx_v_val, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":422 - * 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[5]; __pyx_lineno = 422; __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; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":424 - * 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++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":425 - * - * 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[5]; __pyx_lineno = 425; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":427 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":428 - * - * 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[5]; __pyx_lineno = 428; __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)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":430 - * 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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":431 - * - * if prev == prev: - * skiplist.remove(prev) # <<<<<<<<<<<<<< - * nobs -= 1 - * - */ - __pyx_t_5 = ((struct __pyx_vtabstruct_7tseries_IndexableSkiplist *)__pyx_v_skiplist->__pyx_vtab)->remove(__pyx_v_skiplist, __pyx_v_prev, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":432 - * if prev == prev: - * skiplist.remove(prev) - * nobs -= 1 # <<<<<<<<<<<<<< - * - * if val == val: - */ - __pyx_v_nobs = (__pyx_v_nobs - 1); - goto __pyx_L10; - } - __pyx_L10:; - goto __pyx_L9; - } - __pyx_L9:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":434 - * nobs -= 1 - * - * if val == val: # <<<<<<<<<<<<<< - * nobs += 1 - * skiplist.insert(val) - */ - __pyx_t_7 = (__pyx_v_val == __pyx_v_val); - if (__pyx_t_7) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":435 - * - * if val == val: - * nobs += 1 # <<<<<<<<<<<<<< - * skiplist.insert(val) - * - */ - __pyx_v_nobs = (__pyx_v_nobs + 1); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":436 - * if val == val: - * nobs += 1 - * skiplist.insert(val) # <<<<<<<<<<<<<< - * - * output[i] = op(skiplist, nobs, minp) - */ - __pyx_t_5 = ((struct __pyx_vtabstruct_7tseries_IndexableSkiplist *)__pyx_v_skiplist->__pyx_vtab)->insert(__pyx_v_skiplist, __pyx_v_val, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L11; - } - __pyx_L11:; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":438 - * skiplist.insert(val) - * - * output[i] = op(skiplist, nobs, minp) # <<<<<<<<<<<<<< - * - * return output - */ - __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[5]; __pyx_lineno = 438; __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_op(((PyObject *)__pyx_v_skiplist), __pyx_v_nobs, __pyx_v_minp); - } - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":440 - * output[i] = op(skiplist, nobs, minp) - * - * return output # <<<<<<<<<<<<<< - * - * def roll_median(ndarray input, int win, int minp): - */ - __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_skiplist_op"); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_input); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_input); - __Pyx_DECREF((PyObject *)__pyx_v_skiplist); - __Pyx_XDECREF((PyObject *)__pyx_v_output); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":442 - * return output - * - * def roll_median(ndarray input, int win, int minp): # <<<<<<<<<<<<<< - * ''' - * O(N log(window)) implementation using skip list - */ - -static PyObject *__pyx_pf_7tseries_16roll_median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7tseries_16roll_median[] = "\n O(N log(window)) implementation using skip list\n "; -static PyMethodDef __pyx_mdef_7tseries_16roll_median = {__Pyx_NAMESTR("roll_median"), (PyCFunction)__pyx_pf_7tseries_16roll_median, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7tseries_16roll_median)}; -static PyObject *__pyx_pf_7tseries_16roll_median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_input = 0; - int __pyx_v_win; - int __pyx_v_minp; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - 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[5]; __pyx_lineno = 442; __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[5]; __pyx_lineno = 442; __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[5]; __pyx_lineno = 442; __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[5]; __pyx_lineno = 442; __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[5]; __pyx_lineno = 442; __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[5]; __pyx_lineno = 442; __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[5]; __pyx_lineno = 442; __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[5]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("tseries.roll_median"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":446 - * O(N log(window)) implementation using skip list - * ''' - * return _roll_skiplist_op(input, win, minp, _get_median) # <<<<<<<<<<<<<< - * - * def roll_max(ndarray input, int win, int minp): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_input); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_7tseries__roll_skiplist_op(((PyArrayObject *)__pyx_t_1), __pyx_v_win, __pyx_v_minp, __pyx_f_7tseries__get_median); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("tseries.roll_median"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":448 - * return _roll_skiplist_op(input, win, minp, _get_median) - * - * def roll_max(ndarray input, int win, int minp): # <<<<<<<<<<<<<< - * ''' - * O(N log(window)) implementation using skip list - */ - -static PyObject *__pyx_pf_7tseries_17roll_max(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7tseries_17roll_max[] = "\n O(N log(window)) implementation using skip list\n "; -static PyMethodDef __pyx_mdef_7tseries_17roll_max = {__Pyx_NAMESTR("roll_max"), (PyCFunction)__pyx_pf_7tseries_17roll_max, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7tseries_17roll_max)}; -static PyObject *__pyx_pf_7tseries_17roll_max(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_input = 0; - int __pyx_v_win; - int __pyx_v_minp; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__win,&__pyx_n_s__minp,0}; - __Pyx_RefNannySetupContext("roll_max"); - __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_max", 1, 3, 3, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 448; __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_max", 1, 3, 3, 2); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 448; __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[5]; __pyx_lineno = 448; __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[5]; __pyx_lineno = 448; __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[5]; __pyx_lineno = 448; __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[5]; __pyx_lineno = 448; __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[5]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("roll_max", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("tseries.roll_max"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":452 - * O(N log(window)) implementation using skip list - * ''' - * return _roll_skiplist_op(input, win, minp, _get_max) # <<<<<<<<<<<<<< - * - * def roll_min(ndarray input, int win, int minp): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_input); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_7tseries__roll_skiplist_op(((PyArrayObject *)__pyx_t_1), __pyx_v_win, __pyx_v_minp, __pyx_f_7tseries__get_max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("tseries.roll_max"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":454 - * return _roll_skiplist_op(input, win, minp, _get_max) - * - * def roll_min(ndarray input, int win, int minp): # <<<<<<<<<<<<<< - * ''' - * O(N log(window)) implementation using skip list - */ - -static PyObject *__pyx_pf_7tseries_18roll_min(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7tseries_18roll_min[] = "\n O(N log(window)) implementation using skip list\n "; -static PyMethodDef __pyx_mdef_7tseries_18roll_min = {__Pyx_NAMESTR("roll_min"), (PyCFunction)__pyx_pf_7tseries_18roll_min, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7tseries_18roll_min)}; -static PyObject *__pyx_pf_7tseries_18roll_min(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_input = 0; - int __pyx_v_win; - int __pyx_v_minp; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__win,&__pyx_n_s__minp,0}; - __Pyx_RefNannySetupContext("roll_min"); - __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_min", 1, 3, 3, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 454; __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_min", 1, 3, 3, 2); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 454; __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[5]; __pyx_lineno = 454; __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[5]; __pyx_lineno = 454; __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[5]; __pyx_lineno = 454; __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[5]; __pyx_lineno = 454; __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[5]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("roll_min", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("tseries.roll_min"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":458 - * O(N log(window)) implementation using skip list - * ''' - * return _roll_skiplist_op(input, win, minp, _get_min) # <<<<<<<<<<<<<< - * - * # Unfortunately had to resort to some hackery here, would like for - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_input); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_7tseries__roll_skiplist_op(((PyArrayObject *)__pyx_t_1), __pyx_v_win, __pyx_v_minp, __pyx_f_7tseries__get_min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("tseries.roll_min"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":463 - * # Cython to be able to get this right. - * - * cdef double_t _get_median(object sl, int nobs, int minp): # <<<<<<<<<<<<<< - * cdef int midpoint - * cdef IndexableSkiplist skiplist = sl - */ - -static __pyx_t_5numpy_double_t __pyx_f_7tseries__get_median(PyObject *__pyx_v_sl, int __pyx_v_nobs, int __pyx_v_minp) { - int __pyx_v_midpoint; - struct __pyx_obj_7tseries_IndexableSkiplist *__pyx_v_skiplist = 0; - __pyx_t_5numpy_double_t __pyx_r; - int __pyx_t_1; - long __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - __pyx_t_5numpy_double_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("_get_median"); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":465 - * cdef double_t _get_median(object sl, int nobs, int minp): - * cdef int midpoint - * cdef IndexableSkiplist skiplist = sl # <<<<<<<<<<<<<< - * if nobs >= minp: - * midpoint = nobs / 2 - */ - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_sl))); - __pyx_v_skiplist = ((struct __pyx_obj_7tseries_IndexableSkiplist *)__pyx_v_sl); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":466 - * cdef int midpoint - * cdef IndexableSkiplist skiplist = sl - * if nobs >= minp: # <<<<<<<<<<<<<< - * midpoint = nobs / 2 - * if nobs % 2: - */ - __pyx_t_1 = (__pyx_v_nobs >= __pyx_v_minp); - if (__pyx_t_1) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":467 - * cdef IndexableSkiplist skiplist = sl - * if nobs >= minp: - * midpoint = nobs / 2 # <<<<<<<<<<<<<< - * if nobs % 2: - * return skiplist.get(midpoint) - */ - __pyx_v_midpoint = __Pyx_div_long(__pyx_v_nobs, 2); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":468 - * if nobs >= minp: - * midpoint = nobs / 2 - * if nobs % 2: # <<<<<<<<<<<<<< - * return skiplist.get(midpoint) - * else: - */ - __pyx_t_2 = __Pyx_mod_long(__pyx_v_nobs, 2); - if (__pyx_t_2) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":469 - * midpoint = nobs / 2 - * if nobs % 2: - * return skiplist.get(midpoint) # <<<<<<<<<<<<<< - * else: - * return (skiplist.get(midpoint) + - */ - __pyx_t_3 = ((struct __pyx_vtabstruct_7tseries_IndexableSkiplist *)__pyx_v_skiplist->__pyx_vtab)->get(__pyx_v_skiplist, __pyx_v_midpoint, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; - goto __pyx_L0; - goto __pyx_L4; - } - /*else*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":471 - * return skiplist.get(midpoint) - * else: - * return (skiplist.get(midpoint) + # <<<<<<<<<<<<<< - * skiplist.get(midpoint - 1)) / 2 - * else: - */ - __pyx_t_3 = ((struct __pyx_vtabstruct_7tseries_IndexableSkiplist *)__pyx_v_skiplist->__pyx_vtab)->get(__pyx_v_skiplist, __pyx_v_midpoint, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":472 - * else: - * return (skiplist.get(midpoint) + - * skiplist.get(midpoint - 1)) / 2 # <<<<<<<<<<<<<< - * else: - * return NaN - */ - __pyx_t_5 = ((struct __pyx_vtabstruct_7tseries_IndexableSkiplist *)__pyx_v_skiplist->__pyx_vtab)->get(__pyx_v_skiplist, (__pyx_v_midpoint - 1), 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 471; __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_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_int_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_4 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_r = __pyx_t_4; - goto __pyx_L0; - } - __pyx_L4:; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":474 - * skiplist.get(midpoint - 1)) / 2 - * else: - * return NaN # <<<<<<<<<<<<<< - * - * cdef double_t _get_max(object skiplist, int nobs, int minp): - */ - __pyx_r = __pyx_v_7tseries_NaN; - goto __pyx_L0; - } - __pyx_L3:; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_WriteUnraisable("tseries._get_median"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_skiplist); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":476 - * return NaN - * - * cdef double_t _get_max(object skiplist, int nobs, int minp): # <<<<<<<<<<<<<< - * if nobs >= minp: - * return skiplist.get(nobs - 1) - */ - -static __pyx_t_5numpy_double_t __pyx_f_7tseries__get_max(PyObject *__pyx_v_skiplist, int __pyx_v_nobs, int __pyx_v_minp) { - __pyx_t_5numpy_double_t __pyx_r; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __pyx_t_5numpy_double_t __pyx_t_5; - __Pyx_RefNannySetupContext("_get_max"); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":477 - * - * cdef double_t _get_max(object skiplist, int nobs, int minp): - * if nobs >= minp: # <<<<<<<<<<<<<< - * return skiplist.get(nobs - 1) - * else: - */ - __pyx_t_1 = (__pyx_v_nobs >= __pyx_v_minp); - if (__pyx_t_1) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":478 - * cdef double_t _get_max(object skiplist, int nobs, int minp): - * if nobs >= minp: - * return skiplist.get(nobs - 1) # <<<<<<<<<<<<<< - * else: - * return NaN - */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_skiplist, __pyx_n_s__get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromLong((__pyx_v_nobs - 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 478; __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[5]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_5; - goto __pyx_L0; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":480 - * return skiplist.get(nobs - 1) - * else: - * return NaN # <<<<<<<<<<<<<< - * - * cdef double_t _get_min(object skiplist, int nobs, int minp): - */ - __pyx_r = __pyx_v_7tseries_NaN; - goto __pyx_L0; - } - __pyx_L3:; - - __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_WriteUnraisable("tseries._get_max"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":482 - * return NaN - * - * cdef double_t _get_min(object skiplist, int nobs, int minp): # <<<<<<<<<<<<<< - * if nobs >= minp: - * return skiplist.get(0) - */ - -static __pyx_t_5numpy_double_t __pyx_f_7tseries__get_min(PyObject *__pyx_v_skiplist, int __pyx_v_nobs, int __pyx_v_minp) { - __pyx_t_5numpy_double_t __pyx_r; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __pyx_t_5numpy_double_t __pyx_t_4; - __Pyx_RefNannySetupContext("_get_min"); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":483 - * - * cdef double_t _get_min(object skiplist, int nobs, int minp): - * if nobs >= minp: # <<<<<<<<<<<<<< - * return skiplist.get(0) - * else: - */ - __pyx_t_1 = (__pyx_v_nobs >= __pyx_v_minp); - if (__pyx_t_1) { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":484 - * cdef double_t _get_min(object skiplist, int nobs, int minp): - * if nobs >= minp: - * return skiplist.get(0) # <<<<<<<<<<<<<< - * else: - * return NaN - */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_skiplist, __pyx_n_s__get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; - goto __pyx_L0; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":486 - * return skiplist.get(0) - * else: - * return NaN # <<<<<<<<<<<<<< - */ - __pyx_r = __pyx_v_7tseries_NaN; - goto __pyx_L0; - } - __pyx_L3:; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_WriteUnraisable("tseries._get_min"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":1 - * def getFillVec(ndarray oldIndex, ndarray newIndex, dict oldMap, dict newMap, # <<<<<<<<<<<<<< - * kind=None): - * - */ - -static PyObject *__pyx_pf_7tseries_19getFillVec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7tseries_19getFillVec = {__Pyx_NAMESTR("getFillVec"), (PyCFunction)__pyx_pf_7tseries_19getFillVec, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7tseries_19getFillVec(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}; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":2 - * def getFillVec(ndarray oldIndex, ndarray newIndex, dict oldMap, dict newMap, - * kind=None): # <<<<<<<<<<<<<< - * - * if kind is None: - */ - values[4] = ((PyObject *)Py_None); - 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", 0, 4, 5, 1); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1; __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", 0, 4, 5, 2); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1; __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", 0, 4, 5, 3); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__kind); - if (value) { values[4] = value; kw_args--; } - } - } - 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[6]; __pyx_lineno = 1; __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 { - __pyx_v_kind = ((PyObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: - __pyx_v_kind = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: - __pyx_v_newMap = ((PyObject*)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_oldMap = ((PyObject*)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_newIndex = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_oldIndex = ((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("getFillVec", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("tseries.getFillVec"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __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[6]; __pyx_lineno = 1; __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[6]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_oldMap), (&PyDict_Type), 1, "oldMap", 1))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_newMap), (&PyDict_Type), 1, "newMap", 1))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":4 - * kind=None): - * - * if kind is None: # <<<<<<<<<<<<<< - * fillVec, maskVec = getMergeVec(newIndex, oldMap) - * elif kind == 'PAD': - */ - __pyx_t_1 = (__pyx_v_kind == Py_None); - if (__pyx_t_1) { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":5 - * - * 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[6]; __pyx_lineno = 5; __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[6]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__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[6]; __pyx_lineno = 5; __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[6]; __pyx_lineno = 5; __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[6]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_EndUnpack(__pyx_t_5, 2) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 5; __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; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":6 - * 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[6]; __pyx_lineno = 6; __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[6]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_1) { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":7 - * 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 = __Pyx_GetName(__pyx_m, __pyx_n_s___pad); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)__pyx_v_oldIndex)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_oldIndex)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_oldIndex)); - __Pyx_INCREF(((PyObject *)__pyx_v_newIndex)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_newIndex)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_newIndex)); - __Pyx_INCREF(((PyObject *)__pyx_v_oldMap)); - PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_oldMap)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_oldMap)); - __Pyx_INCREF(((PyObject *)__pyx_v_newMap)); - PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_newMap)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_newMap)); - __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) { - PyObject* tuple = __pyx_t_3; - __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2); - __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_4; - __pyx_t_4 = 0; - } else { - __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __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_2 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_EndUnpack(__pyx_t_5, 2) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 7; __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_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_maskVec); - __pyx_v_maskVec = __pyx_t_4; - __pyx_t_4 = 0; - } - goto __pyx_L6; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":8 - * elif kind == 'PAD': - * fillVec, maskVec = _pad(oldIndex, newIndex, oldMap, newMap) - * elif kind == 'BACKFILL': # <<<<<<<<<<<<<< - * fillVec, maskVec = _backfill(oldIndex, newIndex, oldMap, newMap) - * else: - */ - __pyx_t_3 = PyObject_RichCompare(__pyx_v_kind, ((PyObject *)__pyx_n_s__BACKFILL), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_1) { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":9 - * fillVec, maskVec = _pad(oldIndex, newIndex, oldMap, newMap) - * elif kind == 'BACKFILL': - * fillVec, maskVec = _backfill(oldIndex, newIndex, oldMap, newMap) # <<<<<<<<<<<<<< - * else: - * raise Exception("Don't recognize method: %s" % kind) - */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s___backfill); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_INCREF(((PyObject *)__pyx_v_oldIndex)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_oldIndex)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_oldIndex)); - __Pyx_INCREF(((PyObject *)__pyx_v_newIndex)); - PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_newIndex)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_newIndex)); - __Pyx_INCREF(((PyObject *)__pyx_v_oldMap)); - PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_v_oldMap)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_oldMap)); - __Pyx_INCREF(((PyObject *)__pyx_v_newMap)); - PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)__pyx_v_newMap)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_newMap)); - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) { - PyObject* tuple = __pyx_t_2; - __pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_fillVec); - __pyx_v_fillVec = __pyx_t_4; - __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_maskVec); - __pyx_v_maskVec = __pyx_t_3; - __pyx_t_3 = 0; - } else { - __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_EndUnpack(__pyx_t_5, 2) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 9; __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_4; - __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_maskVec); - __pyx_v_maskVec = __pyx_t_3; - __pyx_t_3 = 0; - } - goto __pyx_L6; - } - /*else*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":11 - * fillVec, maskVec = _backfill(oldIndex, newIndex, oldMap, newMap) - * else: - * raise Exception("Don't recognize method: %s" % kind) # <<<<<<<<<<<<<< - * - * return fillVec, maskVec.astype(np.bool) - */ - __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), __pyx_v_kind); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[6]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L6:; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":13 - * raise Exception("Don't recognize method: %s" % kind) - * - * return fillVec, maskVec.astype(np.bool) # <<<<<<<<<<<<<< - * - * @cython.wraparound(False) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyObject_GetAttr(__pyx_v_maskVec, __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__bool); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __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[6]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_INCREF(__pyx_v_fillVec); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fillVec); - __Pyx_GIVEREF(__pyx_v_fillVec); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_r = ((PyObject *)__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_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_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":16 - * - * @cython.wraparound(False) - * def _backfill(ndarray[object, ndim=1] oldIndex, # <<<<<<<<<<<<<< - * ndarray[object, ndim=1] newIndex, - * dict oldMap, dict newMap): - */ - -static PyObject *__pyx_pf_7tseries_20_backfill(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7tseries_20_backfill[] = "\n Backfilling logic for generating fill vector\n\n Diagram of what's going on\n\n Old New Fill vector Mask\n . 0 1\n . 0 1\n . 0 1\n A A 0 1\n . 1 1\n . 1 1\n . 1 1\n . 1 1\n . 1 1\n B B 1 1\n . 2 1\n . 2 1\n . 2 1\n C C 2 1\n . 0\n . 0\n D\n "; -static PyMethodDef __pyx_mdef_7tseries_20_backfill = {__Pyx_NAMESTR("_backfill"), (PyCFunction)__pyx_pf_7tseries_20_backfill, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7tseries_20_backfill)}; -static PyObject *__pyx_pf_7tseries_20_backfill(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; - int __pyx_v_oldLength; - int __pyx_v_newLength; - int __pyx_v_curLoc; - PyArrayObject *__pyx_v_fillVec; - PyArrayObject *__pyx_v_mask; - int __pyx_v_newPos; - int __pyx_v_oldPos; - PyObject *__pyx_v_prevOld; - PyObject *__pyx_v_curOld; - Py_buffer __pyx_bstruct_oldIndex; - Py_ssize_t __pyx_bstride_0_oldIndex = 0; - Py_ssize_t __pyx_bshape_0_oldIndex = 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_fillVec; - Py_ssize_t __pyx_bstride_0_fillVec = 0; - Py_ssize_t __pyx_bshape_0_fillVec = 0; - Py_buffer __pyx_bstruct_newIndex; - Py_ssize_t __pyx_bstride_0_newIndex = 0; - Py_ssize_t __pyx_bshape_0_newIndex = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - 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; - long __pyx_t_13; - long __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - long __pyx_t_19; - int __pyx_t_20; - int __pyx_t_21; - int __pyx_t_22; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__oldIndex,&__pyx_n_s__newIndex,&__pyx_n_s__oldMap,&__pyx_n_s__newMap,0}; - __Pyx_RefNannySetupContext("_backfill"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[4] = {0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - 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("_backfill", 1, 4, 4, 1); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 16; __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("_backfill", 1, 4, 4, 2); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 16; __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("_backfill", 1, 4, 4, 3); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 16; __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), "_backfill") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 16; __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]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - 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)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_backfill", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("tseries._backfill"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_v_fillVec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_mask = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_prevOld = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_curOld = Py_None; __Pyx_INCREF(Py_None); - __pyx_bstruct_fillVec.buf = NULL; - __pyx_bstruct_mask.buf = NULL; - __pyx_bstruct_oldIndex.buf = NULL; - __pyx_bstruct_newIndex.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_oldIndex), __pyx_ptype_5numpy_ndarray, 1, "oldIndex", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 16; __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[6]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_oldMap), (&PyDict_Type), 1, "oldMap", 1))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_newMap), (&PyDict_Type), 1, "newMap", 1))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_oldIndex, (PyObject*)__pyx_v_oldIndex, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_oldIndex = __pyx_bstruct_oldIndex.strides[0]; - __pyx_bshape_0_oldIndex = __pyx_bstruct_oldIndex.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_newIndex, (PyObject*)__pyx_v_newIndex, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_newIndex = __pyx_bstruct_newIndex.strides[0]; - __pyx_bshape_0_newIndex = __pyx_bstruct_newIndex.shape[0]; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":51 - * - * # Get the size - * oldLength = len(oldIndex) # <<<<<<<<<<<<<< - * newLength = len(newIndex) - * - */ - __pyx_t_1 = ((PyObject *)__pyx_v_oldIndex); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_oldLength = __pyx_t_2; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":52 - * # Get the size - * oldLength = len(oldIndex) - * newLength = len(newIndex) # <<<<<<<<<<<<<< - * - * fillVec = np.empty(len(newIndex), dtype = np.int32) - */ - __pyx_t_1 = ((PyObject *)__pyx_v_newIndex); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_newLength = __pyx_t_2; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":54 - * newLength = len(newIndex) - * - * fillVec = np.empty(len(newIndex), dtype = np.int32) # <<<<<<<<<<<<<< - * fillVec.fill(-1) - * - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 54; __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 *)__pyx_v_newIndex); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 54; __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[6]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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[6]; __pyx_lineno = 54; __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[6]; __pyx_lineno = 54; __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[6]; __pyx_lineno = 54; __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[6]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = ((PyArrayObject *)__pyx_t_6); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fillVec); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_fillVec, (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_fillVec, (PyObject*)__pyx_v_fillVec, &__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_fillVec = __pyx_bstruct_fillVec.strides[0]; - __pyx_bshape_0_fillVec = __pyx_bstruct_fillVec.shape[0]; - if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_fillVec)); - __pyx_v_fillVec = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":55 - * - * fillVec = np.empty(len(newIndex), dtype = np.int32) - * fillVec.fill(-1) # <<<<<<<<<<<<<< - * - * mask = np.zeros(len(newIndex), dtype = np.int8) - */ - __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_fillVec), __pyx_n_s__fill); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":57 - * fillVec.fill(-1) - * - * mask = np.zeros(len(newIndex), dtype = np.int8) # <<<<<<<<<<<<<< - * - * # Current positions - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = ((PyObject *)__pyx_v_newIndex); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 57; __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[6]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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[6]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 57; __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[6]; __pyx_lineno = 57; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_6, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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[6]; __pyx_lineno = 57; __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[6]; __pyx_lineno = 57; __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":60 - * - * # Current positions - * oldPos = oldLength - 1 # <<<<<<<<<<<<<< - * newPos = newLength - 1 - * - */ - __pyx_v_oldPos = (__pyx_v_oldLength - 1); - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":61 - * # Current positions - * oldPos = oldLength - 1 - * newPos = newLength - 1 # <<<<<<<<<<<<<< - * - * # corner case, no filling possible - */ - __pyx_v_newPos = (__pyx_v_newLength - 1); - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":64 - * - * # corner case, no filling possible - * if newIndex[0] > oldIndex[oldLength - 1]: # <<<<<<<<<<<<<< - * return fillVec, mask - * - */ - __pyx_t_13 = 0; - __pyx_t_8 = -1; - if (__pyx_t_13 < 0) { - __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_newIndex)) __pyx_t_8 = 0; - if (unlikely(__pyx_t_8 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_8); - {__pyx_filename = __pyx_f[6]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_newIndex.buf, __pyx_t_13, __pyx_bstride_0_newIndex); - __Pyx_INCREF((PyObject*)__pyx_t_5); - __pyx_t_14 = (__pyx_v_oldLength - 1); - __pyx_t_8 = -1; - if (__pyx_t_14 < 0) { - __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_oldIndex)) __pyx_t_8 = 0; - if (unlikely(__pyx_t_8 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_8); - {__pyx_filename = __pyx_f[6]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_oldIndex.buf, __pyx_t_14, __pyx_bstride_0_oldIndex); - __Pyx_INCREF((PyObject*)__pyx_t_1); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_t_1, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 64; __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_1); __pyx_t_1 = 0; - __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_15) { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":65 - * # corner case, no filling possible - * if newIndex[0] > oldIndex[oldLength - 1]: - * return fillVec, mask # <<<<<<<<<<<<<< - * - * while newPos >= 0: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_INCREF(((PyObject *)__pyx_v_fillVec)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_fillVec)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_fillVec)); - __Pyx_INCREF(((PyObject *)__pyx_v_mask)); - PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_mask)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_mask)); - __pyx_r = ((PyObject *)__pyx_t_4); - __pyx_t_4 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":67 - * return fillVec, mask - * - * while newPos >= 0: # <<<<<<<<<<<<<< - * curOld = oldIndex[oldPos] - * - */ - while (1) { - __pyx_t_15 = (__pyx_v_newPos >= 0); - if (!__pyx_t_15) break; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":68 - * - * while newPos >= 0: - * curOld = oldIndex[oldPos] # <<<<<<<<<<<<<< - * - * # Until we reach a point where we are before the curOld point - */ - __pyx_t_8 = __pyx_v_oldPos; - __pyx_t_16 = -1; - if (__pyx_t_8 < 0) { - __pyx_t_16 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_oldIndex)) __pyx_t_16 = 0; - if (unlikely(__pyx_t_16 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_16); - {__pyx_filename = __pyx_f[6]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_oldIndex.buf, __pyx_t_8, __pyx_bstride_0_oldIndex); - __Pyx_INCREF((PyObject*)__pyx_t_4); - __Pyx_DECREF(__pyx_v_curOld); - __pyx_v_curOld = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":71 - * - * # Until we reach a point where we are before the curOld point - * while newIndex[newPos] > curOld: # <<<<<<<<<<<<<< - * newPos -= 1 - * if newPos < 0: - */ - while (1) { - __pyx_t_16 = __pyx_v_newPos; - __pyx_t_17 = -1; - if (__pyx_t_16 < 0) { - __pyx_t_17 = 0; - } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_newIndex)) __pyx_t_17 = 0; - if (unlikely(__pyx_t_17 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_17); - {__pyx_filename = __pyx_f[6]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_newIndex.buf, __pyx_t_16, __pyx_bstride_0_newIndex); - __Pyx_INCREF((PyObject*)__pyx_t_4); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_v_curOld, Py_GT); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_15 < 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_15) break; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":72 - * # Until we reach a point where we are before the curOld point - * while newIndex[newPos] > curOld: - * newPos -= 1 # <<<<<<<<<<<<<< - * if newPos < 0: - * break - */ - __pyx_v_newPos = (__pyx_v_newPos - 1); - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":73 - * while newIndex[newPos] > curOld: - * newPos -= 1 - * if newPos < 0: # <<<<<<<<<<<<<< - * break - * - */ - __pyx_t_15 = (__pyx_v_newPos < 0); - if (__pyx_t_15) { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":74 - * newPos -= 1 - * if newPos < 0: - * break # <<<<<<<<<<<<<< - * - * # Get the location in the old index - */ - goto __pyx_L10_break; - goto __pyx_L11; - } - __pyx_L11:; - } - __pyx_L10_break:; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":77 - * - * # Get the location in the old index - * curLoc = oldMap[curOld] # <<<<<<<<<<<<<< - * - * # At the beginning of the old index - */ - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_oldMap), __pyx_v_curOld); if (!__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_17 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_curLoc = __pyx_t_17; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":80 - * - * # At the beginning of the old index - * if oldPos == 0: # <<<<<<<<<<<<<< - * # Make sure we are before the curOld index - * if newIndex[newPos] <= curOld: - */ - __pyx_t_15 = (__pyx_v_oldPos == 0); - if (__pyx_t_15) { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":82 - * if oldPos == 0: - * # Make sure we are before the curOld index - * if newIndex[newPos] <= curOld: # <<<<<<<<<<<<<< - * fillVec[:newPos + 1] = curLoc - * mask[:newPos + 1] = 1 - */ - __pyx_t_17 = __pyx_v_newPos; - __pyx_t_18 = -1; - if (__pyx_t_17 < 0) { - __pyx_t_18 = 0; - } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_newIndex)) __pyx_t_18 = 0; - if (unlikely(__pyx_t_18 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_18); - {__pyx_filename = __pyx_f[6]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_newIndex.buf, __pyx_t_17, __pyx_bstride_0_newIndex); - __Pyx_INCREF((PyObject*)__pyx_t_1); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_v_curOld, Py_LE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_15) { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":83 - * # Make sure we are before the curOld index - * if newIndex[newPos] <= curOld: - * fillVec[:newPos + 1] = curLoc # <<<<<<<<<<<<<< - * mask[:newPos + 1] = 1 - * # Exit the main loop - */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_curLoc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_PySequence_SetSlice(((PyObject *)__pyx_v_fillVec), 0, (__pyx_v_newPos + 1), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":84 - * if newIndex[newPos] <= curOld: - * fillVec[:newPos + 1] = curLoc - * mask[:newPos + 1] = 1 # <<<<<<<<<<<<<< - * # Exit the main loop - * break - */ - if (__Pyx_PySequence_SetSlice(((PyObject *)__pyx_v_mask), 0, (__pyx_v_newPos + 1), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L13; - } - __pyx_L13:; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":86 - * mask[:newPos + 1] = 1 - * # Exit the main loop - * break # <<<<<<<<<<<<<< - * else: - * # Get the index there - */ - goto __pyx_L8_break; - goto __pyx_L12; - } - /*else*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":89 - * else: - * # Get the index there - * prevOld = oldIndex[oldPos - 1] # <<<<<<<<<<<<<< - * - * # Until we reach the previous index - */ - __pyx_t_19 = (__pyx_v_oldPos - 1); - __pyx_t_18 = -1; - if (__pyx_t_19 < 0) { - __pyx_t_18 = 0; - } else if (unlikely(__pyx_t_19 >= __pyx_bshape_0_oldIndex)) __pyx_t_18 = 0; - if (unlikely(__pyx_t_18 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_18); - {__pyx_filename = __pyx_f[6]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_oldIndex.buf, __pyx_t_19, __pyx_bstride_0_oldIndex); - __Pyx_INCREF((PyObject*)__pyx_t_4); - __Pyx_DECREF(__pyx_v_prevOld); - __pyx_v_prevOld = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":92 - * - * # Until we reach the previous index - * while newIndex[newPos] > prevOld: # <<<<<<<<<<<<<< - * # Set the current fill location - * fillVec[newPos] = curLoc - */ - while (1) { - __pyx_t_18 = __pyx_v_newPos; - __pyx_t_20 = -1; - if (__pyx_t_18 < 0) { - __pyx_t_20 = 0; - } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_newIndex)) __pyx_t_20 = 0; - if (unlikely(__pyx_t_20 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_20); - {__pyx_filename = __pyx_f[6]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_newIndex.buf, __pyx_t_18, __pyx_bstride_0_newIndex); - __Pyx_INCREF((PyObject*)__pyx_t_4); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_v_prevOld, Py_GT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!__pyx_t_15) break; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":94 - * while newIndex[newPos] > prevOld: - * # Set the current fill location - * fillVec[newPos] = curLoc # <<<<<<<<<<<<<< - * mask[newPos] = 1 - * - */ - __pyx_t_20 = __pyx_v_newPos; - __pyx_t_21 = -1; - if (__pyx_t_20 < 0) { - __pyx_t_21 = 0; - } else if (unlikely(__pyx_t_20 >= __pyx_bshape_0_fillVec)) __pyx_t_21 = 0; - if (unlikely(__pyx_t_21 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_21); - {__pyx_filename = __pyx_f[6]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_fillVec.buf, __pyx_t_20, __pyx_bstride_0_fillVec) = __pyx_v_curLoc; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":95 - * # Set the current fill location - * fillVec[newPos] = curLoc - * mask[newPos] = 1 # <<<<<<<<<<<<<< - * - * newPos -= 1 - */ - __pyx_t_21 = __pyx_v_newPos; - __pyx_t_22 = -1; - if (__pyx_t_21 < 0) { - __pyx_t_22 = 0; - } else if (unlikely(__pyx_t_21 >= __pyx_bshape_0_mask)) __pyx_t_22 = 0; - if (unlikely(__pyx_t_22 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_22); - {__pyx_filename = __pyx_f[6]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_bstruct_mask.buf, __pyx_t_21, __pyx_bstride_0_mask) = 1; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":97 - * mask[newPos] = 1 - * - * newPos -= 1 # <<<<<<<<<<<<<< - * if newPos < 0: - * break - */ - __pyx_v_newPos = (__pyx_v_newPos - 1); - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":98 - * - * newPos -= 1 - * if newPos < 0: # <<<<<<<<<<<<<< - * break - * - */ - __pyx_t_15 = (__pyx_v_newPos < 0); - if (__pyx_t_15) { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":99 - * newPos -= 1 - * if newPos < 0: - * break # <<<<<<<<<<<<<< - * - * # Move one period back - */ - goto __pyx_L15_break; - goto __pyx_L16; - } - __pyx_L16:; - } - __pyx_L15_break:; - } - __pyx_L12:; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":102 - * - * # Move one period back - * oldPos -= 1 # <<<<<<<<<<<<<< - * - * return (fillVec, mask) - */ - __pyx_v_oldPos = (__pyx_v_oldPos - 1); - } - __pyx_L8_break:; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":104 - * oldPos -= 1 - * - * return (fillVec, mask) # <<<<<<<<<<<<<< - * - * @cython.wraparound(False) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject *)__pyx_v_fillVec)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_fillVec)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_fillVec)); - __Pyx_INCREF(((PyObject *)__pyx_v_mask)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_mask)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_mask)); - __pyx_r = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_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_oldIndex); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fillVec); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_newIndex); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("tseries._backfill"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_oldIndex); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fillVec); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_newIndex); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_fillVec); - __Pyx_DECREF((PyObject *)__pyx_v_mask); - __Pyx_DECREF(__pyx_v_prevOld); - __Pyx_DECREF(__pyx_v_curOld); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":107 - * - * @cython.wraparound(False) - * def _pad(ndarray[object, ndim=1] oldIndex, # <<<<<<<<<<<<<< - * ndarray[object, ndim=1] newIndex, - * dict oldMap, dict newMap): - */ - -static PyObject *__pyx_pf_7tseries_21_pad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7tseries_21_pad[] = "\n Padding logic for generating fill vector\n\n Diagram of what's going on\n\n Old New Fill vector Mask\n . 0\n . 0\n . 0\n A A 0 1\n . 0 1\n . 0 1\n . 0 1\n . 0 1\n . 0 1\n B B 1 1\n . 1 1\n . 1 1\n . 1 1\n C C 2 1\n "; -static PyMethodDef __pyx_mdef_7tseries_21_pad = {__Pyx_NAMESTR("_pad"), (PyCFunction)__pyx_pf_7tseries_21_pad, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7tseries_21_pad)}; -static PyObject *__pyx_pf_7tseries_21_pad(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; - int __pyx_v_oldLength; - int __pyx_v_newLength; - int __pyx_v_curLoc; - PyArrayObject *__pyx_v_fillVec; - PyArrayObject *__pyx_v_mask; - int __pyx_v_newPos; - int __pyx_v_oldPos; - PyObject *__pyx_v_curOld; - PyObject *__pyx_v_nextOld; - long __pyx_v_done; - Py_buffer __pyx_bstruct_oldIndex; - Py_ssize_t __pyx_bstride_0_oldIndex = 0; - Py_ssize_t __pyx_bshape_0_oldIndex = 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_fillVec; - Py_ssize_t __pyx_bstride_0_fillVec = 0; - Py_ssize_t __pyx_bshape_0_fillVec = 0; - Py_buffer __pyx_bstruct_newIndex; - Py_ssize_t __pyx_bstride_0_newIndex = 0; - Py_ssize_t __pyx_bshape_0_newIndex = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - 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; - long __pyx_t_13; - long __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - long __pyx_t_19; - int __pyx_t_20; - int __pyx_t_21; - int __pyx_t_22; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__oldIndex,&__pyx_n_s__newIndex,&__pyx_n_s__oldMap,&__pyx_n_s__newMap,0}; - __Pyx_RefNannySetupContext("_pad"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[4] = {0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - 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("_pad", 1, 4, 4, 1); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 107; __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("_pad", 1, 4, 4, 2); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 107; __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("_pad", 1, 4, 4, 3); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 107; __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), "_pad") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 107; __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]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - 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)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_pad", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("tseries._pad"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_v_fillVec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_mask = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_curOld = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_nextOld = Py_None; __Pyx_INCREF(Py_None); - __pyx_bstruct_fillVec.buf = NULL; - __pyx_bstruct_mask.buf = NULL; - __pyx_bstruct_oldIndex.buf = NULL; - __pyx_bstruct_newIndex.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_oldIndex), __pyx_ptype_5numpy_ndarray, 1, "oldIndex", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 107; __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[6]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_oldMap), (&PyDict_Type), 1, "oldMap", 1))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_newMap), (&PyDict_Type), 1, "newMap", 1))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_oldIndex, (PyObject*)__pyx_v_oldIndex, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_oldIndex = __pyx_bstruct_oldIndex.strides[0]; - __pyx_bshape_0_oldIndex = __pyx_bstruct_oldIndex.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_newIndex, (PyObject*)__pyx_v_newIndex, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_newIndex = __pyx_bstruct_newIndex.strides[0]; - __pyx_bshape_0_newIndex = __pyx_bstruct_newIndex.shape[0]; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":139 - * - * # Get the size - * oldLength = len(oldIndex) # <<<<<<<<<<<<<< - * newLength = len(newIndex) - * - */ - __pyx_t_1 = ((PyObject *)__pyx_v_oldIndex); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_oldLength = __pyx_t_2; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":140 - * # Get the size - * oldLength = len(oldIndex) - * newLength = len(newIndex) # <<<<<<<<<<<<<< - * - * fillVec = np.empty(len(newIndex), dtype = np.int32) - */ - __pyx_t_1 = ((PyObject *)__pyx_v_newIndex); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_newLength = __pyx_t_2; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":142 - * newLength = len(newIndex) - * - * fillVec = np.empty(len(newIndex), dtype = np.int32) # <<<<<<<<<<<<<< - * fillVec.fill(-1) - * - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __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 *)__pyx_v_newIndex); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __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[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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[6]; __pyx_lineno = 142; __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[6]; __pyx_lineno = 142; __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[6]; __pyx_lineno = 142; __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[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = ((PyArrayObject *)__pyx_t_6); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fillVec); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_fillVec, (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_fillVec, (PyObject*)__pyx_v_fillVec, &__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_fillVec = __pyx_bstruct_fillVec.strides[0]; - __pyx_bshape_0_fillVec = __pyx_bstruct_fillVec.shape[0]; - if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_fillVec)); - __pyx_v_fillVec = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":143 - * - * fillVec = np.empty(len(newIndex), dtype = np.int32) - * fillVec.fill(-1) # <<<<<<<<<<<<<< - * - * mask = np.zeros(len(newIndex), dtype = np.int8) - */ - __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_fillVec), __pyx_n_s__fill); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":145 - * fillVec.fill(-1) - * - * mask = np.zeros(len(newIndex), dtype = np.int8) # <<<<<<<<<<<<<< - * - * oldPos = 0 - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = ((PyObject *)__pyx_v_newIndex); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 145; __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[6]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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[6]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 145; __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[6]; __pyx_lineno = 145; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_6, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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[6]; __pyx_lineno = 145; __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[6]; __pyx_lineno = 145; __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":147 - * mask = np.zeros(len(newIndex), dtype = np.int8) - * - * oldPos = 0 # <<<<<<<<<<<<<< - * newPos = 0 - * - */ - __pyx_v_oldPos = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":148 - * - * oldPos = 0 - * newPos = 0 # <<<<<<<<<<<<<< - * - * # corner case, no filling possible - */ - __pyx_v_newPos = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":151 - * - * # corner case, no filling possible - * if newIndex[newLength - 1] < oldIndex[0]: # <<<<<<<<<<<<<< - * return fillVec, mask - * - */ - __pyx_t_13 = (__pyx_v_newLength - 1); - __pyx_t_8 = -1; - if (__pyx_t_13 < 0) { - __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_newIndex)) __pyx_t_8 = 0; - if (unlikely(__pyx_t_8 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_8); - {__pyx_filename = __pyx_f[6]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_newIndex.buf, __pyx_t_13, __pyx_bstride_0_newIndex); - __Pyx_INCREF((PyObject*)__pyx_t_5); - __pyx_t_14 = 0; - __pyx_t_8 = -1; - if (__pyx_t_14 < 0) { - __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_oldIndex)) __pyx_t_8 = 0; - if (unlikely(__pyx_t_8 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_8); - {__pyx_filename = __pyx_f[6]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_oldIndex.buf, __pyx_t_14, __pyx_bstride_0_oldIndex); - __Pyx_INCREF((PyObject*)__pyx_t_1); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_t_1, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 151; __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_1); __pyx_t_1 = 0; - __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_15) { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":152 - * # corner case, no filling possible - * if newIndex[newLength - 1] < oldIndex[0]: - * return fillVec, mask # <<<<<<<<<<<<<< - * - * while newPos < newLength: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_INCREF(((PyObject *)__pyx_v_fillVec)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_fillVec)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_fillVec)); - __Pyx_INCREF(((PyObject *)__pyx_v_mask)); - PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_mask)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_mask)); - __pyx_r = ((PyObject *)__pyx_t_4); - __pyx_t_4 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":154 - * return fillVec, mask - * - * while newPos < newLength: # <<<<<<<<<<<<<< - * curOld = oldIndex[oldPos] - * - */ - while (1) { - __pyx_t_15 = (__pyx_v_newPos < __pyx_v_newLength); - if (!__pyx_t_15) break; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":155 - * - * while newPos < newLength: - * curOld = oldIndex[oldPos] # <<<<<<<<<<<<<< - * - * # At beginning, keep going until we go exceed the - */ - __pyx_t_8 = __pyx_v_oldPos; - __pyx_t_16 = -1; - if (__pyx_t_8 < 0) { - __pyx_t_16 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_oldIndex)) __pyx_t_16 = 0; - if (unlikely(__pyx_t_16 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_16); - {__pyx_filename = __pyx_f[6]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_oldIndex.buf, __pyx_t_8, __pyx_bstride_0_oldIndex); - __Pyx_INCREF((PyObject*)__pyx_t_4); - __Pyx_DECREF(__pyx_v_curOld); - __pyx_v_curOld = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":159 - * # At beginning, keep going until we go exceed the - * # first OLD index in the NEW index - * while newIndex[newPos] < curOld: # <<<<<<<<<<<<<< - * newPos += 1 - * if newPos > newLength - 1: - */ - while (1) { - __pyx_t_16 = __pyx_v_newPos; - __pyx_t_17 = -1; - if (__pyx_t_16 < 0) { - __pyx_t_17 = 0; - } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_newIndex)) __pyx_t_17 = 0; - if (unlikely(__pyx_t_17 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_17); - {__pyx_filename = __pyx_f[6]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_newIndex.buf, __pyx_t_16, __pyx_bstride_0_newIndex); - __Pyx_INCREF((PyObject*)__pyx_t_4); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_v_curOld, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!__pyx_t_15) break; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":160 - * # first OLD index in the NEW index - * while newIndex[newPos] < curOld: - * newPos += 1 # <<<<<<<<<<<<<< - * if newPos > newLength - 1: - * break - */ - __pyx_v_newPos = (__pyx_v_newPos + 1); - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":161 - * while newIndex[newPos] < curOld: - * newPos += 1 - * if newPos > newLength - 1: # <<<<<<<<<<<<<< - * break - * - */ - __pyx_t_15 = (__pyx_v_newPos > (__pyx_v_newLength - 1)); - if (__pyx_t_15) { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":162 - * newPos += 1 - * if newPos > newLength - 1: - * break # <<<<<<<<<<<<<< - * - * # We got there, get the current location in the old index - */ - goto __pyx_L10_break; - goto __pyx_L11; - } - __pyx_L11:; - } - __pyx_L10_break:; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":165 - * - * # 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_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_oldMap), __pyx_v_curOld); if (!__pyx_t_1) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_curLoc = __pyx_t_17; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":168 - * - * # We're at the end of the road, need to propagate this value to the end - * if oldPos == oldLength - 1: # <<<<<<<<<<<<<< - * if newIndex[newPos] >= curOld: - * fillVec[newPos:] = curLoc - */ - __pyx_t_15 = (__pyx_v_oldPos == (__pyx_v_oldLength - 1)); - if (__pyx_t_15) { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":169 - * # We're at the end of the road, need to propagate this value to the end - * if oldPos == oldLength - 1: - * if newIndex[newPos] >= curOld: # <<<<<<<<<<<<<< - * fillVec[newPos:] = curLoc - * mask[newPos:] = 1 - */ - __pyx_t_17 = __pyx_v_newPos; - __pyx_t_18 = -1; - if (__pyx_t_17 < 0) { - __pyx_t_18 = 0; - } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_newIndex)) __pyx_t_18 = 0; - if (unlikely(__pyx_t_18 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_18); - {__pyx_filename = __pyx_f[6]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_newIndex.buf, __pyx_t_17, __pyx_bstride_0_newIndex); - __Pyx_INCREF((PyObject*)__pyx_t_1); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_v_curOld, Py_GE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_15) { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":170 - * if oldPos == oldLength - 1: - * if newIndex[newPos] >= curOld: - * fillVec[newPos:] = curLoc # <<<<<<<<<<<<<< - * mask[newPos:] = 1 - * break - */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_curLoc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_PySequence_SetSlice(((PyObject *)__pyx_v_fillVec), __pyx_v_newPos, PY_SSIZE_T_MAX, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":171 - * if newIndex[newPos] >= curOld: - * fillVec[newPos:] = curLoc - * mask[newPos:] = 1 # <<<<<<<<<<<<<< - * break - * else: - */ - if (__Pyx_PySequence_SetSlice(((PyObject *)__pyx_v_mask), __pyx_v_newPos, PY_SSIZE_T_MAX, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L13; - } - __pyx_L13:; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":172 - * fillVec[newPos:] = curLoc - * mask[newPos:] = 1 - * break # <<<<<<<<<<<<<< - * else: - * # Not at the end, need to go about filling - */ - goto __pyx_L8_break; - goto __pyx_L12; - } - /*else*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":177 - * - * # Get the next index so we know when to stop propagating this value - * nextOld = oldIndex[oldPos + 1] # <<<<<<<<<<<<<< - * - * done = 0 - */ - __pyx_t_19 = (__pyx_v_oldPos + 1); - __pyx_t_18 = -1; - if (__pyx_t_19 < 0) { - __pyx_t_18 = 0; - } else if (unlikely(__pyx_t_19 >= __pyx_bshape_0_oldIndex)) __pyx_t_18 = 0; - if (unlikely(__pyx_t_18 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_18); - {__pyx_filename = __pyx_f[6]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_oldIndex.buf, __pyx_t_19, __pyx_bstride_0_oldIndex); - __Pyx_INCREF((PyObject*)__pyx_t_4); - __Pyx_DECREF(__pyx_v_nextOld); - __pyx_v_nextOld = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":179 - * nextOld = oldIndex[oldPos + 1] - * - * done = 0 # <<<<<<<<<<<<<< - * - * # Until we reach the next OLD value in the NEW index - */ - __pyx_v_done = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":182 - * - * # Until we reach the next OLD value in the NEW index - * while newIndex[newPos] < nextOld: # <<<<<<<<<<<<<< - * # Use this location to fill - * fillVec[newPos] = curLoc - */ - while (1) { - __pyx_t_18 = __pyx_v_newPos; - __pyx_t_20 = -1; - if (__pyx_t_18 < 0) { - __pyx_t_20 = 0; - } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_newIndex)) __pyx_t_20 = 0; - if (unlikely(__pyx_t_20 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_20); - {__pyx_filename = __pyx_f[6]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_newIndex.buf, __pyx_t_18, __pyx_bstride_0_newIndex); - __Pyx_INCREF((PyObject*)__pyx_t_4); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_v_nextOld, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!__pyx_t_15) break; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":184 - * while newIndex[newPos] < nextOld: - * # Use this location to fill - * fillVec[newPos] = curLoc # <<<<<<<<<<<<<< - * - * # Set mask to be 1 so will not be NaN'd - */ - __pyx_t_20 = __pyx_v_newPos; - __pyx_t_21 = -1; - if (__pyx_t_20 < 0) { - __pyx_t_21 = 0; - } else if (unlikely(__pyx_t_20 >= __pyx_bshape_0_fillVec)) __pyx_t_21 = 0; - if (unlikely(__pyx_t_21 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_21); - {__pyx_filename = __pyx_f[6]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_fillVec.buf, __pyx_t_20, __pyx_bstride_0_fillVec) = __pyx_v_curLoc; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":187 - * - * # Set mask to be 1 so will not be NaN'd - * mask[newPos] = 1 # <<<<<<<<<<<<<< - * newPos += 1 - * - */ - __pyx_t_21 = __pyx_v_newPos; - __pyx_t_22 = -1; - if (__pyx_t_21 < 0) { - __pyx_t_22 = 0; - } else if (unlikely(__pyx_t_21 >= __pyx_bshape_0_mask)) __pyx_t_22 = 0; - if (unlikely(__pyx_t_22 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_22); - {__pyx_filename = __pyx_f[6]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_bstruct_mask.buf, __pyx_t_21, __pyx_bstride_0_mask) = 1; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":188 - * # 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 = (__pyx_v_newPos + 1); - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":191 - * - * # We got to the end of the new index - * if newPos > newLength - 1: # <<<<<<<<<<<<<< - * done = 1 - * break - */ - __pyx_t_15 = (__pyx_v_newPos > (__pyx_v_newLength - 1)); - if (__pyx_t_15) { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":192 - * # We got to the end of the new index - * if newPos > newLength - 1: - * done = 1 # <<<<<<<<<<<<<< - * break - * - */ - __pyx_v_done = 1; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":193 - * if newPos > newLength - 1: - * done = 1 - * break # <<<<<<<<<<<<<< - * - * # We got to the end of the new index - */ - goto __pyx_L15_break; - goto __pyx_L16; - } - __pyx_L16:; - } - __pyx_L15_break:; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":196 - * - * # We got to the end of the new index - * if done: # <<<<<<<<<<<<<< - * break - * - */ - if (__pyx_v_done) { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":197 - * # We got to the end of the new index - * if done: - * break # <<<<<<<<<<<<<< - * - * # We already advanced the iterold pointer to the next value, - */ - goto __pyx_L8_break; - goto __pyx_L17; - } - __pyx_L17:; - } - __pyx_L12:; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":201 - * # We already advanced the iterold pointer to the next value, - * # inc the count - * oldPos += 1 # <<<<<<<<<<<<<< - * - * return fillVec, mask - */ - __pyx_v_oldPos = (__pyx_v_oldPos + 1); - } - __pyx_L8_break:; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":203 - * oldPos += 1 - * - * return fillVec, mask # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject *)__pyx_v_fillVec)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_fillVec)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_fillVec)); - __Pyx_INCREF(((PyObject *)__pyx_v_mask)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_mask)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_mask)); - __pyx_r = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_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_oldIndex); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fillVec); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_newIndex); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("tseries._pad"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_oldIndex); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fillVec); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_newIndex); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_fillVec); - __Pyx_DECREF((PyObject *)__pyx_v_mask); - __Pyx_DECREF(__pyx_v_curOld); - __Pyx_DECREF(__pyx_v_nextOld); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":206 - * - * @cython.boundscheck(False) - * def getMergeVec(ndarray values, dict oldMap): # <<<<<<<<<<<<<< - * cdef int i, j, length, newLength - * - */ - -static PyObject *__pyx_pf_7tseries_22getMergeVec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7tseries_22getMergeVec = {__Pyx_NAMESTR("getMergeVec"), (PyCFunction)__pyx_pf_7tseries_22getMergeVec, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7tseries_22getMergeVec(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_fillVec; - 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_fillVec; - Py_ssize_t __pyx_bstride_0_fillVec = 0; - Py_ssize_t __pyx_bshape_0_fillVec = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - 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[6]; __pyx_lineno = 206; __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[6]; __pyx_lineno = 206; __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[6]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("tseries.getMergeVec"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_v_iternew = ((PyArrayIterObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_fillVec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_mask = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_fillVec.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[6]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_oldMap), (&PyDict_Type), 1, "oldMap", 1))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":214 - * cdef ndarray[int8_t, ndim=1] mask - * - * newLength = len(values) # <<<<<<<<<<<<<< - * fillVec = np.empty(newLength, dtype=np.int32) - * mask = np.zeros(newLength, dtype=np.int8) - */ - __pyx_t_1 = ((PyObject *)__pyx_v_values); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_newLength = __pyx_t_2; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":215 - * - * newLength = len(values) - * fillVec = np.empty(newLength, dtype=np.int32) # <<<<<<<<<<<<<< - * mask = np.zeros(newLength, dtype=np.int8) - * - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_newLength); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 215; __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[6]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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[6]; __pyx_lineno = 215; __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[6]; __pyx_lineno = 215; __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[6]; __pyx_lineno = 215; __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[6]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = ((PyArrayObject *)__pyx_t_6); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fillVec); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_fillVec, (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_fillVec, (PyObject*)__pyx_v_fillVec, &__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_fillVec = __pyx_bstruct_fillVec.strides[0]; - __pyx_bshape_0_fillVec = __pyx_bstruct_fillVec.shape[0]; - if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_fillVec)); - __pyx_v_fillVec = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":216 - * newLength = len(values) - * fillVec = np.empty(newLength, dtype=np.int32) - * mask = np.zeros(newLength, dtype=np.int8) # <<<<<<<<<<<<<< - * - * iternew = PyArray_IterNew(values) - */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 216; __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[6]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __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[6]; __pyx_lineno = 216; __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[6]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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[6]; __pyx_lineno = 216; __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[6]; __pyx_lineno = 216; __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[6]; __pyx_lineno = 216; __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[6]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__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[6]; __pyx_lineno = 216; __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[6]; __pyx_lineno = 216; __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":218 - * mask = np.zeros(newLength, dtype=np.int8) - * - * iternew = PyArray_IterNew(values) # <<<<<<<<<<<<<< - * - * for i from 0 <= i < newLength: - */ - __pyx_t_5 = ((PyObject *)__pyx_v_values); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = PyArray_IterNew(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_INCREF(((PyObject *)((PyArrayIterObject *)__pyx_t_6))); - __Pyx_DECREF(((PyObject *)__pyx_v_iternew)); - __pyx_v_iternew = ((PyArrayIterObject *)__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":220 - * iternew = 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++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":221 - * - * for i from 0 <= i < newLength: - * idx = PyArray_GETITEM(values, PyArray_ITER_DATA(iternew)) # <<<<<<<<<<<<<< - * - * if idx in oldMap: - */ - __pyx_t_6 = ((PyObject *)__pyx_v_values); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_5 = PyArray_GETITEM(((PyArrayObject *)__pyx_t_6), PyArray_ITER_DATA(__pyx_v_iternew)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_v_idx); - __pyx_v_idx = __pyx_t_5; - __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":223 - * idx = PyArray_GETITEM(values, PyArray_ITER_DATA(iternew)) - * - * if idx in oldMap: # <<<<<<<<<<<<<< - * fillVec[i] = oldMap[idx] - * mask[i] = 1 - */ - if (unlikely(__pyx_v_oldMap == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_13 = ((PyDict_Contains(((PyObject *)__pyx_v_oldMap), __pyx_v_idx))); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_13) { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":224 - * - * if idx in oldMap: - * fillVec[i] = oldMap[idx] # <<<<<<<<<<<<<< - * mask[i] = 1 - * - */ - __pyx_t_5 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_oldMap), __pyx_v_idx); if (!__pyx_t_5) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 224; __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[6]; __pyx_lineno = 224; __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_fillVec; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_fillVec.buf, __pyx_t_15, __pyx_bstride_0_fillVec) = __pyx_t_14; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":225 - * if idx in oldMap: - * fillVec[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:; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":227 - * mask[i] = 1 - * - * PyArray_ITER_NEXT(iternew) # <<<<<<<<<<<<<< - * - * for i from 0 <= i < newLength: - */ - PyArray_ITER_NEXT(__pyx_v_iternew); - } - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":229 - * PyArray_ITER_NEXT(iternew) - * - * for i from 0 <= i < newLength: # <<<<<<<<<<<<<< - * if mask[i] == 0: - * fillVec[i] = -1 - */ - __pyx_t_8 = __pyx_v_newLength; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":230 - * - * for i from 0 <= i < newLength: - * if mask[i] == 0: # <<<<<<<<<<<<<< - * fillVec[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) { - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":231 - * for i from 0 <= i < newLength: - * if mask[i] == 0: - * fillVec[i] = -1 # <<<<<<<<<<<<<< - * - * return fillVec, mask.astype(bool) - */ - __pyx_t_18 = __pyx_v_i; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_0_fillVec; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_fillVec.buf, __pyx_t_18, __pyx_bstride_0_fillVec) = -1; - goto __pyx_L11; - } - __pyx_L11:; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":233 - * fillVec[i] = -1 - * - * return fillVec, 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[6]; __pyx_lineno = 233; __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[6]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __Pyx_INCREF(((PyObject*)&PyBool_Type)); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject*)&PyBool_Type)); - __Pyx_GIVEREF(((PyObject*)&PyBool_Type)); - __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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)); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_r = ((PyObject *)__pyx_t_6); - __pyx_t_6 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_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_fillVec); - __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_fillVec); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_iternew); - __Pyx_DECREF(__pyx_v_idx); - __Pyx_DECREF((PyObject *)__pyx_v_fillVec); - __Pyx_DECREF((PyObject *)__pyx_v_mask); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":3 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef ndarray _applyFunc(double_func func, ndarray index, ndarray ao, # <<<<<<<<<<<<<< - * ndarray bo, dict aMap, dict bMap): - * ''' - */ - -static PyArrayObject *__pyx_f_7tseries__applyFunc(__pyx_t_7tseries_double_func __pyx_v_func, PyArrayObject *__pyx_v_index, PyArrayObject *__pyx_v_ao, PyArrayObject *__pyx_v_bo, PyObject *__pyx_v_aMap, PyObject *__pyx_v_bMap) { - PyArrayObject *__pyx_v_result; - double *__pyx_v_result_data; - int __pyx_v_length; - Py_ssize_t __pyx_v_i; - Py_ssize_t __pyx_v_aidx; - Py_ssize_t __pyx_v_bidx; - double __pyx_v_nan; - PyObject *__pyx_v_idx; - PyArrayObject *__pyx_v_ibuf; - PyArrayObject *__pyx_v_A; - PyArrayObject *__pyx_v_B; - Py_buffer __pyx_bstruct_A; - Py_ssize_t __pyx_bstride_0_A = 0; - Py_ssize_t __pyx_bshape_0_A = 0; - Py_buffer __pyx_bstruct_B; - Py_ssize_t __pyx_bstride_0_B = 0; - Py_ssize_t __pyx_bshape_0_B = 0; - Py_buffer __pyx_bstruct_ibuf; - Py_ssize_t __pyx_bstride_0_ibuf = 0; - Py_ssize_t __pyx_bshape_0_ibuf = 0; - PyArrayObject *__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; - PyObject *__pyx_t_6 = NULL; - double __pyx_t_7; - Py_ssize_t __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - __Pyx_RefNannySetupContext("_applyFunc"); - __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_ibuf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_A = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_B = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_ibuf.buf = NULL; - __pyx_bstruct_A.buf = NULL; - __pyx_bstruct_B.buf = NULL; - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":17 - * cdef ndarray[double_t, ndim=1] A, B - * - * A = ao # <<<<<<<<<<<<<< - * B = bo - * - */ - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_A); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_A, (PyObject*)((PyArrayObject *)__pyx_v_ao), &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_A, (PyObject*)__pyx_v_A, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4); - } - } - __pyx_bstride_0_A = __pyx_bstruct_A.strides[0]; - __pyx_bshape_0_A = __pyx_bstruct_A.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_INCREF(((PyObject *)__pyx_v_ao)); - __Pyx_DECREF(((PyObject *)__pyx_v_A)); - __pyx_v_A = ((PyArrayObject *)__pyx_v_ao); - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":18 - * - * A = ao - * B = bo # <<<<<<<<<<<<<< - * - * ibuf = index - */ - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_B); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_B, (PyObject*)((PyArrayObject *)__pyx_v_bo), &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_B, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_4, __pyx_t_3, __pyx_t_2); - } - } - __pyx_bstride_0_B = __pyx_bstruct_B.strides[0]; - __pyx_bshape_0_B = __pyx_bstruct_B.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_INCREF(((PyObject *)__pyx_v_bo)); - __Pyx_DECREF(((PyObject *)__pyx_v_B)); - __pyx_v_B = ((PyArrayObject *)__pyx_v_bo); - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":20 - * B = bo - * - * ibuf = index # <<<<<<<<<<<<<< - * - * nan = np.NaN - */ - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ibuf); - __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_ibuf, (PyObject*)((PyArrayObject *)__pyx_v_index), &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_1 < 0)) { - PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_ibuf, (PyObject*)__pyx_v_ibuf, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4); - } - } - __pyx_bstride_0_ibuf = __pyx_bstruct_ibuf.strides[0]; - __pyx_bshape_0_ibuf = __pyx_bstruct_ibuf.shape[0]; - if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_INCREF(((PyObject *)__pyx_v_index)); - __Pyx_DECREF(((PyObject *)__pyx_v_ibuf)); - __pyx_v_ibuf = ((PyArrayObject *)__pyx_v_index); - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":22 - * ibuf = index - * - * nan = np.NaN # <<<<<<<<<<<<<< - * length = len(index) - * result = np.empty(length, dtype=float) - */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__NaN); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 22; __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_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_nan = __pyx_t_7; - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":23 - * - * nan = np.NaN - * length = len(index) # <<<<<<<<<<<<<< - * result = np.empty(length, dtype=float) - * result_data = result.data - */ - __pyx_t_6 = ((PyObject *)__pyx_v_index); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_8 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_length = __pyx_t_8; - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":24 - * nan = np.NaN - * length = len(index) - * result = np.empty(length, dtype=float) # <<<<<<<<<<<<<< - * result_data = result.data - * - */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyInt_FromLong(__pyx_v_length); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - PyTuple_SET_ITEM(__pyx_t_9, 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[7]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = PyEval_CallObjectWithKeywords(__pyx_t_5, ((PyObject *)__pyx_t_9), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_t_10))); - __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = ((PyArrayObject *)__pyx_t_10); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":25 - * length = len(index) - * result = np.empty(length, dtype=float) - * result_data = result.data # <<<<<<<<<<<<<< - * - * for i from 0 <= i < length: - */ - __pyx_v_result_data = ((double *)__pyx_v_result->data); - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":27 - * result_data = result.data - * - * for i from 0 <= i < length: # <<<<<<<<<<<<<< - * idx = ibuf[i] - * - */ - __pyx_t_1 = __pyx_v_length; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":28 - * - * for i from 0 <= i < length: - * idx = ibuf[i] # <<<<<<<<<<<<<< - * - * if idx not in aMap or idx not in bMap: - */ - __pyx_t_8 = __pyx_v_i; - __pyx_t_10 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_ibuf.buf, __pyx_t_8, __pyx_bstride_0_ibuf); - __Pyx_INCREF((PyObject*)__pyx_t_10); - __Pyx_DECREF(__pyx_v_idx); - __pyx_v_idx = __pyx_t_10; - __pyx_t_10 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":30 - * idx = ibuf[i] - * - * if idx not in aMap or idx not in bMap: # <<<<<<<<<<<<<< - * result_data[i] = nan - * continue - */ - if (unlikely(__pyx_v_aMap == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_11 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_aMap), __pyx_v_idx))); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!__pyx_t_11) { - if (unlikely(__pyx_v_bMap == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_12 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_bMap), __pyx_v_idx))); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_13 = __pyx_t_12; - } else { - __pyx_t_13 = __pyx_t_11; - } - if (__pyx_t_13) { - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":31 - * - * 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; - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":32 - * if idx not in aMap or idx not in bMap: - * result_data[i] = nan - * continue # <<<<<<<<<<<<<< - * - * aidx = aMap[idx] - */ - goto __pyx_L3_continue; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":34 - * continue - * - * aidx = aMap[idx] # <<<<<<<<<<<<<< - * bidx = bMap[idx] - * result_data[i] = func(A[aidx], B[bidx]) - */ - __pyx_t_10 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_aMap), __pyx_v_idx); if (!__pyx_t_10) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_10); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_aidx = __pyx_t_14; - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":35 - * - * aidx = aMap[idx] - * bidx = bMap[idx] # <<<<<<<<<<<<<< - * result_data[i] = func(A[aidx], B[bidx]) - * - */ - __pyx_t_10 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_bMap), __pyx_v_idx); if (!__pyx_t_10) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_10); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_bidx = __pyx_t_14; - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":36 - * aidx = aMap[idx] - * bidx = bMap[idx] - * result_data[i] = func(A[aidx], B[bidx]) # <<<<<<<<<<<<<< - * - * return result - */ - __pyx_t_14 = __pyx_v_aidx; - __pyx_t_15 = __pyx_v_bidx; - (__pyx_v_result_data[__pyx_v_i]) = __pyx_v_func((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_A.buf, __pyx_t_14, __pyx_bstride_0_A)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_B.buf, __pyx_t_15, __pyx_bstride_0_B))); - __pyx_L3_continue:; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":38 - * result_data[i] = func(A[aidx], B[bidx]) - * - * return result # <<<<<<<<<<<<<< - * - * def combineFunc(object name, ndarray index, ndarray 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_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_A); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_B); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ibuf); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("tseries._applyFunc"); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_A); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_B); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ibuf); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_result); - __Pyx_DECREF(__pyx_v_idx); - __Pyx_DECREF((PyObject *)__pyx_v_ibuf); - __Pyx_DECREF((PyObject *)__pyx_v_A); - __Pyx_DECREF((PyObject *)__pyx_v_B); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":40 - * return result - * - * def combineFunc(object name, ndarray index, ndarray ao, # <<<<<<<<<<<<<< - * ndarray bo, dict aMap, dict bMap): - * ''' - */ - -static PyObject *__pyx_pf_7tseries_23combineFunc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7tseries_23combineFunc[] = "\n Combine two series (values and index maps for each passed in) using the\n indicated function.\n "; -static PyMethodDef __pyx_mdef_7tseries_23combineFunc = {__Pyx_NAMESTR("combineFunc"), (PyCFunction)__pyx_pf_7tseries_23combineFunc, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7tseries_23combineFunc)}; -static PyObject *__pyx_pf_7tseries_23combineFunc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_name = 0; - PyArrayObject *__pyx_v_index = 0; - PyArrayObject *__pyx_v_ao = 0; - PyArrayObject *__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; - 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__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[7]; __pyx_lineno = 40; __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[7]; __pyx_lineno = 40; __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[7]; __pyx_lineno = 40; __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[7]; __pyx_lineno = 40; __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[7]; __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), "combineFunc") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_name = values[0]; - __pyx_v_index = ((PyArrayObject *)values[1]); - __pyx_v_ao = ((PyArrayObject *)values[2]); - __pyx_v_bo = ((PyArrayObject *)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 = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_bo = ((PyArrayObject *)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[7]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("tseries.combineFunc"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ao), __pyx_ptype_5numpy_ndarray, 1, "ao", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bo), __pyx_ptype_5numpy_ndarray, 1, "bo", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_aMap), (&PyDict_Type), 1, "aMap", 1))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bMap), (&PyDict_Type), 1, "bMap", 1))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":46 - * 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[7]; __pyx_lineno = 46; __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[7]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":47 - * ''' - * 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_v_index); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = ((PyObject *)__pyx_v_ao); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = ((PyObject *)__pyx_v_bo); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = ((PyObject *)__pyx_v_aMap); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = ((PyObject *)__pyx_v_bMap); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_7 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___add, ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_3), ((PyArrayObject *)__pyx_t_4), ((PyObject*)__pyx_t_5), ((PyObject*)__pyx_t_6))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 47; __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; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":48 - * 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_7 = PyObject_RichCompare(__pyx_v_name, ((PyObject *)__pyx_n_s____sub__), Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_2) { - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":49 - * 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_7 = ((PyObject *)__pyx_v_index); - __Pyx_INCREF(__pyx_t_7); - __pyx_t_6 = ((PyObject *)__pyx_v_ao); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_5 = ((PyObject *)__pyx_v_bo); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_4 = ((PyObject *)__pyx_v_aMap); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = ((PyObject *)__pyx_v_bMap); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___sub, ((PyArrayObject *)__pyx_t_7), ((PyArrayObject *)__pyx_t_6), ((PyArrayObject *)__pyx_t_5), ((PyObject*)__pyx_t_4), ((PyObject*)__pyx_t_3))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":50 - * 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[7]; __pyx_lineno = 50; __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[7]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":51 - * 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_v_index); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = ((PyObject *)__pyx_v_ao); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = ((PyObject *)__pyx_v_bo); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = ((PyObject *)__pyx_v_aMap); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = ((PyObject *)__pyx_v_bMap); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_7 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___div, ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_3), ((PyArrayObject *)__pyx_t_4), ((PyObject*)__pyx_t_5), ((PyObject*)__pyx_t_6))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 51; __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; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":52 - * 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_7 = PyObject_RichCompare(__pyx_v_name, ((PyObject *)__pyx_n_s____mul__), Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_2) { - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":53 - * 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_7 = ((PyObject *)__pyx_v_index); - __Pyx_INCREF(__pyx_t_7); - __pyx_t_6 = ((PyObject *)__pyx_v_ao); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_5 = ((PyObject *)__pyx_v_bo); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_4 = ((PyObject *)__pyx_v_aMap); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = ((PyObject *)__pyx_v_bMap); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___mul, ((PyArrayObject *)__pyx_t_7), ((PyArrayObject *)__pyx_t_6), ((PyArrayObject *)__pyx_t_5), ((PyObject*)__pyx_t_4), ((PyObject*)__pyx_t_3))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":54 - * 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[7]; __pyx_lineno = 54; __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[7]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":55 - * 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_v_index); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = ((PyObject *)__pyx_v_ao); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = ((PyObject *)__pyx_v_bo); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = ((PyObject *)__pyx_v_aMap); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = ((PyObject *)__pyx_v_bMap); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_7 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___eq, ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_3), ((PyArrayObject *)__pyx_t_4), ((PyObject*)__pyx_t_5), ((PyObject*)__pyx_t_6))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 55; __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; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":56 - * 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_7 = PyObject_RichCompare(__pyx_v_name, ((PyObject *)__pyx_n_s____ne__), Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_2) { - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":57 - * 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_7 = ((PyObject *)__pyx_v_index); - __Pyx_INCREF(__pyx_t_7); - __pyx_t_6 = ((PyObject *)__pyx_v_ao); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_5 = ((PyObject *)__pyx_v_bo); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_4 = ((PyObject *)__pyx_v_aMap); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = ((PyObject *)__pyx_v_bMap); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___ne, ((PyArrayObject *)__pyx_t_7), ((PyArrayObject *)__pyx_t_6), ((PyArrayObject *)__pyx_t_5), ((PyObject*)__pyx_t_4), ((PyObject*)__pyx_t_3))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":58 - * 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[7]; __pyx_lineno = 58; __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[7]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":59 - * 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_v_index); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = ((PyObject *)__pyx_v_ao); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = ((PyObject *)__pyx_v_bo); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = ((PyObject *)__pyx_v_aMap); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = ((PyObject *)__pyx_v_bMap); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_7 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___lt, ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_3), ((PyArrayObject *)__pyx_t_4), ((PyObject*)__pyx_t_5), ((PyObject*)__pyx_t_6))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 59; __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; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":60 - * 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_7 = PyObject_RichCompare(__pyx_v_name, ((PyObject *)__pyx_n_s____gt__), Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_2) { - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":61 - * 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_7 = ((PyObject *)__pyx_v_index); - __Pyx_INCREF(__pyx_t_7); - __pyx_t_6 = ((PyObject *)__pyx_v_ao); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_5 = ((PyObject *)__pyx_v_bo); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_4 = ((PyObject *)__pyx_v_aMap); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = ((PyObject *)__pyx_v_bMap); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_1 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___gt, ((PyArrayObject *)__pyx_t_7), ((PyArrayObject *)__pyx_t_6), ((PyArrayObject *)__pyx_t_5), ((PyObject*)__pyx_t_4), ((PyObject*)__pyx_t_3))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":62 - * 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[7]; __pyx_lineno = 62; __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[7]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":63 - * 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_v_index); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = ((PyObject *)__pyx_v_ao); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = ((PyObject *)__pyx_v_bo); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = ((PyObject *)__pyx_v_aMap); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = ((PyObject *)__pyx_v_bMap); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_7 = ((PyObject *)__pyx_f_7tseries__applyFunc(__pyx_f_7tseries___pow, ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_3), ((PyArrayObject *)__pyx_t_4), ((PyObject*)__pyx_t_5), ((PyObject*)__pyx_t_6))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 63; __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; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - /*else*/ { - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":65 - * return _applyFunc(__pow, index, ao, bo, aMap, bMap) - * else: - * raise Exception('bad funcname requested of Cython code') # <<<<<<<<<<<<<< - */ - __pyx_t_7 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_Raise(__pyx_t_7, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - {__pyx_filename = __pyx_f[7]; __pyx_lineno = 65; __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_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("tseries.combineFunc"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":5 - * from datetime import date as pydate - * - * cdef inline int64_t gmtime(object date): # <<<<<<<<<<<<<< - * cdef int y, m, d, h, mn, s, ms, days - * - */ - -static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_7tseries_gmtime(PyObject *__pyx_v_date) { - int __pyx_v_y; - int __pyx_v_m; - int __pyx_v_d; - int __pyx_v_h; - int __pyx_v_mn; - int __pyx_v_s; - int __pyx_v_ms; - int __pyx_v_days; - __pyx_t_5numpy_int64_t __pyx_r; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - __Pyx_RefNannySetupContext("gmtime"); - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":8 - * cdef int y, m, d, h, mn, s, ms, days - * - * y = PyDateTime_GET_YEAR(date) # <<<<<<<<<<<<<< - * m = PyDateTime_GET_MONTH(date) - * d = PyDateTime_GET_DAY(date) - */ - if (!(likely(((__pyx_v_date) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_date, __pyx_ptype_7tseries_datetime))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __pyx_v_date; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_y = PyDateTime_GET_YEAR(((PyDateTime_DateTime *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":9 - * - * y = PyDateTime_GET_YEAR(date) - * m = PyDateTime_GET_MONTH(date) # <<<<<<<<<<<<<< - * d = PyDateTime_GET_DAY(date) - * h = PyDateTime_DATE_GET_HOUR(date) - */ - if (!(likely(((__pyx_v_date) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_date, __pyx_ptype_7tseries_datetime))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __pyx_v_date; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_m = PyDateTime_GET_MONTH(((PyDateTime_DateTime *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":10 - * y = PyDateTime_GET_YEAR(date) - * m = PyDateTime_GET_MONTH(date) - * d = PyDateTime_GET_DAY(date) # <<<<<<<<<<<<<< - * h = PyDateTime_DATE_GET_HOUR(date) - * mn = PyDateTime_DATE_GET_MINUTE(date) - */ - if (!(likely(((__pyx_v_date) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_date, __pyx_ptype_7tseries_datetime))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __pyx_v_date; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_d = PyDateTime_GET_DAY(((PyDateTime_DateTime *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":11 - * m = PyDateTime_GET_MONTH(date) - * d = PyDateTime_GET_DAY(date) - * h = PyDateTime_DATE_GET_HOUR(date) # <<<<<<<<<<<<<< - * mn = PyDateTime_DATE_GET_MINUTE(date) - * s = PyDateTime_DATE_GET_SECOND(date) - */ - if (!(likely(((__pyx_v_date) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_date, __pyx_ptype_7tseries_datetime))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __pyx_v_date; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_h = PyDateTime_DATE_GET_HOUR(((PyDateTime_DateTime *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":12 - * d = PyDateTime_GET_DAY(date) - * h = PyDateTime_DATE_GET_HOUR(date) - * mn = PyDateTime_DATE_GET_MINUTE(date) # <<<<<<<<<<<<<< - * s = PyDateTime_DATE_GET_SECOND(date) - * ms = PyDateTime_DATE_GET_MICROSECOND(date) / 1000 - */ - if (!(likely(((__pyx_v_date) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_date, __pyx_ptype_7tseries_datetime))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __pyx_v_date; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_mn = PyDateTime_DATE_GET_MINUTE(((PyDateTime_DateTime *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":13 - * h = PyDateTime_DATE_GET_HOUR(date) - * mn = PyDateTime_DATE_GET_MINUTE(date) - * s = PyDateTime_DATE_GET_SECOND(date) # <<<<<<<<<<<<<< - * ms = PyDateTime_DATE_GET_MICROSECOND(date) / 1000 - * - */ - if (!(likely(((__pyx_v_date) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_date, __pyx_ptype_7tseries_datetime))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __pyx_v_date; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_s = PyDateTime_DATE_GET_SECOND(((PyDateTime_DateTime *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":14 - * mn = PyDateTime_DATE_GET_MINUTE(date) - * s = PyDateTime_DATE_GET_SECOND(date) - * ms = PyDateTime_DATE_GET_MICROSECOND(date) / 1000 # <<<<<<<<<<<<<< - * - * days = pydate(y, m, 1).toordinal() - _EPOCH_ORD + d - 1 - */ - if (!(likely(((__pyx_v_date) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_date, __pyx_ptype_7tseries_datetime))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __pyx_v_date; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_ms = __Pyx_div_long(PyDateTime_DATE_GET_MICROSECOND(((PyDateTime_DateTime *)__pyx_t_1)), 1000); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":16 - * ms = PyDateTime_DATE_GET_MICROSECOND(date) / 1000 - * - * days = pydate(y, m, 1).toordinal() - _EPOCH_ORD + d - 1 # <<<<<<<<<<<<<< - * return (( (((days * 24 + h) * 60 + mn))) * 60 + s) * 1000 - * - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pydate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromLong(__pyx_v_y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromLong(__pyx_v_m); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_INCREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_1); - __Pyx_GIVEREF(__pyx_int_1); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__toordinal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyInt_FromLong(__pyx_v_7tseries__EPOCH_ORD); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyInt_FromLong(__pyx_v_d); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __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_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Subtract(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_days = __pyx_t_5; - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":17 - * - * days = pydate(y, m, 1).toordinal() - _EPOCH_ORD + d - 1 - * return (( (((days * 24 + h) * 60 + mn))) * 60 + s) * 1000 # <<<<<<<<<<<<<< - * - * cpdef object to_datetime(int64_t timestamp): - */ - __pyx_r = (((((__pyx_t_5numpy_int64_t)((((__pyx_v_days * 24) + __pyx_v_h) * 60) + __pyx_v_mn)) * 60) + __pyx_v_s) * 1000); - goto __pyx_L0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_WriteUnraisable("tseries.gmtime"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":19 - * return (( (((days * 24 + h) * 60 + mn))) * 60 + s) * 1000 - * - * cpdef object to_datetime(int64_t timestamp): # <<<<<<<<<<<<<< - * return pydatetime.utcfromtimestamp(timestamp / 1000.0) - * - */ - -static PyObject *__pyx_pf_7tseries_24to_datetime(PyObject *__pyx_self, PyObject *__pyx_arg_timestamp); /*proto*/ -static PyObject *__pyx_f_7tseries_to_datetime(__pyx_t_5numpy_int64_t __pyx_v_timestamp, int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("to_datetime"); - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":20 - * - * cpdef object to_datetime(int64_t timestamp): - * return pydatetime.utcfromtimestamp(timestamp / 1000.0) # <<<<<<<<<<<<<< - * - * cpdef object to_timestamp(object dt): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pydatetime); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__utcfromtimestamp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyFloat_FromDouble((__pyx_v_timestamp / 1000.0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __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[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("tseries.to_datetime"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":19 - * return (( (((days * 24 + h) * 60 + mn))) * 60 + s) * 1000 - * - * cpdef object to_datetime(int64_t timestamp): # <<<<<<<<<<<<<< - * return pydatetime.utcfromtimestamp(timestamp / 1000.0) - * - */ - -static PyObject *__pyx_pf_7tseries_24to_datetime(PyObject *__pyx_self, PyObject *__pyx_arg_timestamp); /*proto*/ -static PyObject *__pyx_pf_7tseries_24to_datetime(PyObject *__pyx_self, PyObject *__pyx_arg_timestamp) { - __pyx_t_5numpy_int64_t __pyx_v_timestamp; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("to_datetime"); - __pyx_self = __pyx_self; - assert(__pyx_arg_timestamp); { - __pyx_v_timestamp = __Pyx_PyInt_from_py_npy_int64(__pyx_arg_timestamp); if (unlikely((__pyx_v_timestamp == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("tseries.to_datetime"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_7tseries_to_datetime(__pyx_v_timestamp, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __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.to_datetime"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":22 - * return pydatetime.utcfromtimestamp(timestamp / 1000.0) - * - * cpdef object to_timestamp(object dt): # <<<<<<<<<<<<<< - * return gmtime(dt) - * - */ - -static PyObject *__pyx_pf_7tseries_25to_timestamp(PyObject *__pyx_self, PyObject *__pyx_v_dt); /*proto*/ -static PyObject *__pyx_f_7tseries_to_timestamp(PyObject *__pyx_v_dt, int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("to_timestamp"); - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":23 - * - * cpdef object to_timestamp(object dt): - * return gmtime(dt) # <<<<<<<<<<<<<< - * - * def array_to_timestamp(ndarray[object, ndim=1] arr): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_v_dt; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_7tseries_gmtime(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("tseries.to_timestamp"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":22 - * return pydatetime.utcfromtimestamp(timestamp / 1000.0) - * - * cpdef object to_timestamp(object dt): # <<<<<<<<<<<<<< - * return gmtime(dt) - * - */ - -static PyObject *__pyx_pf_7tseries_25to_timestamp(PyObject *__pyx_self, PyObject *__pyx_v_dt); /*proto*/ -static PyObject *__pyx_pf_7tseries_25to_timestamp(PyObject *__pyx_self, PyObject *__pyx_v_dt) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("to_timestamp"); - __pyx_self = __pyx_self; - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_v_dt; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_7tseries_to_timestamp(__pyx_t_1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("tseries.to_timestamp"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":25 - * return gmtime(dt) - * - * def array_to_timestamp(ndarray[object, ndim=1] arr): # <<<<<<<<<<<<<< - * cdef int i, n - * cdef ndarray[int64_t, ndim=1] result - */ - -static PyObject *__pyx_pf_7tseries_26array_to_timestamp(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/ -static PyMethodDef __pyx_mdef_7tseries_26array_to_timestamp = {__Pyx_NAMESTR("array_to_timestamp"), (PyCFunction)__pyx_pf_7tseries_26array_to_timestamp, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7tseries_26array_to_timestamp(PyObject *__pyx_self, PyObject *__pyx_v_arr) { - int __pyx_v_i; - int __pyx_v_n; - PyArrayObject *__pyx_v_result; - Py_buffer __pyx_bstruct_arr; - Py_ssize_t __pyx_bstride_0_arr = 0; - Py_ssize_t __pyx_bshape_0_arr = 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; - Py_ssize_t __pyx_t_2; - 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; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - __Pyx_RefNannySetupContext("array_to_timestamp"); - __pyx_self = __pyx_self; - __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_result.buf = NULL; - __pyx_bstruct_arr.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __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[2]; __pyx_lineno = 25; __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]; - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":29 - * cdef ndarray[int64_t, ndim=1] result - * - * n = len(arr) # <<<<<<<<<<<<<< - * result = np.empty(n, dtype=np.int64) - * - */ - __pyx_t_1 = __pyx_v_arr; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_n = __pyx_t_2; - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":30 - * - * n = len(arr) - * result = np.empty(n, dtype=np.int64) # <<<<<<<<<<<<<< - * - * for i from 0 <= i < n: - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 30; __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[2]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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[2]; __pyx_lineno = 30; __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[2]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 30; __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[2]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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 = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = ((PyArrayObject *)__pyx_t_6); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_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_result, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_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_result = __pyx_bstruct_result.strides[0]; - __pyx_bshape_0_result = __pyx_bstruct_result.shape[0]; - if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":32 - * result = np.empty(n, dtype=np.int64) - * - * for i from 0 <= i < n: # <<<<<<<<<<<<<< - * result[i] = gmtime(arr[i]) - * - */ - __pyx_t_8 = __pyx_v_n; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":33 - * - * for i from 0 <= i < n: - * result[i] = gmtime(arr[i]) # <<<<<<<<<<<<<< - * - * return result - */ - __pyx_t_12 = __pyx_v_i; - __pyx_t_13 = -1; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_bshape_0_arr; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 0; - } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_arr)) __pyx_t_13 = 0; - if (unlikely(__pyx_t_13 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_13); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_arr.buf, __pyx_t_12, __pyx_bstride_0_arr); - __Pyx_INCREF((PyObject*)__pyx_t_6); - __pyx_t_13 = __pyx_v_i; - __pyx_t_14 = -1; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_bshape_0_result; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0; - } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_result)) __pyx_t_14 = 0; - if (unlikely(__pyx_t_14 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_14); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_result.buf, __pyx_t_13, __pyx_bstride_0_result) = __pyx_f_7tseries_gmtime(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":35 - * result[i] = gmtime(arr[i]) - * - * return result # <<<<<<<<<<<<<< - * - * def array_to_datetime(ndarray[int64_t, ndim=1] arr): - */ - __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_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_arr); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("tseries.array_to_timestamp"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_arr); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":37 - * return result - * - * def array_to_datetime(ndarray[int64_t, ndim=1] arr): # <<<<<<<<<<<<<< - * cdef int i, n - * cdef ndarray[object, ndim=1] result - */ - -static PyObject *__pyx_pf_7tseries_27array_to_datetime(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/ -static PyMethodDef __pyx_mdef_7tseries_27array_to_datetime = {__Pyx_NAMESTR("array_to_datetime"), (PyCFunction)__pyx_pf_7tseries_27array_to_datetime, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7tseries_27array_to_datetime(PyObject *__pyx_self, PyObject *__pyx_v_arr) { - int __pyx_v_i; - int __pyx_v_n; - PyArrayObject *__pyx_v_result; - Py_buffer __pyx_bstruct_arr; - Py_ssize_t __pyx_bstride_0_arr = 0; - Py_ssize_t __pyx_bshape_0_arr = 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; - Py_ssize_t __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; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - PyObject **__pyx_t_14; - __Pyx_RefNannySetupContext("array_to_datetime"); - __pyx_self = __pyx_self; - __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_result.buf = NULL; - __pyx_bstruct_arr.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __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_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __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]; - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":41 - * cdef ndarray[object, ndim=1] result - * - * n = len(arr) # <<<<<<<<<<<<<< - * result = np.empty(n, dtype=object) - * - */ - __pyx_t_1 = __pyx_v_arr; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_n = __pyx_t_2; - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":42 - * - * n = len(arr) - * result = np.empty(n, dtype=object) # <<<<<<<<<<<<<< - * - * for i from 0 <= i < n: - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 42; __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[2]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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[2]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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[2]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __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_object, 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_object, 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[2]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":44 - * result = np.empty(n, dtype=object) - * - * for i from 0 <= i < n: # <<<<<<<<<<<<<< - * result[i] = to_datetime(arr[i]) - * - */ - __pyx_t_7 = __pyx_v_n; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) { - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":45 - * - * for i from 0 <= i < n: - * result[i] = to_datetime(arr[i]) # <<<<<<<<<<<<<< - * - * return result - */ - __pyx_t_11 = __pyx_v_i; - __pyx_t_12 = -1; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_bshape_0_arr; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0; - } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_arr)) __pyx_t_12 = 0; - if (unlikely(__pyx_t_12 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_12); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = __pyx_f_7tseries_to_datetime((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_arr.buf, __pyx_t_11, __pyx_bstride_0_arr)), 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __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[2]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_14 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_result.buf, __pyx_t_12, __pyx_bstride_0_result); - __Pyx_GOTREF(*__pyx_t_14); - __Pyx_DECREF(*__pyx_t_14); __Pyx_INCREF(__pyx_t_5); - *__pyx_t_14 = __pyx_t_5; - __Pyx_GIVEREF(*__pyx_t_14); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":47 - * result[i] = to_datetime(arr[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_1); - __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_arr); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("tseries.array_to_datetime"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_arr); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "numpy.pxd":188 - * # experimental exception made for __getbuffer__ and __releasebuffer__ - * # -- the details of this may change. - * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< - * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fullfill the PEP. - */ - -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_v_copy_shape; - int __pyx_v_i; - int __pyx_v_ndim; - int __pyx_v_endian_detector; - int __pyx_v_little_endian; - int __pyx_v_t; - char *__pyx_v_f; - PyArray_Descr *__pyx_v_descr = 0; - int __pyx_v_offset; - int __pyx_v_hasfields; - int __pyx_r; - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - 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); - - /* "numpy.pxd":194 - * # of flags - * cdef int copy_shape, i, ndim - * cdef int endian_detector = 1 # <<<<<<<<<<<<<< - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * - */ - __pyx_v_endian_detector = 1; - - /* "numpy.pxd":195 - * cdef int copy_shape, i, ndim - * cdef int endian_detector = 1 - * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< - * - * ndim = PyArray_NDIM(self) - */ - __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - - /* "numpy.pxd":197 - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * - * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - */ - __pyx_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "numpy.pxd":199 - * ndim = PyArray_NDIM(self) - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * copy_shape = 1 - * else: - */ - __pyx_t_2 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); - if (__pyx_t_2) { - - /* "numpy.pxd":200 - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * copy_shape = 1 # <<<<<<<<<<<<<< - * else: - * copy_shape = 0 - */ - __pyx_v_copy_shape = 1; - goto __pyx_L5; - } - /*else*/ { - - /* "numpy.pxd":202 - * copy_shape = 1 - * else: - * copy_shape = 0 # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - */ - __pyx_v_copy_shape = 0; - } - __pyx_L5:; - - /* "numpy.pxd":204 - * copy_shape = 0 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") - */ - __pyx_t_2 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); - if (__pyx_t_2) { - - /* "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") - * - */ - __pyx_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_t_1), NPY_C_CONTIGUOUS)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __pyx_t_3; - } else { - __pyx_t_4 = __pyx_t_2; - } - if (__pyx_t_4) { - - /* "numpy.pxd":206 - * 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_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "numpy.pxd":208 - * 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_4 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); - if (__pyx_t_4) { - - /* "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") - * - */ - __pyx_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_t_1), NPY_F_CONTIGUOUS)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __pyx_t_2; - } else { - __pyx_t_3 = __pyx_t_4; - } - if (__pyx_t_3) { - - /* "numpy.pxd":210 - * 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_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; - } - __pyx_L7:; - - /* "numpy.pxd":212 - * raise ValueError(u"ndarray is not Fortran contiguous") - * - * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< - * info.ndim = ndim - * if copy_shape: - */ - __pyx_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "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 - */ - __pyx_v_info->ndim = __pyx_v_ndim; - - /* "numpy.pxd":214 - * info.buf = PyArray_DATA(self) - * info.ndim = ndim - * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. - */ - if (__pyx_v_copy_shape) { - - /* "numpy.pxd":217 - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. - * info.strides = 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))); - - /* "numpy.pxd":218 - * # as one block, strides first. - * info.strides = 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); - - /* "numpy.pxd":219 - * info.strides = 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_5 = __pyx_v_ndim; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; - - /* "numpy.pxd":220 - * 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_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_t_1))[__pyx_v_i]); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "numpy.pxd":221 - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] - * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< - * else: - * info.strides = PyArray_STRIDES(self) - */ - __pyx_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_t_1))[__pyx_v_i]); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - goto __pyx_L8; - } - /*else*/ { - - /* "numpy.pxd":223 - * info.shape[i] = PyArray_DIMS(self)[i] - * else: - * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL - */ - __pyx_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_t_1))); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "numpy.pxd":224 - * else: - * info.strides = PyArray_STRIDES(self) - * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) - */ - __pyx_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_t_1))); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_L8:; - - /* "numpy.pxd":225 - * info.strides = PyArray_STRIDES(self) - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * info.itemsize = PyArray_ITEMSIZE(self) - * info.readonly = not PyArray_ISWRITEABLE(self) - */ - __pyx_v_info->suboffsets = NULL; - - /* "numpy.pxd":226 - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< - * info.readonly = not PyArray_ISWRITEABLE(self) - * - */ - __pyx_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "numpy.pxd":227 - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) - * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< - * - * cdef int t - */ - __pyx_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_t_1))); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "numpy.pxd":230 - * - * cdef int t - * cdef char* f = NULL # <<<<<<<<<<<<<< - * cdef dtype descr = self.descr - * cdef list stack - */ - __pyx_v_f = NULL; - - /* "numpy.pxd":231 - * cdef int t - * cdef char* f = NULL - * cdef dtype descr = self.descr # <<<<<<<<<<<<<< - * cdef list stack - * cdef int offset - */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; - - /* "numpy.pxd":235 - * cdef int offset - * - * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< - * - * if not hasfields and not copy_shape: - */ - __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - - /* "numpy.pxd":237 - * cdef bint hasfields = PyDataType_HASFIELDS(descr) - * - * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< - * # do not call releasebuffer - * info.obj = None - */ - __pyx_t_3 = (!__pyx_v_hasfields); - if (__pyx_t_3) { - __pyx_t_4 = (!__pyx_v_copy_shape); - __pyx_t_2 = __pyx_t_4; - } else { - __pyx_t_2 = __pyx_t_3; - } - if (__pyx_t_2) { - - /* "numpy.pxd":239 - * 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*/ { - - /* "numpy.pxd":242 - * 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:; - - /* "numpy.pxd":244 - * info.obj = self - * - * if not hasfields: # <<<<<<<<<<<<<< - * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - */ - __pyx_t_2 = (!__pyx_v_hasfields); - if (__pyx_t_2) { - - /* "numpy.pxd":245 - * - * if not hasfields: - * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): - */ - __pyx_v_t = __pyx_v_descr->type_num; - - /* "numpy.pxd":246 - * 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_2 = (__pyx_v_descr->byteorder == '>'); - if (__pyx_t_2) { - __pyx_t_3 = __pyx_v_little_endian; - } else { - __pyx_t_3 = __pyx_t_2; - } - if (!__pyx_t_3) { - - /* "numpy.pxd":247 - * 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_2 = (__pyx_v_descr->byteorder == '<'); - if (__pyx_t_2) { - __pyx_t_4 = (!__pyx_v_little_endian); - __pyx_t_7 = __pyx_t_4; - } else { - __pyx_t_7 = __pyx_t_2; - } - __pyx_t_2 = __pyx_t_7; - } else { - __pyx_t_2 = __pyx_t_3; - } - if (__pyx_t_2) { - - /* "numpy.pxd":248 - * 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_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L13; - } - __pyx_L13:; - - /* "numpy.pxd":249 - * (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_2 = (__pyx_v_t == NPY_BYTE); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__b; - goto __pyx_L14; - } - - /* "numpy.pxd":250 - * 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_2 = (__pyx_v_t == NPY_UBYTE); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__B; - goto __pyx_L14; - } - - /* "numpy.pxd":251 - * 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_2 = (__pyx_v_t == NPY_SHORT); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__h; - goto __pyx_L14; - } - - /* "numpy.pxd":252 - * 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_2 = (__pyx_v_t == NPY_USHORT); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__H; - goto __pyx_L14; - } - - /* "numpy.pxd":253 - * 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_2 = (__pyx_v_t == NPY_INT); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__i; - goto __pyx_L14; - } - - /* "numpy.pxd":254 - * 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_2 = (__pyx_v_t == NPY_UINT); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__I; - goto __pyx_L14; - } - - /* "numpy.pxd":255 - * 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_2 = (__pyx_v_t == NPY_LONG); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__l; - goto __pyx_L14; - } - - /* "numpy.pxd":256 - * 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_2 = (__pyx_v_t == NPY_ULONG); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__L; - goto __pyx_L14; - } - - /* "numpy.pxd":257 - * 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_2 = (__pyx_v_t == NPY_LONGLONG); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__q; - goto __pyx_L14; - } - - /* "numpy.pxd":258 - * 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_2 = (__pyx_v_t == NPY_ULONGLONG); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__Q; - goto __pyx_L14; - } - - /* "numpy.pxd":259 - * 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_2 = (__pyx_v_t == NPY_FLOAT); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__f; - goto __pyx_L14; - } - - /* "numpy.pxd":260 - * 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_2 = (__pyx_v_t == NPY_DOUBLE); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__d; - goto __pyx_L14; - } - - /* "numpy.pxd":261 - * 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_2 = (__pyx_v_t == NPY_LONGDOUBLE); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__g; - goto __pyx_L14; - } - - /* "numpy.pxd":262 - * 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_2 = (__pyx_v_t == NPY_CFLOAT); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__Zf; - goto __pyx_L14; - } - - /* "numpy.pxd":263 - * 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_2 = (__pyx_v_t == NPY_CDOUBLE); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__Zd; - goto __pyx_L14; - } - - /* "numpy.pxd":264 - * 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_2 = (__pyx_v_t == NPY_CLONGDOUBLE); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__Zg; - goto __pyx_L14; - } - - /* "numpy.pxd":265 - * 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_2 = (__pyx_v_t == NPY_OBJECT); - if (__pyx_t_2) { - __pyx_v_f = __pyx_k__O; - goto __pyx_L14; - } - /*else*/ { - - /* "numpy.pxd":267 - * elif t == NPY_OBJECT: f = "O" - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * info.format = f - * return - */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_18), __pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_8, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L14:; - - /* "numpy.pxd":268 - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * info.format = f # <<<<<<<<<<<<<< - * return - * else: - */ - __pyx_v_info->format = __pyx_v_f; - - /* "numpy.pxd":269 - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * info.format = f - * return # <<<<<<<<<<<<<< - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L12; - } - /*else*/ { - - /* "numpy.pxd":271 - * return - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment - * offset = 0 - */ - __pyx_v_info->format = ((char *)malloc(255)); - - /* "numpy.pxd":272 - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< - * offset = 0 - * f = _util_dtypestring(descr, info.format + 1, - */ - (__pyx_v_info->format[0]) = '^'; - - /* "numpy.pxd":273 - * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment - * offset = 0 # <<<<<<<<<<<<<< - * f = _util_dtypestring(descr, info.format + 1, - * info.format + _buffer_format_string_len, - */ - __pyx_v_offset = 0; - - /* "numpy.pxd":276 - * 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[8]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_9; - - /* "numpy.pxd":277 - * 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_1); - __Pyx_XDECREF(__pyx_t_8); - __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_RefNannyFinishContext(); - return __pyx_r; -} - -/* "numpy.pxd":279 - * f[0] = 0 # Terminate format string - * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - */ - -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - __Pyx_RefNannySetupContext("__releasebuffer__"); - - /* "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): - */ - __pyx_t_1 = __pyx_v_self; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "numpy.pxd":281 - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) # <<<<<<<<<<<<<< - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) - */ - free(__pyx_v_info->format); - goto __pyx_L5; - } - __pyx_L5:; - - /* "numpy.pxd":282 - * 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_2 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); - if (__pyx_t_2) { - - /* "numpy.pxd":283 - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) # <<<<<<<<<<<<<< - * # info.shape was stored after info.strides in the same block - * - */ - free(__pyx_v_info->strides); - goto __pyx_L6; - } - __pyx_L6:; - - __Pyx_RefNannyFinishContext(); -} - -/* "numpy.pxd":756 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, 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"); - - /* "numpy.pxd":757 - * - * cdef inline object PyArray_MultiIterNew1(a): - * return PyArray_MultiIterNew(1, 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[8]; __pyx_lineno = 757; __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; -} - -/* "numpy.pxd":759 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, 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"); - - /* "numpy.pxd":760 - * - * cdef inline object PyArray_MultiIterNew2(a, b): - * return PyArray_MultiIterNew(2, a, 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[8]; __pyx_lineno = 760; __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; -} - -/* "numpy.pxd":762 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, 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"); - - /* "numpy.pxd":763 - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - * return PyArray_MultiIterNew(3, a, b, 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[8]; __pyx_lineno = 763; __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; -} - -/* "numpy.pxd":765 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, 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"); - - /* "numpy.pxd":766 - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - * return PyArray_MultiIterNew(4, a, b, c, 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[8]; __pyx_lineno = 766; __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; -} - -/* "numpy.pxd":768 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, 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"); - - /* "numpy.pxd":769 - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - * return PyArray_MultiIterNew(5, a, b, c, d, 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[8]; __pyx_lineno = 769; __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; -} - -/* "numpy.pxd":771 - * return PyArray_MultiIterNew(5, a, b, c, d, 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; - long __pyx_t_10; - char *__pyx_t_11; - __Pyx_RefNannySetupContext("_util_dtypestring"); - __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); - - /* "numpy.pxd":778 - * cdef int delta_offset - * cdef tuple i - * cdef int endian_detector = 1 # <<<<<<<<<<<<<< - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * cdef tuple fields - */ - __pyx_v_endian_detector = 1; - - /* "numpy.pxd":779 - * cdef tuple i - * cdef int endian_detector = 1 - * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< - * cdef tuple fields - * - */ - __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - - /* "numpy.pxd":782 - * cdef tuple fields - * - * for childname in descr.names: # <<<<<<<<<<<<<< - * fields = descr.fields[childname] - * child, new_offset = fields - */ - if (unlikely(__pyx_v_descr->names == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); - 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; - - /* "numpy.pxd":783 - * - * 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[8]; __pyx_lineno = 783; __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[8]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "numpy.pxd":784 - * 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[8]; __pyx_lineno = 784; __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[8]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "numpy.pxd":786 - * 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[8]; __pyx_lineno = 786; __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[8]; __pyx_lineno = 786; __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[8]; __pyx_lineno = 786; __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[8]; __pyx_lineno = 786; __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[8]; __pyx_lineno = 786; __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[8]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - - /* "numpy.pxd":787 - * - * if (end - f) - (new_offset - offset[0]) < 15: - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< - * - * if ((child.byteorder == '>' and little_endian) or - */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "numpy.pxd":789 - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; - } else { - __pyx_t_7 = __pyx_t_6; - } - if (!__pyx_t_7) { - - /* "numpy.pxd":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 - */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; - } else { - __pyx_t_9 = __pyx_t_6; - } - __pyx_t_6 = __pyx_t_9; - } else { - __pyx_t_6 = __pyx_t_7; - } - if (__pyx_t_6) { - - /* "numpy.pxd":791 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * # One could encode it in the format string and have Cython - * # complain instead, BUT: < and > in format strings also imply - */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "numpy.pxd":801 - * - * # 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[8]; __pyx_lineno = 801; __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[8]; __pyx_lineno = 801; __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[8]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; - - /* "numpy.pxd":802 - * # Output padding bytes - * while offset[0] < new_offset: - * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< - * f += 1 - * offset[0] += 1 - */ - (__pyx_v_f[0]) = 120; - - /* "numpy.pxd":803 - * while offset[0] < new_offset: - * f[0] = 120 # "x"; pad byte - * f += 1 # <<<<<<<<<<<<<< - * offset[0] += 1 - * - */ - __pyx_v_f = (__pyx_v_f + 1); - - /* "numpy.pxd":804 - * f[0] = 120 # "x"; pad byte - * f += 1 - * offset[0] += 1 # <<<<<<<<<<<<<< - * - * offset[0] += child.itemsize - */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); - } - - /* "numpy.pxd":806 - * offset[0] += 1 - * - * offset[0] += child.itemsize # <<<<<<<<<<<<<< - * - * if not PyDataType_HASFIELDS(child): - */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); - - /* "numpy.pxd":808 - * offset[0] += child.itemsize - * - * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< - * t = child.type_num - * if end - f < 5: - */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { - - /* "numpy.pxd":809 - * - * 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[8]; __pyx_lineno = 809; __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; - - /* "numpy.pxd":810 - * if not PyDataType_HASFIELDS(child): - * t = child.type_num - * if end - f < 5: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short.") - * - */ - __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { - - /* "numpy.pxd":811 - * t = child.type_num - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< - * - * # Until ticket #99 is fixed, use integers to avoid warnings - */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; - } - __pyx_L10:; - - /* "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" - */ - __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __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[8]; __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[8]; __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]) = 98; - goto __pyx_L11; - } - - /* "numpy.pxd":815 - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - */ - __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __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[8]; __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[8]; __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]) = 66; - goto __pyx_L11; - } - - /* "numpy.pxd":816 - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - */ - __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __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[8]; __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[8]; __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]) = 104; - goto __pyx_L11; - } - - /* "numpy.pxd":817 - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - */ - __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __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[8]; __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[8]; __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]) = 72; - goto __pyx_L11; - } - - /* "numpy.pxd":818 - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - */ - __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __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[8]; __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[8]; __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]) = 105; - goto __pyx_L11; - } - - /* "numpy.pxd":819 - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - */ - __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __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[8]; __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[8]; __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]) = 73; - goto __pyx_L11; - } - - /* "numpy.pxd":820 - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - */ - __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __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[8]; __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[8]; __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]) = 108; - goto __pyx_L11; - } - - /* "numpy.pxd":821 - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __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[8]; __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[8]; __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]) = 76; - goto __pyx_L11; - } - - /* "numpy.pxd":822 - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __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[8]; __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[8]; __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]) = 113; - goto __pyx_L11; - } - - /* "numpy.pxd":823 - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __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[8]; __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[8]; __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]) = 81; - goto __pyx_L11; - } - - /* "numpy.pxd":824 - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - */ - __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __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[8]; __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[8]; __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]) = 102; - goto __pyx_L11; - } - - /* "numpy.pxd":825 - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - */ - __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __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[8]; __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[8]; __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]) = 100; - goto __pyx_L11; - } - - /* "numpy.pxd":826 - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __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[8]; __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[8]; __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]) = 103; - goto __pyx_L11; - } - - /* "numpy.pxd":827 - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - */ - __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __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[8]; __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[8]; __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]) = 102; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; - } - - /* "numpy.pxd":828 - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - * elif t == NPY_OBJECT: f[0] = 79 #"O" - */ - __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __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[8]; __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[8]; __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]) = 100; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; - } - - /* "numpy.pxd":829 - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - */ - __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __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[8]; __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[8]; __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]) = 90; - (__pyx_v_f[1]) = 103; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; - } - - /* "numpy.pxd":830 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - */ - __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 830; __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[8]; __pyx_lineno = 830; __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[8]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 79; - goto __pyx_L11; - } - /*else*/ { - - /* "numpy.pxd":832 - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * f += 1 - * else: - */ - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_18), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L11:; - - /* "numpy.pxd":833 - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * f += 1 # <<<<<<<<<<<<<< - * else: - * # Cython ignores struct boundary information ("T{...}"), - */ - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L9; - } - /*else*/ { - - /* "numpy.pxd":837 - * # Cython ignores struct boundary information ("T{...}"), - * # so don't output it - * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< - * return f - * - */ - __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_11; - } - __pyx_L9:; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "numpy.pxd":838 - * # 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_RefNannyFinishContext(); - return __pyx_r; -} - -/* "numpy.pxd":953 - * - * - * 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; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("set_array_base"); - - /* "numpy.pxd":955 - * cdef inline void set_array_base(ndarray arr, object base): - * cdef PyObject* baseptr - * if base is None: # <<<<<<<<<<<<<< - * baseptr = NULL - * else: - */ - __pyx_t_1 = (__pyx_v_base == Py_None); - if (__pyx_t_1) { - - /* "numpy.pxd":956 - * cdef PyObject* baseptr - * if base is None: - * baseptr = NULL # <<<<<<<<<<<<<< - * else: - * Py_INCREF(base) # important to do this before decref below! - */ - __pyx_v_baseptr = NULL; - goto __pyx_L3; - } - /*else*/ { - - /* "numpy.pxd":958 - * baseptr = NULL - * else: - * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< - * baseptr = base - * Py_XDECREF(arr.base) - */ - __pyx_t_2 = __pyx_v_base; - __Pyx_INCREF(__pyx_t_2); - Py_INCREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "numpy.pxd":959 - * else: - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base # <<<<<<<<<<<<<< - * Py_XDECREF(arr.base) - * arr.base = baseptr - */ - __pyx_v_baseptr = ((PyObject *)__pyx_v_base); - } - __pyx_L3:; - - /* "numpy.pxd":960 - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base - * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< - * arr.base = baseptr - * - */ - Py_XDECREF(__pyx_v_arr->base); - - /* "numpy.pxd":961 - * baseptr = base - * Py_XDECREF(arr.base) - * arr.base = baseptr # <<<<<<<<<<<<<< - * - * cdef inline object get_array_base(ndarray arr): - */ - __pyx_v_arr->base = __pyx_v_baseptr; - - __Pyx_RefNannyFinishContext(); -} - -/* "numpy.pxd":963 - * 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"); - - /* "numpy.pxd":964 - * - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: # <<<<<<<<<<<<<< - * return None - * else: - */ - __pyx_t_1 = (__pyx_v_arr->base == NULL); - if (__pyx_t_1) { - - /* "numpy.pxd":965 - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: - * return None # <<<<<<<<<<<<<< - * else: - * return arr.base - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; - goto __pyx_L0; - goto __pyx_L3; - } - /*else*/ { - - /* "numpy.pxd":967 - * return None - * else: - * return arr.base # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); - __pyx_r = ((PyObject *)__pyx_v_arr->base); - goto __pyx_L0; - } - __pyx_L3:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_tp_new_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 = ((PyObject*)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)); - (*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) { - e = (*v)(p->width, 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); - p->width = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_7tseries_4Node_value(PyObject *o, void *x) { - return __pyx_pf_7tseries_4Node_5value___get__(o); -} - -static int __pyx_setprop_7tseries_4Node_value(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_7tseries_4Node_5value_1__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -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_1__set__(o, v); - } - else { - return __pyx_pf_7tseries_4Node_4next_2__del__(o); - } -} - -static PyObject *__pyx_getprop_7tseries_4Node_width(PyObject *o, void *x) { - return __pyx_pf_7tseries_4Node_5width___get__(o); -} - -static int __pyx_setprop_7tseries_4Node_width(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_7tseries_4Node_5width_1__set__(o, v); - } - else { - return __pyx_pf_7tseries_4Node_5width_2__del__(o); - } -} - -static PyMethodDef __pyx_methods_7tseries_Node[] = { - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_7tseries_Node[] = { - {(char *)"value", __pyx_getprop_7tseries_4Node_value, __pyx_setprop_7tseries_4Node_value, 0, 0}, - {(char *)"next", __pyx_getprop_7tseries_4Node_next, __pyx_setprop_7tseries_4Node_next, 0, 0}, - {(char *)"width", __pyx_getprop_7tseries_4Node_width, __pyx_setprop_7tseries_4Node_width, 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, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_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 -}; - -static 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*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 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_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|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*/ - 0, /*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 struct __pyx_vtabstruct_7tseries_IndexableSkiplist __pyx_vtable_7tseries_IndexableSkiplist; - -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->__pyx_vtab = __pyx_vtabptr_7tseries_IndexableSkiplist; - 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 PyMethodDef __pyx_methods_7tseries_IndexableSkiplist[] = { - {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_7tseries_17IndexableSkiplist_3get, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pf_7tseries_17IndexableSkiplist_4insert, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("remove"), (PyCFunction)__pyx_pf_7tseries_17IndexableSkiplist_5remove, 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, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_IndexableSkiplist = { - __pyx_pf_7tseries_17IndexableSkiplist_1__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_1__len__, /*mp_length*/ - __pyx_pf_7tseries_17IndexableSkiplist_2__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 -}; - -static 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*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 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_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("\n Sorted collection supporting O(lg n) insertion, removal, and\n 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 PyMethodDef __pyx_methods[] = { - {__Pyx_NAMESTR("map_indices"), (PyCFunction)__pyx_pf_7tseries_map_indices, METH_O, __Pyx_DOCSTR(__pyx_doc_7tseries_map_indices)}, - {__Pyx_NAMESTR("checknull"), (PyCFunction)__pyx_pf_7tseries_3checknull, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("to_datetime"), (PyCFunction)__pyx_pf_7tseries_24to_datetime, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("to_timestamp"), (PyCFunction)__pyx_pf_7tseries_25to_timestamp, METH_O, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -#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_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0}, - {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, - {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0}, - {&__pyx_kp_u_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 1, 0, 0}, - {&__pyx_kp_u_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 1, 0, 0}, - {&__pyx_kp_u_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 1, 0, 0}, - {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, - {&__pyx_kp_u_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 1, 0, 0}, - {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, - {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 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__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__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____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, - {&__pyx_n_s___backfill, __pyx_k___backfill, sizeof(__pyx_k___backfill), 0, 0, 1, 1}, - {&__pyx_n_s___pad, __pyx_k___pad, sizeof(__pyx_k___pad), 0, 0, 1, 1}, - {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 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__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1}, - {&__pyx_n_s__array_to_datetime, __pyx_k__array_to_datetime, sizeof(__pyx_k__array_to_datetime), 0, 0, 1, 1}, - {&__pyx_n_s__array_to_timestamp, __pyx_k__array_to_timestamp, sizeof(__pyx_k__array_to_timestamp), 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__combineFunc, __pyx_k__combineFunc, sizeof(__pyx_k__combineFunc), 0, 0, 1, 1}, - {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1}, - {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, - {&__pyx_n_s__date, __pyx_k__date, sizeof(__pyx_k__date), 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__ewma, __pyx_k__ewma, sizeof(__pyx_k__ewma), 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__fill, __pyx_k__fill, sizeof(__pyx_k__fill), 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__getFillVec, __pyx_k__getFillVec, sizeof(__pyx_k__getFillVec), 0, 0, 1, 1}, - {&__pyx_n_s__getMergeVec, __pyx_k__getMergeVec, sizeof(__pyx_k__getMergeVec), 0, 0, 1, 1}, - {&__pyx_n_s__groupby, __pyx_k__groupby, sizeof(__pyx_k__groupby), 0, 0, 1, 1}, - {&__pyx_n_s__groupby_indices, __pyx_k__groupby_indices, sizeof(__pyx_k__groupby_indices), 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__int64, __pyx_k__int64, sizeof(__pyx_k__int64), 0, 0, 1, 1}, - {&__pyx_n_s__int8, __pyx_k__int8, sizeof(__pyx_k__int8), 0, 0, 1, 1}, - {&__pyx_n_s__isAllDates, __pyx_k__isAllDates, sizeof(__pyx_k__isAllDates), 0, 0, 1, 1}, - {&__pyx_n_s__isAllDates2, __pyx_k__isAllDates2, sizeof(__pyx_k__isAllDates2), 0, 0, 1, 1}, - {&__pyx_n_s__isnan, __pyx_k__isnan, sizeof(__pyx_k__isnan), 0, 0, 1, 1}, - {&__pyx_n_s__isnullobj, __pyx_k__isnullobj, sizeof(__pyx_k__isnullobj), 0, 0, 1, 1}, - {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, - {&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1}, - {&__pyx_n_s__kind, __pyx_k__kind, sizeof(__pyx_k__kind), 0, 0, 1, 1}, - {&__pyx_n_s__kth_smallest, __pyx_k__kth_smallest, sizeof(__pyx_k__kth_smallest), 0, 0, 1, 1}, - {&__pyx_n_s__mapper, __pyx_k__mapper, sizeof(__pyx_k__mapper), 0, 0, 1, 1}, - {&__pyx_n_s__maxlevels, __pyx_k__maxlevels, sizeof(__pyx_k__maxlevels), 0, 0, 1, 1}, - {&__pyx_n_s__median, __pyx_k__median, sizeof(__pyx_k__median), 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__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__output, __pyx_k__output, sizeof(__pyx_k__output), 0, 0, 1, 1}, - {&__pyx_n_s__pydate, __pyx_k__pydate, sizeof(__pyx_k__pydate), 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__roll_kurt, __pyx_k__roll_kurt, sizeof(__pyx_k__roll_kurt), 0, 0, 1, 1}, - {&__pyx_n_s__roll_max, __pyx_k__roll_max, sizeof(__pyx_k__roll_max), 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_min, __pyx_k__roll_min, sizeof(__pyx_k__roll_min), 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__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__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__toordinal, __pyx_k__toordinal, sizeof(__pyx_k__toordinal), 0, 0, 1, 1}, - {&__pyx_n_s__tseries, __pyx_k__tseries, sizeof(__pyx_k__tseries), 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__utcfromtimestamp, __pyx_k__utcfromtimestamp, sizeof(__pyx_k__utcfromtimestamp), 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__win, __pyx_k__win, sizeof(__pyx_k__win), 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 = 20; __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 = 32; __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 = 73; __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 = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 42; __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[8]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":32 - * 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_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_3)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); - PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_s_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":137 - * - * if value != ( ( ( chain[0]).next)[0]).value: - * raise KeyError('Not Found') # <<<<<<<<<<<<<< - * - * # remove one link at each level - */ - __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); - PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":484 - * cdef double_t _get_min(object skiplist, int nobs, int minp): - * if nobs >= minp: - * return skiplist.get(0) # <<<<<<<<<<<<<< - * else: - * return NaN - */ - __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); - __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, __pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":55 - * - * fillVec = np.empty(len(newIndex), dtype = np.int32) - * fillVec.fill(-1) # <<<<<<<<<<<<<< - * - * mask = np.zeros(len(newIndex), dtype = np.int8) - */ - __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); - __Pyx_INCREF(__pyx_int_neg_1); - PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, __pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_int_neg_1); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":143 - * - * fillVec = np.empty(len(newIndex), dtype = np.int32) - * fillVec.fill(-1) # <<<<<<<<<<<<<< - * - * mask = np.zeros(len(newIndex), dtype = np.int8) - */ - __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9)); - __Pyx_INCREF(__pyx_int_neg_1); - PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, __pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_int_neg_1); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":65 - * return _applyFunc(__pow, index, ao, bo, aMap, bMap) - * else: - * raise Exception('bad funcname requested of Cython code') # <<<<<<<<<<<<<< - */ - __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_10)); - PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_s_10)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); - - /* "numpy.pxd":206 - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - */ - __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_13)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_12)); - PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_u_12)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); - - /* "numpy.pxd":210 - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< - * - * info.buf = PyArray_DATA(self) - */ - __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_14)); - PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_u_14)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_14)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); - - /* "numpy.pxd":248 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" - */ - __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_16)); - PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_u_16)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_16)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); - - /* "numpy.pxd":787 - * - * if (end - f) - (new_offset - offset[0]) < 15: - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< - * - * if ((child.byteorder == '>' and little_endian) or - */ - __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_20)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_19)); - PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_u_19)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_19)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); - - /* "numpy.pxd":791 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * # One could encode it in the format string and have Cython - * # complain instead, BUT: < and > in format strings also imply - */ - __pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_21)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_16)); - PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_kp_u_16)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_16)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); - - /* "numpy.pxd":811 - * t = child.type_num - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< - * - * # Until ticket #99 is fixed, use integers to avoid warnings - */ - __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_23)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_22)); - PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_kp_u_22)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_22)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[9]; __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[9]; __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[9]; __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[9]; __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[9]; __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[9]; __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[9]; __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; - #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_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #ifdef __pyx_binding_PyCFunctionType_USED - if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[9]; __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[9]; __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[9]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - /*--- Initialize various global constants etc. ---*/ - if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[9]; __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[9]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - } - /*--- Builtin init code ---*/ - if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /*--- Constants init code ---*/ - if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[9]; __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 = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyType_Ready(&__pyx_type_7tseries_Node) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __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 = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7tseries_Node = &__pyx_type_7tseries_Node; - __pyx_vtabptr_7tseries_IndexableSkiplist = &__pyx_vtable_7tseries_IndexableSkiplist; - __pyx_vtable_7tseries_IndexableSkiplist.get = (PyObject *(*)(struct __pyx_obj_7tseries_IndexableSkiplist *, int, int __pyx_skip_dispatch))__pyx_f_7tseries_17IndexableSkiplist_get; - __pyx_vtable_7tseries_IndexableSkiplist.insert = (PyObject *(*)(struct __pyx_obj_7tseries_IndexableSkiplist *, double, int __pyx_skip_dispatch))__pyx_f_7tseries_17IndexableSkiplist_insert; - __pyx_vtable_7tseries_IndexableSkiplist.remove = (PyObject *(*)(struct __pyx_obj_7tseries_IndexableSkiplist *, double, int __pyx_skip_dispatch))__pyx_f_7tseries_17IndexableSkiplist_remove; - if (PyType_Ready(&__pyx_type_7tseries_IndexableSkiplist) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7tseries_IndexableSkiplist.tp_dict, __pyx_vtabptr_7tseries_IndexableSkiplist) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 46; __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 = 46; __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[8]; __pyx_lineno = 149; __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[8]; __pyx_lineno = 159; __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[8]; __pyx_lineno = 163; __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[8]; __pyx_lineno = 172; __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[8]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /*--- Function import code ---*/ - /*--- Execution code ---*/ - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":10 - * from cpython cimport PyFloat_Check - * - * import numpy as np # <<<<<<<<<<<<<< - * isnan = np.isnan - * cdef double NaN = 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 = 10; __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 = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":11 - * - * import numpy as np - * isnan = np.isnan # <<<<<<<<<<<<<< - * cdef double NaN = 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 = 11; __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 = 11; __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 = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":12 - * import numpy as np - * isnan = np.isnan - * cdef double NaN = 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 = 12; __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 = 12; __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 = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_7tseries_NaN = __pyx_t_3; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":14 - * cdef double NaN = 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 = 14; __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 = 14; __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 = 14; __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 = 14; __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; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":83 - * - * # import datetime C API - * PyDateTime_IMPORT # <<<<<<<<<<<<<< - * - * # initialize numpy - */ - PyDateTime_IMPORT; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":86 - * - * # initialize numpy - * import_array() # <<<<<<<<<<<<<< - * - * cpdef map_indices(ndarray index): - */ - import_array(); - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":115 - * return result - * - * def isAllDates(ndarray index): # <<<<<<<<<<<<<< - * cdef int i, length - * cdef flatiter iter - */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7tseries_1isAllDates, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__isAllDates, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/common.pyx":135 - * return True - * - * def isAllDates2(ndarray[object, ndim=1] arr): # <<<<<<<<<<<<<< - * ''' - * cannot use - */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7tseries_2isAllDates2, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__isAllDates2, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/wesm/code/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; - - /* "/home/wesm/code/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; - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":28 - * - * # initialize numpy - * import_array() # <<<<<<<<<<<<<< - * - * # TODO: optimize this, make less messy - */ - import_array(); - - /* "/home/wesm/code/pandas/pandas/lib/src/skiplist.pyx":44 - * - * # Singleton terminator node - * NIL = Node(np.inf, [], []) # <<<<<<<<<<<<<< - * - * 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 = 44; __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 = 44; __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 = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__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)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__NIL, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/isnull.pyx":2 - * - * cdef double INF = 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_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__inf); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2; __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_PyFloat_AsDouble(__pyx_t_5); 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_5); __pyx_t_5 = 0; - __pyx_v_7tseries_INF = __pyx_t_3; - - /* "/home/wesm/code/pandas/pandas/lib/src/isnull.pyx":3 - * - * cdef double INF = np.inf - * cdef double NEGINF = -INF # <<<<<<<<<<<<<< - * - * cdef inline _checknull(object val): - */ - __pyx_v_7tseries_NEGINF = (-__pyx_v_7tseries_INF); - - /* "/home/wesm/code/pandas/pandas/lib/src/isnull.pyx":14 - * return _checknull(val) - * - * def isnullobj(ndarray input): # <<<<<<<<<<<<<< - * cdef int i, length - * cdef object val - */ - __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7tseries_4isnullobj, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__isnullobj, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/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 - */ - __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7tseries_5arrmap, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__arrmap, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/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 - */ - __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7tseries_6groupby, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__groupby, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/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 - */ - __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7tseries_7groupby_indices, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__groupby_indices, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":28 - * - * - * def kth_smallest(ndarray[double_t, ndim=1] a, int k): # <<<<<<<<<<<<<< - * cdef: - * int i,j,l,m,n - */ - __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7tseries_8kth_smallest, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__kth_smallest, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":58 - * - * - * def median(ndarray arr): # <<<<<<<<<<<<<< - * ''' - * A faster median - */ - __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7tseries_9median, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__median, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":78 - * # Rolling sum - * - * def roll_sum(ndarray[double_t, ndim=1] input, # <<<<<<<<<<<<<< - * int win, int minp): - * cdef double val, prev, sum_x = 0 - */ - __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7tseries_10roll_sum, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_sum, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":122 - * # Rolling mean - * - * def roll_mean(ndarray[double_t, ndim=1] input, # <<<<<<<<<<<<<< - * int win, int minp): - * cdef double val, prev, sum_x = 0 - */ - __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7tseries_11roll_mean, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_mean, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":166 - * # Exponentially weighted moving average - * - * def ewma(ndarray[double_t, ndim=1] input, double_t com): # <<<<<<<<<<<<<< - * ''' - * Compute exponentially-weighted moving average using center-of-mass. - */ - __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7tseries_12ewma, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ewma, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":217 - * # 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 - */ - __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7tseries_13roll_var, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_var, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":264 - * # Rolling skewness - * - * def roll_skew(ndarray[double_t, ndim=1] input, # <<<<<<<<<<<<<< - * int win, int minp): - * cdef double val, prev - */ - __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7tseries_14roll_skew, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_skew, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":327 - * - * - * def roll_kurt(ndarray[double_t, ndim=1] input, # <<<<<<<<<<<<<< - * int win, int minp): - * cdef double val, prev - */ - __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7tseries_15roll_kurt, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_kurt, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":442 - * return output - * - * def roll_median(ndarray input, int win, int minp): # <<<<<<<<<<<<<< - * ''' - * O(N log(window)) implementation using skip list - */ - __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7tseries_16roll_median, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_median, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":448 - * return _roll_skiplist_op(input, win, minp, _get_median) - * - * def roll_max(ndarray input, int win, int minp): # <<<<<<<<<<<<<< - * ''' - * O(N log(window)) implementation using skip list - */ - __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7tseries_17roll_max, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_max, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/moments.pyx":454 - * return _roll_skiplist_op(input, win, minp, _get_max) - * - * def roll_min(ndarray input, int win, int minp): # <<<<<<<<<<<<<< - * ''' - * O(N log(window)) implementation using skip list - */ - __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7tseries_18roll_min, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_min, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":1 - * def getFillVec(ndarray oldIndex, ndarray newIndex, dict oldMap, dict newMap, # <<<<<<<<<<<<<< - * kind=None): - * - */ - __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7tseries_19getFillVec, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__getFillVec, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":16 - * - * @cython.wraparound(False) - * def _backfill(ndarray[object, ndim=1] oldIndex, # <<<<<<<<<<<<<< - * ndarray[object, ndim=1] newIndex, - * dict oldMap, dict newMap): - */ - __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7tseries_20_backfill, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___backfill, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":107 - * - * @cython.wraparound(False) - * def _pad(ndarray[object, ndim=1] oldIndex, # <<<<<<<<<<<<<< - * ndarray[object, ndim=1] newIndex, - * dict oldMap, dict newMap): - */ - __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7tseries_21_pad, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___pad, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/reindex.pyx":206 - * - * @cython.boundscheck(False) - * def getMergeVec(ndarray values, dict oldMap): # <<<<<<<<<<<<<< - * cdef int i, j, length, newLength - * - */ - __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7tseries_22getMergeVec, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__getMergeVec, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/operators.pyx":40 - * return result - * - * def combineFunc(object name, ndarray index, ndarray ao, # <<<<<<<<<<<<<< - * ndarray bo, dict aMap, dict bMap): - * ''' - */ - __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_7tseries_23combineFunc, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__combineFunc, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":1 - * cdef int _EPOCH_ORD = 719163 # <<<<<<<<<<<<<< - * - * from datetime import date as pydate - */ - __pyx_v_7tseries__EPOCH_ORD = 719163; - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":3 - * cdef int _EPOCH_ORD = 719163 - * - * from datetime import date as pydate # <<<<<<<<<<<<<< - * - * cdef inline int64_t gmtime(object date): - */ - __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__date)); - PyList_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_n_s__date)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__date)); - __pyx_t_4 = __Pyx_Import(((PyObject *)__pyx_n_s__datetime), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__date); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pydate, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":25 - * return gmtime(dt) - * - * def array_to_timestamp(ndarray[object, ndim=1] arr): # <<<<<<<<<<<<<< - * cdef int i, n - * cdef ndarray[int64_t, ndim=1] result - */ - __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_7tseries_26array_to_timestamp, NULL, __pyx_n_s__tseries); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__array_to_timestamp, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/wesm/code/pandas/pandas/lib/src/io.pyx":37 - * return result - * - * def array_to_datetime(ndarray[int64_t, ndim=1] arr): # <<<<<<<<<<<<<< - * cdef int i, n - * cdef ndarray[object, ndim=1] result - */ - __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_7tseries_27array_to_datetime, NULL, __pyx_n_s__tseries); 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); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__array_to_datetime, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "tseries.pyx":1 - * include "common.pyx" # <<<<<<<<<<<<<< - * include "skiplist.pyx" - * include "isnull.pyx" - */ - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - - /* "cpython/type.pxd":2 - * - * cdef extern from "Python.h": # <<<<<<<<<<<<<< - * # The C structure of the objects used to describe built-in types. - * - */ - 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); - 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 -} - -/* Runtime support code */ - -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { - PyObject *result; - result = PyObject_GetAttr(dict, name); - if (!result) - PyErr_SetObject(PyExc_NameError, name); - return result; -} - -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 void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} - -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} - - -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - 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 , */ - 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 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 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 CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { - if (obj == Py_None) { - __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 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 void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); - #endif -} - -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { - values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - } - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%s() got an unexpected keyword argument '%s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - - -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (likely(PyObject_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} - - -static 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_RaiseNoneIndexingError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable"); -} - -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(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "too many values to unpack (expected %d)", (int)expected); - #else - "too many values to unpack (expected %zd)", expected); - #endif -} - -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, Py_ssize_t expected) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - __Pyx_RaiseTooManyValuesError(expected); - return -1; - } - else if (!PyErr_Occurred()) - return 0; - else - return -1; -} - -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); - } else { - __Pyx_RaiseTooManyValuesError(index); - } -} - -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_1__releasebuffer__(obj, view); - Py_DECREF(obj); - view->obj = NULL; - } -} - -#endif - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { - PyObject *py_import = 0; - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); - if (!py_import) - goto bad; - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; - } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, NULL); -bad: - Py_XDECREF(empty_list); - Py_XDECREF(py_import); - Py_XDECREF(empty_dict); - return module; -} - -static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject* x) { - const npy_int32 neg_one = (npy_int32)-1, const_zero = (npy_int32)0; - const int is_unsigned = const_zero < neg_one; - if (sizeof(npy_int32) == sizeof(char)) { - if (is_unsigned) - return (npy_int32)__Pyx_PyInt_AsUnsignedChar(x); - else - return (npy_int32)__Pyx_PyInt_AsSignedChar(x); - } else if (sizeof(npy_int32) == sizeof(short)) { - if (is_unsigned) - return (npy_int32)__Pyx_PyInt_AsUnsignedShort(x); - else - return (npy_int32)__Pyx_PyInt_AsSignedShort(x); - } else if (sizeof(npy_int32) == sizeof(int)) { - if (is_unsigned) - return (npy_int32)__Pyx_PyInt_AsUnsignedInt(x); - else - return (npy_int32)__Pyx_PyInt_AsSignedInt(x); - } else if (sizeof(npy_int32) == sizeof(long)) { - if (is_unsigned) - return (npy_int32)__Pyx_PyInt_AsUnsignedLong(x); - else - return (npy_int32)__Pyx_PyInt_AsSignedLong(x); - } else if (sizeof(npy_int32) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return (npy_int32)__Pyx_PyInt_AsUnsignedLongLong(x); - else - return (npy_int32)__Pyx_PyInt_AsSignedLongLong(x); - } else { - npy_int32 val; - PyObject *v = __Pyx_PyNumber_Int(x); - #if PY_VERSION_HEX < 0x03000000 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (npy_int32)-1; - } -} - -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int64(npy_int64 val) { - const npy_int64 neg_one = (npy_int64)-1, const_zero = (npy_int64)0; - const int is_unsigned = const_zero < neg_one; - if ((sizeof(npy_int64) == sizeof(char)) || - (sizeof(npy_int64) == sizeof(short))) { - return PyInt_FromLong((long)val); - } else if ((sizeof(npy_int64) == sizeof(int)) || - (sizeof(npy_int64) == sizeof(long))) { - if (is_unsigned) - return PyLong_FromUnsignedLong((unsigned long)val); - else - return PyInt_FromLong((long)val); - } else if (sizeof(npy_int64) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); - else - return PyLong_FromLongLong((PY_LONG_LONG)val); - } else { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - return _PyLong_FromByteArray(bytes, sizeof(npy_int64), - little, !is_unsigned); - } -} - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return ::std::complex< float >(x, y); - } - #else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return x + y*(__pyx_t_float_complex)_Complex_I; - } - #endif -#else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - __pyx_t_float_complex z; - z.real = x; - z.imag = y; - return z; - } -#endif - -#if CYTHON_CCOMPLEX -#else - static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - return (a.real == b.real) && (a.imag == b.imag); - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - float denom = b.real * b.real + b.imag * b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { - __pyx_t_float_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { - return (a.real == 0) && (a.imag == 0); - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { - __pyx_t_float_complex z; - z.real = a.real; - z.imag = -a.imag; - return z; - } - #if 1 - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { - #if !defined(HAVE_HYPOT) || defined(_MSC_VER) - return sqrtf(z.real*z.real + z.imag*z.imag); - #else - return hypotf(z.real, z.imag); - #endif - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - float r, lnr, theta, z_r, z_theta; - if (b.imag == 0 && b.real == (int)b.real) { - if (b.real < 0) { - float denom = a.real * a.real + a.imag * a.imag; - a.real = a.real / denom; - a.imag = -a.imag / denom; - b.real = -b.real; - } - switch ((int)b.real) { - case 0: - z.real = 1; - z.imag = 0; - return z; - case 1: - return a; - case 2: - z = __Pyx_c_prodf(a, a); - return __Pyx_c_prodf(a, a); - case 3: - z = __Pyx_c_prodf(a, a); - return __Pyx_c_prodf(z, a); - case 4: - z = __Pyx_c_prodf(a, a); - return __Pyx_c_prodf(z, z); - } - } - if (a.imag == 0) { - if (a.real == 0) { - return a; - } - r = a.real; - theta = 0; - } else { - r = __Pyx_c_absf(a); - theta = atan2f(a.imag, a.real); - } - lnr = logf(r); - z_r = expf(lnr * b.real - theta * b.imag); - z_theta = theta * b.real + lnr * b.imag; - z.real = z_r * cosf(z_theta); - z.imag = z_r * sinf(z_theta); - return z; - } - #endif -#endif - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return ::std::complex< double >(x, y); - } - #else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return x + y*(__pyx_t_double_complex)_Complex_I; - } - #endif -#else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - __pyx_t_double_complex z; - z.real = x; - z.imag = y; - return z; - } -#endif - -#if CYTHON_CCOMPLEX -#else - static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { - return (a.real == b.real) && (a.imag == b.imag); - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - double denom = b.real * b.real + b.imag * b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { - __pyx_t_double_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { - return (a.real == 0) && (a.imag == 0); - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { - __pyx_t_double_complex z; - z.real = a.real; - z.imag = -a.imag; - return z; - } - #if 1 - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { - #if !defined(HAVE_HYPOT) || defined(_MSC_VER) - return sqrt(z.real*z.real + z.imag*z.imag); - #else - return hypot(z.real, z.imag); - #endif - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - double r, lnr, theta, z_r, z_theta; - if (b.imag == 0 && b.real == (int)b.real) { - if (b.real < 0) { - double denom = a.real * a.real + a.imag * a.imag; - a.real = a.real / denom; - a.imag = -a.imag / denom; - b.real = -b.real; - } - switch ((int)b.real) { - case 0: - z.real = 1; - z.imag = 0; - return z; - case 1: - return a; - case 2: - z = __Pyx_c_prod(a, a); - return __Pyx_c_prod(a, a); - case 3: - z = __Pyx_c_prod(a, a); - return __Pyx_c_prod(z, a); - case 4: - z = __Pyx_c_prod(a, a); - return __Pyx_c_prod(z, z); - } - } - if (a.imag == 0) { - if (a.real == 0) { - return a; - } - r = a.real; - theta = 0; - } else { - r = __Pyx_c_abs(a); - theta = atan2(a.imag, a.real); - } - lnr = log(r); - z_r = exp(lnr * b.real - theta * b.imag); - z_theta = theta * b.real + lnr * b.imag; - z.real = z_r * cos(z_theta); - z.imag = z_r * sin(z_theta); - return z; - } - #endif -#endif - -static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { - const unsigned char neg_one = (unsigned char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned char" : - "value too large to convert to unsigned char"); - } - return (unsigned char)-1; - } - return (unsigned char)val; - } - return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { - const unsigned short neg_one = (unsigned short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned short" : - "value too large to convert to unsigned short"); - } - return (unsigned short)-1; - } - return (unsigned short)val; - } - return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { - const unsigned int neg_one = (unsigned int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned int" : - "value too large to convert to unsigned int"); - } - return (unsigned int)-1; - } - return (unsigned int)val; - } - return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { - const char neg_one = (char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to char" : - "value too large to convert to char"); - } - return (char)-1; - } - return (char)val; - } - return (char)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { - const short neg_one = (short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to short" : - "value too large to convert to short"); - } - return (short)-1; - } - return (short)val; - } - return (short)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { - const int neg_one = (int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to int" : - "value too large to convert to int"); - } - return (int)-1; - } - return (int)val; - } - return (int)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { - const signed char neg_one = (signed char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed char" : - "value too large to convert to signed char"); - } - return (signed char)-1; - } - return (signed char)val; - } - return (signed char)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { - const signed short neg_one = (signed short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed short" : - "value too large to convert to signed short"); - } - return (signed short)-1; - } - return (signed short)val; - } - return (signed short)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { - const signed int neg_one = (signed int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed int" : - "value too large to convert to signed int"); - } - return (signed int)-1; - } - return (signed int)val; - } - return (signed int)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { - const int neg_one = (int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to int" : - "value too large to convert to int"); - } - return (int)-1; - } - return (int)val; - } - return (int)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { - const unsigned long neg_one = (unsigned long)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; - } - return (unsigned long)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; - } - return 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); - } -} - -static CYTHON_INLINE npy_int64 __Pyx_PyInt_from_py_npy_int64(PyObject* x) { - const npy_int64 neg_one = (npy_int64)-1, const_zero = (npy_int64)0; - const int is_unsigned = const_zero < neg_one; - if (sizeof(npy_int64) == sizeof(char)) { - if (is_unsigned) - return (npy_int64)__Pyx_PyInt_AsUnsignedChar(x); - else - return (npy_int64)__Pyx_PyInt_AsSignedChar(x); - } else if (sizeof(npy_int64) == sizeof(short)) { - if (is_unsigned) - return (npy_int64)__Pyx_PyInt_AsUnsignedShort(x); - else - return (npy_int64)__Pyx_PyInt_AsSignedShort(x); - } else if (sizeof(npy_int64) == sizeof(int)) { - if (is_unsigned) - return (npy_int64)__Pyx_PyInt_AsUnsignedInt(x); - else - return (npy_int64)__Pyx_PyInt_AsSignedInt(x); - } else if (sizeof(npy_int64) == sizeof(long)) { - if (is_unsigned) - return (npy_int64)__Pyx_PyInt_AsUnsignedLong(x); - else - return (npy_int64)__Pyx_PyInt_AsSignedLong(x); - } else if (sizeof(npy_int64) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return (npy_int64)__Pyx_PyInt_AsUnsignedLongLong(x); - else - return (npy_int64)__Pyx_PyInt_AsSignedLongLong(x); - } else { - npy_int64 val; - PyObject *v = __Pyx_PyNumber_Int(x); - #if PY_VERSION_HEX < 0x03000000 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (npy_int64)-1; - } -} - -#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); - #if PY_VERSION_HEX < 0x02050000 - PyErr_Warn(NULL, warning); - #else - PyErr_WarnEx(NULL, warning, 0); - #endif - } - 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 - -static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) - PyObject *ob = PyCapsule_New(vtable, 0, 0); -#else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); -#endif - if (!ob) - goto bad; - if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; -} - -#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) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} - -static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { - PyNumberMethods *m; - const char *name = NULL; - PyObject *res = NULL; -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check(x) || PyLong_Check(x)) -#else - if (PyLong_Check(x)) -#endif - return Py_INCREF(x), x; - m = Py_TYPE(x)->tp_as_number; -#if PY_VERSION_HEX < 0x03000000 - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = PyNumber_Long(x); - } -#else - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Long(x); - } -#endif - if (res) { -#if PY_VERSION_HEX < 0x03000000 - if (!PyInt_Check(res) && !PyLong_Check(res)) { -#else - if (!PyLong_Check(res)) { -#endif - PyErr_Format(PyExc_TypeError, - "__%s__ returned non-%s (type %.200s)", - name, name, Py_TYPE(res)->tp_name); - Py_DECREF(res); - return NULL; - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} - -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject* x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} - -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { -#if PY_VERSION_HEX < 0x02050000 - if (ival <= LONG_MAX) - return PyInt_FromLong((long)ival); - else { - unsigned char *bytes = (unsigned char *) &ival; - int one = 1; int little = (int)*(unsigned char*)&one; - return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); - } -#else - return PyInt_FromSize_t(ival); -#endif -} - -static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { - unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); - if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { - return (size_t)-1; - } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to size_t"); - return (size_t)-1; - } - return (size_t)val; -} - - -#endif /* Py_PYTHON_H */ diff --git a/pandas/setup.py b/pandas/setup.py index af2909a67fe34..f9945f0fdaab1 100644 --- a/pandas/setup.py +++ b/pandas/setup.py @@ -1,15 +1,24 @@ #!/usr/bin/env python +import numpy + def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('pandas', parent_package, top_path) config.add_subpackage('core') config.add_subpackage('io') - config.add_subpackage('lib') config.add_subpackage('rpy') config.add_subpackage('sandbox') config.add_subpackage('stats') config.add_subpackage('util') + config.add_data_dir('tests') + + config.add_extension('_tseries', + sources=['src/tseries.c'], + include_dirs=[numpy.get_include()]) + config.add_extension('_sparse', + sources=['src/sparse.c'], + include_dirs=[numpy.get_include()]) return config if __name__ == '__main__': diff --git a/pandas/lib/src/common.pyx b/pandas/src/common.pyx similarity index 100% rename from pandas/lib/src/common.pyx rename to pandas/src/common.pyx diff --git a/pandas/lib/src/groupby.pyx b/pandas/src/groupby.pyx similarity index 99% rename from pandas/lib/src/groupby.pyx rename to pandas/src/groupby.pyx index 1f10ab598e44c..7cdfb06a29be8 100644 --- a/pandas/lib/src/groupby.pyx +++ b/pandas/src/groupby.pyx @@ -144,14 +144,12 @@ def _bucket_locs(index, buckets, inclusive=False): return locs +''' def ts_upsample_mean(ndarray[object, ndim=1] indices, ndarray[object, ndim=1] buckets, ndarray[double_t, ndim=1] values, inclusive=False): - ''' - put something here - ''' cdef: Py_ssize_t i, j, nbuckets, nvalues ndarray[double_t, ndim=1] output @@ -181,6 +179,7 @@ def ts_upsample_mean(ndarray[object, ndim=1] indices, j += 1 else: while j < nvalues and indices[j] < next_bound: + cdef: Py_ssize_t i, j, nbuckets, nvalues ndarray[double_t, ndim=1] output @@ -238,6 +237,7 @@ def ts_upsample_mean(ndarray[object, ndim=1] indices, break return output +''' def ts_upsample_generic(ndarray[object, ndim=1] indices, ndarray[object, ndim=1] buckets, diff --git a/pandas/lib/src/io.pyx b/pandas/src/io.pyx similarity index 100% rename from pandas/lib/src/io.pyx rename to pandas/src/io.pyx diff --git a/pandas/lib/src/isnull.pyx b/pandas/src/isnull.pyx similarity index 100% rename from pandas/lib/src/isnull.pyx rename to pandas/src/isnull.pyx diff --git a/pandas/lib/src/moments.pyx b/pandas/src/moments.pyx similarity index 100% rename from pandas/lib/src/moments.pyx rename to pandas/src/moments.pyx diff --git a/pandas/lib/src/operators.pyx b/pandas/src/operators.pyx similarity index 100% rename from pandas/lib/src/operators.pyx rename to pandas/src/operators.pyx diff --git a/pandas/lib/src/reindex.pyx b/pandas/src/reindex.pyx similarity index 77% rename from pandas/lib/src/reindex.pyx rename to pandas/src/reindex.pyx index dbcd61cf0dc43..a0be2900bea8f 100644 --- a/pandas/lib/src/reindex.pyx +++ b/pandas/src/reindex.pyx @@ -13,8 +13,7 @@ def getFillVec(ndarray oldIndex, ndarray newIndex, dict oldMap, dict newMap, return fillVec, maskVec.astype(np.bool) @cython.wraparound(False) -def _backfill(ndarray[object, ndim=1] oldIndex, - ndarray[object, ndim=1] newIndex, +def _backfill(ndarray[object] oldIndex, ndarray[object] newIndex, dict oldMap, dict newMap): ''' Backfilling logic for generating fill vector @@ -104,8 +103,7 @@ def _backfill(ndarray[object, ndim=1] oldIndex, return (fillVec, mask) @cython.wraparound(False) -def _pad(ndarray[object, ndim=1] oldIndex, - ndarray[object, ndim=1] newIndex, +def _pad(ndarray[object] oldIndex, ndarray[object] newIndex, dict oldMap, dict newMap): ''' Padding logic for generating fill vector @@ -202,6 +200,93 @@ def _pad(ndarray[object, ndim=1] oldIndex, return fillVec, mask +def pad_inplace_float64(ndarray[float64_t] values, + ndarray[np.uint8_t, cast=True] mask): + ''' + mask: True if needs to be padded otherwise False + + e.g. + pad_inplace_float64(values, isnull(values)) + ''' + cdef: + Py_ssize_t i, n + float64_t val + + n = len(values) + val = NaN + for i from 0 <= i < n: + if mask[i]: + values[i] = val + else: + val = values[i] + +def get_pad_indexer(ndarray[np.uint8_t, cast=True] mask): + ''' + mask: True if needs to be padded otherwise False + + e.g. + pad_inplace_float64(values, isnull(values)) + ''' + cdef: + Py_ssize_t i, n + int32_t idx + ndarray[int32_t] indexer + + n = len(mask) + indexer = np.empty(n, dtype=np.int32) + + idx = 0 + for i from 0 <= i < n: + if not mask[i]: + idx = i + indexer[i] = idx + + return indexer + +def get_backfill_indexer(ndarray[np.uint8_t, cast=True] mask): + ''' + mask: True if needs to be padded otherwise False + + e.g. + pad_inplace_float64(values, isnull(values)) + ''' + cdef: + Py_ssize_t i, n + int32_t idx + ndarray[int32_t] indexer + + n = len(mask) + indexer = np.empty(n, dtype=np.int32) + + idx = n - 1 + i = n - 1 + while i >= 0: + if not mask[i]: + idx = i + indexer[i] = idx + i -= 1 + + return indexer + +def backfill_inplace_float64(ndarray[float64_t] values, + ndarray[np.uint8_t, cast=True] mask): + ''' + mask: True if needs to be backfilled otherwise False + ''' + cdef: + Py_ssize_t i, n + float64_t val + + n = len(values) + val = NaN + i = n - 1 + while i >= 0: + if mask[i]: + values[i] = val + else: + val = values[i] + i -= 1 + @cython.boundscheck(False) def getMergeVec(ndarray values, dict oldMap): cdef int i, j, length, newLength diff --git a/pandas/lib/src/skiplist.pyx b/pandas/src/skiplist.pyx similarity index 100% rename from pandas/lib/src/skiplist.pyx rename to pandas/src/skiplist.pyx diff --git a/pandas/lib/src/sparse.pyx b/pandas/src/sparse.pyx similarity index 100% rename from pandas/lib/src/sparse.pyx rename to pandas/src/sparse.pyx diff --git a/pandas/lib/src/tseries.pyx b/pandas/src/tseries.pyx similarity index 100% rename from pandas/lib/src/tseries.pyx rename to pandas/src/tseries.pyx diff --git a/pandas/stats/fama_macbeth.py b/pandas/stats/fama_macbeth.py index 50410fb7ce32c..687332a14ff5a 100644 --- a/pandas/stats/fama_macbeth.py +++ b/pandas/stats/fama_macbeth.py @@ -5,7 +5,6 @@ from pandas.core.api import Series, DataFrame import pandas.stats.common as common from pandas.util.decorators import cache_readonly -import pandas.lib.tseries as tseries def fama_macbeth(**kwargs): """Runs Fama-MacBeth regression. diff --git a/pandas/stats/moments.py b/pandas/stats/moments.py index 8daa2be764edf..22b48d1c9cf4f 100644 --- a/pandas/stats/moments.py +++ b/pandas/stats/moments.py @@ -10,7 +10,7 @@ import numpy as np from pandas.core.api import DataFrame, Series, notnull -import pandas.lib.tseries as tseries +import pandas._tseries as _tseries __all__ = ['rolling_count', 'rolling_max', 'rolling_min', 'rolling_sum', 'rolling_mean', 'rolling_std', 'rolling_cov', @@ -125,7 +125,7 @@ def ewma(arg, com=None, span=None, min_periods=0, time_rule=None): arg = _conv_timerule(arg, time_rule) def _ewma(v): - result = tseries.ewma(v, com) + result = _tseries.ewma(v, com) first_index = _first_valid_index(v) result[first_index : first_index + min_periods] = NaN return result @@ -311,19 +311,19 @@ def call_cython(arg, window, minp): return f -rolling_max = _rolling_func(tseries.roll_max, 'Moving maximum') -rolling_min = _rolling_func(tseries.roll_min, 'Moving minimum') -rolling_sum = _rolling_func(tseries.roll_sum, 'Moving sum') -rolling_mean = _rolling_func(tseries.roll_mean, 'Moving mean') -rolling_median = _rolling_func(tseries.roll_median, 'Moving median') +rolling_max = _rolling_func(_tseries.roll_max, 'Moving maximum') +rolling_min = _rolling_func(_tseries.roll_min, 'Moving minimum') +rolling_sum = _rolling_func(_tseries.roll_sum, 'Moving sum') +rolling_mean = _rolling_func(_tseries.roll_mean, 'Moving mean') +rolling_median = _rolling_func(_tseries.roll_median, 'Moving median') -_ts_std = lambda *a, **kw: np.sqrt(tseries.roll_var(*a, **kw)) +_ts_std = lambda *a, **kw: np.sqrt(_tseries.roll_var(*a, **kw)) rolling_std = _rolling_func(_ts_std, 'Unbiased moving standard deviation', check_minp=_two_periods) -rolling_var = _rolling_func(tseries.roll_var, 'Unbiased moving variance', +rolling_var = _rolling_func(_tseries.roll_var, 'Unbiased moving variance', check_minp=_two_periods) -rolling_skew = _rolling_func(tseries.roll_skew, 'Unbiased moving skewness', +rolling_skew = _rolling_func(_tseries.roll_skew, 'Unbiased moving skewness', check_minp=_two_periods) -rolling_kurt = _rolling_func(tseries.roll_kurt, 'Unbiased moving kurtosis', +rolling_kurt = _rolling_func(_tseries.roll_kurt, 'Unbiased moving kurtosis', check_minp=_two_periods) diff --git a/pandas/core/tests/test_common.py b/pandas/tests/test_common.py similarity index 100% rename from pandas/core/tests/test_common.py rename to pandas/tests/test_common.py diff --git a/pandas/core/tests/test_daterange.py b/pandas/tests/test_daterange.py similarity index 100% rename from pandas/core/tests/test_daterange.py rename to pandas/tests/test_daterange.py diff --git a/pandas/core/tests/test_datetools.py b/pandas/tests/test_datetools.py similarity index 100% rename from pandas/core/tests/test_datetools.py rename to pandas/tests/test_datetools.py diff --git a/pandas/core/tests/test_frame.py b/pandas/tests/test_frame.py similarity index 100% rename from pandas/core/tests/test_frame.py rename to pandas/tests/test_frame.py diff --git a/pandas/core/tests/test_functions.py b/pandas/tests/test_functions.py similarity index 100% rename from pandas/core/tests/test_functions.py rename to pandas/tests/test_functions.py diff --git a/pandas/core/tests/test_groupby.py b/pandas/tests/test_groupby.py similarity index 95% rename from pandas/core/tests/test_groupby.py rename to pandas/tests/test_groupby.py index 484664befe21d..66b7ec81450f4 100644 --- a/pandas/core/tests/test_groupby.py +++ b/pandas/tests/test_groupby.py @@ -2,12 +2,10 @@ from pandas.core.daterange import DateRange from pandas.core.index import Index -from pandas.core.groupby import GroupBy from pandas.core.pytools import rands, groupby from pandas.core.frame import DataFrame from pandas.core.series import Series import pandas.core.datetools as dt -import pandas.lib.tseries as tseries import numpy as np # unittest.TestCase diff --git a/pandas/core/tests/test_index.py b/pandas/tests/test_index.py similarity index 99% rename from pandas/core/tests/test_index.py rename to pandas/tests/test_index.py index 3148cbb5268dd..01bc9f7356393 100644 --- a/pandas/core/tests/test_index.py +++ b/pandas/tests/test_index.py @@ -1,6 +1,5 @@ from datetime import timedelta import operator -import os import pickle import unittest @@ -8,7 +7,7 @@ from pandas.core.index import Index import pandas.util.testing as common -import pandas.lib.tseries as tseries +import pandas._tseries as tseries class TestIndex(unittest.TestCase): diff --git a/pandas/core/tests/test_internals.py b/pandas/tests/test_internals.py similarity index 100% rename from pandas/core/tests/test_internals.py rename to pandas/tests/test_internals.py diff --git a/pandas/lib/tests/test_libsparse.py b/pandas/tests/test_libsparse.py similarity index 99% rename from pandas/lib/tests/test_libsparse.py rename to pandas/tests/test_libsparse.py index c796a2e23ada5..5782b1ad224d8 100644 --- a/pandas/lib/tests/test_libsparse.py +++ b/pandas/tests/test_libsparse.py @@ -11,8 +11,8 @@ from pandas.core.sparse import SparseSeries from pandas import DataFrame -from pandas.lib.sparse import IntIndex, BlockIndex -import pandas.lib.sparse as splib +from pandas._sparse import IntIndex, BlockIndex +import pandas._sparse as splib TEST_LENGTH = 20 diff --git a/pandas/core/tests/test_panel.py b/pandas/tests/test_panel.py similarity index 100% rename from pandas/core/tests/test_panel.py rename to pandas/tests/test_panel.py diff --git a/pandas/core/tests/test_pytools.py b/pandas/tests/test_pytools.py similarity index 100% rename from pandas/core/tests/test_pytools.py rename to pandas/tests/test_pytools.py diff --git a/pandas/core/tests/test_series.py b/pandas/tests/test_series.py similarity index 100% rename from pandas/core/tests/test_series.py rename to pandas/tests/test_series.py diff --git a/pandas/core/tests/test_sparse.py b/pandas/tests/test_sparse.py similarity index 100% rename from pandas/core/tests/test_sparse.py rename to pandas/tests/test_sparse.py diff --git a/pandas/lib/tests/test_tseries.py b/pandas/tests/test_tseries.py similarity index 98% rename from pandas/lib/tests/test_tseries.py rename to pandas/tests/test_tseries.py index da53eb26b9430..d2cb8119ac566 100644 --- a/pandas/lib/tests/test_tseries.py +++ b/pandas/tests/test_tseries.py @@ -3,7 +3,7 @@ import numpy as np from pandas import Index import pandas.util.testing as common -import pandas.lib.tseries as tseries +import pandas._tseries as tseries class TestTseriesUtil(unittest.TestCase): diff --git a/setup.py b/setup.py index d61380b0b8b3f..cb565e35ff81a 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,30 @@ #/usr/bin/env python +""" +Parts of this file were taken from the pyzmq project +(https://github.com/zeromq/pyzmq) and hence are subject to the terms of the +Lesser GPU General Public License. +""" + from datetime import datetime +from glob import glob +import os +import sys +import shutil + +import numpy as np from numpy.distutils.misc_util import Configuration from numpy.distutils.core import setup +from distutils.core import Command +from distutils.extension import Extension +from distutils.command.build import build +from distutils.command.build_ext import build_ext +from distutils.command.sdist import sdist + +from os.path import splitext, basename, join as pjoin + DESCRIPTION = "Cross-section and time series data analysis toolkit" LONG_DESCRIPTION = """ pandas provides NumPy-based data structures and statistical tools for @@ -34,7 +54,7 @@ AUTHOR = "AQR Capital Management, LLC" MAINTAINER = "Wes McKinney" MAINTAINER_EMAIL = "wesmckinn@gmail.com" -URL = "http://pandas.sourceforge.net" +URL = "http://github.com/wesm/pandas" DOWNLOAD_URL = '' CLASSIFIERS = [ 'Development Status :: 4 - Beta', @@ -54,8 +74,7 @@ FULLVERSION = VERSION if not ISRELEASED: - # FULLVERSION += '.dev' + datetime.today().strftime('%Y%m%d') - FULLVERSION += '.beta' + FULLVERSION += '.dev' + datetime.today().strftime('%Y%m%d') def write_version_py(filename='pandas/version.py'): cnt = """\ @@ -69,28 +88,149 @@ def write_version_py(filename='pandas/version.py'): finally: a.close() -def configuration(parent_package='', top_path=None): - # write_version_py() - - config = Configuration(None, parent_package, top_path, - version=FULLVERSION) - config.set_options(ignore_setup_xxx_py=True, - assume_default_configuration=True, - delegate_options_to_subpackages=True, - quiet=True) - - config.add_subpackage('pandas') - return config - -if __name__ == '__main__': - setup(name=DISTNAME, - maintainer=MAINTAINER, - maintainer_email=MAINTAINER_EMAIL, - description=DESCRIPTION, - license=LICENSE, - url=URL, - download_url=DOWNLOAD_URL, - long_description=LONG_DESCRIPTION, - classifiers=CLASSIFIERS, - platforms='any', - configuration=configuration) + +class CleanCommand(Command): + """Custom distutils command to clean the .so and .pyc files.""" + + user_options = [ ] + + def initialize_options(self): + self._clean_me = [] + self._clean_trees = [] + for root, dirs, files in list(os.walk('pandas')): + for f in files: + if os.path.splitext(f)[-1] in ('.pyc', '.so', '.o', '.pyd'): + self._clean_me.append(pjoin(root, f)) + for d in dirs: + if d == '__pycache__': + self._clean_trees.append(pjoin(root, d)) + + for d in ('build',): + if os.path.exists(d): + self._clean_trees.append(d) + + def finalize_options(self): + pass + + def run(self): + for clean_me in self._clean_me: + try: + os.unlink(clean_me) + except Exception: + pass + for clean_tree in self._clean_trees: + try: + shutil.rmtree(clean_tree) + except Exception: + pass + +class CheckSDist(sdist): + """Custom sdist that ensures Cython has compiled all pyx files to c.""" + + _pyxfiles = ['pandas/src/tseries.pyx' + 'pandas/src/sparse.pyx'] + + def initialize_options(self): + sdist.initialize_options(self) + + ''' + self._pyxfiles = [] + for root, dirs, files in os.walk('pandas'): + for f in files: + if f.endswith('.pyx'): + self._pyxfiles.append(pjoin(root, f)) + ''' + + def run(self): + if 'cython' in cmdclass: + self.run_command('cython') + else: + for pyxfile in self._pyxfiles: + cfile = pyxfile[:-3]+'c' + msg = "C-source file '%s' not found."%(cfile)+\ + " Run 'setup.py cython' before sdist." + assert os.path.isfile(cfile), msg + sdist.run(self) + +class CheckingBuildExt(build_ext): + """Subclass build_ext to get clearer report if Cython is neccessary.""" + + def check_cython_extensions(self, extensions): + for ext in extensions: + for src in ext.sources: + if not os.path.exists(src): + fatal("""Cython-generated file '%s' not found. + Cython is required to compile pandas from a development branch. + Please install Cython or download a release package of pandas. + """%src) + + def build_extensions(self): + self.check_cython_extensions(self.extensions) + self.check_extensions_list(self.extensions) + + for ext in self.extensions: + self.build_extension(ext) + +cmdclass = {'clean': CleanCommand, + 'build': build} + +try: + from Cython.Distutils import build_ext + cython=True +except ImportError: + cython=False + suffix = '.c' + cmdclass['build_ext'] = CheckingBuildExt +else: + suffix = '.pyx' + class CythonCommand(build_ext): + """Custom distutils command subclassed from Cython.Distutils.build_ext + to compile pyx->c, and stop there. All this does is override the + C-compile method build_extension() with a no-op.""" + def build_extension(self, ext): + pass + + cmdclass['cython'] = CythonCommand + cmdclass['build_ext'] = build_ext + cmdclass['sdist'] = CheckSDist + +tseries_depends = ['reindex', 'io', 'common', 'groupby' + 'skiplist', 'isnull', 'moments', 'operators'] + +def srcpath(name=None, suffix='.pyx', subdir='src'): + return pjoin('pandas', subdir, name+suffix) + +tseries_ext = Extension('pandas._tseries', + sources=[srcpath('tseries', suffix=suffix)], + # depends=[srcpath(f, suffix='.pyx') + # for f in tseries_depends], + include_dirs=[np.get_include()]) +sparse_ext = Extension('pandas._sparse', + sources=[srcpath('sparse', suffix=suffix)], + include_dirs=[np.get_include()]) +extensions = [tseries_ext, + sparse_ext] + +setup(name=DISTNAME, + version=FULLVERSION, + maintainer=MAINTAINER, + packages=['pandas', + 'pandas.core', + 'pandas.io', + 'pandas.stats', + 'pandas.util'], + package_data={'pandas' : ['tests/*.py'], + 'pandas.io' : ['tests/*.py', + 'tests/*.h5'], + 'pandas.stats' : ['tests/*.py']}, + ext_modules=extensions, + maintainer_email=MAINTAINER_EMAIL, + description=DESCRIPTION, + license=LICENSE, + cmdclass = cmdclass, + url=URL, + download_url=DOWNLOAD_URL, + long_description=LONG_DESCRIPTION, + classifiers=CLASSIFIERS, + platforms='any', + )