Generated by Cython 0.29.34
Yellow lines hint at Python interaction.
Click on a line that starts with a "+
" to see the C code that Cython generated for it.
Raw output: wtau.c
+001: #cython: boundscheck=False, wraparound=False, nonecheck=False
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
002:
003: """
004: Copyright (c) 2001-2002 Enthought, Inc. 2003-2023, SciPy Developers.
005: All rights reserved.
006:
007: Redistribution and use in source and binary forms, with or without
008: modification, are permitted provided that the following conditions
009: are met:
010:
011: 1. Redistributions of source code must retain the above copyright
012: notice, this list of conditions and the following disclaimer.
013:
014: 2. Redistributions in binary form must reproduce the above
015: copyright notice, this list of conditions and the following
016: disclaimer in the documentation and/or other materials provided
017: with the distribution.
018:
019: 3. Neither the name of the copyright holder nor the names of its
020: contributors may be used to endorse or promote products derived
021: from this software without specific prior written permission.
022:
023: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
024: "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
025: LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
026: A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
027: OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
028: SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
029: LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
030: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
031: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
032: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
033: OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
034: """
035:
036: import cython
037: from cpython cimport bool
038: from libc cimport math
039: cimport cython
040: cimport numpy as np
041: from numpy.math cimport PI
042: from numpy.math cimport INFINITY
043: from numpy.math cimport NAN
044: from numpy cimport ndarray, int64_t, float64_t, intp_t
+045: import warnings
__pyx_t_1 = __Pyx_Import(__pyx_n_s_warnings, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_warnings, __pyx_t_1) < 0) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+046: import numpy as np
__pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
047: cimport scipy.special.cython_special as cs
048: from cython.parallel import prange
049: from libc.math cimport sqrt
050: from libc.stdio cimport printf
051:
+052: np.import_array()
__pyx_t_2 = __pyx_f_5numpy_import_array(); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 52, __pyx_L1_error)
053:
054: ctypedef fused ordered:
055: np.int32_t
056: np.int64_t
057: np.float32_t
058: np.float64_t
059:
+060: cpdef float64_t weigh( intp_t offset,
/* Python wrapper */ static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_1weigh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_10sortedness_4wtau_4wtau_weigh[] = "weigh(signatures, args, kwargs, defaults)"; static PyMethodDef __pyx_mdef_10sortedness_4wtau_4wtau_1weigh = {"weigh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10sortedness_4wtau_4wtau_1weigh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10sortedness_4wtau_4wtau_weigh}; static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_1weigh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_signatures = 0; PyObject *__pyx_v_args = 0; PyObject *__pyx_v_kwargs = 0; CYTHON_UNUSED PyObject *__pyx_v_defaults = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fused_cpdef (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_signatures,&__pyx_n_s_args,&__pyx_n_s_kwargs,&__pyx_n_s_defaults,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_signatures)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 1); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 2); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_defaults)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 3); __PYX_ERR(0, 60, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fused_cpdef") < 0)) __PYX_ERR(0, 60, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_signatures = values[0]; __pyx_v_args = values[1]; __pyx_v_kwargs = values[2]; __pyx_v_defaults = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 60, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("sortedness.wtau.wtau.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_10sortedness_4wtau_4wtau_weigh(__pyx_self, __pyx_v_signatures, __pyx_v_args, __pyx_v_kwargs, __pyx_v_defaults); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_10sortedness_4wtau_4wtau_weigh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults) { PyObject *__pyx_v_dest_sig = NULL; Py_ssize_t __pyx_v_i; PyTypeObject *__pyx_v_ndarray = 0; __Pyx_memviewslice __pyx_v_memslice; Py_ssize_t __pyx_v_itemsize; int __pyx_v_dtype_signed; char __pyx_v_kind; int __pyx_v____pyx_int32_t_is_signed; int __pyx_v____pyx_int64_t_is_signed; PyObject *__pyx_v_arg = NULL; PyObject *__pyx_v_dtype = NULL; PyObject *__pyx_v_arg_base = NULL; PyObject *__pyx_v_candidates = NULL; PyObject *__pyx_v_sig = NULL; int __pyx_v_match_found; PyObject *__pyx_v_src_sig = NULL; PyObject *__pyx_v_dst_type = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("weigh", 0); __Pyx_INCREF(__pyx_v_kwargs); __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyList_SET_ITEM(__pyx_t_1, 0, Py_None); __pyx_v_dest_sig = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_v_kwargs != Py_None); __pyx_t_4 = (__pyx_t_3 != 0); if (__pyx_t_4) { } else { __pyx_t_2 = __pyx_t_4; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 60, __pyx_L1_error) __pyx_t_3 = ((!__pyx_t_4) != 0); __pyx_t_2 = __pyx_t_3; __pyx_L4_bool_binop_done:; if (__pyx_t_2) { __Pyx_INCREF(Py_None); __Pyx_DECREF_SET(__pyx_v_kwargs, Py_None); } __pyx_t_1 = ((PyObject *)__Pyx_ImportNumPyArrayTypeIfAvailable()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_ndarray = ((PyTypeObject*)__pyx_t_1); __pyx_t_1 = 0; __pyx_v_itemsize = -1L; __pyx_v____pyx_int32_t_is_signed = (!((((__pyx_t_5numpy_int32_t)-1L) > 0) != 0)); __pyx_v____pyx_int64_t_is_signed = (!((((__pyx_t_5numpy_int64_t)-1L) > 0) != 0)); if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); __PYX_ERR(0, 60, __pyx_L1_error) } __pyx_t_5 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 60, __pyx_L1_error) __pyx_t_2 = ((6 < __pyx_t_5) != 0); if (__pyx_t_2) { if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 60, __pyx_L1_error) } __pyx_t_1 = PyTuple_GET_ITEM(((PyObject*)__pyx_v_args), 6); __Pyx_INCREF(__pyx_t_1); __pyx_v_arg = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L6; } __pyx_t_3 = (__pyx_v_kwargs != Py_None); __pyx_t_4 = (__pyx_t_3 != 0); if (__pyx_t_4) { } else { __pyx_t_2 = __pyx_t_4; goto __pyx_L7_bool_binop_done; } if (unlikely(__pyx_v_kwargs == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(0, 60, __pyx_L1_error) } __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_x, ((PyObject*)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 60, __pyx_L1_error) __pyx_t_3 = (__pyx_t_4 != 0); __pyx_t_2 = __pyx_t_3; __pyx_L7_bool_binop_done:; if (__pyx_t_2) { if (unlikely(__pyx_v_kwargs == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 60, __pyx_L1_error) } __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_kwargs), __pyx_n_s_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_arg = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L6; } /*else*/ { if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); __PYX_ERR(0, 60, __pyx_L1_error) } __pyx_t_5 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 60, __pyx_L1_error) __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_int_8); __Pyx_GIVEREF(__pyx_int_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_8); __Pyx_INCREF(__pyx_n_s_s); __Pyx_GIVEREF(__pyx_n_s_s); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_s); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Expected_at_least_d_argument_s_g, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __PYX_ERR(0, 60, __pyx_L1_error) } __pyx_L6:; while (1) { __pyx_t_2 = (__pyx_v_ndarray != ((PyTypeObject*)Py_None)); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_arg, __pyx_v_ndarray); __pyx_t_2 = (__pyx_t_3 != 0); if (__pyx_t_2) { __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_dtype = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L12; } __pyx_t_2 = __pyx_memoryview_check(__pyx_v_arg); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_base); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_arg_base = __pyx_t_6; __pyx_t_6 = 0; __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_arg_base, __pyx_v_ndarray); __pyx_t_2 = (__pyx_t_3 != 0); if (__pyx_t_2) { __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg_base, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_dtype = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L13; } /*else*/ { __Pyx_INCREF(Py_None); __pyx_v_dtype = Py_None; } __pyx_L13:; goto __pyx_L12; } /*else*/ { __Pyx_INCREF(Py_None); __pyx_v_dtype = Py_None; } __pyx_L12:; __pyx_v_itemsize = -1L; __pyx_t_2 = (__pyx_v_dtype != Py_None); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_itemsize = __pyx_t_5; __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyObject_Ord(__pyx_t_6); if (unlikely(__pyx_t_7 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_kind = __pyx_t_7; __pyx_v_dtype_signed = (__pyx_v_kind == 'i'); switch (__pyx_v_kind) { case 'i': case 'u': __pyx_t_2 = (((sizeof(__pyx_t_5numpy_int32_t)) == __pyx_v_itemsize) != 0); if (__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L16_bool_binop_done; } __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 1) != 0); if (__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L16_bool_binop_done; } __pyx_t_2 = ((!((__pyx_v____pyx_int32_t_is_signed ^ __pyx_v_dtype_signed) != 0)) != 0); __pyx_t_3 = __pyx_t_2; __pyx_L16_bool_binop_done:; if (__pyx_t_3) { if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_int32_t, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 60, __pyx_L1_error) goto __pyx_L10_break; } __pyx_t_2 = (((sizeof(__pyx_t_5numpy_int64_t)) == __pyx_v_itemsize) != 0); if (__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L20_bool_binop_done; } __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 1) != 0); if (__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L20_bool_binop_done; } __pyx_t_2 = ((!((__pyx_v____pyx_int64_t_is_signed ^ __pyx_v_dtype_signed) != 0)) != 0); __pyx_t_3 = __pyx_t_2; __pyx_L20_bool_binop_done:; if (__pyx_t_3) { if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_int64_t, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 60, __pyx_L1_error) goto __pyx_L10_break; } break; case 'f': __pyx_t_2 = (((sizeof(__pyx_t_5numpy_float32_t)) == __pyx_v_itemsize) != 0); if (__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L24_bool_binop_done; } __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 1) != 0); __pyx_t_3 = __pyx_t_2; __pyx_L24_bool_binop_done:; if (__pyx_t_3) { if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float32_t, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 60, __pyx_L1_error) goto __pyx_L10_break; } __pyx_t_2 = (((sizeof(__pyx_t_5numpy_float64_t)) == __pyx_v_itemsize) != 0); if (__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L27_bool_binop_done; } __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 1) != 0); __pyx_t_3 = __pyx_t_2; __pyx_L27_bool_binop_done:; if (__pyx_t_3) { if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float64_t, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 60, __pyx_L1_error) goto __pyx_L10_break; } break; case 'c': break; case 'O': break; default: break; } } } __pyx_t_2 = ((__pyx_v_itemsize == -1L) != 0); if (!__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L30_bool_binop_done; } __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(__pyx_t_5numpy_int32_t))) != 0); __pyx_t_3 = __pyx_t_2; __pyx_L30_bool_binop_done:; if (__pyx_t_3) { __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_int32_t(__pyx_v_arg, 0); __pyx_v_memslice = __pyx_t_8; __pyx_t_3 = (__pyx_v_memslice.memview != 0); if (__pyx_t_3) { __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_int32_t, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 60, __pyx_L1_error) goto __pyx_L10_break; } /*else*/ { PyErr_Clear(); } } __pyx_t_2 = ((__pyx_v_itemsize == -1L) != 0); if (!__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L34_bool_binop_done; } __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(__pyx_t_5numpy_int64_t))) != 0); __pyx_t_3 = __pyx_t_2; __pyx_L34_bool_binop_done:; if (__pyx_t_3) { __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_int64_t(__pyx_v_arg, 0); __pyx_v_memslice = __pyx_t_8; __pyx_t_3 = (__pyx_v_memslice.memview != 0); if (__pyx_t_3) { __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_int64_t, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 60, __pyx_L1_error) goto __pyx_L10_break; } /*else*/ { PyErr_Clear(); } } __pyx_t_2 = ((__pyx_v_itemsize == -1L) != 0); if (!__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L38_bool_binop_done; } __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(__pyx_t_5numpy_float32_t))) != 0); __pyx_t_3 = __pyx_t_2; __pyx_L38_bool_binop_done:; if (__pyx_t_3) { __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_float32_t(__pyx_v_arg, 0); __pyx_v_memslice = __pyx_t_8; __pyx_t_3 = (__pyx_v_memslice.memview != 0); if (__pyx_t_3) { __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float32_t, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 60, __pyx_L1_error) goto __pyx_L10_break; } /*else*/ { PyErr_Clear(); } } __pyx_t_2 = ((__pyx_v_itemsize == -1L) != 0); if (!__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L42_bool_binop_done; } __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(__pyx_t_5numpy_float64_t))) != 0); __pyx_t_3 = __pyx_t_2; __pyx_L42_bool_binop_done:; if (__pyx_t_3) { __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_float64_t(__pyx_v_arg, 0); __pyx_v_memslice = __pyx_t_8; __pyx_t_3 = (__pyx_v_memslice.memview != 0); if (__pyx_t_3) { __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float64_t, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 60, __pyx_L1_error) goto __pyx_L10_break; } /*else*/ { PyErr_Clear(); } } if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, Py_None, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 60, __pyx_L1_error) goto __pyx_L10_break; } __pyx_L10_break:; __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_candidates = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0; __pyx_t_5 = 0; if (unlikely(__pyx_v_signatures == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(0, 60, __pyx_L1_error) } __pyx_t_1 = __Pyx_dict_iterator(((PyObject*)__pyx_v_signatures), 1, ((PyObject *)NULL), (&__pyx_t_9), (&__pyx_t_10)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = __pyx_t_1; __pyx_t_1 = 0; while (1) { __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_9, &__pyx_t_5, &__pyx_t_1, NULL, NULL, __pyx_t_10); if (unlikely(__pyx_t_11 == 0)) break; if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_sig, __pyx_t_1); __pyx_t_1 = 0; __pyx_v_match_found = 0; __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_sig, __pyx_n_s_strip); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_14 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) { __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13); if (likely(__pyx_t_14)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); __Pyx_INCREF(__pyx_t_14); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_13, function); } } __pyx_t_12 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_14, __pyx_kp_s_) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_kp_s_); __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_split); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) { __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13); if (likely(__pyx_t_12)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_13, function); } } __pyx_t_1 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_12, __pyx_kp_s__2) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_kp_s__2); __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF_SET(__pyx_v_src_sig, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_15 = PyList_GET_SIZE(__pyx_v_dest_sig); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 60, __pyx_L1_error) __pyx_t_16 = __pyx_t_15; for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_i = __pyx_t_17; __pyx_t_1 = PyList_GET_ITEM(__pyx_v_dest_sig, __pyx_v_i); __Pyx_INCREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_dst_type, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_v_dst_type != Py_None); __pyx_t_2 = (__pyx_t_3 != 0); if (__pyx_t_2) { __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_src_sig, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_13 = PyObject_RichCompare(__pyx_t_1, __pyx_v_dst_type, Py_EQ); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; if (__pyx_t_2) { __pyx_v_match_found = 1; goto __pyx_L50; } /*else*/ { __pyx_v_match_found = 0; goto __pyx_L48_break; } __pyx_L50:; } } __pyx_L48_break:; __pyx_t_2 = (__pyx_v_match_found != 0); if (__pyx_t_2) { __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_candidates, __pyx_v_sig); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(0, 60, __pyx_L1_error) } } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_2 = (PyList_GET_SIZE(__pyx_v_candidates) != 0); __pyx_t_3 = ((!__pyx_t_2) != 0); if (__pyx_t_3) { __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __PYX_ERR(0, 60, __pyx_L1_error) } __pyx_t_9 = PyList_GET_SIZE(__pyx_v_candidates); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 60, __pyx_L1_error) __pyx_t_3 = ((__pyx_t_9 > 1) != 0); if (__pyx_t_3) { /* … */ __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_No_matching_signature_found); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __PYX_ERR(0, 60, __pyx_L1_error) } /*else*/ { __Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_signatures == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 60, __pyx_L1_error) } __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_signatures), PyList_GET_ITEM(__pyx_v_candidates, 0)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L0; } /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); __Pyx_XDECREF(__pyx_t_14); __Pyx_AddTraceback("sortedness.wtau.wtau.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_dest_sig); __Pyx_XDECREF(__pyx_v_ndarray); __Pyx_XDECREF(__pyx_v_arg); __Pyx_XDECREF(__pyx_v_dtype); __Pyx_XDECREF(__pyx_v_arg_base); __Pyx_XDECREF(__pyx_v_candidates); __Pyx_XDECREF(__pyx_v_sig); __Pyx_XDECREF(__pyx_v_src_sig); __Pyx_XDECREF(__pyx_v_dst_type); __Pyx_XDECREF(__pyx_v_kwargs); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_7__pyx_fuse_0weigh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_1weigh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static __pyx_t_5numpy_float64_t __pyx_fuse_0__pyx_f_10sortedness_4wtau_4wtau_weigh(__pyx_t_5numpy_intp_t __pyx_v_offset, __pyx_t_5numpy_intp_t __pyx_v_length, __Pyx_memviewslice __pyx_v_rank, __Pyx_memviewslice __pyx_v_perm, __Pyx_memviewslice __pyx_v_temp, __Pyx_memviewslice __pyx_v_exchanges_weight, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y, CYTHON_UNUSED int __pyx_skip_dispatch) { __pyx_t_5numpy_intp_t __pyx_v_length0; __pyx_t_5numpy_intp_t __pyx_v_length1; __pyx_t_5numpy_intp_t __pyx_v_middle; __pyx_t_5numpy_intp_t __pyx_v_i; __pyx_t_5numpy_intp_t __pyx_v_j; __pyx_t_5numpy_intp_t __pyx_v_k; __pyx_t_5numpy_float64_t __pyx_v_weight; __pyx_t_5numpy_float64_t __pyx_v_residual; __pyx_t_5numpy_float64_t __pyx_r; /* … */ /* function exit code */ __pyx_L1_error:; __PYX_XDEC_MEMVIEW(&__pyx_t_8, 0); __PYX_XDEC_MEMVIEW(&__pyx_t_10, 0); __Pyx_WriteUnraisable("sortedness.wtau.wtau.weigh", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1); __pyx_r = 0; __pyx_L0:; return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_7__pyx_fuse_0weigh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_fuse_0__pyx_mdef_10sortedness_4wtau_4wtau_7__pyx_fuse_0weigh = {"__pyx_fuse_0weigh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10sortedness_4wtau_4wtau_7__pyx_fuse_0weigh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10sortedness_4wtau_4wtau_weigh}; static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_7__pyx_fuse_0weigh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { __pyx_t_5numpy_intp_t __pyx_v_offset; __pyx_t_5numpy_intp_t __pyx_v_length; __Pyx_memviewslice __pyx_v_rank = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_perm = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_temp = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_exchanges_weight = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_x = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_y = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fuse_0weigh (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_offset,&__pyx_n_s_length,&__pyx_n_s_rank,&__pyx_n_s_perm,&__pyx_n_s_temp,&__pyx_n_s_exchanges_weight,&__pyx_n_s_x,&__pyx_n_s_y,0}; PyObject* values[8] = {0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); CYTHON_FALLTHROUGH; case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offset)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_length)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_0weigh", 1, 8, 8, 1); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rank)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_0weigh", 1, 8, 8, 2); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_perm)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_0weigh", 1, 8, 8, 3); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_temp)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_0weigh", 1, 8, 8, 4); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exchanges_weight)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_0weigh", 1, 8, 8, 5); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_0weigh", 1, 8, 8, 6); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_0weigh", 1, 8, 8, 7); __PYX_ERR(0, 60, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fuse_0weigh") < 0)) __PYX_ERR(0, 60, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); values[7] = PyTuple_GET_ITEM(__pyx_args, 7); } __pyx_v_offset = __Pyx_PyInt_As_Py_intptr_t(values[0]); if (unlikely((__pyx_v_offset == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L3_error) __pyx_v_length = __Pyx_PyInt_As_Py_intptr_t(values[1]); if (unlikely((__pyx_v_length == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 61, __pyx_L3_error) __pyx_v_rank = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rank.memview)) __PYX_ERR(0, 62, __pyx_L3_error) __pyx_v_perm = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_perm.memview)) __PYX_ERR(0, 63, __pyx_L3_error) __pyx_v_temp = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_temp.memview)) __PYX_ERR(0, 64, __pyx_L3_error) __pyx_v_exchanges_weight = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_float64_t(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_exchanges_weight.memview)) __PYX_ERR(0, 65, __pyx_L3_error) __pyx_v_x = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_int32_t(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_x.memview)) __PYX_ERR(0, 66, __pyx_L3_error) __pyx_v_y = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_int32_t(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_y.memview)) __PYX_ERR(0, 67, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__pyx_fuse_0weigh", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 60, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("sortedness.wtau.wtau.__pyx_fuse_0weigh", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_10sortedness_4wtau_4wtau_6__pyx_fuse_0weigh(__pyx_self, __pyx_v_offset, __pyx_v_length, __pyx_v_rank, __pyx_v_perm, __pyx_v_temp, __pyx_v_exchanges_weight, __pyx_v_x, __pyx_v_y); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_10sortedness_4wtau_4wtau_6__pyx_fuse_0weigh(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_intp_t __pyx_v_offset, __pyx_t_5numpy_intp_t __pyx_v_length, __Pyx_memviewslice __pyx_v_rank, __Pyx_memviewslice __pyx_v_perm, __Pyx_memviewslice __pyx_v_temp, __Pyx_memviewslice __pyx_v_exchanges_weight, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fuse_0weigh", 0); __Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_v_rank.memview)) { __Pyx_RaiseUnboundLocalError("rank"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely(!__pyx_v_perm.memview)) { __Pyx_RaiseUnboundLocalError("perm"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely(!__pyx_v_temp.memview)) { __Pyx_RaiseUnboundLocalError("temp"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely(!__pyx_v_exchanges_weight.memview)) { __Pyx_RaiseUnboundLocalError("exchanges_weight"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely(!__pyx_v_x.memview)) { __Pyx_RaiseUnboundLocalError("x"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely(!__pyx_v_y.memview)) { __Pyx_RaiseUnboundLocalError("y"); __PYX_ERR(0, 60, __pyx_L1_error) } __pyx_t_1 = PyFloat_FromDouble(__pyx_fuse_0__pyx_f_10sortedness_4wtau_4wtau_weigh(__pyx_v_offset, __pyx_v_length, __pyx_v_rank, __pyx_v_perm, __pyx_v_temp, __pyx_v_exchanges_weight, __pyx_v_x, __pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sortedness.wtau.wtau.__pyx_fuse_0weigh", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __PYX_XDEC_MEMVIEW(&__pyx_v_rank, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_perm, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_temp, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_exchanges_weight, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_x, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_y, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_9__pyx_fuse_1weigh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_1weigh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static __pyx_t_5numpy_float64_t __pyx_fuse_1__pyx_f_10sortedness_4wtau_4wtau_weigh(__pyx_t_5numpy_intp_t __pyx_v_offset, __pyx_t_5numpy_intp_t __pyx_v_length, __Pyx_memviewslice __pyx_v_rank, __Pyx_memviewslice __pyx_v_perm, __Pyx_memviewslice __pyx_v_temp, __Pyx_memviewslice __pyx_v_exchanges_weight, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y, CYTHON_UNUSED int __pyx_skip_dispatch) { __pyx_t_5numpy_intp_t __pyx_v_length0; __pyx_t_5numpy_intp_t __pyx_v_length1; __pyx_t_5numpy_intp_t __pyx_v_middle; __pyx_t_5numpy_intp_t __pyx_v_i; __pyx_t_5numpy_intp_t __pyx_v_j; __pyx_t_5numpy_intp_t __pyx_v_k; __pyx_t_5numpy_float64_t __pyx_v_weight; __pyx_t_5numpy_float64_t __pyx_v_residual; __pyx_t_5numpy_float64_t __pyx_r; /* … */ /* function exit code */ __pyx_L1_error:; __PYX_XDEC_MEMVIEW(&__pyx_t_8, 0); __PYX_XDEC_MEMVIEW(&__pyx_t_10, 0); __Pyx_WriteUnraisable("sortedness.wtau.wtau.weigh", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1); __pyx_r = 0; __pyx_L0:; return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_9__pyx_fuse_1weigh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_fuse_1__pyx_mdef_10sortedness_4wtau_4wtau_9__pyx_fuse_1weigh = {"__pyx_fuse_1weigh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10sortedness_4wtau_4wtau_9__pyx_fuse_1weigh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10sortedness_4wtau_4wtau_weigh}; static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_9__pyx_fuse_1weigh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { __pyx_t_5numpy_intp_t __pyx_v_offset; __pyx_t_5numpy_intp_t __pyx_v_length; __Pyx_memviewslice __pyx_v_rank = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_perm = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_temp = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_exchanges_weight = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_x = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_y = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fuse_1weigh (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_offset,&__pyx_n_s_length,&__pyx_n_s_rank,&__pyx_n_s_perm,&__pyx_n_s_temp,&__pyx_n_s_exchanges_weight,&__pyx_n_s_x,&__pyx_n_s_y,0}; PyObject* values[8] = {0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); CYTHON_FALLTHROUGH; case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offset)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_length)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_1weigh", 1, 8, 8, 1); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rank)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_1weigh", 1, 8, 8, 2); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_perm)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_1weigh", 1, 8, 8, 3); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_temp)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_1weigh", 1, 8, 8, 4); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exchanges_weight)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_1weigh", 1, 8, 8, 5); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_1weigh", 1, 8, 8, 6); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_1weigh", 1, 8, 8, 7); __PYX_ERR(0, 60, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fuse_1weigh") < 0)) __PYX_ERR(0, 60, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); values[7] = PyTuple_GET_ITEM(__pyx_args, 7); } __pyx_v_offset = __Pyx_PyInt_As_Py_intptr_t(values[0]); if (unlikely((__pyx_v_offset == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L3_error) __pyx_v_length = __Pyx_PyInt_As_Py_intptr_t(values[1]); if (unlikely((__pyx_v_length == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 61, __pyx_L3_error) __pyx_v_rank = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rank.memview)) __PYX_ERR(0, 62, __pyx_L3_error) __pyx_v_perm = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_perm.memview)) __PYX_ERR(0, 63, __pyx_L3_error) __pyx_v_temp = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_temp.memview)) __PYX_ERR(0, 64, __pyx_L3_error) __pyx_v_exchanges_weight = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_float64_t(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_exchanges_weight.memview)) __PYX_ERR(0, 65, __pyx_L3_error) __pyx_v_x = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_int64_t(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_x.memview)) __PYX_ERR(0, 66, __pyx_L3_error) __pyx_v_y = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_int64_t(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_y.memview)) __PYX_ERR(0, 67, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__pyx_fuse_1weigh", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 60, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("sortedness.wtau.wtau.__pyx_fuse_1weigh", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_10sortedness_4wtau_4wtau_8__pyx_fuse_1weigh(__pyx_self, __pyx_v_offset, __pyx_v_length, __pyx_v_rank, __pyx_v_perm, __pyx_v_temp, __pyx_v_exchanges_weight, __pyx_v_x, __pyx_v_y); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_10sortedness_4wtau_4wtau_8__pyx_fuse_1weigh(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_intp_t __pyx_v_offset, __pyx_t_5numpy_intp_t __pyx_v_length, __Pyx_memviewslice __pyx_v_rank, __Pyx_memviewslice __pyx_v_perm, __Pyx_memviewslice __pyx_v_temp, __Pyx_memviewslice __pyx_v_exchanges_weight, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fuse_1weigh", 0); __Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_v_rank.memview)) { __Pyx_RaiseUnboundLocalError("rank"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely(!__pyx_v_perm.memview)) { __Pyx_RaiseUnboundLocalError("perm"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely(!__pyx_v_temp.memview)) { __Pyx_RaiseUnboundLocalError("temp"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely(!__pyx_v_exchanges_weight.memview)) { __Pyx_RaiseUnboundLocalError("exchanges_weight"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely(!__pyx_v_x.memview)) { __Pyx_RaiseUnboundLocalError("x"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely(!__pyx_v_y.memview)) { __Pyx_RaiseUnboundLocalError("y"); __PYX_ERR(0, 60, __pyx_L1_error) } __pyx_t_1 = PyFloat_FromDouble(__pyx_fuse_1__pyx_f_10sortedness_4wtau_4wtau_weigh(__pyx_v_offset, __pyx_v_length, __pyx_v_rank, __pyx_v_perm, __pyx_v_temp, __pyx_v_exchanges_weight, __pyx_v_x, __pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sortedness.wtau.wtau.__pyx_fuse_1weigh", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __PYX_XDEC_MEMVIEW(&__pyx_v_rank, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_perm, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_temp, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_exchanges_weight, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_x, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_y, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_11__pyx_fuse_2weigh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_1weigh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static __pyx_t_5numpy_float64_t __pyx_fuse_2__pyx_f_10sortedness_4wtau_4wtau_weigh(__pyx_t_5numpy_intp_t __pyx_v_offset, __pyx_t_5numpy_intp_t __pyx_v_length, __Pyx_memviewslice __pyx_v_rank, __Pyx_memviewslice __pyx_v_perm, __Pyx_memviewslice __pyx_v_temp, __Pyx_memviewslice __pyx_v_exchanges_weight, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y, CYTHON_UNUSED int __pyx_skip_dispatch) { __pyx_t_5numpy_intp_t __pyx_v_length0; __pyx_t_5numpy_intp_t __pyx_v_length1; __pyx_t_5numpy_intp_t __pyx_v_middle; __pyx_t_5numpy_intp_t __pyx_v_i; __pyx_t_5numpy_intp_t __pyx_v_j; __pyx_t_5numpy_intp_t __pyx_v_k; __pyx_t_5numpy_float64_t __pyx_v_weight; __pyx_t_5numpy_float64_t __pyx_v_residual; __pyx_t_5numpy_float64_t __pyx_r; /* … */ /* function exit code */ __pyx_L1_error:; __PYX_XDEC_MEMVIEW(&__pyx_t_8, 0); __PYX_XDEC_MEMVIEW(&__pyx_t_10, 0); __Pyx_WriteUnraisable("sortedness.wtau.wtau.weigh", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1); __pyx_r = 0; __pyx_L0:; return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_11__pyx_fuse_2weigh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_fuse_2__pyx_mdef_10sortedness_4wtau_4wtau_11__pyx_fuse_2weigh = {"__pyx_fuse_2weigh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10sortedness_4wtau_4wtau_11__pyx_fuse_2weigh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10sortedness_4wtau_4wtau_weigh}; static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_11__pyx_fuse_2weigh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { __pyx_t_5numpy_intp_t __pyx_v_offset; __pyx_t_5numpy_intp_t __pyx_v_length; __Pyx_memviewslice __pyx_v_rank = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_perm = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_temp = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_exchanges_weight = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_x = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_y = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fuse_2weigh (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_offset,&__pyx_n_s_length,&__pyx_n_s_rank,&__pyx_n_s_perm,&__pyx_n_s_temp,&__pyx_n_s_exchanges_weight,&__pyx_n_s_x,&__pyx_n_s_y,0}; PyObject* values[8] = {0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); CYTHON_FALLTHROUGH; case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offset)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_length)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_2weigh", 1, 8, 8, 1); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rank)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_2weigh", 1, 8, 8, 2); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_perm)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_2weigh", 1, 8, 8, 3); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_temp)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_2weigh", 1, 8, 8, 4); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exchanges_weight)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_2weigh", 1, 8, 8, 5); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_2weigh", 1, 8, 8, 6); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_2weigh", 1, 8, 8, 7); __PYX_ERR(0, 60, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fuse_2weigh") < 0)) __PYX_ERR(0, 60, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); values[7] = PyTuple_GET_ITEM(__pyx_args, 7); } __pyx_v_offset = __Pyx_PyInt_As_Py_intptr_t(values[0]); if (unlikely((__pyx_v_offset == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L3_error) __pyx_v_length = __Pyx_PyInt_As_Py_intptr_t(values[1]); if (unlikely((__pyx_v_length == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 61, __pyx_L3_error) __pyx_v_rank = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rank.memview)) __PYX_ERR(0, 62, __pyx_L3_error) __pyx_v_perm = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_perm.memview)) __PYX_ERR(0, 63, __pyx_L3_error) __pyx_v_temp = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_temp.memview)) __PYX_ERR(0, 64, __pyx_L3_error) __pyx_v_exchanges_weight = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_float64_t(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_exchanges_weight.memview)) __PYX_ERR(0, 65, __pyx_L3_error) __pyx_v_x = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_float32_t(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_x.memview)) __PYX_ERR(0, 66, __pyx_L3_error) __pyx_v_y = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_float32_t(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_y.memview)) __PYX_ERR(0, 67, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__pyx_fuse_2weigh", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 60, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("sortedness.wtau.wtau.__pyx_fuse_2weigh", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_10sortedness_4wtau_4wtau_10__pyx_fuse_2weigh(__pyx_self, __pyx_v_offset, __pyx_v_length, __pyx_v_rank, __pyx_v_perm, __pyx_v_temp, __pyx_v_exchanges_weight, __pyx_v_x, __pyx_v_y); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_10sortedness_4wtau_4wtau_10__pyx_fuse_2weigh(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_intp_t __pyx_v_offset, __pyx_t_5numpy_intp_t __pyx_v_length, __Pyx_memviewslice __pyx_v_rank, __Pyx_memviewslice __pyx_v_perm, __Pyx_memviewslice __pyx_v_temp, __Pyx_memviewslice __pyx_v_exchanges_weight, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fuse_2weigh", 0); __Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_v_rank.memview)) { __Pyx_RaiseUnboundLocalError("rank"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely(!__pyx_v_perm.memview)) { __Pyx_RaiseUnboundLocalError("perm"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely(!__pyx_v_temp.memview)) { __Pyx_RaiseUnboundLocalError("temp"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely(!__pyx_v_exchanges_weight.memview)) { __Pyx_RaiseUnboundLocalError("exchanges_weight"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely(!__pyx_v_x.memview)) { __Pyx_RaiseUnboundLocalError("x"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely(!__pyx_v_y.memview)) { __Pyx_RaiseUnboundLocalError("y"); __PYX_ERR(0, 60, __pyx_L1_error) } __pyx_t_1 = PyFloat_FromDouble(__pyx_fuse_2__pyx_f_10sortedness_4wtau_4wtau_weigh(__pyx_v_offset, __pyx_v_length, __pyx_v_rank, __pyx_v_perm, __pyx_v_temp, __pyx_v_exchanges_weight, __pyx_v_x, __pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sortedness.wtau.wtau.__pyx_fuse_2weigh", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __PYX_XDEC_MEMVIEW(&__pyx_v_rank, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_perm, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_temp, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_exchanges_weight, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_x, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_y, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_13__pyx_fuse_3weigh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_1weigh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static __pyx_t_5numpy_float64_t __pyx_fuse_3__pyx_f_10sortedness_4wtau_4wtau_weigh(__pyx_t_5numpy_intp_t __pyx_v_offset, __pyx_t_5numpy_intp_t __pyx_v_length, __Pyx_memviewslice __pyx_v_rank, __Pyx_memviewslice __pyx_v_perm, __Pyx_memviewslice __pyx_v_temp, __Pyx_memviewslice __pyx_v_exchanges_weight, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y, CYTHON_UNUSED int __pyx_skip_dispatch) { __pyx_t_5numpy_intp_t __pyx_v_length0; __pyx_t_5numpy_intp_t __pyx_v_length1; __pyx_t_5numpy_intp_t __pyx_v_middle; __pyx_t_5numpy_intp_t __pyx_v_i; __pyx_t_5numpy_intp_t __pyx_v_j; __pyx_t_5numpy_intp_t __pyx_v_k; __pyx_t_5numpy_float64_t __pyx_v_weight; __pyx_t_5numpy_float64_t __pyx_v_residual; __pyx_t_5numpy_float64_t __pyx_r; /* … */ /* function exit code */ __pyx_L1_error:; __PYX_XDEC_MEMVIEW(&__pyx_t_8, 0); __PYX_XDEC_MEMVIEW(&__pyx_t_10, 0); __Pyx_WriteUnraisable("sortedness.wtau.wtau.weigh", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1); __pyx_r = 0; __pyx_L0:; return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_13__pyx_fuse_3weigh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_fuse_3__pyx_mdef_10sortedness_4wtau_4wtau_13__pyx_fuse_3weigh = {"__pyx_fuse_3weigh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10sortedness_4wtau_4wtau_13__pyx_fuse_3weigh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10sortedness_4wtau_4wtau_weigh}; static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_13__pyx_fuse_3weigh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { __pyx_t_5numpy_intp_t __pyx_v_offset; __pyx_t_5numpy_intp_t __pyx_v_length; __Pyx_memviewslice __pyx_v_rank = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_perm = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_temp = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_exchanges_weight = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_x = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_y = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fuse_3weigh (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_offset,&__pyx_n_s_length,&__pyx_n_s_rank,&__pyx_n_s_perm,&__pyx_n_s_temp,&__pyx_n_s_exchanges_weight,&__pyx_n_s_x,&__pyx_n_s_y,0}; PyObject* values[8] = {0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); CYTHON_FALLTHROUGH; case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offset)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_length)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_3weigh", 1, 8, 8, 1); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rank)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_3weigh", 1, 8, 8, 2); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_perm)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_3weigh", 1, 8, 8, 3); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_temp)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_3weigh", 1, 8, 8, 4); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exchanges_weight)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_3weigh", 1, 8, 8, 5); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_3weigh", 1, 8, 8, 6); __PYX_ERR(0, 60, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_3weigh", 1, 8, 8, 7); __PYX_ERR(0, 60, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fuse_3weigh") < 0)) __PYX_ERR(0, 60, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); values[7] = PyTuple_GET_ITEM(__pyx_args, 7); } __pyx_v_offset = __Pyx_PyInt_As_Py_intptr_t(values[0]); if (unlikely((__pyx_v_offset == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L3_error) __pyx_v_length = __Pyx_PyInt_As_Py_intptr_t(values[1]); if (unlikely((__pyx_v_length == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 61, __pyx_L3_error) __pyx_v_rank = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rank.memview)) __PYX_ERR(0, 62, __pyx_L3_error) __pyx_v_perm = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_perm.memview)) __PYX_ERR(0, 63, __pyx_L3_error) __pyx_v_temp = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_temp.memview)) __PYX_ERR(0, 64, __pyx_L3_error) __pyx_v_exchanges_weight = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_float64_t(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_exchanges_weight.memview)) __PYX_ERR(0, 65, __pyx_L3_error) __pyx_v_x = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_float64_t(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_x.memview)) __PYX_ERR(0, 66, __pyx_L3_error) __pyx_v_y = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_float64_t(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_y.memview)) __PYX_ERR(0, 67, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__pyx_fuse_3weigh", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 60, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("sortedness.wtau.wtau.__pyx_fuse_3weigh", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_10sortedness_4wtau_4wtau_12__pyx_fuse_3weigh(__pyx_self, __pyx_v_offset, __pyx_v_length, __pyx_v_rank, __pyx_v_perm, __pyx_v_temp, __pyx_v_exchanges_weight, __pyx_v_x, __pyx_v_y); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_10sortedness_4wtau_4wtau_12__pyx_fuse_3weigh(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_intp_t __pyx_v_offset, __pyx_t_5numpy_intp_t __pyx_v_length, __Pyx_memviewslice __pyx_v_rank, __Pyx_memviewslice __pyx_v_perm, __Pyx_memviewslice __pyx_v_temp, __Pyx_memviewslice __pyx_v_exchanges_weight, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fuse_3weigh", 0); __Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_v_rank.memview)) { __Pyx_RaiseUnboundLocalError("rank"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely(!__pyx_v_perm.memview)) { __Pyx_RaiseUnboundLocalError("perm"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely(!__pyx_v_temp.memview)) { __Pyx_RaiseUnboundLocalError("temp"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely(!__pyx_v_exchanges_weight.memview)) { __Pyx_RaiseUnboundLocalError("exchanges_weight"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely(!__pyx_v_x.memview)) { __Pyx_RaiseUnboundLocalError("x"); __PYX_ERR(0, 60, __pyx_L1_error) } if (unlikely(!__pyx_v_y.memview)) { __Pyx_RaiseUnboundLocalError("y"); __PYX_ERR(0, 60, __pyx_L1_error) } __pyx_t_1 = PyFloat_FromDouble(__pyx_fuse_3__pyx_f_10sortedness_4wtau_4wtau_weigh(__pyx_v_offset, __pyx_v_length, __pyx_v_rank, __pyx_v_perm, __pyx_v_temp, __pyx_v_exchanges_weight, __pyx_v_x, __pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sortedness.wtau.wtau.__pyx_fuse_3weigh", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __PYX_XDEC_MEMVIEW(&__pyx_v_rank, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_perm, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_temp, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_exchanges_weight, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_x, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_y, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_Function_call_with_ambiguous_arg); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); /* … */ __pyx_tuple__26 = PyTuple_Pack(8, __pyx_n_s_offset, __pyx_n_s_length, __pyx_n_s_rank, __pyx_n_s_perm, __pyx_n_s_temp, __pyx_n_s_exchanges_weight, __pyx_n_s_x, __pyx_n_s_y); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__26); __Pyx_GIVEREF(__pyx_tuple__26); /* … */ __pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_FusedFunction_New(&__pyx_fuse_0__pyx_mdef_10sortedness_4wtau_4wtau_7__pyx_fuse_0weigh, 0, __pyx_n_s_pyx_fuse_0weigh, NULL, __pyx_n_s_sortedness_wtau_wtau, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_empty_tuple); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_int32_t, __pyx_t_3) < 0) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __pyx_FusedFunction_New(&__pyx_fuse_1__pyx_mdef_10sortedness_4wtau_4wtau_9__pyx_fuse_1weigh, 0, __pyx_n_s_pyx_fuse_1weigh, NULL, __pyx_n_s_sortedness_wtau_wtau, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_empty_tuple); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_int64_t, __pyx_t_3) < 0) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __pyx_FusedFunction_New(&__pyx_fuse_2__pyx_mdef_10sortedness_4wtau_4wtau_11__pyx_fuse_2weigh, 0, __pyx_n_s_pyx_fuse_2weigh, NULL, __pyx_n_s_sortedness_wtau_wtau, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_empty_tuple); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_float32_t, __pyx_t_3) < 0) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __pyx_FusedFunction_New(&__pyx_fuse_3__pyx_mdef_10sortedness_4wtau_4wtau_13__pyx_fuse_3weigh, 0, __pyx_n_s_pyx_fuse_3weigh, NULL, __pyx_n_s_sortedness_wtau_wtau, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_empty_tuple); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_float64_t, __pyx_t_3) < 0) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __pyx_FusedFunction_New(&__pyx_mdef_10sortedness_4wtau_4wtau_1weigh, 0, __pyx_n_s_weigh, NULL, __pyx_n_s_sortedness_wtau_wtau, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_empty_tuple); ((__pyx_FusedFunctionObject *) __pyx_t_3)->__signatures__ = __pyx_t_1; __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_weigh, __pyx_t_3) < 0) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(8, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_sortedness_wtau_wtau_pyx, __pyx_n_s_pyx_fuse_0weigh, 60, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 60, __pyx_L1_error)
061: intp_t length,
062: intp_t[::1] rank,
063: intp_t[::1] perm,
064: intp_t[::1] temp,
065: float64_t[::1] exchanges_weight,
066: ordered[::1] x,
067: ordered[::1] y
068: ) nogil:
069: cdef intp_t length0, length1, middle, i, j, k
070: cdef float64_t weight, residual
071:
+072: if length == 1:
__pyx_t_1 = ((__pyx_v_length == 1) != 0); if (__pyx_t_1) { /* … */ } /* … */ __pyx_t_1 = ((__pyx_v_length == 1) != 0); if (__pyx_t_1) { /* … */ } /* … */ __pyx_t_1 = ((__pyx_v_length == 1) != 0); if (__pyx_t_1) { /* … */ } /* … */ __pyx_t_1 = ((__pyx_v_length == 1) != 0); if (__pyx_t_1) { /* … */ }
+073: return 1./(1 + rank[perm[offset]])
__pyx_t_2 = __pyx_v_offset; __pyx_t_3 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_2)) ))); __pyx_t_4 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_3)) )))); if (unlikely(__pyx_t_4 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 73, __pyx_L1_error) } __pyx_r = (1. / ((double)__pyx_t_4)); goto __pyx_L0; /* … */ __pyx_t_2 = __pyx_v_offset; __pyx_t_3 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_2)) ))); __pyx_t_4 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_3)) )))); if (unlikely(__pyx_t_4 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 73, __pyx_L1_error) } __pyx_r = (1. / ((double)__pyx_t_4)); goto __pyx_L0; /* … */ __pyx_t_2 = __pyx_v_offset; __pyx_t_3 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_2)) ))); __pyx_t_4 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_3)) )))); if (unlikely(__pyx_t_4 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 73, __pyx_L1_error) } __pyx_r = (1. / ((double)__pyx_t_4)); goto __pyx_L0; /* … */ __pyx_t_2 = __pyx_v_offset; __pyx_t_3 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_2)) ))); __pyx_t_4 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_3)) )))); if (unlikely(__pyx_t_4 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 73, __pyx_L1_error) } __pyx_r = (1. / ((double)__pyx_t_4)); goto __pyx_L0;
+074: length0 = length // 2
__pyx_v_length0 = __Pyx_div_long(__pyx_v_length, 2); /* … */ __pyx_v_length0 = __Pyx_div_long(__pyx_v_length, 2); /* … */ __pyx_v_length0 = __Pyx_div_long(__pyx_v_length, 2); /* … */ __pyx_v_length0 = __Pyx_div_long(__pyx_v_length, 2);
+075: length1 = length - length0
__pyx_v_length1 = (__pyx_v_length - __pyx_v_length0); /* … */ __pyx_v_length1 = (__pyx_v_length - __pyx_v_length0); /* … */ __pyx_v_length1 = (__pyx_v_length - __pyx_v_length0); /* … */ __pyx_v_length1 = (__pyx_v_length - __pyx_v_length0);
+076: middle = offset + length0
__pyx_v_middle = (__pyx_v_offset + __pyx_v_length0); /* … */ __pyx_v_middle = (__pyx_v_offset + __pyx_v_length0); /* … */ __pyx_v_middle = (__pyx_v_offset + __pyx_v_length0); /* … */ __pyx_v_middle = (__pyx_v_offset + __pyx_v_length0);
+077: residual = weigh(offset, length0, rank, perm, temp, exchanges_weight, x, y)
__pyx_v_residual = __pyx_fuse_0__pyx_f_10sortedness_4wtau_4wtau_weigh(__pyx_v_offset, __pyx_v_length0, __pyx_v_rank, __pyx_v_perm, __pyx_v_temp, __pyx_v_exchanges_weight, __pyx_v_x, __pyx_v_y, 0); /* … */ __pyx_v_residual = __pyx_fuse_1__pyx_f_10sortedness_4wtau_4wtau_weigh(__pyx_v_offset, __pyx_v_length0, __pyx_v_rank, __pyx_v_perm, __pyx_v_temp, __pyx_v_exchanges_weight, __pyx_v_x, __pyx_v_y, 0); /* … */ __pyx_v_residual = __pyx_fuse_2__pyx_f_10sortedness_4wtau_4wtau_weigh(__pyx_v_offset, __pyx_v_length0, __pyx_v_rank, __pyx_v_perm, __pyx_v_temp, __pyx_v_exchanges_weight, __pyx_v_x, __pyx_v_y, 0); /* … */ __pyx_v_residual = __pyx_fuse_3__pyx_f_10sortedness_4wtau_4wtau_weigh(__pyx_v_offset, __pyx_v_length0, __pyx_v_rank, __pyx_v_perm, __pyx_v_temp, __pyx_v_exchanges_weight, __pyx_v_x, __pyx_v_y, 0);
+078: weight = weigh(middle, length1, rank, perm, temp, exchanges_weight, x, y) + residual
__pyx_v_weight = (__pyx_fuse_0__pyx_f_10sortedness_4wtau_4wtau_weigh(__pyx_v_middle, __pyx_v_length1, __pyx_v_rank, __pyx_v_perm, __pyx_v_temp, __pyx_v_exchanges_weight, __pyx_v_x, __pyx_v_y, 0) + __pyx_v_residual); /* … */ __pyx_v_weight = (__pyx_fuse_1__pyx_f_10sortedness_4wtau_4wtau_weigh(__pyx_v_middle, __pyx_v_length1, __pyx_v_rank, __pyx_v_perm, __pyx_v_temp, __pyx_v_exchanges_weight, __pyx_v_x, __pyx_v_y, 0) + __pyx_v_residual); /* … */ __pyx_v_weight = (__pyx_fuse_2__pyx_f_10sortedness_4wtau_4wtau_weigh(__pyx_v_middle, __pyx_v_length1, __pyx_v_rank, __pyx_v_perm, __pyx_v_temp, __pyx_v_exchanges_weight, __pyx_v_x, __pyx_v_y, 0) + __pyx_v_residual); /* … */ __pyx_v_weight = (__pyx_fuse_3__pyx_f_10sortedness_4wtau_4wtau_weigh(__pyx_v_middle, __pyx_v_length1, __pyx_v_rank, __pyx_v_perm, __pyx_v_temp, __pyx_v_exchanges_weight, __pyx_v_x, __pyx_v_y, 0) + __pyx_v_residual);
+079: if y[perm[middle - 1]] < y[perm[middle]]:
__pyx_t_2 = (__pyx_v_middle - 1); __pyx_t_3 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_2)) ))); __pyx_t_5 = __pyx_v_middle; __pyx_t_6 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_5)) ))); __pyx_t_1 = (((*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int32_t *) __pyx_v_y.data) + __pyx_t_3)) ))) < (*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int32_t *) __pyx_v_y.data) + __pyx_t_6)) )))) != 0); if (__pyx_t_1) { /* … */ } /* … */ __pyx_t_2 = (__pyx_v_middle - 1); __pyx_t_3 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_2)) ))); __pyx_t_5 = __pyx_v_middle; __pyx_t_6 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_5)) ))); __pyx_t_1 = (((*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int64_t *) __pyx_v_y.data) + __pyx_t_3)) ))) < (*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int64_t *) __pyx_v_y.data) + __pyx_t_6)) )))) != 0); if (__pyx_t_1) { /* … */ } /* … */ __pyx_t_2 = (__pyx_v_middle - 1); __pyx_t_3 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_2)) ))); __pyx_t_5 = __pyx_v_middle; __pyx_t_6 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_5)) ))); __pyx_t_1 = (((*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float32_t *) __pyx_v_y.data) + __pyx_t_3)) ))) < (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float32_t *) __pyx_v_y.data) + __pyx_t_6)) )))) != 0); if (__pyx_t_1) { /* … */ } /* … */ __pyx_t_2 = (__pyx_v_middle - 1); __pyx_t_3 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_2)) ))); __pyx_t_5 = __pyx_v_middle; __pyx_t_6 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_5)) ))); __pyx_t_1 = (((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_y.data) + __pyx_t_3)) ))) < (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_y.data) + __pyx_t_6)) )))) != 0); if (__pyx_t_1) { /* … */ }
+080: return weight
__pyx_r = __pyx_v_weight; goto __pyx_L0; /* … */ __pyx_r = __pyx_v_weight; goto __pyx_L0; /* … */ __pyx_r = __pyx_v_weight; goto __pyx_L0; /* … */ __pyx_r = __pyx_v_weight; goto __pyx_L0;
081:
082: # merging
+083: i = j = k = 0
__pyx_v_i = 0; __pyx_v_j = 0; __pyx_v_k = 0; /* … */ __pyx_v_i = 0; __pyx_v_j = 0; __pyx_v_k = 0; /* … */ __pyx_v_i = 0; __pyx_v_j = 0; __pyx_v_k = 0; /* … */ __pyx_v_i = 0; __pyx_v_j = 0; __pyx_v_k = 0;
084:
+085: while j < length0 and k < length1:
while (1) { __pyx_t_7 = ((__pyx_v_j < __pyx_v_length0) != 0); if (__pyx_t_7) { } else { __pyx_t_1 = __pyx_t_7; goto __pyx_L7_bool_binop_done; } __pyx_t_7 = ((__pyx_v_k < __pyx_v_length1) != 0); __pyx_t_1 = __pyx_t_7; __pyx_L7_bool_binop_done:; if (!__pyx_t_1) break; /* … */ while (1) { __pyx_t_7 = ((__pyx_v_j < __pyx_v_length0) != 0); if (__pyx_t_7) { } else { __pyx_t_1 = __pyx_t_7; goto __pyx_L7_bool_binop_done; } __pyx_t_7 = ((__pyx_v_k < __pyx_v_length1) != 0); __pyx_t_1 = __pyx_t_7; __pyx_L7_bool_binop_done:; if (!__pyx_t_1) break; /* … */ while (1) { __pyx_t_7 = ((__pyx_v_j < __pyx_v_length0) != 0); if (__pyx_t_7) { } else { __pyx_t_1 = __pyx_t_7; goto __pyx_L7_bool_binop_done; } __pyx_t_7 = ((__pyx_v_k < __pyx_v_length1) != 0); __pyx_t_1 = __pyx_t_7; __pyx_L7_bool_binop_done:; if (!__pyx_t_1) break; /* … */ while (1) { __pyx_t_7 = ((__pyx_v_j < __pyx_v_length0) != 0); if (__pyx_t_7) { } else { __pyx_t_1 = __pyx_t_7; goto __pyx_L7_bool_binop_done; } __pyx_t_7 = ((__pyx_v_k < __pyx_v_length1) != 0); __pyx_t_1 = __pyx_t_7; __pyx_L7_bool_binop_done:; if (!__pyx_t_1) break;
+086: if y[perm[offset + j]] <= y[perm[middle + k]]:
__pyx_t_5 = (__pyx_v_offset + __pyx_v_j); __pyx_t_6 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_5)) ))); __pyx_t_2 = (__pyx_v_middle + __pyx_v_k); __pyx_t_3 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_2)) ))); __pyx_t_1 = (((*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int32_t *) __pyx_v_y.data) + __pyx_t_6)) ))) <= (*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int32_t *) __pyx_v_y.data) + __pyx_t_3)) )))) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L9; } /* … */ __pyx_t_5 = (__pyx_v_offset + __pyx_v_j); __pyx_t_6 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_5)) ))); __pyx_t_2 = (__pyx_v_middle + __pyx_v_k); __pyx_t_3 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_2)) ))); __pyx_t_1 = (((*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int64_t *) __pyx_v_y.data) + __pyx_t_6)) ))) <= (*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int64_t *) __pyx_v_y.data) + __pyx_t_3)) )))) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L9; } /* … */ __pyx_t_5 = (__pyx_v_offset + __pyx_v_j); __pyx_t_6 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_5)) ))); __pyx_t_2 = (__pyx_v_middle + __pyx_v_k); __pyx_t_3 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_2)) ))); __pyx_t_1 = (((*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float32_t *) __pyx_v_y.data) + __pyx_t_6)) ))) <= (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float32_t *) __pyx_v_y.data) + __pyx_t_3)) )))) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L9; } /* … */ __pyx_t_5 = (__pyx_v_offset + __pyx_v_j); __pyx_t_6 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_5)) ))); __pyx_t_2 = (__pyx_v_middle + __pyx_v_k); __pyx_t_3 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_2)) ))); __pyx_t_1 = (((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_y.data) + __pyx_t_6)) ))) <= (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_y.data) + __pyx_t_3)) )))) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L9; }
+087: temp[i] = perm[offset + j]
__pyx_t_2 = (__pyx_v_offset + __pyx_v_j); __pyx_t_3 = __pyx_v_i; *((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_temp.data) + __pyx_t_3)) )) = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_2)) ))); /* … */ __pyx_t_2 = (__pyx_v_offset + __pyx_v_j); __pyx_t_3 = __pyx_v_i; *((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_temp.data) + __pyx_t_3)) )) = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_2)) ))); /* … */ __pyx_t_2 = (__pyx_v_offset + __pyx_v_j); __pyx_t_3 = __pyx_v_i; *((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_temp.data) + __pyx_t_3)) )) = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_2)) ))); /* … */ __pyx_t_2 = (__pyx_v_offset + __pyx_v_j); __pyx_t_3 = __pyx_v_i; *((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_temp.data) + __pyx_t_3)) )) = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_2)) )));
+088: residual -= 1./(1 + rank[temp[i]])
__pyx_t_2 = __pyx_v_i; __pyx_t_3 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_temp.data) + __pyx_t_2)) ))); __pyx_t_4 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_3)) )))); if (unlikely(__pyx_t_4 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 88, __pyx_L1_error) } __pyx_v_residual = (__pyx_v_residual - (1. / ((double)__pyx_t_4))); /* … */ __pyx_t_2 = __pyx_v_i; __pyx_t_3 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_temp.data) + __pyx_t_2)) ))); __pyx_t_4 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_3)) )))); if (unlikely(__pyx_t_4 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 88, __pyx_L1_error) } __pyx_v_residual = (__pyx_v_residual - (1. / ((double)__pyx_t_4))); /* … */ __pyx_t_2 = __pyx_v_i; __pyx_t_3 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_temp.data) + __pyx_t_2)) ))); __pyx_t_4 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_3)) )))); if (unlikely(__pyx_t_4 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 88, __pyx_L1_error) } __pyx_v_residual = (__pyx_v_residual - (1. / ((double)__pyx_t_4))); /* … */ __pyx_t_2 = __pyx_v_i; __pyx_t_3 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_temp.data) + __pyx_t_2)) ))); __pyx_t_4 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_3)) )))); if (unlikely(__pyx_t_4 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 88, __pyx_L1_error) } __pyx_v_residual = (__pyx_v_residual - (1. / ((double)__pyx_t_4)));
+089: j += 1
__pyx_v_j = (__pyx_v_j + 1); /* … */ __pyx_v_j = (__pyx_v_j + 1); /* … */ __pyx_v_j = (__pyx_v_j + 1); /* … */ __pyx_v_j = (__pyx_v_j + 1);
090: else:
+091: temp[i] = perm[middle + k]
/*else*/ { __pyx_t_2 = (__pyx_v_middle + __pyx_v_k); __pyx_t_3 = __pyx_v_i; *((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_temp.data) + __pyx_t_3)) )) = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_2)) ))); /* … */ /*else*/ { __pyx_t_2 = (__pyx_v_middle + __pyx_v_k); __pyx_t_3 = __pyx_v_i; *((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_temp.data) + __pyx_t_3)) )) = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_2)) ))); /* … */ /*else*/ { __pyx_t_2 = (__pyx_v_middle + __pyx_v_k); __pyx_t_3 = __pyx_v_i; *((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_temp.data) + __pyx_t_3)) )) = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_2)) ))); /* … */ /*else*/ { __pyx_t_2 = (__pyx_v_middle + __pyx_v_k); __pyx_t_3 = __pyx_v_i; *((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_temp.data) + __pyx_t_3)) )) = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_2)) )));
+092: exchanges_weight[0] += 1./(1 + rank[temp[i]]) * (length0 - j) + residual
__pyx_t_2 = __pyx_v_i; __pyx_t_3 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_temp.data) + __pyx_t_2)) ))); __pyx_t_4 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_3)) )))); if (unlikely(__pyx_t_4 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 92, __pyx_L1_error) } __pyx_t_2 = 0; *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_exchanges_weight.data) + __pyx_t_2)) )) += (((1. / ((double)__pyx_t_4)) * (__pyx_v_length0 - __pyx_v_j)) + __pyx_v_residual); /* … */ __pyx_t_2 = __pyx_v_i; __pyx_t_3 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_temp.data) + __pyx_t_2)) ))); __pyx_t_4 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_3)) )))); if (unlikely(__pyx_t_4 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 92, __pyx_L1_error) } __pyx_t_2 = 0; *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_exchanges_weight.data) + __pyx_t_2)) )) += (((1. / ((double)__pyx_t_4)) * (__pyx_v_length0 - __pyx_v_j)) + __pyx_v_residual); /* … */ __pyx_t_2 = __pyx_v_i; __pyx_t_3 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_temp.data) + __pyx_t_2)) ))); __pyx_t_4 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_3)) )))); if (unlikely(__pyx_t_4 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 92, __pyx_L1_error) } __pyx_t_2 = 0; *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_exchanges_weight.data) + __pyx_t_2)) )) += (((1. / ((double)__pyx_t_4)) * (__pyx_v_length0 - __pyx_v_j)) + __pyx_v_residual); /* … */ __pyx_t_2 = __pyx_v_i; __pyx_t_3 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_temp.data) + __pyx_t_2)) ))); __pyx_t_4 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_3)) )))); if (unlikely(__pyx_t_4 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 92, __pyx_L1_error) } __pyx_t_2 = 0; *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_exchanges_weight.data) + __pyx_t_2)) )) += (((1. / ((double)__pyx_t_4)) * (__pyx_v_length0 - __pyx_v_j)) + __pyx_v_residual);
+093: k += 1
__pyx_v_k = (__pyx_v_k + 1); } __pyx_L9:; /* … */ __pyx_v_k = (__pyx_v_k + 1); } __pyx_L9:; /* … */ __pyx_v_k = (__pyx_v_k + 1); } __pyx_L9:; /* … */ __pyx_v_k = (__pyx_v_k + 1); } __pyx_L9:;
+094: i += 1
__pyx_v_i = (__pyx_v_i + 1); } /* … */ __pyx_v_i = (__pyx_v_i + 1); } /* … */ __pyx_v_i = (__pyx_v_i + 1); } /* … */ __pyx_v_i = (__pyx_v_i + 1); }
095:
+096: perm[offset+i:offset+i+length0-j] = perm[offset+j:offset+length0]
__pyx_t_8.data = __pyx_v_perm.data; __pyx_t_8.memview = __pyx_v_perm.memview; __PYX_INC_MEMVIEW(&__pyx_t_8, 0); __pyx_t_9 = -1; if (unlikely(__pyx_memoryview_slice_memviewslice( &__pyx_t_8, __pyx_v_perm.shape[0], __pyx_v_perm.strides[0], __pyx_v_perm.suboffsets[0], 0, 0, &__pyx_t_9, (__pyx_v_offset + __pyx_v_j), (__pyx_v_offset + __pyx_v_length0), 0, 1, 1, 0, 1) < 0)) { __PYX_ERR(0, 96, __pyx_L1_error) } __pyx_t_10.data = __pyx_v_perm.data; __pyx_t_10.memview = __pyx_v_perm.memview; __PYX_INC_MEMVIEW(&__pyx_t_10, 0); __pyx_t_9 = -1; if (unlikely(__pyx_memoryview_slice_memviewslice( &__pyx_t_10, __pyx_v_perm.shape[0], __pyx_v_perm.strides[0], __pyx_v_perm.suboffsets[0], 0, 0, &__pyx_t_9, (__pyx_v_offset + __pyx_v_i), (((__pyx_v_offset + __pyx_v_i) + __pyx_v_length0) - __pyx_v_j), 0, 1, 1, 0, 1) < 0)) { __PYX_ERR(0, 96, __pyx_L1_error) } if (unlikely(__pyx_memoryview_copy_contents(__pyx_t_8, __pyx_t_10, 1, 1, 0) < 0)) __PYX_ERR(0, 96, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_t_10, 0); __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL; __PYX_XDEC_MEMVIEW(&__pyx_t_8, 0); __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL; /* … */ __pyx_t_8.data = __pyx_v_perm.data; __pyx_t_8.memview = __pyx_v_perm.memview; __PYX_INC_MEMVIEW(&__pyx_t_8, 0); __pyx_t_9 = -1; if (unlikely(__pyx_memoryview_slice_memviewslice( &__pyx_t_8, __pyx_v_perm.shape[0], __pyx_v_perm.strides[0], __pyx_v_perm.suboffsets[0], 0, 0, &__pyx_t_9, (__pyx_v_offset + __pyx_v_j), (__pyx_v_offset + __pyx_v_length0), 0, 1, 1, 0, 1) < 0)) { __PYX_ERR(0, 96, __pyx_L1_error) } __pyx_t_10.data = __pyx_v_perm.data; __pyx_t_10.memview = __pyx_v_perm.memview; __PYX_INC_MEMVIEW(&__pyx_t_10, 0); __pyx_t_9 = -1; if (unlikely(__pyx_memoryview_slice_memviewslice( &__pyx_t_10, __pyx_v_perm.shape[0], __pyx_v_perm.strides[0], __pyx_v_perm.suboffsets[0], 0, 0, &__pyx_t_9, (__pyx_v_offset + __pyx_v_i), (((__pyx_v_offset + __pyx_v_i) + __pyx_v_length0) - __pyx_v_j), 0, 1, 1, 0, 1) < 0)) { __PYX_ERR(0, 96, __pyx_L1_error) } if (unlikely(__pyx_memoryview_copy_contents(__pyx_t_8, __pyx_t_10, 1, 1, 0) < 0)) __PYX_ERR(0, 96, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_t_10, 0); __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL; __PYX_XDEC_MEMVIEW(&__pyx_t_8, 0); __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL; /* … */ __pyx_t_8.data = __pyx_v_perm.data; __pyx_t_8.memview = __pyx_v_perm.memview; __PYX_INC_MEMVIEW(&__pyx_t_8, 0); __pyx_t_9 = -1; if (unlikely(__pyx_memoryview_slice_memviewslice( &__pyx_t_8, __pyx_v_perm.shape[0], __pyx_v_perm.strides[0], __pyx_v_perm.suboffsets[0], 0, 0, &__pyx_t_9, (__pyx_v_offset + __pyx_v_j), (__pyx_v_offset + __pyx_v_length0), 0, 1, 1, 0, 1) < 0)) { __PYX_ERR(0, 96, __pyx_L1_error) } __pyx_t_10.data = __pyx_v_perm.data; __pyx_t_10.memview = __pyx_v_perm.memview; __PYX_INC_MEMVIEW(&__pyx_t_10, 0); __pyx_t_9 = -1; if (unlikely(__pyx_memoryview_slice_memviewslice( &__pyx_t_10, __pyx_v_perm.shape[0], __pyx_v_perm.strides[0], __pyx_v_perm.suboffsets[0], 0, 0, &__pyx_t_9, (__pyx_v_offset + __pyx_v_i), (((__pyx_v_offset + __pyx_v_i) + __pyx_v_length0) - __pyx_v_j), 0, 1, 1, 0, 1) < 0)) { __PYX_ERR(0, 96, __pyx_L1_error) } if (unlikely(__pyx_memoryview_copy_contents(__pyx_t_8, __pyx_t_10, 1, 1, 0) < 0)) __PYX_ERR(0, 96, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_t_10, 0); __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL; __PYX_XDEC_MEMVIEW(&__pyx_t_8, 0); __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL; /* … */ __pyx_t_8.data = __pyx_v_perm.data; __pyx_t_8.memview = __pyx_v_perm.memview; __PYX_INC_MEMVIEW(&__pyx_t_8, 0); __pyx_t_9 = -1; if (unlikely(__pyx_memoryview_slice_memviewslice( &__pyx_t_8, __pyx_v_perm.shape[0], __pyx_v_perm.strides[0], __pyx_v_perm.suboffsets[0], 0, 0, &__pyx_t_9, (__pyx_v_offset + __pyx_v_j), (__pyx_v_offset + __pyx_v_length0), 0, 1, 1, 0, 1) < 0)) { __PYX_ERR(0, 96, __pyx_L1_error) } __pyx_t_10.data = __pyx_v_perm.data; __pyx_t_10.memview = __pyx_v_perm.memview; __PYX_INC_MEMVIEW(&__pyx_t_10, 0); __pyx_t_9 = -1; if (unlikely(__pyx_memoryview_slice_memviewslice( &__pyx_t_10, __pyx_v_perm.shape[0], __pyx_v_perm.strides[0], __pyx_v_perm.suboffsets[0], 0, 0, &__pyx_t_9, (__pyx_v_offset + __pyx_v_i), (((__pyx_v_offset + __pyx_v_i) + __pyx_v_length0) - __pyx_v_j), 0, 1, 1, 0, 1) < 0)) { __PYX_ERR(0, 96, __pyx_L1_error) } if (unlikely(__pyx_memoryview_copy_contents(__pyx_t_8, __pyx_t_10, 1, 1, 0) < 0)) __PYX_ERR(0, 96, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_t_10, 0); __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL; __PYX_XDEC_MEMVIEW(&__pyx_t_8, 0); __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL;
+097: perm[offset:offset+i] = temp[0:i]
__pyx_t_8.data = __pyx_v_temp.data; __pyx_t_8.memview = __pyx_v_temp.memview; __PYX_INC_MEMVIEW(&__pyx_t_8, 0); __pyx_t_9 = -1; if (unlikely(__pyx_memoryview_slice_memviewslice( &__pyx_t_8, __pyx_v_temp.shape[0], __pyx_v_temp.strides[0], __pyx_v_temp.suboffsets[0], 0, 0, &__pyx_t_9, 0, __pyx_v_i, 0, 1, 1, 0, 1) < 0)) { __PYX_ERR(0, 97, __pyx_L1_error) } __pyx_t_10.data = __pyx_v_perm.data; __pyx_t_10.memview = __pyx_v_perm.memview; __PYX_INC_MEMVIEW(&__pyx_t_10, 0); __pyx_t_9 = -1; if (unlikely(__pyx_memoryview_slice_memviewslice( &__pyx_t_10, __pyx_v_perm.shape[0], __pyx_v_perm.strides[0], __pyx_v_perm.suboffsets[0], 0, 0, &__pyx_t_9, __pyx_v_offset, (__pyx_v_offset + __pyx_v_i), 0, 1, 1, 0, 1) < 0)) { __PYX_ERR(0, 97, __pyx_L1_error) } if (unlikely(__pyx_memoryview_copy_contents(__pyx_t_8, __pyx_t_10, 1, 1, 0) < 0)) __PYX_ERR(0, 97, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_t_10, 0); __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL; __PYX_XDEC_MEMVIEW(&__pyx_t_8, 0); __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL; /* … */ __pyx_t_8.data = __pyx_v_temp.data; __pyx_t_8.memview = __pyx_v_temp.memview; __PYX_INC_MEMVIEW(&__pyx_t_8, 0); __pyx_t_9 = -1; if (unlikely(__pyx_memoryview_slice_memviewslice( &__pyx_t_8, __pyx_v_temp.shape[0], __pyx_v_temp.strides[0], __pyx_v_temp.suboffsets[0], 0, 0, &__pyx_t_9, 0, __pyx_v_i, 0, 1, 1, 0, 1) < 0)) { __PYX_ERR(0, 97, __pyx_L1_error) } __pyx_t_10.data = __pyx_v_perm.data; __pyx_t_10.memview = __pyx_v_perm.memview; __PYX_INC_MEMVIEW(&__pyx_t_10, 0); __pyx_t_9 = -1; if (unlikely(__pyx_memoryview_slice_memviewslice( &__pyx_t_10, __pyx_v_perm.shape[0], __pyx_v_perm.strides[0], __pyx_v_perm.suboffsets[0], 0, 0, &__pyx_t_9, __pyx_v_offset, (__pyx_v_offset + __pyx_v_i), 0, 1, 1, 0, 1) < 0)) { __PYX_ERR(0, 97, __pyx_L1_error) } if (unlikely(__pyx_memoryview_copy_contents(__pyx_t_8, __pyx_t_10, 1, 1, 0) < 0)) __PYX_ERR(0, 97, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_t_10, 0); __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL; __PYX_XDEC_MEMVIEW(&__pyx_t_8, 0); __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL; /* … */ __pyx_t_8.data = __pyx_v_temp.data; __pyx_t_8.memview = __pyx_v_temp.memview; __PYX_INC_MEMVIEW(&__pyx_t_8, 0); __pyx_t_9 = -1; if (unlikely(__pyx_memoryview_slice_memviewslice( &__pyx_t_8, __pyx_v_temp.shape[0], __pyx_v_temp.strides[0], __pyx_v_temp.suboffsets[0], 0, 0, &__pyx_t_9, 0, __pyx_v_i, 0, 1, 1, 0, 1) < 0)) { __PYX_ERR(0, 97, __pyx_L1_error) } __pyx_t_10.data = __pyx_v_perm.data; __pyx_t_10.memview = __pyx_v_perm.memview; __PYX_INC_MEMVIEW(&__pyx_t_10, 0); __pyx_t_9 = -1; if (unlikely(__pyx_memoryview_slice_memviewslice( &__pyx_t_10, __pyx_v_perm.shape[0], __pyx_v_perm.strides[0], __pyx_v_perm.suboffsets[0], 0, 0, &__pyx_t_9, __pyx_v_offset, (__pyx_v_offset + __pyx_v_i), 0, 1, 1, 0, 1) < 0)) { __PYX_ERR(0, 97, __pyx_L1_error) } if (unlikely(__pyx_memoryview_copy_contents(__pyx_t_8, __pyx_t_10, 1, 1, 0) < 0)) __PYX_ERR(0, 97, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_t_10, 0); __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL; __PYX_XDEC_MEMVIEW(&__pyx_t_8, 0); __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL; /* … */ __pyx_t_8.data = __pyx_v_temp.data; __pyx_t_8.memview = __pyx_v_temp.memview; __PYX_INC_MEMVIEW(&__pyx_t_8, 0); __pyx_t_9 = -1; if (unlikely(__pyx_memoryview_slice_memviewslice( &__pyx_t_8, __pyx_v_temp.shape[0], __pyx_v_temp.strides[0], __pyx_v_temp.suboffsets[0], 0, 0, &__pyx_t_9, 0, __pyx_v_i, 0, 1, 1, 0, 1) < 0)) { __PYX_ERR(0, 97, __pyx_L1_error) } __pyx_t_10.data = __pyx_v_perm.data; __pyx_t_10.memview = __pyx_v_perm.memview; __PYX_INC_MEMVIEW(&__pyx_t_10, 0); __pyx_t_9 = -1; if (unlikely(__pyx_memoryview_slice_memviewslice( &__pyx_t_10, __pyx_v_perm.shape[0], __pyx_v_perm.strides[0], __pyx_v_perm.suboffsets[0], 0, 0, &__pyx_t_9, __pyx_v_offset, (__pyx_v_offset + __pyx_v_i), 0, 1, 1, 0, 1) < 0)) { __PYX_ERR(0, 97, __pyx_L1_error) } if (unlikely(__pyx_memoryview_copy_contents(__pyx_t_8, __pyx_t_10, 1, 1, 0) < 0)) __PYX_ERR(0, 97, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_t_10, 0); __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL; __PYX_XDEC_MEMVIEW(&__pyx_t_8, 0); __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL;
+098: return weight
__pyx_r = __pyx_v_weight; goto __pyx_L0; /* … */ __pyx_r = __pyx_v_weight; goto __pyx_L0; /* … */ __pyx_r = __pyx_v_weight; goto __pyx_L0; /* … */ __pyx_r = __pyx_v_weight; goto __pyx_L0;
099:
100:
+101: cpdef float64_t _weightedrankedtau( ordered[::1] x, ordered[::1] y, intp_t[::1] rank,
/* Python wrapper */ static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_3_weightedrankedtau(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_10sortedness_4wtau_4wtau_2_weightedrankedtau[] = "_weightedrankedtau(signatures, args, kwargs, defaults)"; static PyMethodDef __pyx_mdef_10sortedness_4wtau_4wtau_3_weightedrankedtau = {"_weightedrankedtau", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10sortedness_4wtau_4wtau_3_weightedrankedtau, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10sortedness_4wtau_4wtau_2_weightedrankedtau}; static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_3_weightedrankedtau(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_signatures = 0; PyObject *__pyx_v_args = 0; PyObject *__pyx_v_kwargs = 0; CYTHON_UNUSED PyObject *__pyx_v_defaults = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fused_cpdef (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_signatures,&__pyx_n_s_args,&__pyx_n_s_kwargs,&__pyx_n_s_defaults,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_signatures)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 1); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 2); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_defaults)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 3); __PYX_ERR(0, 101, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fused_cpdef") < 0)) __PYX_ERR(0, 101, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_signatures = values[0]; __pyx_v_args = values[1]; __pyx_v_kwargs = values[2]; __pyx_v_defaults = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 101, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("sortedness.wtau.wtau.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_10sortedness_4wtau_4wtau_2_weightedrankedtau(__pyx_self, __pyx_v_signatures, __pyx_v_args, __pyx_v_kwargs, __pyx_v_defaults); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_10sortedness_4wtau_4wtau_2_weightedrankedtau(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults) { PyObject *__pyx_v_dest_sig = NULL; Py_ssize_t __pyx_v_i; PyTypeObject *__pyx_v_ndarray = 0; __Pyx_memviewslice __pyx_v_memslice; Py_ssize_t __pyx_v_itemsize; int __pyx_v_dtype_signed; char __pyx_v_kind; int __pyx_v____pyx_int32_t_is_signed; int __pyx_v____pyx_int64_t_is_signed; PyObject *__pyx_v_arg = NULL; PyObject *__pyx_v_dtype = NULL; PyObject *__pyx_v_arg_base = NULL; PyObject *__pyx_v_candidates = NULL; PyObject *__pyx_v_sig = NULL; int __pyx_v_match_found; PyObject *__pyx_v_src_sig = NULL; PyObject *__pyx_v_dst_type = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_weightedrankedtau", 0); __Pyx_INCREF(__pyx_v_kwargs); __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyList_SET_ITEM(__pyx_t_1, 0, Py_None); __pyx_v_dest_sig = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_v_kwargs != Py_None); __pyx_t_4 = (__pyx_t_3 != 0); if (__pyx_t_4) { } else { __pyx_t_2 = __pyx_t_4; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 101, __pyx_L1_error) __pyx_t_3 = ((!__pyx_t_4) != 0); __pyx_t_2 = __pyx_t_3; __pyx_L4_bool_binop_done:; if (__pyx_t_2) { __Pyx_INCREF(Py_None); __Pyx_DECREF_SET(__pyx_v_kwargs, Py_None); } __pyx_t_1 = ((PyObject *)__Pyx_ImportNumPyArrayTypeIfAvailable()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_ndarray = ((PyTypeObject*)__pyx_t_1); __pyx_t_1 = 0; __pyx_v_itemsize = -1L; __pyx_v____pyx_int32_t_is_signed = (!((((__pyx_t_5numpy_int32_t)-1L) > 0) != 0)); __pyx_v____pyx_int64_t_is_signed = (!((((__pyx_t_5numpy_int64_t)-1L) > 0) != 0)); if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); __PYX_ERR(0, 101, __pyx_L1_error) } __pyx_t_5 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 101, __pyx_L1_error) __pyx_t_2 = ((0 < __pyx_t_5) != 0); if (__pyx_t_2) { if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 101, __pyx_L1_error) } __pyx_t_1 = PyTuple_GET_ITEM(((PyObject*)__pyx_v_args), 0); __Pyx_INCREF(__pyx_t_1); __pyx_v_arg = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L6; } __pyx_t_3 = (__pyx_v_kwargs != Py_None); __pyx_t_4 = (__pyx_t_3 != 0); if (__pyx_t_4) { } else { __pyx_t_2 = __pyx_t_4; goto __pyx_L7_bool_binop_done; } if (unlikely(__pyx_v_kwargs == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(0, 101, __pyx_L1_error) } __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_x, ((PyObject*)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 101, __pyx_L1_error) __pyx_t_3 = (__pyx_t_4 != 0); __pyx_t_2 = __pyx_t_3; __pyx_L7_bool_binop_done:; if (__pyx_t_2) { if (unlikely(__pyx_v_kwargs == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 101, __pyx_L1_error) } __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_kwargs), __pyx_n_s_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_arg = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L6; } /*else*/ { if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); __PYX_ERR(0, 101, __pyx_L1_error) } __pyx_t_5 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 101, __pyx_L1_error) __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_int_7); __Pyx_GIVEREF(__pyx_int_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_7); __Pyx_INCREF(__pyx_n_s_s); __Pyx_GIVEREF(__pyx_n_s_s); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_s); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Expected_at_least_d_argument_s_g, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __PYX_ERR(0, 101, __pyx_L1_error) } __pyx_L6:; while (1) { __pyx_t_2 = (__pyx_v_ndarray != ((PyTypeObject*)Py_None)); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_arg, __pyx_v_ndarray); __pyx_t_2 = (__pyx_t_3 != 0); if (__pyx_t_2) { __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_dtype = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L12; } __pyx_t_2 = __pyx_memoryview_check(__pyx_v_arg); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_base); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_arg_base = __pyx_t_6; __pyx_t_6 = 0; __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_arg_base, __pyx_v_ndarray); __pyx_t_2 = (__pyx_t_3 != 0); if (__pyx_t_2) { __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg_base, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_dtype = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L13; } /*else*/ { __Pyx_INCREF(Py_None); __pyx_v_dtype = Py_None; } __pyx_L13:; goto __pyx_L12; } /*else*/ { __Pyx_INCREF(Py_None); __pyx_v_dtype = Py_None; } __pyx_L12:; __pyx_v_itemsize = -1L; __pyx_t_2 = (__pyx_v_dtype != Py_None); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_itemsize = __pyx_t_5; __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyObject_Ord(__pyx_t_6); if (unlikely(__pyx_t_7 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_kind = __pyx_t_7; __pyx_v_dtype_signed = (__pyx_v_kind == 'i'); switch (__pyx_v_kind) { case 'i': case 'u': __pyx_t_2 = (((sizeof(__pyx_t_5numpy_int32_t)) == __pyx_v_itemsize) != 0); if (__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L16_bool_binop_done; } __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 1) != 0); if (__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L16_bool_binop_done; } __pyx_t_2 = ((!((__pyx_v____pyx_int32_t_is_signed ^ __pyx_v_dtype_signed) != 0)) != 0); __pyx_t_3 = __pyx_t_2; __pyx_L16_bool_binop_done:; if (__pyx_t_3) { if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_int32_t, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 101, __pyx_L1_error) goto __pyx_L10_break; } __pyx_t_2 = (((sizeof(__pyx_t_5numpy_int64_t)) == __pyx_v_itemsize) != 0); if (__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L20_bool_binop_done; } __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 1) != 0); if (__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L20_bool_binop_done; } __pyx_t_2 = ((!((__pyx_v____pyx_int64_t_is_signed ^ __pyx_v_dtype_signed) != 0)) != 0); __pyx_t_3 = __pyx_t_2; __pyx_L20_bool_binop_done:; if (__pyx_t_3) { if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_int64_t, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 101, __pyx_L1_error) goto __pyx_L10_break; } break; case 'f': __pyx_t_2 = (((sizeof(__pyx_t_5numpy_float32_t)) == __pyx_v_itemsize) != 0); if (__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L24_bool_binop_done; } __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 1) != 0); __pyx_t_3 = __pyx_t_2; __pyx_L24_bool_binop_done:; if (__pyx_t_3) { if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float32_t, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 101, __pyx_L1_error) goto __pyx_L10_break; } __pyx_t_2 = (((sizeof(__pyx_t_5numpy_float64_t)) == __pyx_v_itemsize) != 0); if (__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L27_bool_binop_done; } __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 1) != 0); __pyx_t_3 = __pyx_t_2; __pyx_L27_bool_binop_done:; if (__pyx_t_3) { if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float64_t, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 101, __pyx_L1_error) goto __pyx_L10_break; } break; case 'c': break; case 'O': break; default: break; } } } __pyx_t_2 = ((__pyx_v_itemsize == -1L) != 0); if (!__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L30_bool_binop_done; } __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(__pyx_t_5numpy_int32_t))) != 0); __pyx_t_3 = __pyx_t_2; __pyx_L30_bool_binop_done:; if (__pyx_t_3) { __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_int32_t(__pyx_v_arg, 0); __pyx_v_memslice = __pyx_t_8; __pyx_t_3 = (__pyx_v_memslice.memview != 0); if (__pyx_t_3) { __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_int32_t, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 101, __pyx_L1_error) goto __pyx_L10_break; } /*else*/ { PyErr_Clear(); } } __pyx_t_2 = ((__pyx_v_itemsize == -1L) != 0); if (!__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L34_bool_binop_done; } __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(__pyx_t_5numpy_int64_t))) != 0); __pyx_t_3 = __pyx_t_2; __pyx_L34_bool_binop_done:; if (__pyx_t_3) { __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_int64_t(__pyx_v_arg, 0); __pyx_v_memslice = __pyx_t_8; __pyx_t_3 = (__pyx_v_memslice.memview != 0); if (__pyx_t_3) { __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_int64_t, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 101, __pyx_L1_error) goto __pyx_L10_break; } /*else*/ { PyErr_Clear(); } } __pyx_t_2 = ((__pyx_v_itemsize == -1L) != 0); if (!__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L38_bool_binop_done; } __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(__pyx_t_5numpy_float32_t))) != 0); __pyx_t_3 = __pyx_t_2; __pyx_L38_bool_binop_done:; if (__pyx_t_3) { __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_float32_t(__pyx_v_arg, 0); __pyx_v_memslice = __pyx_t_8; __pyx_t_3 = (__pyx_v_memslice.memview != 0); if (__pyx_t_3) { __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float32_t, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 101, __pyx_L1_error) goto __pyx_L10_break; } /*else*/ { PyErr_Clear(); } } __pyx_t_2 = ((__pyx_v_itemsize == -1L) != 0); if (!__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L42_bool_binop_done; } __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(__pyx_t_5numpy_float64_t))) != 0); __pyx_t_3 = __pyx_t_2; __pyx_L42_bool_binop_done:; if (__pyx_t_3) { __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_float64_t(__pyx_v_arg, 0); __pyx_v_memslice = __pyx_t_8; __pyx_t_3 = (__pyx_v_memslice.memview != 0); if (__pyx_t_3) { __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float64_t, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 101, __pyx_L1_error) goto __pyx_L10_break; } /*else*/ { PyErr_Clear(); } } if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, Py_None, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 101, __pyx_L1_error) goto __pyx_L10_break; } __pyx_L10_break:; __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_candidates = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0; __pyx_t_5 = 0; if (unlikely(__pyx_v_signatures == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(0, 101, __pyx_L1_error) } __pyx_t_1 = __Pyx_dict_iterator(((PyObject*)__pyx_v_signatures), 1, ((PyObject *)NULL), (&__pyx_t_9), (&__pyx_t_10)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = __pyx_t_1; __pyx_t_1 = 0; while (1) { __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_9, &__pyx_t_5, &__pyx_t_1, NULL, NULL, __pyx_t_10); if (unlikely(__pyx_t_11 == 0)) break; if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_sig, __pyx_t_1); __pyx_t_1 = 0; __pyx_v_match_found = 0; __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_sig, __pyx_n_s_strip); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_14 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) { __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13); if (likely(__pyx_t_14)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); __Pyx_INCREF(__pyx_t_14); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_13, function); } } __pyx_t_12 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_14, __pyx_kp_s_) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_kp_s_); __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_split); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) { __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13); if (likely(__pyx_t_12)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_13, function); } } __pyx_t_1 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_12, __pyx_kp_s__2) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_kp_s__2); __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF_SET(__pyx_v_src_sig, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_15 = PyList_GET_SIZE(__pyx_v_dest_sig); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 101, __pyx_L1_error) __pyx_t_16 = __pyx_t_15; for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_i = __pyx_t_17; __pyx_t_1 = PyList_GET_ITEM(__pyx_v_dest_sig, __pyx_v_i); __Pyx_INCREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_dst_type, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_v_dst_type != Py_None); __pyx_t_2 = (__pyx_t_3 != 0); if (__pyx_t_2) { __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_src_sig, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_13 = PyObject_RichCompare(__pyx_t_1, __pyx_v_dst_type, Py_EQ); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; if (__pyx_t_2) { __pyx_v_match_found = 1; goto __pyx_L50; } /*else*/ { __pyx_v_match_found = 0; goto __pyx_L48_break; } __pyx_L50:; } } __pyx_L48_break:; __pyx_t_2 = (__pyx_v_match_found != 0); if (__pyx_t_2) { __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_candidates, __pyx_v_sig); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(0, 101, __pyx_L1_error) } } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_2 = (PyList_GET_SIZE(__pyx_v_candidates) != 0); __pyx_t_3 = ((!__pyx_t_2) != 0); if (__pyx_t_3) { __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __PYX_ERR(0, 101, __pyx_L1_error) } __pyx_t_9 = PyList_GET_SIZE(__pyx_v_candidates); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 101, __pyx_L1_error) __pyx_t_3 = ((__pyx_t_9 > 1) != 0); if (__pyx_t_3) { __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __PYX_ERR(0, 101, __pyx_L1_error) } /*else*/ { __Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_signatures == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 101, __pyx_L1_error) } __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_signatures), PyList_GET_ITEM(__pyx_v_candidates, 0)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L0; } /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); __Pyx_XDECREF(__pyx_t_14); __Pyx_AddTraceback("sortedness.wtau.wtau.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_dest_sig); __Pyx_XDECREF(__pyx_v_ndarray); __Pyx_XDECREF(__pyx_v_arg); __Pyx_XDECREF(__pyx_v_dtype); __Pyx_XDECREF(__pyx_v_arg_base); __Pyx_XDECREF(__pyx_v_candidates); __Pyx_XDECREF(__pyx_v_sig); __Pyx_XDECREF(__pyx_v_src_sig); __Pyx_XDECREF(__pyx_v_dst_type); __Pyx_XDECREF(__pyx_v_kwargs); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_17__pyx_fuse_0_weightedrankedtau(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_3_weightedrankedtau(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static __pyx_t_5numpy_float64_t __pyx_fuse_0__pyx_f_10sortedness_4wtau_4wtau__weightedrankedtau(__Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y, __Pyx_memviewslice __pyx_v_rank, __pyx_t_5numpy_int64_t __pyx_v_n, __Pyx_memviewslice __pyx_v_perm, __Pyx_memviewslice __pyx_v_exchanges_weight, __Pyx_memviewslice __pyx_v_temp, CYTHON_UNUSED int __pyx_skip_dispatch) { CYTHON_UNUSED __Pyx_memviewslice __pyx_v_y_local = { 0, 0, { 0 }, { 0 }, { 0 } }; __pyx_t_5numpy_intp_t __pyx_v_i; __pyx_t_5numpy_intp_t __pyx_v_first; __pyx_t_5numpy_float64_t __pyx_v_t; __pyx_t_5numpy_float64_t __pyx_v_u; __pyx_t_5numpy_float64_t __pyx_v_v; __pyx_t_5numpy_float64_t __pyx_v_w; __pyx_t_5numpy_float64_t __pyx_v_s; __pyx_t_5numpy_float64_t __pyx_v_sq; __pyx_t_5numpy_float64_t __pyx_v_tot; __pyx_t_5numpy_float64_t __pyx_v_tau; CYTHON_UNUSED __Pyx_memviewslice __pyx_v_rank_local = { 0, 0, { 0 }, { 0 }, { 0 } }; __pyx_t_5numpy_float64_t __pyx_r; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_WriteUnraisable("sortedness.wtau.wtau._weightedrankedtau", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1); __pyx_r = 0; __pyx_L0:; __PYX_XDEC_MEMVIEW(&__pyx_v_y_local, 0); __PYX_XDEC_MEMVIEW(&__pyx_v_rank_local, 0); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_17__pyx_fuse_0_weightedrankedtau(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_fuse_0__pyx_mdef_10sortedness_4wtau_4wtau_17__pyx_fuse_0_weightedrankedtau = {"__pyx_fuse_0_weightedrankedtau", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10sortedness_4wtau_4wtau_17__pyx_fuse_0_weightedrankedtau, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10sortedness_4wtau_4wtau_2_weightedrankedtau}; static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_17__pyx_fuse_0_weightedrankedtau(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { __Pyx_memviewslice __pyx_v_x = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_y = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_rank = { 0, 0, { 0 }, { 0 }, { 0 } }; __pyx_t_5numpy_int64_t __pyx_v_n; __Pyx_memviewslice __pyx_v_perm = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_exchanges_weight = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_temp = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fuse_0_weightedrankedtau (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_rank,&__pyx_n_s_n,&__pyx_n_s_perm,&__pyx_n_s_exchanges_weight,&__pyx_n_s_temp,0}; PyObject* values[7] = {0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); CYTHON_FALLTHROUGH; case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_0_weightedrankedtau", 1, 7, 7, 1); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rank)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_0_weightedrankedtau", 1, 7, 7, 2); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_0_weightedrankedtau", 1, 7, 7, 3); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_perm)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_0_weightedrankedtau", 1, 7, 7, 4); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exchanges_weight)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_0_weightedrankedtau", 1, 7, 7, 5); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_temp)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_0_weightedrankedtau", 1, 7, 7, 6); __PYX_ERR(0, 101, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fuse_0_weightedrankedtau") < 0)) __PYX_ERR(0, 101, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); } __pyx_v_x = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_int32_t(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_x.memview)) __PYX_ERR(0, 101, __pyx_L3_error) __pyx_v_y = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_int32_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_y.memview)) __PYX_ERR(0, 101, __pyx_L3_error) __pyx_v_rank = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rank.memview)) __PYX_ERR(0, 101, __pyx_L3_error) __pyx_v_n = __Pyx_PyInt_As_npy_int64(values[3]); if (unlikely((__pyx_v_n == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 102, __pyx_L3_error) __pyx_v_perm = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_perm.memview)) __PYX_ERR(0, 103, __pyx_L3_error) __pyx_v_exchanges_weight = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_float64_t(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_exchanges_weight.memview)) __PYX_ERR(0, 104, __pyx_L3_error) __pyx_v_temp = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_temp.memview)) __PYX_ERR(0, 105, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__pyx_fuse_0_weightedrankedtau", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 101, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("sortedness.wtau.wtau.__pyx_fuse_0_weightedrankedtau", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_10sortedness_4wtau_4wtau_16__pyx_fuse_0_weightedrankedtau(__pyx_self, __pyx_v_x, __pyx_v_y, __pyx_v_rank, __pyx_v_n, __pyx_v_perm, __pyx_v_exchanges_weight, __pyx_v_temp); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_10sortedness_4wtau_4wtau_16__pyx_fuse_0_weightedrankedtau(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y, __Pyx_memviewslice __pyx_v_rank, __pyx_t_5numpy_int64_t __pyx_v_n, __Pyx_memviewslice __pyx_v_perm, __Pyx_memviewslice __pyx_v_exchanges_weight, __Pyx_memviewslice __pyx_v_temp) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fuse_0_weightedrankedtau", 0); __Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_v_x.memview)) { __Pyx_RaiseUnboundLocalError("x"); __PYX_ERR(0, 101, __pyx_L1_error) } if (unlikely(!__pyx_v_y.memview)) { __Pyx_RaiseUnboundLocalError("y"); __PYX_ERR(0, 101, __pyx_L1_error) } if (unlikely(!__pyx_v_rank.memview)) { __Pyx_RaiseUnboundLocalError("rank"); __PYX_ERR(0, 101, __pyx_L1_error) } if (unlikely(!__pyx_v_perm.memview)) { __Pyx_RaiseUnboundLocalError("perm"); __PYX_ERR(0, 101, __pyx_L1_error) } if (unlikely(!__pyx_v_exchanges_weight.memview)) { __Pyx_RaiseUnboundLocalError("exchanges_weight"); __PYX_ERR(0, 101, __pyx_L1_error) } if (unlikely(!__pyx_v_temp.memview)) { __Pyx_RaiseUnboundLocalError("temp"); __PYX_ERR(0, 101, __pyx_L1_error) } __pyx_t_1 = PyFloat_FromDouble(__pyx_fuse_0__pyx_f_10sortedness_4wtau_4wtau__weightedrankedtau(__pyx_v_x, __pyx_v_y, __pyx_v_rank, __pyx_v_n, __pyx_v_perm, __pyx_v_exchanges_weight, __pyx_v_temp, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sortedness.wtau.wtau.__pyx_fuse_0_weightedrankedtau", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __PYX_XDEC_MEMVIEW(&__pyx_v_x, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_y, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_rank, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_perm, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_exchanges_weight, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_temp, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_19__pyx_fuse_1_weightedrankedtau(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_3_weightedrankedtau(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static __pyx_t_5numpy_float64_t __pyx_fuse_1__pyx_f_10sortedness_4wtau_4wtau__weightedrankedtau(__Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y, __Pyx_memviewslice __pyx_v_rank, __pyx_t_5numpy_int64_t __pyx_v_n, __Pyx_memviewslice __pyx_v_perm, __Pyx_memviewslice __pyx_v_exchanges_weight, __Pyx_memviewslice __pyx_v_temp, CYTHON_UNUSED int __pyx_skip_dispatch) { CYTHON_UNUSED __Pyx_memviewslice __pyx_v_y_local = { 0, 0, { 0 }, { 0 }, { 0 } }; __pyx_t_5numpy_intp_t __pyx_v_i; __pyx_t_5numpy_intp_t __pyx_v_first; __pyx_t_5numpy_float64_t __pyx_v_t; __pyx_t_5numpy_float64_t __pyx_v_u; __pyx_t_5numpy_float64_t __pyx_v_v; __pyx_t_5numpy_float64_t __pyx_v_w; __pyx_t_5numpy_float64_t __pyx_v_s; __pyx_t_5numpy_float64_t __pyx_v_sq; __pyx_t_5numpy_float64_t __pyx_v_tot; __pyx_t_5numpy_float64_t __pyx_v_tau; CYTHON_UNUSED __Pyx_memviewslice __pyx_v_rank_local = { 0, 0, { 0 }, { 0 }, { 0 } }; __pyx_t_5numpy_float64_t __pyx_r; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_WriteUnraisable("sortedness.wtau.wtau._weightedrankedtau", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1); __pyx_r = 0; __pyx_L0:; __PYX_XDEC_MEMVIEW(&__pyx_v_y_local, 0); __PYX_XDEC_MEMVIEW(&__pyx_v_rank_local, 0); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_19__pyx_fuse_1_weightedrankedtau(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_fuse_1__pyx_mdef_10sortedness_4wtau_4wtau_19__pyx_fuse_1_weightedrankedtau = {"__pyx_fuse_1_weightedrankedtau", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10sortedness_4wtau_4wtau_19__pyx_fuse_1_weightedrankedtau, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10sortedness_4wtau_4wtau_2_weightedrankedtau}; static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_19__pyx_fuse_1_weightedrankedtau(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { __Pyx_memviewslice __pyx_v_x = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_y = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_rank = { 0, 0, { 0 }, { 0 }, { 0 } }; __pyx_t_5numpy_int64_t __pyx_v_n; __Pyx_memviewslice __pyx_v_perm = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_exchanges_weight = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_temp = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fuse_1_weightedrankedtau (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_rank,&__pyx_n_s_n,&__pyx_n_s_perm,&__pyx_n_s_exchanges_weight,&__pyx_n_s_temp,0}; PyObject* values[7] = {0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); CYTHON_FALLTHROUGH; case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_1_weightedrankedtau", 1, 7, 7, 1); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rank)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_1_weightedrankedtau", 1, 7, 7, 2); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_1_weightedrankedtau", 1, 7, 7, 3); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_perm)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_1_weightedrankedtau", 1, 7, 7, 4); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exchanges_weight)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_1_weightedrankedtau", 1, 7, 7, 5); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_temp)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_1_weightedrankedtau", 1, 7, 7, 6); __PYX_ERR(0, 101, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fuse_1_weightedrankedtau") < 0)) __PYX_ERR(0, 101, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); } __pyx_v_x = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_int64_t(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_x.memview)) __PYX_ERR(0, 101, __pyx_L3_error) __pyx_v_y = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_int64_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_y.memview)) __PYX_ERR(0, 101, __pyx_L3_error) __pyx_v_rank = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rank.memview)) __PYX_ERR(0, 101, __pyx_L3_error) __pyx_v_n = __Pyx_PyInt_As_npy_int64(values[3]); if (unlikely((__pyx_v_n == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 102, __pyx_L3_error) __pyx_v_perm = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_perm.memview)) __PYX_ERR(0, 103, __pyx_L3_error) __pyx_v_exchanges_weight = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_float64_t(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_exchanges_weight.memview)) __PYX_ERR(0, 104, __pyx_L3_error) __pyx_v_temp = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_temp.memview)) __PYX_ERR(0, 105, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__pyx_fuse_1_weightedrankedtau", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 101, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("sortedness.wtau.wtau.__pyx_fuse_1_weightedrankedtau", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_10sortedness_4wtau_4wtau_18__pyx_fuse_1_weightedrankedtau(__pyx_self, __pyx_v_x, __pyx_v_y, __pyx_v_rank, __pyx_v_n, __pyx_v_perm, __pyx_v_exchanges_weight, __pyx_v_temp); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_10sortedness_4wtau_4wtau_18__pyx_fuse_1_weightedrankedtau(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y, __Pyx_memviewslice __pyx_v_rank, __pyx_t_5numpy_int64_t __pyx_v_n, __Pyx_memviewslice __pyx_v_perm, __Pyx_memviewslice __pyx_v_exchanges_weight, __Pyx_memviewslice __pyx_v_temp) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fuse_1_weightedrankedtau", 0); __Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_v_x.memview)) { __Pyx_RaiseUnboundLocalError("x"); __PYX_ERR(0, 101, __pyx_L1_error) } if (unlikely(!__pyx_v_y.memview)) { __Pyx_RaiseUnboundLocalError("y"); __PYX_ERR(0, 101, __pyx_L1_error) } if (unlikely(!__pyx_v_rank.memview)) { __Pyx_RaiseUnboundLocalError("rank"); __PYX_ERR(0, 101, __pyx_L1_error) } if (unlikely(!__pyx_v_perm.memview)) { __Pyx_RaiseUnboundLocalError("perm"); __PYX_ERR(0, 101, __pyx_L1_error) } if (unlikely(!__pyx_v_exchanges_weight.memview)) { __Pyx_RaiseUnboundLocalError("exchanges_weight"); __PYX_ERR(0, 101, __pyx_L1_error) } if (unlikely(!__pyx_v_temp.memview)) { __Pyx_RaiseUnboundLocalError("temp"); __PYX_ERR(0, 101, __pyx_L1_error) } __pyx_t_1 = PyFloat_FromDouble(__pyx_fuse_1__pyx_f_10sortedness_4wtau_4wtau__weightedrankedtau(__pyx_v_x, __pyx_v_y, __pyx_v_rank, __pyx_v_n, __pyx_v_perm, __pyx_v_exchanges_weight, __pyx_v_temp, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sortedness.wtau.wtau.__pyx_fuse_1_weightedrankedtau", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __PYX_XDEC_MEMVIEW(&__pyx_v_x, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_y, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_rank, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_perm, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_exchanges_weight, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_temp, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_21__pyx_fuse_2_weightedrankedtau(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_3_weightedrankedtau(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static __pyx_t_5numpy_float64_t __pyx_fuse_2__pyx_f_10sortedness_4wtau_4wtau__weightedrankedtau(__Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y, __Pyx_memviewslice __pyx_v_rank, __pyx_t_5numpy_int64_t __pyx_v_n, __Pyx_memviewslice __pyx_v_perm, __Pyx_memviewslice __pyx_v_exchanges_weight, __Pyx_memviewslice __pyx_v_temp, CYTHON_UNUSED int __pyx_skip_dispatch) { CYTHON_UNUSED __Pyx_memviewslice __pyx_v_y_local = { 0, 0, { 0 }, { 0 }, { 0 } }; __pyx_t_5numpy_intp_t __pyx_v_i; __pyx_t_5numpy_intp_t __pyx_v_first; __pyx_t_5numpy_float64_t __pyx_v_t; __pyx_t_5numpy_float64_t __pyx_v_u; __pyx_t_5numpy_float64_t __pyx_v_v; __pyx_t_5numpy_float64_t __pyx_v_w; __pyx_t_5numpy_float64_t __pyx_v_s; __pyx_t_5numpy_float64_t __pyx_v_sq; __pyx_t_5numpy_float64_t __pyx_v_tot; __pyx_t_5numpy_float64_t __pyx_v_tau; CYTHON_UNUSED __Pyx_memviewslice __pyx_v_rank_local = { 0, 0, { 0 }, { 0 }, { 0 } }; __pyx_t_5numpy_float64_t __pyx_r; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_WriteUnraisable("sortedness.wtau.wtau._weightedrankedtau", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1); __pyx_r = 0; __pyx_L0:; __PYX_XDEC_MEMVIEW(&__pyx_v_y_local, 0); __PYX_XDEC_MEMVIEW(&__pyx_v_rank_local, 0); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_21__pyx_fuse_2_weightedrankedtau(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_fuse_2__pyx_mdef_10sortedness_4wtau_4wtau_21__pyx_fuse_2_weightedrankedtau = {"__pyx_fuse_2_weightedrankedtau", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10sortedness_4wtau_4wtau_21__pyx_fuse_2_weightedrankedtau, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10sortedness_4wtau_4wtau_2_weightedrankedtau}; static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_21__pyx_fuse_2_weightedrankedtau(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { __Pyx_memviewslice __pyx_v_x = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_y = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_rank = { 0, 0, { 0 }, { 0 }, { 0 } }; __pyx_t_5numpy_int64_t __pyx_v_n; __Pyx_memviewslice __pyx_v_perm = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_exchanges_weight = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_temp = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fuse_2_weightedrankedtau (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_rank,&__pyx_n_s_n,&__pyx_n_s_perm,&__pyx_n_s_exchanges_weight,&__pyx_n_s_temp,0}; PyObject* values[7] = {0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); CYTHON_FALLTHROUGH; case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_2_weightedrankedtau", 1, 7, 7, 1); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rank)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_2_weightedrankedtau", 1, 7, 7, 2); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_2_weightedrankedtau", 1, 7, 7, 3); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_perm)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_2_weightedrankedtau", 1, 7, 7, 4); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exchanges_weight)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_2_weightedrankedtau", 1, 7, 7, 5); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_temp)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_2_weightedrankedtau", 1, 7, 7, 6); __PYX_ERR(0, 101, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fuse_2_weightedrankedtau") < 0)) __PYX_ERR(0, 101, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); } __pyx_v_x = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_float32_t(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_x.memview)) __PYX_ERR(0, 101, __pyx_L3_error) __pyx_v_y = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_float32_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_y.memview)) __PYX_ERR(0, 101, __pyx_L3_error) __pyx_v_rank = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rank.memview)) __PYX_ERR(0, 101, __pyx_L3_error) __pyx_v_n = __Pyx_PyInt_As_npy_int64(values[3]); if (unlikely((__pyx_v_n == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 102, __pyx_L3_error) __pyx_v_perm = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_perm.memview)) __PYX_ERR(0, 103, __pyx_L3_error) __pyx_v_exchanges_weight = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_float64_t(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_exchanges_weight.memview)) __PYX_ERR(0, 104, __pyx_L3_error) __pyx_v_temp = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_temp.memview)) __PYX_ERR(0, 105, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__pyx_fuse_2_weightedrankedtau", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 101, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("sortedness.wtau.wtau.__pyx_fuse_2_weightedrankedtau", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_10sortedness_4wtau_4wtau_20__pyx_fuse_2_weightedrankedtau(__pyx_self, __pyx_v_x, __pyx_v_y, __pyx_v_rank, __pyx_v_n, __pyx_v_perm, __pyx_v_exchanges_weight, __pyx_v_temp); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_10sortedness_4wtau_4wtau_20__pyx_fuse_2_weightedrankedtau(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y, __Pyx_memviewslice __pyx_v_rank, __pyx_t_5numpy_int64_t __pyx_v_n, __Pyx_memviewslice __pyx_v_perm, __Pyx_memviewslice __pyx_v_exchanges_weight, __Pyx_memviewslice __pyx_v_temp) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fuse_2_weightedrankedtau", 0); __Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_v_x.memview)) { __Pyx_RaiseUnboundLocalError("x"); __PYX_ERR(0, 101, __pyx_L1_error) } if (unlikely(!__pyx_v_y.memview)) { __Pyx_RaiseUnboundLocalError("y"); __PYX_ERR(0, 101, __pyx_L1_error) } if (unlikely(!__pyx_v_rank.memview)) { __Pyx_RaiseUnboundLocalError("rank"); __PYX_ERR(0, 101, __pyx_L1_error) } if (unlikely(!__pyx_v_perm.memview)) { __Pyx_RaiseUnboundLocalError("perm"); __PYX_ERR(0, 101, __pyx_L1_error) } if (unlikely(!__pyx_v_exchanges_weight.memview)) { __Pyx_RaiseUnboundLocalError("exchanges_weight"); __PYX_ERR(0, 101, __pyx_L1_error) } if (unlikely(!__pyx_v_temp.memview)) { __Pyx_RaiseUnboundLocalError("temp"); __PYX_ERR(0, 101, __pyx_L1_error) } __pyx_t_1 = PyFloat_FromDouble(__pyx_fuse_2__pyx_f_10sortedness_4wtau_4wtau__weightedrankedtau(__pyx_v_x, __pyx_v_y, __pyx_v_rank, __pyx_v_n, __pyx_v_perm, __pyx_v_exchanges_weight, __pyx_v_temp, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sortedness.wtau.wtau.__pyx_fuse_2_weightedrankedtau", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __PYX_XDEC_MEMVIEW(&__pyx_v_x, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_y, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_rank, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_perm, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_exchanges_weight, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_temp, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_23__pyx_fuse_3_weightedrankedtau(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_3_weightedrankedtau(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static __pyx_t_5numpy_float64_t __pyx_fuse_3__pyx_f_10sortedness_4wtau_4wtau__weightedrankedtau(__Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y, __Pyx_memviewslice __pyx_v_rank, __pyx_t_5numpy_int64_t __pyx_v_n, __Pyx_memviewslice __pyx_v_perm, __Pyx_memviewslice __pyx_v_exchanges_weight, __Pyx_memviewslice __pyx_v_temp, CYTHON_UNUSED int __pyx_skip_dispatch) { CYTHON_UNUSED __Pyx_memviewslice __pyx_v_y_local = { 0, 0, { 0 }, { 0 }, { 0 } }; __pyx_t_5numpy_intp_t __pyx_v_i; __pyx_t_5numpy_intp_t __pyx_v_first; __pyx_t_5numpy_float64_t __pyx_v_t; __pyx_t_5numpy_float64_t __pyx_v_u; __pyx_t_5numpy_float64_t __pyx_v_v; __pyx_t_5numpy_float64_t __pyx_v_w; __pyx_t_5numpy_float64_t __pyx_v_s; __pyx_t_5numpy_float64_t __pyx_v_sq; __pyx_t_5numpy_float64_t __pyx_v_tot; __pyx_t_5numpy_float64_t __pyx_v_tau; CYTHON_UNUSED __Pyx_memviewslice __pyx_v_rank_local = { 0, 0, { 0 }, { 0 }, { 0 } }; __pyx_t_5numpy_float64_t __pyx_r; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_WriteUnraisable("sortedness.wtau.wtau._weightedrankedtau", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1); __pyx_r = 0; __pyx_L0:; __PYX_XDEC_MEMVIEW(&__pyx_v_y_local, 0); __PYX_XDEC_MEMVIEW(&__pyx_v_rank_local, 0); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_23__pyx_fuse_3_weightedrankedtau(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_fuse_3__pyx_mdef_10sortedness_4wtau_4wtau_23__pyx_fuse_3_weightedrankedtau = {"__pyx_fuse_3_weightedrankedtau", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10sortedness_4wtau_4wtau_23__pyx_fuse_3_weightedrankedtau, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10sortedness_4wtau_4wtau_2_weightedrankedtau}; static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_23__pyx_fuse_3_weightedrankedtau(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { __Pyx_memviewslice __pyx_v_x = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_y = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_rank = { 0, 0, { 0 }, { 0 }, { 0 } }; __pyx_t_5numpy_int64_t __pyx_v_n; __Pyx_memviewslice __pyx_v_perm = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_exchanges_weight = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_temp = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fuse_3_weightedrankedtau (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_rank,&__pyx_n_s_n,&__pyx_n_s_perm,&__pyx_n_s_exchanges_weight,&__pyx_n_s_temp,0}; PyObject* values[7] = {0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); CYTHON_FALLTHROUGH; case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_3_weightedrankedtau", 1, 7, 7, 1); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rank)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_3_weightedrankedtau", 1, 7, 7, 2); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_3_weightedrankedtau", 1, 7, 7, 3); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_perm)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_3_weightedrankedtau", 1, 7, 7, 4); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exchanges_weight)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_3_weightedrankedtau", 1, 7, 7, 5); __PYX_ERR(0, 101, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_temp)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fuse_3_weightedrankedtau", 1, 7, 7, 6); __PYX_ERR(0, 101, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fuse_3_weightedrankedtau") < 0)) __PYX_ERR(0, 101, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); } __pyx_v_x = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_float64_t(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_x.memview)) __PYX_ERR(0, 101, __pyx_L3_error) __pyx_v_y = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_float64_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_y.memview)) __PYX_ERR(0, 101, __pyx_L3_error) __pyx_v_rank = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rank.memview)) __PYX_ERR(0, 101, __pyx_L3_error) __pyx_v_n = __Pyx_PyInt_As_npy_int64(values[3]); if (unlikely((__pyx_v_n == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 102, __pyx_L3_error) __pyx_v_perm = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_perm.memview)) __PYX_ERR(0, 103, __pyx_L3_error) __pyx_v_exchanges_weight = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_float64_t(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_exchanges_weight.memview)) __PYX_ERR(0, 104, __pyx_L3_error) __pyx_v_temp = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_intp_t(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_temp.memview)) __PYX_ERR(0, 105, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__pyx_fuse_3_weightedrankedtau", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 101, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("sortedness.wtau.wtau.__pyx_fuse_3_weightedrankedtau", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_10sortedness_4wtau_4wtau_22__pyx_fuse_3_weightedrankedtau(__pyx_self, __pyx_v_x, __pyx_v_y, __pyx_v_rank, __pyx_v_n, __pyx_v_perm, __pyx_v_exchanges_weight, __pyx_v_temp); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_10sortedness_4wtau_4wtau_22__pyx_fuse_3_weightedrankedtau(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y, __Pyx_memviewslice __pyx_v_rank, __pyx_t_5numpy_int64_t __pyx_v_n, __Pyx_memviewslice __pyx_v_perm, __Pyx_memviewslice __pyx_v_exchanges_weight, __Pyx_memviewslice __pyx_v_temp) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fuse_3_weightedrankedtau", 0); __Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_v_x.memview)) { __Pyx_RaiseUnboundLocalError("x"); __PYX_ERR(0, 101, __pyx_L1_error) } if (unlikely(!__pyx_v_y.memview)) { __Pyx_RaiseUnboundLocalError("y"); __PYX_ERR(0, 101, __pyx_L1_error) } if (unlikely(!__pyx_v_rank.memview)) { __Pyx_RaiseUnboundLocalError("rank"); __PYX_ERR(0, 101, __pyx_L1_error) } if (unlikely(!__pyx_v_perm.memview)) { __Pyx_RaiseUnboundLocalError("perm"); __PYX_ERR(0, 101, __pyx_L1_error) } if (unlikely(!__pyx_v_exchanges_weight.memview)) { __Pyx_RaiseUnboundLocalError("exchanges_weight"); __PYX_ERR(0, 101, __pyx_L1_error) } if (unlikely(!__pyx_v_temp.memview)) { __Pyx_RaiseUnboundLocalError("temp"); __PYX_ERR(0, 101, __pyx_L1_error) } __pyx_t_1 = PyFloat_FromDouble(__pyx_fuse_3__pyx_f_10sortedness_4wtau_4wtau__weightedrankedtau(__pyx_v_x, __pyx_v_y, __pyx_v_rank, __pyx_v_n, __pyx_v_perm, __pyx_v_exchanges_weight, __pyx_v_temp, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sortedness.wtau.wtau.__pyx_fuse_3_weightedrankedtau", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __PYX_XDEC_MEMVIEW(&__pyx_v_x, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_y, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_rank, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_perm, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_exchanges_weight, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_temp, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__28 = PyTuple_Pack(7, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_rank, __pyx_n_s_n, __pyx_n_s_perm, __pyx_n_s_exchanges_weight, __pyx_n_s_temp); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__28); __Pyx_GIVEREF(__pyx_tuple__28); /* … */ __pyx_t_3 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_FusedFunction_New(&__pyx_fuse_0__pyx_mdef_10sortedness_4wtau_4wtau_17__pyx_fuse_0_weightedrankedtau, 0, __pyx_n_s_pyx_fuse_0_weightedrankedtau, NULL, __pyx_n_s_sortedness_wtau_wtau, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_empty_tuple); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_int32_t, __pyx_t_1) < 0) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __pyx_FusedFunction_New(&__pyx_fuse_1__pyx_mdef_10sortedness_4wtau_4wtau_19__pyx_fuse_1_weightedrankedtau, 0, __pyx_n_s_pyx_fuse_1_weightedrankedtau, NULL, __pyx_n_s_sortedness_wtau_wtau, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_empty_tuple); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_int64_t, __pyx_t_1) < 0) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __pyx_FusedFunction_New(&__pyx_fuse_2__pyx_mdef_10sortedness_4wtau_4wtau_21__pyx_fuse_2_weightedrankedtau, 0, __pyx_n_s_pyx_fuse_2_weightedrankedtau, NULL, __pyx_n_s_sortedness_wtau_wtau, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_empty_tuple); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_float32_t, __pyx_t_1) < 0) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __pyx_FusedFunction_New(&__pyx_fuse_3__pyx_mdef_10sortedness_4wtau_4wtau_23__pyx_fuse_3_weightedrankedtau, 0, __pyx_n_s_pyx_fuse_3_weightedrankedtau, NULL, __pyx_n_s_sortedness_wtau_wtau, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_empty_tuple); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_float64_t, __pyx_t_1) < 0) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __pyx_FusedFunction_New(&__pyx_mdef_10sortedness_4wtau_4wtau_3_weightedrankedtau, 0, __pyx_n_s_weightedrankedtau, NULL, __pyx_n_s_sortedness_wtau_wtau, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_empty_tuple); ((__pyx_FusedFunctionObject *) __pyx_t_1)->__signatures__ = __pyx_t_3; __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_weightedrankedtau, __pyx_t_1) < 0) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_sortedness_wtau_wtau_pyx, __pyx_n_s_pyx_fuse_0_weightedrankedtau, 101, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 101, __pyx_L1_error)
102: int64_t n,
103: intp_t[::1] perm,
104: float64_t[::1] exchanges_weight,
105: intp_t[::1] temp
106: ) nogil:
+107: cdef ordered[::1] y_local = y
__PYX_INC_MEMVIEW(&__pyx_v_y, 1); __pyx_v_y_local = __pyx_v_y; /* … */ __PYX_INC_MEMVIEW(&__pyx_v_y, 1); __pyx_v_y_local = __pyx_v_y; /* … */ __PYX_INC_MEMVIEW(&__pyx_v_y, 1); __pyx_v_y_local = __pyx_v_y; /* … */ __PYX_INC_MEMVIEW(&__pyx_v_y, 1); __pyx_v_y_local = __pyx_v_y;
108: cdef intp_t i, first
109: cdef float64_t t, u, v, w, s, sq, tot, tau
+110: exchanges_weight[0] = 0
__pyx_t_1 = 0; *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_exchanges_weight.data) + __pyx_t_1)) )) = 0.0; /* … */ __pyx_t_1 = 0; *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_exchanges_weight.data) + __pyx_t_1)) )) = 0.0; /* … */ __pyx_t_1 = 0; *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_exchanges_weight.data) + __pyx_t_1)) )) = 0.0; /* … */ __pyx_t_1 = 0; *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_exchanges_weight.data) + __pyx_t_1)) )) = 0.0;
111:
112: # if rank is None:
113: # # To generate a rank array, we must first reverse the permutation
114: # # (to get higher ranks first) and then invert it.
115: # rank = np.empty(n, dtype=np.intp)
116: # rank[...] = perm[::-1]
117: # _invert_in_place(rank)
118:
+119: cdef intp_t[::1] rank_local = rank
__PYX_INC_MEMVIEW(&__pyx_v_rank, 1); __pyx_v_rank_local = __pyx_v_rank; /* … */ __PYX_INC_MEMVIEW(&__pyx_v_rank, 1); __pyx_v_rank_local = __pyx_v_rank; /* … */ __PYX_INC_MEMVIEW(&__pyx_v_rank, 1); __pyx_v_rank_local = __pyx_v_rank; /* … */ __PYX_INC_MEMVIEW(&__pyx_v_rank, 1); __pyx_v_rank_local = __pyx_v_rank;
120:
121: # weigh joint ties
+122: first = 0
__pyx_v_first = 0; /* … */ __pyx_v_first = 0; /* … */ __pyx_v_first = 0; /* … */ __pyx_v_first = 0;
+123: t = 0
__pyx_v_t = 0.0; /* … */ __pyx_v_t = 0.0; /* … */ __pyx_v_t = 0.0; /* … */ __pyx_v_t = 0.0;
+124: w = 1./(1 + rank[perm[first]])
__pyx_t_1 = __pyx_v_first; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_2)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 124, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_1 = __pyx_v_first; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_2)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 124, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_1 = __pyx_v_first; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_2)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 124, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_1 = __pyx_v_first; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_2)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 124, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3));
+125: s = w
__pyx_v_s = __pyx_v_w; /* … */ __pyx_v_s = __pyx_v_w; /* … */ __pyx_v_s = __pyx_v_w; /* … */ __pyx_v_s = __pyx_v_w;
+126: sq = w * w
__pyx_v_sq = (__pyx_v_w * __pyx_v_w); /* … */ __pyx_v_sq = (__pyx_v_w * __pyx_v_w); /* … */ __pyx_v_sq = (__pyx_v_w * __pyx_v_w); /* … */ __pyx_v_sq = (__pyx_v_w * __pyx_v_w);
127:
+128: for i in range(1, n):
__pyx_t_4 = __pyx_v_n; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 1; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* … */ __pyx_t_4 = __pyx_v_n; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 1; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* … */ __pyx_t_4 = __pyx_v_n; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 1; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* … */ __pyx_t_4 = __pyx_v_n; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 1; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6;
+129: if x[perm[first]] != x[perm[i]] or y[perm[first]] != y[perm[i]]:
__pyx_t_1 = __pyx_v_first; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_8 = __pyx_v_i; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_10 = (((*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int32_t *) __pyx_v_x.data) + __pyx_t_2)) ))) != (*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int32_t *) __pyx_v_x.data) + __pyx_t_9)) )))) != 0); if (!__pyx_t_10) { } else { __pyx_t_7 = __pyx_t_10; goto __pyx_L6_bool_binop_done; } __pyx_t_8 = __pyx_v_first; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_1 = __pyx_v_i; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_10 = (((*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int32_t *) __pyx_v_y.data) + __pyx_t_9)) ))) != (*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int32_t *) __pyx_v_y.data) + __pyx_t_2)) )))) != 0); __pyx_t_7 = __pyx_t_10; __pyx_L6_bool_binop_done:; if (__pyx_t_7) { /* … */ } /* … */ __pyx_t_1 = __pyx_v_first; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_8 = __pyx_v_i; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_10 = (((*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int64_t *) __pyx_v_x.data) + __pyx_t_2)) ))) != (*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int64_t *) __pyx_v_x.data) + __pyx_t_9)) )))) != 0); if (!__pyx_t_10) { } else { __pyx_t_7 = __pyx_t_10; goto __pyx_L6_bool_binop_done; } __pyx_t_8 = __pyx_v_first; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_1 = __pyx_v_i; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_10 = (((*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int64_t *) __pyx_v_y.data) + __pyx_t_9)) ))) != (*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int64_t *) __pyx_v_y.data) + __pyx_t_2)) )))) != 0); __pyx_t_7 = __pyx_t_10; __pyx_L6_bool_binop_done:; if (__pyx_t_7) { /* … */ } /* … */ __pyx_t_1 = __pyx_v_first; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_8 = __pyx_v_i; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_10 = (((*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float32_t *) __pyx_v_x.data) + __pyx_t_2)) ))) != (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float32_t *) __pyx_v_x.data) + __pyx_t_9)) )))) != 0); if (!__pyx_t_10) { } else { __pyx_t_7 = __pyx_t_10; goto __pyx_L6_bool_binop_done; } __pyx_t_8 = __pyx_v_first; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_1 = __pyx_v_i; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_10 = (((*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float32_t *) __pyx_v_y.data) + __pyx_t_9)) ))) != (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float32_t *) __pyx_v_y.data) + __pyx_t_2)) )))) != 0); __pyx_t_7 = __pyx_t_10; __pyx_L6_bool_binop_done:; if (__pyx_t_7) { /* … */ } /* … */ __pyx_t_1 = __pyx_v_first; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_8 = __pyx_v_i; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_10 = (((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_x.data) + __pyx_t_2)) ))) != (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_x.data) + __pyx_t_9)) )))) != 0); if (!__pyx_t_10) { } else { __pyx_t_7 = __pyx_t_10; goto __pyx_L6_bool_binop_done; } __pyx_t_8 = __pyx_v_first; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_1 = __pyx_v_i; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_10 = (((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_y.data) + __pyx_t_9)) ))) != (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_y.data) + __pyx_t_2)) )))) != 0); __pyx_t_7 = __pyx_t_10; __pyx_L6_bool_binop_done:; if (__pyx_t_7) { /* … */ }
+130: t += s * (i - first - 1)
__pyx_v_t = (__pyx_v_t + (__pyx_v_s * ((__pyx_v_i - __pyx_v_first) - 1))); /* … */ __pyx_v_t = (__pyx_v_t + (__pyx_v_s * ((__pyx_v_i - __pyx_v_first) - 1))); /* … */ __pyx_v_t = (__pyx_v_t + (__pyx_v_s * ((__pyx_v_i - __pyx_v_first) - 1))); /* … */ __pyx_v_t = (__pyx_v_t + (__pyx_v_s * ((__pyx_v_i - __pyx_v_first) - 1)));
+131: first = i
__pyx_v_first = __pyx_v_i; /* … */ __pyx_v_first = __pyx_v_i; /* … */ __pyx_v_first = __pyx_v_i; /* … */ __pyx_v_first = __pyx_v_i;
+132: s = sq = 0
__pyx_v_s = 0.0; __pyx_v_sq = 0.0; /* … */ __pyx_v_s = 0.0; __pyx_v_sq = 0.0; /* … */ __pyx_v_s = 0.0; __pyx_v_sq = 0.0; /* … */ __pyx_v_s = 0.0; __pyx_v_sq = 0.0;
133:
+134: w = 1./(1 + rank[perm[i]])
__pyx_t_1 = __pyx_v_i; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_2)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 134, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_1 = __pyx_v_i; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_2)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 134, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_1 = __pyx_v_i; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_2)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 134, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_1 = __pyx_v_i; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_2)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 134, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3));
+135: s += w
__pyx_v_s = (__pyx_v_s + __pyx_v_w); /* … */ __pyx_v_s = (__pyx_v_s + __pyx_v_w); /* … */ __pyx_v_s = (__pyx_v_s + __pyx_v_w); /* … */ __pyx_v_s = (__pyx_v_s + __pyx_v_w);
+136: sq += w * w
__pyx_v_sq = (__pyx_v_sq + (__pyx_v_w * __pyx_v_w)); } /* … */ __pyx_v_sq = (__pyx_v_sq + (__pyx_v_w * __pyx_v_w)); } /* … */ __pyx_v_sq = (__pyx_v_sq + (__pyx_v_w * __pyx_v_w)); } /* … */ __pyx_v_sq = (__pyx_v_sq + (__pyx_v_w * __pyx_v_w)); }
137:
+138: t += s * (n - first - 1)
__pyx_v_t = (__pyx_v_t + (__pyx_v_s * ((__pyx_v_n - __pyx_v_first) - 1))); /* … */ __pyx_v_t = (__pyx_v_t + (__pyx_v_s * ((__pyx_v_n - __pyx_v_first) - 1))); /* … */ __pyx_v_t = (__pyx_v_t + (__pyx_v_s * ((__pyx_v_n - __pyx_v_first) - 1))); /* … */ __pyx_v_t = (__pyx_v_t + (__pyx_v_s * ((__pyx_v_n - __pyx_v_first) - 1)));
139:
140: # weigh ties in x
+141: first = 0
__pyx_v_first = 0; /* … */ __pyx_v_first = 0; /* … */ __pyx_v_first = 0; /* … */ __pyx_v_first = 0;
+142: u = 0
__pyx_v_u = 0.0; /* … */ __pyx_v_u = 0.0; /* … */ __pyx_v_u = 0.0; /* … */ __pyx_v_u = 0.0;
+143: w = 1./(1 + rank[perm[first]])
__pyx_t_1 = __pyx_v_first; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_2)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 143, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_1 = __pyx_v_first; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_2)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 143, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_1 = __pyx_v_first; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_2)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 143, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_1 = __pyx_v_first; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_2)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 143, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3));
+144: s = w
__pyx_v_s = __pyx_v_w; /* … */ __pyx_v_s = __pyx_v_w; /* … */ __pyx_v_s = __pyx_v_w; /* … */ __pyx_v_s = __pyx_v_w;
+145: sq = w * w
__pyx_v_sq = (__pyx_v_w * __pyx_v_w); /* … */ __pyx_v_sq = (__pyx_v_w * __pyx_v_w); /* … */ __pyx_v_sq = (__pyx_v_w * __pyx_v_w); /* … */ __pyx_v_sq = (__pyx_v_w * __pyx_v_w);
146:
+147: for i in range(1, n):
__pyx_t_4 = __pyx_v_n; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 1; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* … */ __pyx_t_4 = __pyx_v_n; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 1; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* … */ __pyx_t_4 = __pyx_v_n; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 1; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* … */ __pyx_t_4 = __pyx_v_n; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 1; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6;
+148: if x[perm[first]] != x[perm[i]]:
__pyx_t_1 = __pyx_v_first; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_8 = __pyx_v_i; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_7 = (((*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int32_t *) __pyx_v_x.data) + __pyx_t_2)) ))) != (*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int32_t *) __pyx_v_x.data) + __pyx_t_9)) )))) != 0); if (__pyx_t_7) { /* … */ } /* … */ __pyx_t_1 = __pyx_v_first; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_8 = __pyx_v_i; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_7 = (((*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int64_t *) __pyx_v_x.data) + __pyx_t_2)) ))) != (*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int64_t *) __pyx_v_x.data) + __pyx_t_9)) )))) != 0); if (__pyx_t_7) { /* … */ } /* … */ __pyx_t_1 = __pyx_v_first; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_8 = __pyx_v_i; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_7 = (((*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float32_t *) __pyx_v_x.data) + __pyx_t_2)) ))) != (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float32_t *) __pyx_v_x.data) + __pyx_t_9)) )))) != 0); if (__pyx_t_7) { /* … */ } /* … */ __pyx_t_1 = __pyx_v_first; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_8 = __pyx_v_i; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_7 = (((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_x.data) + __pyx_t_2)) ))) != (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_x.data) + __pyx_t_9)) )))) != 0); if (__pyx_t_7) { /* … */ }
+149: u += s * (i - first - 1)
__pyx_v_u = (__pyx_v_u + (__pyx_v_s * ((__pyx_v_i - __pyx_v_first) - 1))); /* … */ __pyx_v_u = (__pyx_v_u + (__pyx_v_s * ((__pyx_v_i - __pyx_v_first) - 1))); /* … */ __pyx_v_u = (__pyx_v_u + (__pyx_v_s * ((__pyx_v_i - __pyx_v_first) - 1))); /* … */ __pyx_v_u = (__pyx_v_u + (__pyx_v_s * ((__pyx_v_i - __pyx_v_first) - 1)));
+150: first = i
__pyx_v_first = __pyx_v_i; /* … */ __pyx_v_first = __pyx_v_i; /* … */ __pyx_v_first = __pyx_v_i; /* … */ __pyx_v_first = __pyx_v_i;
+151: s = sq = 0
__pyx_v_s = 0.0; __pyx_v_sq = 0.0; /* … */ __pyx_v_s = 0.0; __pyx_v_sq = 0.0; /* … */ __pyx_v_s = 0.0; __pyx_v_sq = 0.0; /* … */ __pyx_v_s = 0.0; __pyx_v_sq = 0.0;
152:
+153: w = 1./(1 + rank[perm[i]])
__pyx_t_8 = __pyx_v_i; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_9)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 153, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_8 = __pyx_v_i; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_9)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 153, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_8 = __pyx_v_i; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_9)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 153, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_8 = __pyx_v_i; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_9)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 153, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3));
+154: s += w
__pyx_v_s = (__pyx_v_s + __pyx_v_w); /* … */ __pyx_v_s = (__pyx_v_s + __pyx_v_w); /* … */ __pyx_v_s = (__pyx_v_s + __pyx_v_w); /* … */ __pyx_v_s = (__pyx_v_s + __pyx_v_w);
+155: sq += w * w
__pyx_v_sq = (__pyx_v_sq + (__pyx_v_w * __pyx_v_w)); } /* … */ __pyx_v_sq = (__pyx_v_sq + (__pyx_v_w * __pyx_v_w)); } /* … */ __pyx_v_sq = (__pyx_v_sq + (__pyx_v_w * __pyx_v_w)); } /* … */ __pyx_v_sq = (__pyx_v_sq + (__pyx_v_w * __pyx_v_w)); }
156:
+157: u += s * (n - first - 1)
__pyx_v_u = (__pyx_v_u + (__pyx_v_s * ((__pyx_v_n - __pyx_v_first) - 1))); /* … */ __pyx_v_u = (__pyx_v_u + (__pyx_v_s * ((__pyx_v_n - __pyx_v_first) - 1))); /* … */ __pyx_v_u = (__pyx_v_u + (__pyx_v_s * ((__pyx_v_n - __pyx_v_first) - 1))); /* … */ __pyx_v_u = (__pyx_v_u + (__pyx_v_s * ((__pyx_v_n - __pyx_v_first) - 1)));
158: # if first == 0: # x is constant (all ties)
159: # return np.nan
160:
161: # weigh discordances
+162: weigh(0, n, rank, perm, temp, exchanges_weight, x, y)
(void)(__pyx_fuse_0__pyx_f_10sortedness_4wtau_4wtau_weigh(0, __pyx_v_n, __pyx_v_rank, __pyx_v_perm, __pyx_v_temp, __pyx_v_exchanges_weight, __pyx_v_x, __pyx_v_y, 0)); /* … */ (void)(__pyx_fuse_1__pyx_f_10sortedness_4wtau_4wtau_weigh(0, __pyx_v_n, __pyx_v_rank, __pyx_v_perm, __pyx_v_temp, __pyx_v_exchanges_weight, __pyx_v_x, __pyx_v_y, 0)); /* … */ (void)(__pyx_fuse_2__pyx_f_10sortedness_4wtau_4wtau_weigh(0, __pyx_v_n, __pyx_v_rank, __pyx_v_perm, __pyx_v_temp, __pyx_v_exchanges_weight, __pyx_v_x, __pyx_v_y, 0)); /* … */ (void)(__pyx_fuse_3__pyx_f_10sortedness_4wtau_4wtau_weigh(0, __pyx_v_n, __pyx_v_rank, __pyx_v_perm, __pyx_v_temp, __pyx_v_exchanges_weight, __pyx_v_x, __pyx_v_y, 0));
163:
164: # weigh ties in y
+165: first = 0
__pyx_v_first = 0; /* … */ __pyx_v_first = 0; /* … */ __pyx_v_first = 0; /* … */ __pyx_v_first = 0;
+166: v = 0
__pyx_v_v = 0.0; /* … */ __pyx_v_v = 0.0; /* … */ __pyx_v_v = 0.0; /* … */ __pyx_v_v = 0.0;
+167: w = 1./(1 + rank[perm[first]])
__pyx_t_8 = __pyx_v_first; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_9)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 167, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_8 = __pyx_v_first; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_9)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 167, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_8 = __pyx_v_first; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_9)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 167, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_8 = __pyx_v_first; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_9)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 167, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3));
+168: s = w
__pyx_v_s = __pyx_v_w; /* … */ __pyx_v_s = __pyx_v_w; /* … */ __pyx_v_s = __pyx_v_w; /* … */ __pyx_v_s = __pyx_v_w;
+169: sq = w * w
__pyx_v_sq = (__pyx_v_w * __pyx_v_w); /* … */ __pyx_v_sq = (__pyx_v_w * __pyx_v_w); /* … */ __pyx_v_sq = (__pyx_v_w * __pyx_v_w); /* … */ __pyx_v_sq = (__pyx_v_w * __pyx_v_w);
170:
+171: for i in range(1, n):
__pyx_t_4 = __pyx_v_n; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 1; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* … */ __pyx_t_4 = __pyx_v_n; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 1; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* … */ __pyx_t_4 = __pyx_v_n; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 1; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* … */ __pyx_t_4 = __pyx_v_n; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 1; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6;
+172: if y[perm[first]] != y[perm[i]]:
__pyx_t_8 = __pyx_v_first; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_1 = __pyx_v_i; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_7 = (((*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int32_t *) __pyx_v_y.data) + __pyx_t_9)) ))) != (*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int32_t *) __pyx_v_y.data) + __pyx_t_2)) )))) != 0); if (__pyx_t_7) { /* … */ } /* … */ __pyx_t_8 = __pyx_v_first; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_1 = __pyx_v_i; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_7 = (((*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int64_t *) __pyx_v_y.data) + __pyx_t_9)) ))) != (*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_int64_t *) __pyx_v_y.data) + __pyx_t_2)) )))) != 0); if (__pyx_t_7) { /* … */ } /* … */ __pyx_t_8 = __pyx_v_first; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_1 = __pyx_v_i; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_7 = (((*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float32_t *) __pyx_v_y.data) + __pyx_t_9)) ))) != (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float32_t *) __pyx_v_y.data) + __pyx_t_2)) )))) != 0); if (__pyx_t_7) { /* … */ } /* … */ __pyx_t_8 = __pyx_v_first; __pyx_t_9 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_8)) ))); __pyx_t_1 = __pyx_v_i; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_7 = (((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_y.data) + __pyx_t_9)) ))) != (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_y.data) + __pyx_t_2)) )))) != 0); if (__pyx_t_7) { /* … */ }
+173: v += s * (i - first - 1)
__pyx_v_v = (__pyx_v_v + (__pyx_v_s * ((__pyx_v_i - __pyx_v_first) - 1))); /* … */ __pyx_v_v = (__pyx_v_v + (__pyx_v_s * ((__pyx_v_i - __pyx_v_first) - 1))); /* … */ __pyx_v_v = (__pyx_v_v + (__pyx_v_s * ((__pyx_v_i - __pyx_v_first) - 1))); /* … */ __pyx_v_v = (__pyx_v_v + (__pyx_v_s * ((__pyx_v_i - __pyx_v_first) - 1)));
+174: first = i
__pyx_v_first = __pyx_v_i; /* … */ __pyx_v_first = __pyx_v_i; /* … */ __pyx_v_first = __pyx_v_i; /* … */ __pyx_v_first = __pyx_v_i;
+175: s = sq = 0
__pyx_v_s = 0.0; __pyx_v_sq = 0.0; /* … */ __pyx_v_s = 0.0; __pyx_v_sq = 0.0; /* … */ __pyx_v_s = 0.0; __pyx_v_sq = 0.0; /* … */ __pyx_v_s = 0.0; __pyx_v_sq = 0.0;
176:
+177: w = 1./(1 + rank[perm[i]])
__pyx_t_1 = __pyx_v_i; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_2)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 177, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_1 = __pyx_v_i; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_2)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 177, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_1 = __pyx_v_i; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_2)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 177, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_1 = __pyx_v_i; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_2)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 177, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3));
+178: s += w
__pyx_v_s = (__pyx_v_s + __pyx_v_w); /* … */ __pyx_v_s = (__pyx_v_s + __pyx_v_w); /* … */ __pyx_v_s = (__pyx_v_s + __pyx_v_w); /* … */ __pyx_v_s = (__pyx_v_s + __pyx_v_w);
+179: sq += w * w
__pyx_v_sq = (__pyx_v_sq + (__pyx_v_w * __pyx_v_w)); } /* … */ __pyx_v_sq = (__pyx_v_sq + (__pyx_v_w * __pyx_v_w)); } /* … */ __pyx_v_sq = (__pyx_v_sq + (__pyx_v_w * __pyx_v_w)); } /* … */ __pyx_v_sq = (__pyx_v_sq + (__pyx_v_w * __pyx_v_w)); }
180:
+181: v += s * (n - first - 1)
__pyx_v_v = (__pyx_v_v + (__pyx_v_s * ((__pyx_v_n - __pyx_v_first) - 1))); /* … */ __pyx_v_v = (__pyx_v_v + (__pyx_v_s * ((__pyx_v_n - __pyx_v_first) - 1))); /* … */ __pyx_v_v = (__pyx_v_v + (__pyx_v_s * ((__pyx_v_n - __pyx_v_first) - 1))); /* … */ __pyx_v_v = (__pyx_v_v + (__pyx_v_s * ((__pyx_v_n - __pyx_v_first) - 1)));
182: # if first == 0: # y is constant (all ties)
183: # return np.nan
184:
185: # weigh all pairs
+186: s = sq = 0
__pyx_v_s = 0.0; __pyx_v_sq = 0.0; /* … */ __pyx_v_s = 0.0; __pyx_v_sq = 0.0; /* … */ __pyx_v_s = 0.0; __pyx_v_sq = 0.0; /* … */ __pyx_v_s = 0.0; __pyx_v_sq = 0.0;
+187: for i in range(n):
__pyx_t_4 = __pyx_v_n; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* … */ __pyx_t_4 = __pyx_v_n; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* … */ __pyx_t_4 = __pyx_v_n; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* … */ __pyx_t_4 = __pyx_v_n; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6;
+188: w = 1./(1 + rank[perm[i]])
__pyx_t_1 = __pyx_v_i; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_2)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 188, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_1 = __pyx_v_i; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_2)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 188, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_1 = __pyx_v_i; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_2)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 188, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3)); /* … */ __pyx_t_1 = __pyx_v_i; __pyx_t_2 = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_perm.data) + __pyx_t_1)) ))); __pyx_t_3 = (1 + (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_intp_t *) __pyx_v_rank.data) + __pyx_t_2)) )))); if (unlikely(__pyx_t_3 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 188, __pyx_L1_error) } __pyx_v_w = (1. / ((double)__pyx_t_3));
+189: s += w
__pyx_v_s = (__pyx_v_s + __pyx_v_w); /* … */ __pyx_v_s = (__pyx_v_s + __pyx_v_w); /* … */ __pyx_v_s = (__pyx_v_s + __pyx_v_w); /* … */ __pyx_v_s = (__pyx_v_s + __pyx_v_w);
+190: sq += w * w
__pyx_v_sq = (__pyx_v_sq + (__pyx_v_w * __pyx_v_w)); } /* … */ __pyx_v_sq = (__pyx_v_sq + (__pyx_v_w * __pyx_v_w)); } /* … */ __pyx_v_sq = (__pyx_v_sq + (__pyx_v_w * __pyx_v_w)); } /* … */ __pyx_v_sq = (__pyx_v_sq + (__pyx_v_w * __pyx_v_w)); }
191:
+192: tot = s * (n - 1)
__pyx_v_tot = (__pyx_v_s * (__pyx_v_n - 1)); /* … */ __pyx_v_tot = (__pyx_v_s * (__pyx_v_n - 1)); /* … */ __pyx_v_tot = (__pyx_v_s * (__pyx_v_n - 1)); /* … */ __pyx_v_tot = (__pyx_v_s * (__pyx_v_n - 1));
193:
+194: tau = ((tot - (v + u - t)) - 2. * exchanges_weight[0]) / sqrt(tot - u) / sqrt(tot - v)
__pyx_t_1 = 0; __pyx_t_11 = ((__pyx_v_tot - ((__pyx_v_v + __pyx_v_u) - __pyx_v_t)) - (2. * (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_exchanges_weight.data) + __pyx_t_1)) ))))); __pyx_t_12 = sqrt((__pyx_v_tot - __pyx_v_u)); if (unlikely(__pyx_t_12 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 194, __pyx_L1_error) } __pyx_t_13 = (__pyx_t_11 / ((__pyx_t_5numpy_float64_t)__pyx_t_12)); __pyx_t_12 = sqrt((__pyx_v_tot - __pyx_v_v)); if (unlikely(__pyx_t_12 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 194, __pyx_L1_error) } __pyx_v_tau = (__pyx_t_13 / ((__pyx_t_5numpy_float64_t)__pyx_t_12)); /* … */ __pyx_t_1 = 0; __pyx_t_11 = ((__pyx_v_tot - ((__pyx_v_v + __pyx_v_u) - __pyx_v_t)) - (2. * (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_exchanges_weight.data) + __pyx_t_1)) ))))); __pyx_t_12 = sqrt((__pyx_v_tot - __pyx_v_u)); if (unlikely(__pyx_t_12 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 194, __pyx_L1_error) } __pyx_t_13 = (__pyx_t_11 / ((__pyx_t_5numpy_float64_t)__pyx_t_12)); __pyx_t_12 = sqrt((__pyx_v_tot - __pyx_v_v)); if (unlikely(__pyx_t_12 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 194, __pyx_L1_error) } __pyx_v_tau = (__pyx_t_13 / ((__pyx_t_5numpy_float64_t)__pyx_t_12)); /* … */ __pyx_t_1 = 0; __pyx_t_11 = ((__pyx_v_tot - ((__pyx_v_v + __pyx_v_u) - __pyx_v_t)) - (2. * (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_exchanges_weight.data) + __pyx_t_1)) ))))); __pyx_t_12 = sqrt((__pyx_v_tot - __pyx_v_u)); if (unlikely(__pyx_t_12 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 194, __pyx_L1_error) } __pyx_t_13 = (__pyx_t_11 / ((__pyx_t_5numpy_float64_t)__pyx_t_12)); __pyx_t_12 = sqrt((__pyx_v_tot - __pyx_v_v)); if (unlikely(__pyx_t_12 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 194, __pyx_L1_error) } __pyx_v_tau = (__pyx_t_13 / ((__pyx_t_5numpy_float64_t)__pyx_t_12)); /* … */ __pyx_t_1 = 0; __pyx_t_11 = ((__pyx_v_tot - ((__pyx_v_v + __pyx_v_u) - __pyx_v_t)) - (2. * (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_float64_t *) __pyx_v_exchanges_weight.data) + __pyx_t_1)) ))))); __pyx_t_12 = sqrt((__pyx_v_tot - __pyx_v_u)); if (unlikely(__pyx_t_12 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 194, __pyx_L1_error) } __pyx_t_13 = (__pyx_t_11 / ((__pyx_t_5numpy_float64_t)__pyx_t_12)); __pyx_t_12 = sqrt((__pyx_v_tot - __pyx_v_v)); if (unlikely(__pyx_t_12 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif PyErr_SetString(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 194, __pyx_L1_error) } __pyx_v_tau = (__pyx_t_13 / ((__pyx_t_5numpy_float64_t)__pyx_t_12));
+195: return min(1., max(-1., tau))
__pyx_t_13 = __pyx_v_tau; __pyx_t_12 = -1.; if (((__pyx_t_13 > __pyx_t_12) != 0)) { __pyx_t_11 = __pyx_t_13; } else { __pyx_t_11 = __pyx_t_12; } __pyx_t_13 = __pyx_t_11; __pyx_t_12 = 1.; if (((__pyx_t_13 < __pyx_t_12) != 0)) { __pyx_t_11 = __pyx_t_13; } else { __pyx_t_11 = __pyx_t_12; } __pyx_r = __pyx_t_11; goto __pyx_L0; /* … */ __pyx_t_13 = __pyx_v_tau; __pyx_t_12 = -1.; if (((__pyx_t_13 > __pyx_t_12) != 0)) { __pyx_t_11 = __pyx_t_13; } else { __pyx_t_11 = __pyx_t_12; } __pyx_t_13 = __pyx_t_11; __pyx_t_12 = 1.; if (((__pyx_t_13 < __pyx_t_12) != 0)) { __pyx_t_11 = __pyx_t_13; } else { __pyx_t_11 = __pyx_t_12; } __pyx_r = __pyx_t_11; goto __pyx_L0; /* … */ __pyx_t_13 = __pyx_v_tau; __pyx_t_12 = -1.; if (((__pyx_t_13 > __pyx_t_12) != 0)) { __pyx_t_11 = __pyx_t_13; } else { __pyx_t_11 = __pyx_t_12; } __pyx_t_13 = __pyx_t_11; __pyx_t_12 = 1.; if (((__pyx_t_13 < __pyx_t_12) != 0)) { __pyx_t_11 = __pyx_t_13; } else { __pyx_t_11 = __pyx_t_12; } __pyx_r = __pyx_t_11; goto __pyx_L0; /* … */ __pyx_t_13 = __pyx_v_tau; __pyx_t_12 = -1.; if (((__pyx_t_13 > __pyx_t_12) != 0)) { __pyx_t_11 = __pyx_t_13; } else { __pyx_t_11 = __pyx_t_12; } __pyx_t_13 = __pyx_t_11; __pyx_t_12 = 1.; if (((__pyx_t_13 < __pyx_t_12) != 0)) { __pyx_t_11 = __pyx_t_13; } else { __pyx_t_11 = __pyx_t_12; } __pyx_r = __pyx_t_11; goto __pyx_L0;
196:
197:
198: # Inverts a permutation in place [B. H. Boonstra, Comm. ACM 8(2):104, 1965].
+199: cpdef _invert_in_place(intp_t[:] perm):
static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_5_invert_in_place(PyObject *__pyx_self, PyObject *__pyx_arg_perm); /*proto*/ static PyObject *__pyx_f_10sortedness_4wtau_4wtau__invert_in_place(__Pyx_memviewslice __pyx_v_perm, CYTHON_UNUSED int __pyx_skip_dispatch) { __pyx_t_5numpy_intp_t __pyx_v_n; __pyx_t_5numpy_intp_t __pyx_v_i; __pyx_t_5numpy_intp_t __pyx_v_j; __pyx_t_5numpy_intp_t __pyx_v_k; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_invert_in_place", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_5_invert_in_place(PyObject *__pyx_self, PyObject *__pyx_arg_perm); /*proto*/ static char __pyx_doc_10sortedness_4wtau_4wtau_4_invert_in_place[] = "_invert_in_place(intp_t[:] perm)"; static PyObject *__pyx_pw_10sortedness_4wtau_4wtau_5_invert_in_place(PyObject *__pyx_self, PyObject *__pyx_arg_perm) { __Pyx_memviewslice __pyx_v_perm = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_invert_in_place (wrapper)", 0); assert(__pyx_arg_perm); { __pyx_v_perm = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_intp_t(__pyx_arg_perm, PyBUF_WRITABLE); if (unlikely(!__pyx_v_perm.memview)) __PYX_ERR(0, 199, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("sortedness.wtau.wtau._invert_in_place", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_10sortedness_4wtau_4wtau_4_invert_in_place(__pyx_self, __pyx_v_perm); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_10sortedness_4wtau_4wtau_4_invert_in_place(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_perm) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_invert_in_place", 0); __Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_v_perm.memview)) { __Pyx_RaiseUnboundLocalError("perm"); __PYX_ERR(0, 199, __pyx_L1_error) } __pyx_t_1 = __pyx_f_10sortedness_4wtau_4wtau__invert_in_place(__pyx_v_perm, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sortedness.wtau.wtau._invert_in_place", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __PYX_XDEC_MEMVIEW(&__pyx_v_perm, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
200: cdef intp_t n, i, j, k
+201: for n in range(len(perm)-1, -1, -1):
__pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_perm);
for (__pyx_t_2 = (__pyx_t_1 - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
__pyx_v_n = __pyx_t_2;
+202: i = perm[n]
__pyx_t_3 = __pyx_v_n; __pyx_v_i = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ (__pyx_v_perm.data + __pyx_t_3 * __pyx_v_perm.strides[0]) )));
+203: if i < 0:
__pyx_t_4 = ((__pyx_v_i < 0) != 0); if (__pyx_t_4) { /* … */ goto __pyx_L5; }
+204: perm[n] = -i - 1
__pyx_t_3 = __pyx_v_n; *((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ (__pyx_v_perm.data + __pyx_t_3 * __pyx_v_perm.strides[0]) )) = ((-__pyx_v_i) - 1);
205: else:
+206: if i != n:
/*else*/ { __pyx_t_4 = ((__pyx_v_i != __pyx_v_n) != 0); if (__pyx_t_4) { /* … */ } } __pyx_L5:; }
+207: k = n
__pyx_v_k = __pyx_v_n;
+208: while True:
while (1) {
+209: j = perm[i]
__pyx_t_3 = __pyx_v_i; __pyx_v_j = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ (__pyx_v_perm.data + __pyx_t_3 * __pyx_v_perm.strides[0]) )));
+210: perm[i] = -k - 1
__pyx_t_3 = __pyx_v_i; *((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ (__pyx_v_perm.data + __pyx_t_3 * __pyx_v_perm.strides[0]) )) = ((-__pyx_v_k) - 1);
+211: if j == n:
__pyx_t_4 = ((__pyx_v_j == __pyx_v_n) != 0); if (__pyx_t_4) { /* … */ }
+212: perm[n] = i
__pyx_t_3 = __pyx_v_n; *((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ (__pyx_v_perm.data + __pyx_t_3 * __pyx_v_perm.strides[0]) )) = __pyx_v_i;
+213: break
goto __pyx_L8_break;
214:
+215: k = i
__pyx_v_k = __pyx_v_i;
+216: i = j
__pyx_v_i = __pyx_v_j; } __pyx_L8_break:;
217:
218:
219: # def parwtau(ordered[::1] x, ordered[::1] y, intp_t[:,:] ranks):
220: # cdef int64_t n = np.int64(len(x))
221: # cdef int64_t m = np.int64(len(ranks[0]))
222: # cdef float64_t[::1] ret = np.empty(m, dtype=np.float64)
223: # cdef intp_t[n] perm
224: # # cdef float64_t[::1] exchanges_weight
225: # cdef int[n] temp
226: # cdef int[n] perm0 = np.lexsort((y, x))
227: # cdef float64_t[::1] exchanges_weight = np.zeros(1, dtype=np.float64)
228: # cdef int[n] temp0 = np.empty(n, dtype=np.intp)
229: # cdef int64_t i, r
230: # for i in prange(len(ranks), nogil=True):
231: # for j in range(n):
232: # perm[j] = perm0[j]
233: # temp[j] = temp0[j]
234: # exchanges_weight[0] = 0
235: # ret[i] = _weightedrankedtau(x, y, ranks[:, i], n, perm, exchanges_weight, temp)
236: # return ret
237:
238: