diff --git a/sklearn/utils/murmurhash.c b/sklearn/utils/murmurhash.c index 1f8c5e436b97769ad70f0ca3a51e3a0d75222250..a0f9735c582a6ef54af2c64e77f986a06304807f 100644 --- a/sklearn/utils/murmurhash.c +++ b/sklearn/utils/murmurhash.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.15.1 on Tue Jan 17 10:35:19 2012 */ +/* Generated by Cython 0.15.1 on Wed Jan 18 06:15:26 2012 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -593,6 +593,7 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; */ typedef npy_cdouble __pyx_t_5numpy_complex_t; + #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif @@ -672,7 +673,6 @@ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* o static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/ #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ @@ -849,6 +849,10 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +/* Module declarations from 'cython.cython.view' */ + +/* Module declarations from 'cython' */ + /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ @@ -877,12 +881,12 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObjec static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ /* Module declarations from 'sklearn.utils.murmurhash' */ -static unsigned int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_int_uint(int, unsigned int, int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_int_int(int, unsigned int, int __pyx_skip_dispatch); /*proto*/ -static unsigned int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_uint(PyObject *, unsigned int, int __pyx_skip_dispatch); /*proto*/ -static int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_int(PyObject *, unsigned int, int __pyx_skip_dispatch); /*proto*/ -static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_array_uint(PyArrayObject *, unsigned int, int __pyx_skip_dispatch); /*proto*/ -static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_array_int(PyArrayObject *, unsigned int, int __pyx_skip_dispatch); /*proto*/ +static unsigned int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_uint(int, unsigned int, int __pyx_skip_dispatch); /*proto*/ +static int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_int(int, unsigned int, int __pyx_skip_dispatch); /*proto*/ +static unsigned int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_uint(PyObject *, unsigned int, int __pyx_skip_dispatch); /*proto*/ +static int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_int(PyObject *, unsigned int, int __pyx_skip_dispatch); /*proto*/ +static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_array_uint(PyArrayObject *, unsigned int, int __pyx_skip_dispatch); /*proto*/ +static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_array_int(PyArrayObject *, unsigned int, int __pyx_skip_dispatch); /*proto*/ static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), 'I' }; static __Pyx_TypeInfo __Pyx_TypeInfo_unsigned_int = { "unsigned int", NULL, sizeof(unsigned int), 'U' }; #define __Pyx_MODULE_NAME "sklearn.utils.murmurhash" @@ -982,23 +986,23 @@ static PyObject *__pyx_k_tuple_15; static PyObject *__pyx_k_tuple_16; static PyObject *__pyx_k_tuple_18; -/* "sklearn/utils/murmurhash.pyx":21 +/* "sklearn/utils/murmurhash.pyx":22 * * - * cpdef unsigned int murmurhash3_32_int_uint(int key, unsigned int seed): # <<<<<<<<<<<<<< - * """Compute the 32bit murmurhash3_32 of a int key at seed.""" + * cpdef unsigned int murmurhash3_int_uint(int key, unsigned int seed): # <<<<<<<<<<<<<< + * """Compute the 32bit murmurhash3 of a int key at seed.""" * cdef unsigned int out */ -static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_murmurhash3_32_int_uint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static unsigned int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_int_uint(int __pyx_v_key, unsigned int __pyx_v_seed, int __pyx_skip_dispatch) { +static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_murmurhash3_int_uint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static unsigned int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_uint(int __pyx_v_key, unsigned int __pyx_v_seed, int __pyx_skip_dispatch) { unsigned int __pyx_v_out; unsigned int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("murmurhash3_32_int_uint"); + __Pyx_RefNannySetupContext("murmurhash3_int_uint"); - /* "sklearn/utils/murmurhash.pyx":24 - * """Compute the 32bit murmurhash3_32 of a int key at seed.""" + /* "sklearn/utils/murmurhash.pyx":25 + * """Compute the 32bit murmurhash3 of a int key at seed.""" * cdef unsigned int out * MurmurHash3_x86_32(&key, sizeof(int), seed, &out) # <<<<<<<<<<<<<< * return out @@ -1006,7 +1010,7 @@ static unsigned int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_int_uint */ MurmurHash3_x86_32((&__pyx_v_key), (sizeof(int)), __pyx_v_seed, (&__pyx_v_out)); - /* "sklearn/utils/murmurhash.pyx":25 + /* "sklearn/utils/murmurhash.pyx":26 * cdef unsigned int out * MurmurHash3_x86_32(&key, sizeof(int), seed, &out) * return out # <<<<<<<<<<<<<< @@ -1022,17 +1026,17 @@ static unsigned int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_int_uint return __pyx_r; } -/* "sklearn/utils/murmurhash.pyx":21 +/* "sklearn/utils/murmurhash.pyx":22 * * - * cpdef unsigned int murmurhash3_32_int_uint(int key, unsigned int seed): # <<<<<<<<<<<<<< - * """Compute the 32bit murmurhash3_32 of a int key at seed.""" + * cpdef unsigned int murmurhash3_int_uint(int key, unsigned int seed): # <<<<<<<<<<<<<< + * """Compute the 32bit murmurhash3 of a int key at seed.""" * cdef unsigned int out */ -static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_murmurhash3_32_int_uint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7sklearn_5utils_10murmurhash_murmurhash3_32_int_uint[] = "Compute the 32bit murmurhash3_32 of a int key at seed."; -static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_murmurhash3_32_int_uint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_murmurhash3_int_uint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_5utils_10murmurhash_murmurhash3_int_uint[] = "Compute the 32bit murmurhash3 of a int key at seed."; +static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_murmurhash3_int_uint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_key; unsigned int __pyx_v_seed; PyObject *__pyx_r = NULL; @@ -1042,7 +1046,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_murmurhash3_32_int_uint(P const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__seed,0}; - __Pyx_RefNannySetupContext("murmurhash3_32_int_uint"); + __Pyx_RefNannySetupContext("murmurhash3_int_uint"); __pyx_self = __pyx_self; { PyObject* values[2] = {0,0}; @@ -1064,11 +1068,11 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_murmurhash3_32_int_uint(P values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seed); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("murmurhash3_32_int_uint", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_int_uint", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __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), "murmurhash3_32_int_uint") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "murmurhash3_int_uint") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1076,19 +1080,19 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_murmurhash3_32_int_uint(P values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_key = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_key == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_seed = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_key = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_key == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_seed = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("murmurhash3_32_int_uint", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_int_uint", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_32_int_uint", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_int_uint", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_int_uint(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_uint(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1098,7 +1102,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_murmurhash3_32_int_uint(P goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_32_int_uint", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_int_uint", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1106,23 +1110,23 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_murmurhash3_32_int_uint(P return __pyx_r; } -/* "sklearn/utils/murmurhash.pyx":28 +/* "sklearn/utils/murmurhash.pyx":29 * * - * cpdef int murmurhash3_32_int_int(int key, unsigned int seed): # <<<<<<<<<<<<<< - * """Compute the 32bit murmurhash3_32 of a int key at seed.""" + * cpdef int murmurhash3_int_int(int key, unsigned int seed): # <<<<<<<<<<<<<< + * """Compute the 32bit murmurhash3 of a int key at seed.""" * cdef int out */ -static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_1murmurhash3_32_int_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_int_int(int __pyx_v_key, unsigned int __pyx_v_seed, int __pyx_skip_dispatch) { +static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_1murmurhash3_int_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_int(int __pyx_v_key, unsigned int __pyx_v_seed, int __pyx_skip_dispatch) { int __pyx_v_out; int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("murmurhash3_32_int_int"); + __Pyx_RefNannySetupContext("murmurhash3_int_int"); - /* "sklearn/utils/murmurhash.pyx":31 - * """Compute the 32bit murmurhash3_32 of a int key at seed.""" + /* "sklearn/utils/murmurhash.pyx":32 + * """Compute the 32bit murmurhash3 of a int key at seed.""" * cdef int out * MurmurHash3_x86_32(&key, sizeof(int), seed, &out) # <<<<<<<<<<<<<< * return out @@ -1130,7 +1134,7 @@ static int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_int_int(int __pyx */ MurmurHash3_x86_32((&__pyx_v_key), (sizeof(int)), __pyx_v_seed, (&__pyx_v_out)); - /* "sklearn/utils/murmurhash.pyx":32 + /* "sklearn/utils/murmurhash.pyx":33 * cdef int out * MurmurHash3_x86_32(&key, sizeof(int), seed, &out) * return out # <<<<<<<<<<<<<< @@ -1146,17 +1150,17 @@ static int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_int_int(int __pyx return __pyx_r; } -/* "sklearn/utils/murmurhash.pyx":28 +/* "sklearn/utils/murmurhash.pyx":29 * * - * cpdef int murmurhash3_32_int_int(int key, unsigned int seed): # <<<<<<<<<<<<<< - * """Compute the 32bit murmurhash3_32 of a int key at seed.""" + * cpdef int murmurhash3_int_int(int key, unsigned int seed): # <<<<<<<<<<<<<< + * """Compute the 32bit murmurhash3 of a int key at seed.""" * cdef int out */ -static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_1murmurhash3_32_int_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7sklearn_5utils_10murmurhash_1murmurhash3_32_int_int[] = "Compute the 32bit murmurhash3_32 of a int key at seed."; -static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_1murmurhash3_32_int_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_1murmurhash3_int_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_5utils_10murmurhash_1murmurhash3_int_int[] = "Compute the 32bit murmurhash3 of a int key at seed."; +static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_1murmurhash3_int_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_key; unsigned int __pyx_v_seed; PyObject *__pyx_r = NULL; @@ -1166,7 +1170,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_1murmurhash3_32_int_int(P const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__seed,0}; - __Pyx_RefNannySetupContext("murmurhash3_32_int_int"); + __Pyx_RefNannySetupContext("murmurhash3_int_int"); __pyx_self = __pyx_self; { PyObject* values[2] = {0,0}; @@ -1188,11 +1192,11 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_1murmurhash3_32_int_int(P values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seed); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("murmurhash3_32_int_int", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_int_int", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __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), "murmurhash3_32_int_int") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "murmurhash3_int_int") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1200,19 +1204,19 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_1murmurhash3_32_int_int(P values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_key = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_key == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_seed = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_key = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_key == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_seed = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("murmurhash3_32_int_int", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_int_int", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_32_int_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_int_int", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_int_int(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_int(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1222,7 +1226,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_1murmurhash3_32_int_int(P goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_32_int_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_int_int", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1230,18 +1234,17 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_1murmurhash3_32_int_int(P return __pyx_r; } -/* "sklearn/utils/murmurhash.pyx":35 +/* "sklearn/utils/murmurhash.pyx":36 * * - * cpdef unsigned int murmurhash3_32_bytes_uint(bytes key, unsigned int seed): # <<<<<<<<<<<<<< - * """Compute the 32bit murmurhash3_32 of a bytes key at seed.""" + * cpdef unsigned int murmurhash3_bytes_uint(bytes key, unsigned int seed): # <<<<<<<<<<<<<< + * """Compute the 32bit murmurhash3 of a bytes key at seed.""" * cdef unsigned int out */ -static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_2murmurhash3_32_bytes_uint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static unsigned int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_uint(PyObject *__pyx_v_key, unsigned int __pyx_v_seed, int __pyx_skip_dispatch) { +static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_2murmurhash3_bytes_uint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static unsigned int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_uint(PyObject *__pyx_v_key, unsigned int __pyx_v_seed, int __pyx_skip_dispatch) { unsigned int __pyx_v_out; - char *__pyx_v_key_c; unsigned int __pyx_r; __Pyx_RefNannyDeclarations char *__pyx_t_1; @@ -1249,34 +1252,25 @@ static unsigned int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_ui int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("murmurhash3_32_bytes_uint"); - - /* "sklearn/utils/murmurhash.pyx":38 - * """Compute the 32bit murmurhash3_32 of a bytes key at seed.""" - * cdef unsigned int out - * cdef char* key_c = key # <<<<<<<<<<<<<< - * MurmurHash3_x86_32(key_c, len(key), seed, &out) - * return out - */ - __pyx_t_1 = PyBytes_AsString(((PyObject *)__pyx_v_key)); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_key_c = __pyx_t_1; + __Pyx_RefNannySetupContext("murmurhash3_bytes_uint"); /* "sklearn/utils/murmurhash.pyx":39 + * """Compute the 32bit murmurhash3 of a bytes key at seed.""" * cdef unsigned int out - * cdef char* key_c = key - * MurmurHash3_x86_32(key_c, len(key), seed, &out) # <<<<<<<<<<<<<< + * MurmurHash3_x86_32(<char*> key, len(key), seed, &out) # <<<<<<<<<<<<<< * return out * */ + __pyx_t_1 = PyBytes_AsString(((PyObject *)__pyx_v_key)); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(((PyObject *)__pyx_v_key) == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_2 = PyBytes_GET_SIZE(((PyObject *)__pyx_v_key)); - MurmurHash3_x86_32(__pyx_v_key_c, __pyx_t_2, __pyx_v_seed, (&__pyx_v_out)); + MurmurHash3_x86_32(((char *)__pyx_t_1), __pyx_t_2, __pyx_v_seed, (&__pyx_v_out)); /* "sklearn/utils/murmurhash.pyx":40 - * cdef char* key_c = key - * MurmurHash3_x86_32(key_c, len(key), seed, &out) + * cdef unsigned int out + * MurmurHash3_x86_32(<char*> key, len(key), seed, &out) * return out # <<<<<<<<<<<<<< * * @@ -1287,24 +1281,24 @@ static unsigned int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_ui __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_WriteUnraisable("sklearn.utils.murmurhash.murmurhash3_32_bytes_uint", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.utils.murmurhash.murmurhash3_bytes_uint", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/utils/murmurhash.pyx":35 +/* "sklearn/utils/murmurhash.pyx":36 * * - * cpdef unsigned int murmurhash3_32_bytes_uint(bytes key, unsigned int seed): # <<<<<<<<<<<<<< - * """Compute the 32bit murmurhash3_32 of a bytes key at seed.""" + * cpdef unsigned int murmurhash3_bytes_uint(bytes key, unsigned int seed): # <<<<<<<<<<<<<< + * """Compute the 32bit murmurhash3 of a bytes key at seed.""" * cdef unsigned int out */ -static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_2murmurhash3_32_bytes_uint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7sklearn_5utils_10murmurhash_2murmurhash3_32_bytes_uint[] = "Compute the 32bit murmurhash3_32 of a bytes key at seed."; -static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_2murmurhash3_32_bytes_uint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_2murmurhash3_bytes_uint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_5utils_10murmurhash_2murmurhash3_bytes_uint[] = "Compute the 32bit murmurhash3 of a bytes key at seed."; +static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_2murmurhash3_bytes_uint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_key = 0; unsigned int __pyx_v_seed; PyObject *__pyx_r = NULL; @@ -1314,7 +1308,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_2murmurhash3_32_bytes_uin const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__seed,0}; - __Pyx_RefNannySetupContext("murmurhash3_32_bytes_uint"); + __Pyx_RefNannySetupContext("murmurhash3_bytes_uint"); __pyx_self = __pyx_self; { PyObject* values[2] = {0,0}; @@ -1336,11 +1330,11 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_2murmurhash3_32_bytes_uin values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seed); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("murmurhash3_32_bytes_uint", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_uint", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __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), "murmurhash3_32_bytes_uint") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "murmurhash3_bytes_uint") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1349,19 +1343,19 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_2murmurhash3_32_bytes_uin values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_key = ((PyObject*)values[0]); - __pyx_v_seed = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_seed = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("murmurhash3_32_bytes_uint", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_uint", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_32_bytes_uint", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_bytes_uint", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyBytes_Type), 1, "key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyBytes_Type), 1, "key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_uint(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_uint(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1371,7 +1365,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_2murmurhash3_32_bytes_uin goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_32_bytes_uint", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_bytes_uint", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1382,15 +1376,14 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_2murmurhash3_32_bytes_uin /* "sklearn/utils/murmurhash.pyx":43 * * - * cpdef int murmurhash3_32_bytes_int(bytes key, unsigned int seed): # <<<<<<<<<<<<<< - * """Compute the 32bit murmurhash3_32 of a bytes key at seed.""" + * cpdef int murmurhash3_bytes_int(bytes key, unsigned int seed): # <<<<<<<<<<<<<< + * """Compute the 32bit murmurhash3 of a bytes key at seed.""" * cdef int out */ -static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_3murmurhash3_32_bytes_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_int(PyObject *__pyx_v_key, unsigned int __pyx_v_seed, int __pyx_skip_dispatch) { +static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_3murmurhash3_bytes_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_int(PyObject *__pyx_v_key, unsigned int __pyx_v_seed, int __pyx_skip_dispatch) { int __pyx_v_out; - char *__pyx_v_key_c; int __pyx_r; __Pyx_RefNannyDeclarations char *__pyx_t_1; @@ -1398,34 +1391,25 @@ static int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_int(PyObjec int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("murmurhash3_32_bytes_int"); + __Pyx_RefNannySetupContext("murmurhash3_bytes_int"); /* "sklearn/utils/murmurhash.pyx":46 - * """Compute the 32bit murmurhash3_32 of a bytes key at seed.""" + * """Compute the 32bit murmurhash3 of a bytes key at seed.""" * cdef int out - * cdef char* key_c = key # <<<<<<<<<<<<<< - * MurmurHash3_x86_32(key_c, len(key), seed, &out) - * return out - */ - __pyx_t_1 = PyBytes_AsString(((PyObject *)__pyx_v_key)); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_key_c = __pyx_t_1; - - /* "sklearn/utils/murmurhash.pyx":47 - * cdef int out - * cdef char* key_c = key - * MurmurHash3_x86_32(key_c, len(key), seed, &out) # <<<<<<<<<<<<<< + * MurmurHash3_x86_32(<char*> key, len(key), seed, &out) # <<<<<<<<<<<<<< * return out * */ + __pyx_t_1 = PyBytes_AsString(((PyObject *)__pyx_v_key)); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(((PyObject *)__pyx_v_key) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_2 = PyBytes_GET_SIZE(((PyObject *)__pyx_v_key)); - MurmurHash3_x86_32(__pyx_v_key_c, __pyx_t_2, __pyx_v_seed, (&__pyx_v_out)); + MurmurHash3_x86_32(((char *)__pyx_t_1), __pyx_t_2, __pyx_v_seed, (&__pyx_v_out)); - /* "sklearn/utils/murmurhash.pyx":48 - * cdef char* key_c = key - * MurmurHash3_x86_32(key_c, len(key), seed, &out) + /* "sklearn/utils/murmurhash.pyx":47 + * cdef int out + * MurmurHash3_x86_32(<char*> key, len(key), seed, &out) * return out # <<<<<<<<<<<<<< * * @@ -1436,7 +1420,7 @@ static int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_int(PyObjec __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_WriteUnraisable("sklearn.utils.murmurhash.murmurhash3_32_bytes_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.utils.murmurhash.murmurhash3_bytes_int", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -1446,14 +1430,14 @@ static int __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_int(PyObjec /* "sklearn/utils/murmurhash.pyx":43 * * - * cpdef int murmurhash3_32_bytes_int(bytes key, unsigned int seed): # <<<<<<<<<<<<<< - * """Compute the 32bit murmurhash3_32 of a bytes key at seed.""" + * cpdef int murmurhash3_bytes_int(bytes key, unsigned int seed): # <<<<<<<<<<<<<< + * """Compute the 32bit murmurhash3 of a bytes key at seed.""" * cdef int out */ -static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_3murmurhash3_32_bytes_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7sklearn_5utils_10murmurhash_3murmurhash3_32_bytes_int[] = "Compute the 32bit murmurhash3_32 of a bytes key at seed."; -static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_3murmurhash3_32_bytes_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_3murmurhash3_bytes_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_5utils_10murmurhash_3murmurhash3_bytes_int[] = "Compute the 32bit murmurhash3 of a bytes key at seed."; +static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_3murmurhash3_bytes_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_key = 0; unsigned int __pyx_v_seed; PyObject *__pyx_r = NULL; @@ -1463,7 +1447,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_3murmurhash3_32_bytes_int const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__seed,0}; - __Pyx_RefNannySetupContext("murmurhash3_32_bytes_int"); + __Pyx_RefNannySetupContext("murmurhash3_bytes_int"); __pyx_self = __pyx_self; { PyObject* values[2] = {0,0}; @@ -1485,11 +1469,11 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_3murmurhash3_32_bytes_int values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seed); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("murmurhash3_32_bytes_int", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_int", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __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), "murmurhash3_32_bytes_int") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "murmurhash3_bytes_int") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1502,15 +1486,15 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_3murmurhash3_32_bytes_int } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("murmurhash3_32_bytes_int", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_int", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_32_bytes_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_bytes_int", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyBytes_Type), 1, "key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_int(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_int(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1520,7 +1504,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_3murmurhash3_32_bytes_int goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_32_bytes_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_bytes_int", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1530,14 +1514,14 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_3murmurhash3_32_bytes_int /* "sklearn/utils/murmurhash.pyx":51 * - * - * cpdef np.ndarray[unsigned int, ndim=1] murmurhash3_32_bytes_array_uint( # <<<<<<<<<<<<<< + * @cython.boundscheck(False) + * cpdef np.ndarray[unsigned int, ndim=1] murmurhash3_bytes_array_uint( # <<<<<<<<<<<<<< * np.ndarray[int] key, unsigned int seed): - * """Compute the 32bit murmurhash3_32 of a key int array at seed.""" + * """Compute 32bit murmurhash3 hashes of a key int array at seed.""" */ -static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_4murmurhash3_32_bytes_array_uint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_array_uint(PyArrayObject *__pyx_v_key, unsigned int __pyx_v_seed, int __pyx_skip_dispatch) { +static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_4murmurhash3_bytes_array_uint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_array_uint(PyArrayObject *__pyx_v_key, unsigned int __pyx_v_seed, int __pyx_skip_dispatch) { PyArrayObject *__pyx_v_out = 0; int __pyx_v_i; Py_buffer __pyx_bstruct_key; @@ -1557,11 +1541,10 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_ int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - int __pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("murmurhash3_32_bytes_array_uint"); + __Pyx_RefNannySetupContext("murmurhash3_bytes_array_uint"); __pyx_bstruct_out.buf = NULL; __pyx_bstruct_key.buf = NULL; { @@ -1572,7 +1555,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_ __pyx_bshape_0_key = __pyx_bstruct_key.shape[0]; /* "sklearn/utils/murmurhash.pyx":55 - * """Compute the 32bit murmurhash3_32 of a key int array at seed.""" + * """Compute 32bit murmurhash3 hashes of a key int array at seed.""" * # TODO make it possible to pass preallocated ouput array * cdef np.ndarray[unsigned int, ndim=1] out = np.zeros( # <<<<<<<<<<<<<< * key.size, np.uint32) @@ -1629,7 +1612,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_ * key.size, np.uint32) * cdef int i * for i in range(key.shape[0]): # <<<<<<<<<<<<<< - * out[i] = murmurhash3_32_int_uint(key[i], seed) + * out[i] = murmurhash3_int_uint(key[i], seed) * return out */ __pyx_t_6 = (__pyx_v_key->dimensions[0]); @@ -1639,36 +1622,20 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_ /* "sklearn/utils/murmurhash.pyx":59 * cdef int i * for i in range(key.shape[0]): - * out[i] = murmurhash3_32_int_uint(key[i], seed) # <<<<<<<<<<<<<< + * out[i] = murmurhash3_int_uint(key[i], seed) # <<<<<<<<<<<<<< * return out * */ __pyx_t_8 = __pyx_v_i; - __pyx_t_9 = -1; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_bshape_0_key; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_key)) __pyx_t_9 = 0; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_0_key; __pyx_t_9 = __pyx_v_i; - __pyx_t_10 = -1; - if (__pyx_t_9 < 0) { - __pyx_t_9 += __pyx_bshape_0_out; - if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0; - } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_out)) __pyx_t_10 = 0; - if (unlikely(__pyx_t_10 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_10); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided1d(unsigned int *, __pyx_bstruct_out.buf, __pyx_t_9, __pyx_bstride_0_out) = __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_int_uint((*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_key.buf, __pyx_t_8, __pyx_bstride_0_key)), __pyx_v_seed, 0); + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_0_out; + *__Pyx_BufPtrStrided1d(unsigned int *, __pyx_bstruct_out.buf, __pyx_t_9, __pyx_bstride_0_out) = __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_uint((*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_key.buf, __pyx_t_8, __pyx_bstride_0_key)), __pyx_v_seed, 0); } /* "sklearn/utils/murmurhash.pyx":60 * for i in range(key.shape[0]): - * out[i] = murmurhash3_32_int_uint(key[i], seed) + * out[i] = murmurhash3_int_uint(key[i], seed) * return out # <<<<<<<<<<<<<< * * @@ -1690,7 +1657,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_ __Pyx_SafeReleaseBuffer(&__pyx_bstruct_key); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_32_bytes_array_uint", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_bytes_array_uint", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -1705,15 +1672,15 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_ /* "sklearn/utils/murmurhash.pyx":51 * - * - * cpdef np.ndarray[unsigned int, ndim=1] murmurhash3_32_bytes_array_uint( # <<<<<<<<<<<<<< + * @cython.boundscheck(False) + * cpdef np.ndarray[unsigned int, ndim=1] murmurhash3_bytes_array_uint( # <<<<<<<<<<<<<< * np.ndarray[int] key, unsigned int seed): - * """Compute the 32bit murmurhash3_32 of a key int array at seed.""" + * """Compute 32bit murmurhash3 hashes of a key int array at seed.""" */ -static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_4murmurhash3_32_bytes_array_uint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7sklearn_5utils_10murmurhash_4murmurhash3_32_bytes_array_uint[] = "Compute the 32bit murmurhash3_32 of a key int array at seed."; -static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_4murmurhash3_32_bytes_array_uint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_4murmurhash3_bytes_array_uint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_5utils_10murmurhash_4murmurhash3_bytes_array_uint[] = "Compute 32bit murmurhash3 hashes of a key int array at seed."; +static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_4murmurhash3_bytes_array_uint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_key = 0; unsigned int __pyx_v_seed; Py_buffer __pyx_bstruct_key; @@ -1726,7 +1693,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_4murmurhash3_32_bytes_arr const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__seed,0}; - __Pyx_RefNannySetupContext("murmurhash3_32_bytes_array_uint"); + __Pyx_RefNannySetupContext("murmurhash3_bytes_array_uint"); __pyx_self = __pyx_self; { PyObject* values[2] = {0,0}; @@ -1748,11 +1715,11 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_4murmurhash3_32_bytes_arr values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seed); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("murmurhash3_32_bytes_array_uint", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_array_uint", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __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), "murmurhash3_32_bytes_array_uint") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "murmurhash3_bytes_array_uint") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1765,9 +1732,9 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_4murmurhash3_32_bytes_arr } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("murmurhash3_32_bytes_array_uint", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_array_uint", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_32_bytes_array_uint", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_bytes_array_uint", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; @@ -1780,7 +1747,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_4murmurhash3_32_bytes_arr __pyx_bstride_0_key = __pyx_bstruct_key.strides[0]; __pyx_bshape_0_key = __pyx_bstruct_key.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_array_uint(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_array_uint(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1794,7 +1761,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_4murmurhash3_32_bytes_arr __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_key); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_32_bytes_array_uint", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_bytes_array_uint", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; @@ -1805,16 +1772,16 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_4murmurhash3_32_bytes_arr return __pyx_r; } -/* "sklearn/utils/murmurhash.pyx":63 +/* "sklearn/utils/murmurhash.pyx":64 * - * - * cpdef np.ndarray[int, ndim=1] murmurhash3_32_bytes_array_int( # <<<<<<<<<<<<<< + * @cython.boundscheck(False) + * cpdef np.ndarray[int, ndim=1] murmurhash3_bytes_array_int( # <<<<<<<<<<<<<< * np.ndarray[int] key, unsigned int seed): - * # TODO make it possible to pass preallocated ouput array + * """Compute 32bit murmurhash3 hashes of a key int array at seed.""" */ -static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_5murmurhash3_32_bytes_array_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_array_int(PyArrayObject *__pyx_v_key, unsigned int __pyx_v_seed, int __pyx_skip_dispatch) { +static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_5murmurhash3_bytes_array_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_array_int(PyArrayObject *__pyx_v_key, unsigned int __pyx_v_seed, int __pyx_skip_dispatch) { PyArrayObject *__pyx_v_out = 0; int __pyx_v_i; Py_buffer __pyx_bstruct_key; @@ -1834,48 +1801,47 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_ int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - int __pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("murmurhash3_32_bytes_array_int"); + __Pyx_RefNannySetupContext("murmurhash3_bytes_array_int"); __pyx_bstruct_out.buf = NULL; __pyx_bstruct_key.buf = NULL; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_key, (PyObject*)__pyx_v_key, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_key, (PyObject*)__pyx_v_key, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_key = __pyx_bstruct_key.strides[0]; __pyx_bshape_0_key = __pyx_bstruct_key.shape[0]; - /* "sklearn/utils/murmurhash.pyx":66 - * np.ndarray[int] key, unsigned int seed): + /* "sklearn/utils/murmurhash.pyx":68 + * """Compute 32bit murmurhash3 hashes of a key int array at seed.""" * # TODO make it possible to pass preallocated ouput array * cdef np.ndarray[int, ndim=1] out = np.zeros( # <<<<<<<<<<<<<< * key.size, np.int32) * cdef int i */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __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[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/murmurhash.pyx":67 + /* "sklearn/utils/murmurhash.pyx":69 * # TODO make it possible to pass preallocated ouput array * cdef np.ndarray[int, ndim=1] out = np.zeros( * key.size, np.int32) # <<<<<<<<<<<<<< * cdef int i * for i in range(key.shape[0]): */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_key), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_key), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __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(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __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); @@ -1883,17 +1849,17 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_ __Pyx_GIVEREF(__pyx_t_4); __pyx_t_1 = 0; __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[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __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 (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_out, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_out = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_out.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_out = __pyx_bstruct_out.strides[0]; __pyx_bshape_0_out = __pyx_bstruct_out.shape[0]; } @@ -1902,50 +1868,34 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_ __pyx_v_out = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/utils/murmurhash.pyx":69 + /* "sklearn/utils/murmurhash.pyx":71 * key.size, np.int32) * cdef int i * for i in range(key.shape[0]): # <<<<<<<<<<<<<< - * out[i] = murmurhash3_32_int_int(key[i], seed) + * out[i] = murmurhash3_int_int(key[i], seed) * return out */ __pyx_t_6 = (__pyx_v_key->dimensions[0]); for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7; - /* "sklearn/utils/murmurhash.pyx":70 + /* "sklearn/utils/murmurhash.pyx":72 * cdef int i * for i in range(key.shape[0]): - * out[i] = murmurhash3_32_int_int(key[i], seed) # <<<<<<<<<<<<<< + * out[i] = murmurhash3_int_int(key[i], seed) # <<<<<<<<<<<<<< * return out * */ __pyx_t_8 = __pyx_v_i; - __pyx_t_9 = -1; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_bshape_0_key; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_key)) __pyx_t_9 = 0; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_0_key; __pyx_t_9 = __pyx_v_i; - __pyx_t_10 = -1; - if (__pyx_t_9 < 0) { - __pyx_t_9 += __pyx_bshape_0_out; - if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0; - } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_out)) __pyx_t_10 = 0; - if (unlikely(__pyx_t_10 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_10); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_out.buf, __pyx_t_9, __pyx_bstride_0_out) = __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_int_int((*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_key.buf, __pyx_t_8, __pyx_bstride_0_key)), __pyx_v_seed, 0); + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_0_out; + *__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_out.buf, __pyx_t_9, __pyx_bstride_0_out) = __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_int((*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_key.buf, __pyx_t_8, __pyx_bstride_0_key)), __pyx_v_seed, 0); } - /* "sklearn/utils/murmurhash.pyx":71 + /* "sklearn/utils/murmurhash.pyx":73 * for i in range(key.shape[0]): - * out[i] = murmurhash3_32_int_int(key[i], seed) + * out[i] = murmurhash3_int_int(key[i], seed) * return out # <<<<<<<<<<<<<< * * @@ -1967,7 +1917,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_ __Pyx_SafeReleaseBuffer(&__pyx_bstruct_key); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_out); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_32_bytes_array_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_bytes_array_int", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -1980,16 +1930,17 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_ return __pyx_r; } -/* "sklearn/utils/murmurhash.pyx":63 - * +/* "sklearn/utils/murmurhash.pyx":64 * - * cpdef np.ndarray[int, ndim=1] murmurhash3_32_bytes_array_int( # <<<<<<<<<<<<<< + * @cython.boundscheck(False) + * cpdef np.ndarray[int, ndim=1] murmurhash3_bytes_array_int( # <<<<<<<<<<<<<< * np.ndarray[int] key, unsigned int seed): - * # TODO make it possible to pass preallocated ouput array + * """Compute 32bit murmurhash3 hashes of a key int array at seed.""" */ -static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_5murmurhash3_32_bytes_array_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_5murmurhash3_32_bytes_array_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_5murmurhash3_bytes_array_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_5utils_10murmurhash_5murmurhash3_bytes_array_int[] = "Compute 32bit murmurhash3 hashes of a key int array at seed."; +static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_5murmurhash3_bytes_array_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_key = 0; unsigned int __pyx_v_seed; Py_buffer __pyx_bstruct_key; @@ -2002,7 +1953,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_5murmurhash3_32_bytes_arr const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__seed,0}; - __Pyx_RefNannySetupContext("murmurhash3_32_bytes_array_int"); + __Pyx_RefNannySetupContext("murmurhash3_bytes_array_int"); __pyx_self = __pyx_self; { PyObject* values[2] = {0,0}; @@ -2024,11 +1975,11 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_5murmurhash3_32_bytes_arr values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seed); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("murmurhash3_32_bytes_array_int", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_array_int", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __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), "murmurhash3_32_bytes_array_int") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "murmurhash3_bytes_array_int") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -2037,26 +1988,26 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_5murmurhash3_32_bytes_arr values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_key = ((PyArrayObject *)values[0]); - __pyx_v_seed = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_seed = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("murmurhash3_32_bytes_array_int", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_array_int", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_32_bytes_array_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_bytes_array_int", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_bstruct_key.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), __pyx_ptype_5numpy_ndarray, 1, "key", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), __pyx_ptype_5numpy_ndarray, 1, "key", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_key, (PyObject*)__pyx_v_key, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_key, (PyObject*)__pyx_v_key, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_key = __pyx_bstruct_key.strides[0]; __pyx_bshape_0_key = __pyx_bstruct_key.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_array_int(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_array_int(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2070,7 +2021,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_5murmurhash3_32_bytes_arr __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_key); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_32_bytes_array_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_bytes_array_int", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; @@ -2081,16 +2032,16 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_5murmurhash3_32_bytes_arr return __pyx_r; } -/* "sklearn/utils/murmurhash.pyx":74 +/* "sklearn/utils/murmurhash.pyx":76 * * * def murmurhash3_32(key, seed=0, positive=False): # <<<<<<<<<<<<<< - * """Compute the 32bit murmurhash3_32 of key at seed. + * """Compute the 32bit murmurhash3 of key at seed. * */ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_6murmurhash3_32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7sklearn_5utils_10murmurhash_6murmurhash3_32[] = "Compute the 32bit murmurhash3_32 of key at seed.\n\n The underlying implementation is MurmurHash3_x86_32 generating low\n latency 32bits hash suitable for implementing lookup tables, Bloom\n filters, count min sketch or feature hashing.\n\n Parameters\n ----------\n key: int32, bytes or unicode\n the physical object to hash\n\n seed: int, optional default is 0\n integer seed for the hashing algorithm.\n\n positive: boolean, optional default is False\n True: the results is casted to an unsigned int\n from 0 to 2 ** 32 - 1\n False: the results is casted to a signed int\n from -(2 ** 31) to 2 ** 31 - 1\n\n "; +static char __pyx_doc_7sklearn_5utils_10murmurhash_6murmurhash3_32[] = "Compute the 32bit murmurhash3 of key at seed.\n\n The underlying implementation is MurmurHash3_x86_32 generating low\n latency 32bits hash suitable for implementing lookup tables, Bloom\n filters, count min sketch or feature hashing.\n\n Parameters\n ----------\n key: int32, bytes, unicode or ndarray with dtype int32\n the physical object to hash\n\n seed: int, optional default is 0\n integer seed for the hashing algorithm.\n\n positive: boolean, optional default is False\n True: the results is casted to an unsigned int\n from 0 to 2 ** 32 - 1\n False: the results is casted to a signed int\n from -(2 ** 31) to 2 ** 31 - 1\n\n "; static PyMethodDef __pyx_mdef_7sklearn_5utils_10murmurhash_6murmurhash3_32 = {__Pyx_NAMESTR("murmurhash3_32"), (PyCFunction)__pyx_pf_7sklearn_5utils_10murmurhash_6murmurhash3_32, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_10murmurhash_6murmurhash3_32)}; static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_6murmurhash3_32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_key = 0; @@ -2099,9 +2050,9 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_6murmurhash3_32(PyObject PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - unsigned int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + unsigned int __pyx_t_4; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; @@ -2141,7 +2092,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_6murmurhash3_32(PyObject } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "murmurhash3_32") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "murmurhash3_32") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2158,391 +2109,430 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_6murmurhash3_32(PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("murmurhash3_32", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_32", 0, 1, 3, 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("sklearn.utils.murmurhash.murmurhash3_32", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_key); - /* "sklearn/utils/murmurhash.pyx":96 + /* "sklearn/utils/murmurhash.pyx":98 + * + * """ + * if isinstance(key, np.int32): # <<<<<<<<<<<<<< + * key = int(key) * + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = PyObject_IsInstance(__pyx_v_key, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "sklearn/utils/murmurhash.pyx":99 * """ + * if isinstance(key, np.int32): + * key = int(key) # <<<<<<<<<<<<<< + * + * if isinstance(key, bytes): + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_key); + __pyx_v_key = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "sklearn/utils/murmurhash.pyx":101 + * key = int(key) + * * if isinstance(key, bytes): # <<<<<<<<<<<<<< * if positive: - * return murmurhash3_32_bytes_uint(key, seed) + * return murmurhash3_bytes_uint(key, seed) */ __pyx_t_1 = ((PyObject *)((PyObject*)(&PyBytes_Type))); __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_key, __pyx_t_1); + __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_key, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + if (__pyx_t_3) { - /* "sklearn/utils/murmurhash.pyx":97 - * """ + /* "sklearn/utils/murmurhash.pyx":102 + * * if isinstance(key, bytes): * if positive: # <<<<<<<<<<<<<< - * return murmurhash3_32_bytes_uint(key, seed) + * return murmurhash3_bytes_uint(key, seed) * else: */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_positive); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_2) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_positive); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { - /* "sklearn/utils/murmurhash.pyx":98 + /* "sklearn/utils/murmurhash.pyx":103 * if isinstance(key, bytes): * if positive: - * return murmurhash3_32_bytes_uint(key, seed) # <<<<<<<<<<<<<< + * return murmurhash3_bytes_uint(key, seed) # <<<<<<<<<<<<<< * else: - * return murmurhash3_32_bytes_int(key, seed) + * return murmurhash3_bytes_int(key, seed) */ __Pyx_XDECREF(__pyx_r); - if (!(likely(PyBytes_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_key)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyBytes_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_key)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = __pyx_v_key; __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_uint(((PyObject*)__pyx_t_1), __pyx_t_3, 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_4 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_uint(((PyObject*)__pyx_t_1), __pyx_t_4, 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __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_4; - __pyx_t_4 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - goto __pyx_L7; + goto __pyx_L8; } /*else*/ { - /* "sklearn/utils/murmurhash.pyx":100 - * return murmurhash3_32_bytes_uint(key, seed) + /* "sklearn/utils/murmurhash.pyx":105 + * return murmurhash3_bytes_uint(key, seed) * else: - * return murmurhash3_32_bytes_int(key, seed) # <<<<<<<<<<<<<< + * return murmurhash3_bytes_int(key, seed) # <<<<<<<<<<<<<< * elif isinstance(key, unicode): * if positive: */ __Pyx_XDECREF(__pyx_r); - if (!(likely(PyBytes_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_key)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = __pyx_v_key; - __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyInt_FromLong(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_int(((PyObject*)__pyx_t_4), __pyx_t_3, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyBytes_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_key)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_v_key; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_int(((PyObject*)__pyx_t_2), __pyx_t_4, 0)); 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_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; } - __pyx_L7:; - goto __pyx_L6; + __pyx_L8:; + goto __pyx_L7; } - /* "sklearn/utils/murmurhash.pyx":101 + /* "sklearn/utils/murmurhash.pyx":106 * else: - * return murmurhash3_32_bytes_int(key, seed) + * return murmurhash3_bytes_int(key, seed) * elif isinstance(key, unicode): # <<<<<<<<<<<<<< * if positive: - * return murmurhash3_32_bytes_uint(key.encode('utf-8'), seed) + * return murmurhash3_bytes_uint(key.encode('utf-8'), seed) */ __pyx_t_1 = ((PyObject *)((PyObject*)(&PyUnicode_Type))); __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_key, __pyx_t_1); + __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_key, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + if (__pyx_t_3) { - /* "sklearn/utils/murmurhash.pyx":102 - * return murmurhash3_32_bytes_int(key, seed) + /* "sklearn/utils/murmurhash.pyx":107 + * return murmurhash3_bytes_int(key, seed) * elif isinstance(key, unicode): * if positive: # <<<<<<<<<<<<<< - * return murmurhash3_32_bytes_uint(key.encode('utf-8'), seed) + * return murmurhash3_bytes_uint(key.encode('utf-8'), seed) * else: */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_positive); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_2) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_positive); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { - /* "sklearn/utils/murmurhash.pyx":103 + /* "sklearn/utils/murmurhash.pyx":108 * elif isinstance(key, unicode): * if positive: - * return murmurhash3_32_bytes_uint(key.encode('utf-8'), seed) # <<<<<<<<<<<<<< + * return murmurhash3_bytes_uint(key.encode('utf-8'), seed) # <<<<<<<<<<<<<< * else: - * return murmurhash3_32_bytes_int(key.encode('utf-8'), seed) + * return murmurhash3_bytes_int(key.encode('utf-8'), seed) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_uint(((PyObject*)__pyx_t_4), __pyx_t_3, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_uint(((PyObject*)__pyx_t_2), __pyx_t_4, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - goto __pyx_L8; + goto __pyx_L9; } /*else*/ { - /* "sklearn/utils/murmurhash.pyx":105 - * return murmurhash3_32_bytes_uint(key.encode('utf-8'), seed) + /* "sklearn/utils/murmurhash.pyx":110 + * return murmurhash3_bytes_uint(key.encode('utf-8'), seed) * else: - * return murmurhash3_32_bytes_int(key.encode('utf-8'), seed) # <<<<<<<<<<<<<< + * return murmurhash3_bytes_int(key.encode('utf-8'), seed) # <<<<<<<<<<<<<< * elif isinstance(key, int): * if positive: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__encode); 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); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyInt_FromLong(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_int(((PyObject*)__pyx_t_4), __pyx_t_3, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_int(((PyObject*)__pyx_t_2), __pyx_t_4, 0)); 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); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; } - __pyx_L8:; - goto __pyx_L6; + __pyx_L9:; + goto __pyx_L7; } - /* "sklearn/utils/murmurhash.pyx":106 + /* "sklearn/utils/murmurhash.pyx":111 * else: - * return murmurhash3_32_bytes_int(key.encode('utf-8'), seed) + * return murmurhash3_bytes_int(key.encode('utf-8'), seed) * elif isinstance(key, int): # <<<<<<<<<<<<<< * if positive: - * return murmurhash3_32_int_uint(key, seed) + * return murmurhash3_int_uint(key, seed) */ __pyx_t_1 = ((PyObject *)((PyObject*)(&PyInt_Type))); __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_key, __pyx_t_1); + __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_key, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + if (__pyx_t_3) { - /* "sklearn/utils/murmurhash.pyx":107 - * return murmurhash3_32_bytes_int(key.encode('utf-8'), seed) + /* "sklearn/utils/murmurhash.pyx":112 + * return murmurhash3_bytes_int(key.encode('utf-8'), seed) * elif isinstance(key, int): * if positive: # <<<<<<<<<<<<<< - * return murmurhash3_32_int_uint(key, seed) + * return murmurhash3_int_uint(key, seed) * else: */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_positive); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_2) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_positive); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { - /* "sklearn/utils/murmurhash.pyx":108 + /* "sklearn/utils/murmurhash.pyx":113 * elif isinstance(key, int): * if positive: - * return murmurhash3_32_int_uint(key, seed) # <<<<<<<<<<<<<< + * return murmurhash3_int_uint(key, seed) # <<<<<<<<<<<<<< * else: - * return murmurhash3_32_int_int(key, seed) + * return murmurhash3_int_int(key, seed) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_key); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_int_uint(__pyx_t_5, __pyx_t_3, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_key); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_uint(__pyx_t_5, __pyx_t_4, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __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_L9; + goto __pyx_L10; } /*else*/ { - /* "sklearn/utils/murmurhash.pyx":110 - * return murmurhash3_32_int_uint(key, seed) + /* "sklearn/utils/murmurhash.pyx":115 + * return murmurhash3_int_uint(key, seed) * else: - * return murmurhash3_32_int_int(key, seed) # <<<<<<<<<<<<<< + * return murmurhash3_int_int(key, seed) # <<<<<<<<<<<<<< * elif isinstance(key, np.ndarray): * if key.dtype != np.int32: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_key); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyInt_FromLong(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_int_int(__pyx_t_5, __pyx_t_3, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_key); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_int(__pyx_t_5, __pyx_t_4, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; } - __pyx_L9:; - goto __pyx_L6; + __pyx_L10:; + goto __pyx_L7; } - /* "sklearn/utils/murmurhash.pyx":111 + /* "sklearn/utils/murmurhash.pyx":116 * else: - * return murmurhash3_32_int_int(key, seed) + * return murmurhash3_int_int(key, seed) * elif isinstance(key, np.ndarray): # <<<<<<<<<<<<<< * if key.dtype != np.int32: * raise ValueError( */ __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5numpy_ndarray)); __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_key, __pyx_t_1); + __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_key, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + if (__pyx_t_3) { - /* "sklearn/utils/murmurhash.pyx":112 - * return murmurhash3_32_int_int(key, seed) + /* "sklearn/utils/murmurhash.pyx":117 + * return murmurhash3_int_int(key, seed) * elif isinstance(key, np.ndarray): * if key.dtype != np.int32: # <<<<<<<<<<<<<< * raise ValueError( * "key.dtype should be int32, got %s" % key.dtype) */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__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 = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_6, Py_NE); 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_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_6, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_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; - if (__pyx_t_2) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { - /* "sklearn/utils/murmurhash.pyx":114 + /* "sklearn/utils/murmurhash.pyx":119 * if key.dtype != np.int32: * raise ValueError( * "key.dtype should be int32, got %s" % key.dtype) # <<<<<<<<<<<<<< * if positive: - * return murmurhash3_32_bytes_array_uint( + * return murmurhash3_bytes_array_uint( */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_6)); + __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 = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_6)); __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L11; } - __pyx_L10:; + __pyx_L11:; - /* "sklearn/utils/murmurhash.pyx":115 + /* "sklearn/utils/murmurhash.pyx":120 * raise ValueError( * "key.dtype should be int32, got %s" % key.dtype) * if positive: # <<<<<<<<<<<<<< - * return murmurhash3_32_bytes_array_uint( + * return murmurhash3_bytes_array_uint( * key.ravel(), seed).reshape(key.shape) */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_positive); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_2) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_positive); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { - /* "sklearn/utils/murmurhash.pyx":116 + /* "sklearn/utils/murmurhash.pyx":121 * "key.dtype should be int32, got %s" % key.dtype) * if positive: - * return murmurhash3_32_bytes_array_uint( # <<<<<<<<<<<<<< + * return murmurhash3_bytes_array_uint( # <<<<<<<<<<<<<< * key.ravel(), seed).reshape(key.shape) * else: */ __Pyx_XDECREF(__pyx_r); - /* "sklearn/utils/murmurhash.pyx":117 + /* "sklearn/utils/murmurhash.pyx":122 * if positive: - * return murmurhash3_32_bytes_array_uint( + * return murmurhash3_bytes_array_uint( * key.ravel(), seed).reshape(key.shape) # <<<<<<<<<<<<<< * else: - * return murmurhash3_32_bytes_array_int( + * return murmurhash3_bytes_array_int( */ - __pyx_t_6 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 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 = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = ((PyObject *)__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_array_uint(((PyArrayObject *)__pyx_t_4), __pyx_t_3, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = ((PyObject *)__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_array_uint(((PyArrayObject *)__pyx_t_2), __pyx_t_4, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__reshape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__reshape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__shape); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__shape); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __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[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L0; - goto __pyx_L11; + goto __pyx_L12; } /*else*/ { - /* "sklearn/utils/murmurhash.pyx":119 + /* "sklearn/utils/murmurhash.pyx":124 * key.ravel(), seed).reshape(key.shape) * else: - * return murmurhash3_32_bytes_array_int( # <<<<<<<<<<<<<< + * return murmurhash3_bytes_array_int( # <<<<<<<<<<<<<< * key.ravel(), seed).reshape(key.shape) * else: */ __Pyx_XDECREF(__pyx_r); - /* "sklearn/utils/murmurhash.pyx":120 + /* "sklearn/utils/murmurhash.pyx":125 * else: - * return murmurhash3_32_bytes_array_int( + * return murmurhash3_bytes_array_int( * key.ravel(), seed).reshape(key.shape) # <<<<<<<<<<<<<< * else: * raise ValueError( */ - __pyx_t_6 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __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 = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 125; __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_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = ((PyObject *)__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_array_int(((PyArrayObject *)__pyx_t_1), __pyx_t_3, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = ((PyObject *)__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_array_int(((PyArrayObject *)__pyx_t_1), __pyx_t_4, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __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_GetAttr(__pyx_t_6, __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__shape); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__shape); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __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[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L0; } - __pyx_L11:; - goto __pyx_L6; + __pyx_L12:; + goto __pyx_L7; } /*else*/ { - /* "sklearn/utils/murmurhash.pyx":124 + /* "sklearn/utils/murmurhash.pyx":129 * raise ValueError( * "key %r with type %s is not supported. " * "Explicit conversion to bytes is required" % (key, type(key))) # <<<<<<<<<<<<<< */ - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_INCREF(__pyx_v_key); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_key); @@ -2550,32 +2540,33 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_6murmurhash3_32(PyObject __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_key))); PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)Py_TYPE(__pyx_v_key))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_key))); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 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_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L6:; + __pyx_L7:; __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_2); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_32", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_key); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -4518,12 +4509,12 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } static PyMethodDef __pyx_methods[] = { - {__Pyx_NAMESTR("murmurhash3_32_int_uint"), (PyCFunction)__pyx_pf_7sklearn_5utils_10murmurhash_murmurhash3_32_int_uint, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_10murmurhash_murmurhash3_32_int_uint)}, - {__Pyx_NAMESTR("murmurhash3_32_int_int"), (PyCFunction)__pyx_pf_7sklearn_5utils_10murmurhash_1murmurhash3_32_int_int, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_10murmurhash_1murmurhash3_32_int_int)}, - {__Pyx_NAMESTR("murmurhash3_32_bytes_uint"), (PyCFunction)__pyx_pf_7sklearn_5utils_10murmurhash_2murmurhash3_32_bytes_uint, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_10murmurhash_2murmurhash3_32_bytes_uint)}, - {__Pyx_NAMESTR("murmurhash3_32_bytes_int"), (PyCFunction)__pyx_pf_7sklearn_5utils_10murmurhash_3murmurhash3_32_bytes_int, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_10murmurhash_3murmurhash3_32_bytes_int)}, - {__Pyx_NAMESTR("murmurhash3_32_bytes_array_uint"), (PyCFunction)__pyx_pf_7sklearn_5utils_10murmurhash_4murmurhash3_32_bytes_array_uint, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_10murmurhash_4murmurhash3_32_bytes_array_uint)}, - {__Pyx_NAMESTR("murmurhash3_32_bytes_array_int"), (PyCFunction)__pyx_pf_7sklearn_5utils_10murmurhash_5murmurhash3_32_bytes_array_int, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("murmurhash3_int_uint"), (PyCFunction)__pyx_pf_7sklearn_5utils_10murmurhash_murmurhash3_int_uint, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_10murmurhash_murmurhash3_int_uint)}, + {__Pyx_NAMESTR("murmurhash3_int_int"), (PyCFunction)__pyx_pf_7sklearn_5utils_10murmurhash_1murmurhash3_int_int, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_10murmurhash_1murmurhash3_int_int)}, + {__Pyx_NAMESTR("murmurhash3_bytes_uint"), (PyCFunction)__pyx_pf_7sklearn_5utils_10murmurhash_2murmurhash3_bytes_uint, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_10murmurhash_2murmurhash3_bytes_uint)}, + {__Pyx_NAMESTR("murmurhash3_bytes_int"), (PyCFunction)__pyx_pf_7sklearn_5utils_10murmurhash_3murmurhash3_bytes_int, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_10murmurhash_3murmurhash3_bytes_int)}, + {__Pyx_NAMESTR("murmurhash3_bytes_array_uint"), (PyCFunction)__pyx_pf_7sklearn_5utils_10murmurhash_4murmurhash3_bytes_array_uint, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_10murmurhash_4murmurhash3_bytes_array_uint)}, + {__Pyx_NAMESTR("murmurhash3_bytes_array_int"), (PyCFunction)__pyx_pf_7sklearn_5utils_10murmurhash_5murmurhash3_bytes_array_int, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_10murmurhash_5murmurhash3_bytes_array_int)}, {0, 0, 0, 0} }; @@ -4576,7 +4567,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __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 = 113; __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 = 118; __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 = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; @@ -4587,28 +4578,28 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); - /* "sklearn/utils/murmurhash.pyx":103 + /* "sklearn/utils/murmurhash.pyx":108 * elif isinstance(key, unicode): * if positive: - * return murmurhash3_32_bytes_uint(key.encode('utf-8'), seed) # <<<<<<<<<<<<<< + * return murmurhash3_bytes_uint(key.encode('utf-8'), seed) # <<<<<<<<<<<<<< * else: - * return murmurhash3_32_bytes_int(key.encode('utf-8'), seed) + * return murmurhash3_bytes_int(key.encode('utf-8'), seed) */ - __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __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)); - /* "sklearn/utils/murmurhash.pyx":105 - * return murmurhash3_32_bytes_uint(key.encode('utf-8'), seed) + /* "sklearn/utils/murmurhash.pyx":110 + * return murmurhash3_bytes_uint(key.encode('utf-8'), seed) * else: - * return murmurhash3_32_bytes_int(key.encode('utf-8'), seed) # <<<<<<<<<<<<<< + * return murmurhash3_bytes_int(key.encode('utf-8'), seed) # <<<<<<<<<<<<<< * elif isinstance(key, int): * if positive: */ - __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_2)); @@ -4772,10 +4763,10 @@ PyMODINIT_FUNC PyInit_murmurhash(void) /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ - if (__Pyx_ExportFunction("murmurhash3_32_int_uint", (void (*)(void))__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_int_uint, "unsigned int (int, unsigned int, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ExportFunction("murmurhash3_32_int_int", (void (*)(void))__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_int_int, "int (int, unsigned int, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ExportFunction("murmurhash3_32_bytes_uint", (void (*)(void))__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_uint, "unsigned int (PyObject *, unsigned int, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ExportFunction("murmurhash3_32_bytes_int", (void (*)(void))__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_32_bytes_int, "int (PyObject *, unsigned int, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("murmurhash3_int_uint", (void (*)(void))__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_uint, "unsigned int (int, unsigned int, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("murmurhash3_int_int", (void (*)(void))__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_int, "int (int, unsigned int, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("murmurhash3_bytes_uint", (void (*)(void))__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_uint, "unsigned int (PyObject *, unsigned int, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("murmurhash3_bytes_int", (void (*)(void))__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_int, "int (PyObject *, unsigned int, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Type init code ---*/ /*--- 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 = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -4787,33 +4778,33 @@ PyMODINIT_FUNC PyInit_murmurhash(void) /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "sklearn/utils/murmurhash.pyx":18 - * + /* "sklearn/utils/murmurhash.pyx":19 + * cimport cython * cimport numpy as np * import numpy as np # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __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 = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/murmurhash.pyx":74 + /* "sklearn/utils/murmurhash.pyx":76 * * * def murmurhash3_32(key, seed=0, positive=False): # <<<<<<<<<<<<<< - * """Compute the 32bit murmurhash3_32 of key at seed. + * """Compute the 32bit murmurhash3 of key at seed. * */ - __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_k_1 = __pyx_t_1; __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_10murmurhash_6murmurhash3_32, NULL, __pyx_n_s_20); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_10murmurhash_6murmurhash3_32, NULL, __pyx_n_s_20); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__murmurhash3_32, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__murmurhash3_32, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "sklearn/utils/murmurhash.pyx":1 @@ -5473,11 +5464,6 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { Py_TYPE(obj)->tp_name, type->tp_name); return 0; } -static void __Pyx_RaiseBufferIndexError(int axis) { - PyErr_Format(PyExc_IndexError, - "Out of bounds on buffer access (axis %d)", axis); -} - static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; diff --git a/sklearn/utils/murmurhash.pxd b/sklearn/utils/murmurhash.pxd index 9817abbc260d7264064ee4c459a40199bbcaabbd..bb79ad1802b059ac5f9981a80329e6ee0fbd23bb 100644 --- a/sklearn/utils/murmurhash.pxd +++ b/sklearn/utils/murmurhash.pxd @@ -1,15 +1,23 @@ +"""Export fast murmurhash C/C++ routines + cython wrappers""" + cdef extern from "MurmurHash3.h": void MurmurHash3_x86_32(void* key, int len, unsigned int seed, void* out) + void MurmurHash3_x86_128(void* key, int len, unsigned int seed, + void* out) + + void MurmurHash3_x64_128(void* key, int len, unsigned int seed, + void* out) + -cpdef unsigned int murmurhash3_32_int_uint(int key, unsigned int seed) +cpdef unsigned int murmurhash3_int_uint(int key, unsigned int seed) -cpdef int murmurhash3_32_int_int(int key, unsigned int seed) +cpdef int murmurhash3_int_int(int key, unsigned int seed) -cpdef unsigned int murmurhash3_32_bytes_uint(bytes key, unsigned int seed) +cpdef unsigned int murmurhash3_bytes_uint(bytes key, unsigned int seed) -cpdef int murmurhash3_32_bytes_int(bytes key, unsigned int seed) +cpdef int murmurhash3_bytes_int(bytes key, unsigned int seed) diff --git a/sklearn/utils/murmurhash.pyx b/sklearn/utils/murmurhash.pyx index a4b41902d0ee764cdecf6d25731903dd71f83222..63e4bbcfc7c1cffebd74f7a0eac4cc45358c0735 100644 --- a/sklearn/utils/murmurhash.pyx +++ b/sklearn/utils/murmurhash.pyx @@ -14,65 +14,67 @@ and can be found here: # # License: BSD Style. +cimport cython cimport numpy as np import numpy as np -cpdef unsigned int murmurhash3_32_int_uint(int key, unsigned int seed): - """Compute the 32bit murmurhash3_32 of a int key at seed.""" +cpdef unsigned int murmurhash3_int_uint(int key, unsigned int seed): + """Compute the 32bit murmurhash3 of a int key at seed.""" cdef unsigned int out MurmurHash3_x86_32(&key, sizeof(int), seed, &out) return out -cpdef int murmurhash3_32_int_int(int key, unsigned int seed): - """Compute the 32bit murmurhash3_32 of a int key at seed.""" +cpdef int murmurhash3_int_int(int key, unsigned int seed): + """Compute the 32bit murmurhash3 of a int key at seed.""" cdef int out MurmurHash3_x86_32(&key, sizeof(int), seed, &out) return out -cpdef unsigned int murmurhash3_32_bytes_uint(bytes key, unsigned int seed): - """Compute the 32bit murmurhash3_32 of a bytes key at seed.""" +cpdef unsigned int murmurhash3_bytes_uint(bytes key, unsigned int seed): + """Compute the 32bit murmurhash3 of a bytes key at seed.""" cdef unsigned int out - cdef char* key_c = key - MurmurHash3_x86_32(key_c, len(key), seed, &out) + MurmurHash3_x86_32(<char*> key, len(key), seed, &out) return out -cpdef int murmurhash3_32_bytes_int(bytes key, unsigned int seed): - """Compute the 32bit murmurhash3_32 of a bytes key at seed.""" +cpdef int murmurhash3_bytes_int(bytes key, unsigned int seed): + """Compute the 32bit murmurhash3 of a bytes key at seed.""" cdef int out - cdef char* key_c = key - MurmurHash3_x86_32(key_c, len(key), seed, &out) + MurmurHash3_x86_32(<char*> key, len(key), seed, &out) return out -cpdef np.ndarray[unsigned int, ndim=1] murmurhash3_32_bytes_array_uint( +@cython.boundscheck(False) +cpdef np.ndarray[unsigned int, ndim=1] murmurhash3_bytes_array_uint( np.ndarray[int] key, unsigned int seed): - """Compute the 32bit murmurhash3_32 of a key int array at seed.""" + """Compute 32bit murmurhash3 hashes of a key int array at seed.""" # TODO make it possible to pass preallocated ouput array cdef np.ndarray[unsigned int, ndim=1] out = np.zeros( key.size, np.uint32) cdef int i for i in range(key.shape[0]): - out[i] = murmurhash3_32_int_uint(key[i], seed) + out[i] = murmurhash3_int_uint(key[i], seed) return out -cpdef np.ndarray[int, ndim=1] murmurhash3_32_bytes_array_int( +@cython.boundscheck(False) +cpdef np.ndarray[int, ndim=1] murmurhash3_bytes_array_int( np.ndarray[int] key, unsigned int seed): + """Compute 32bit murmurhash3 hashes of a key int array at seed.""" # TODO make it possible to pass preallocated ouput array cdef np.ndarray[int, ndim=1] out = np.zeros( key.size, np.int32) cdef int i for i in range(key.shape[0]): - out[i] = murmurhash3_32_int_int(key[i], seed) + out[i] = murmurhash3_int_int(key[i], seed) return out def murmurhash3_32(key, seed=0, positive=False): - """Compute the 32bit murmurhash3_32 of key at seed. + """Compute the 32bit murmurhash3 of key at seed. The underlying implementation is MurmurHash3_x86_32 generating low latency 32bits hash suitable for implementing lookup tables, Bloom @@ -93,30 +95,33 @@ def murmurhash3_32(key, seed=0, positive=False): from -(2 ** 31) to 2 ** 31 - 1 """ + if isinstance(key, np.int32): + key = int(key) + if isinstance(key, bytes): if positive: - return murmurhash3_32_bytes_uint(key, seed) + return murmurhash3_bytes_uint(key, seed) else: - return murmurhash3_32_bytes_int(key, seed) + return murmurhash3_bytes_int(key, seed) elif isinstance(key, unicode): if positive: - return murmurhash3_32_bytes_uint(key.encode('utf-8'), seed) + return murmurhash3_bytes_uint(key.encode('utf-8'), seed) else: - return murmurhash3_32_bytes_int(key.encode('utf-8'), seed) + return murmurhash3_bytes_int(key.encode('utf-8'), seed) elif isinstance(key, int): if positive: - return murmurhash3_32_int_uint(key, seed) + return murmurhash3_int_uint(key, seed) else: - return murmurhash3_32_int_int(key, seed) + return murmurhash3_int_int(key, seed) elif isinstance(key, np.ndarray): if key.dtype != np.int32: raise ValueError( "key.dtype should be int32, got %s" % key.dtype) if positive: - return murmurhash3_32_bytes_array_uint( + return murmurhash3_bytes_array_uint( key.ravel(), seed).reshape(key.shape) else: - return murmurhash3_32_bytes_array_int( + return murmurhash3_bytes_array_int( key.ravel(), seed).reshape(key.shape) else: raise ValueError( diff --git a/sklearn/utils/tests/test_murmurhash.py b/sklearn/utils/tests/test_murmurhash.py index c08096e08d1a0de250d9b70739034cf20c4f4f81..bcef36b5f92093816252add2b0a4210038394376 100644 --- a/sklearn/utils/tests/test_murmurhash.py +++ b/sklearn/utils/tests/test_murmurhash.py @@ -35,7 +35,7 @@ def test_mmhash3_int_array(): assert_array_equal(murmurhash3_32(keys, seed), expected) for seed in [0, 42]: - expected = np.array([murmurhash3_32(int(k), seed, positive=True) + expected = np.array([murmurhash3_32(k, seed, positive=True) for k in keys.flat]) expected = expected.reshape(keys.shape) assert_array_equal(murmurhash3_32(keys, seed, positive=True),