Generated by Cython 0.29.7
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: _rad_sym_test.c
+001: from libc.stdlib cimport rand, RAND_MAX
__Pyx_TraceLine(1,0,__PYX_ERR(0, 1, __pyx_L1_error)) __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
002:
+003: import numpy as np
__Pyx_TraceLine(3,0,__PYX_ERR(0, 3, __pyx_L1_error)) __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
004:
+005: from copulae.core import pseudo_obs
__Pyx_TraceLine(5,0,__PYX_ERR(0, 5, __pyx_L1_error)) __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_pseudo_obs); __Pyx_GIVEREF(__pyx_n_s_pseudo_obs); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_pseudo_obs); __pyx_t_2 = __Pyx_Import(__pyx_n_s_copulae_core, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_pseudo_obs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_pseudo_obs, __pyx_t_1) < 0) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
006:
007:
+008: def rad_sym_test_stat(const double[:] u, const int n, const int p):
/* Python wrapper */ static PyObject *__pyx_pw_7copulae_3gof_13_rad_sym_test_1rad_sym_test_stat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_7copulae_3gof_13_rad_sym_test_rad_sym_test_stat[] = "\n Statistic for the radial symmetry test based on the empirical copula\n\n Parameters\n ----------\n u: ndarray\n Pseudo-observations\n\n n: int\n Number of observations\n\n p: int\n Dimension of data\n\n Returns\n -------\n float\n Test statistics\n "; static PyMethodDef __pyx_mdef_7copulae_3gof_13_rad_sym_test_1rad_sym_test_stat = {"rad_sym_test_stat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7copulae_3gof_13_rad_sym_test_1rad_sym_test_stat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7copulae_3gof_13_rad_sym_test_rad_sym_test_stat}; static PyObject *__pyx_pw_7copulae_3gof_13_rad_sym_test_1rad_sym_test_stat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { __Pyx_memviewslice __pyx_v_u = { 0, 0, { 0 }, { 0 }, { 0 } }; int __pyx_v_n; int __pyx_v_p; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rad_sym_test_stat (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_u,&__pyx_n_s_n,&__pyx_n_s_p,0}; PyObject* values[3] = {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 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_u)) != 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_n)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("rad_sym_test_stat", 1, 3, 3, 1); __PYX_ERR(0, 8, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("rad_sym_test_stat", 1, 3, 3, 2); __PYX_ERR(0, 8, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rad_sym_test_stat") < 0)) __PYX_ERR(0, 8, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_u = __Pyx_PyObject_to_MemoryviewSlice_ds_double__const__(values[0], 0); if (unlikely(!__pyx_v_u.memview)) __PYX_ERR(0, 8, __pyx_L3_error) __pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 8, __pyx_L3_error) __pyx_v_p = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_p == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 8, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("rad_sym_test_stat", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 8, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("copulae.gof._rad_sym_test.rad_sym_test_stat", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7copulae_3gof_13_rad_sym_test_rad_sym_test_stat(__pyx_self, __pyx_v_u, __pyx_v_n, __pyx_v_p); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7copulae_3gof_13_rad_sym_test_rad_sym_test_stat(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_u, int __pyx_v_n, int __pyx_v_p) { double __pyx_v_s; double __pyx_v_diff; int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_TraceDeclarations __Pyx_TraceFrameInit(__pyx_codeobj_) __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rad_sym_test_stat", 0); __Pyx_TraceCall("rad_sym_test_stat", __pyx_f[0], 8, 0, __PYX_ERR(0, 8, __pyx_L1_error)); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("copulae.gof._rad_sym_test.rad_sym_test_stat", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __PYX_XDEC_MEMVIEW(&__pyx_v_u, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_TraceReturn(__pyx_r, 0); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__22 = PyTuple_Pack(6, __pyx_n_s_u, __pyx_n_s_n, __pyx_n_s_p, __pyx_n_s_s, __pyx_n_s_diff, __pyx_n_s_i); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__22); __Pyx_GIVEREF(__pyx_tuple__22); /* … */ __Pyx_TraceLine(8,0,__PYX_ERR(0, 8, __pyx_L1_error)) __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7copulae_3gof_13_rad_sym_test_1rad_sym_test_stat, NULL, __pyx_n_s_copulae_gof__rad_sym_test); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_rad_sym_test_stat, __pyx_t_2) < 0) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_copulae_gof__rad_sym_test_pyx, __pyx_n_s_rad_sym_test_stat, 8, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 8, __pyx_L1_error)
009: """
010: Statistic for the radial symmetry test based on the empirical copula
011:
012: Parameters
013: ----------
014: u: ndarray
015: Pseudo-observations
016:
017: n: int
018: Number of observations
019:
020: p: int
021: Dimension of data
022:
023: Returns
024: -------
025: float
026: Test statistics
027: """
028: cdef:
+029: double s = 0, diff
__Pyx_TraceLine(29,0,__PYX_ERR(0, 29, __pyx_L1_error)) __pyx_v_s = 0.0;
030: int i
031:
+032: for i in range(n):
__Pyx_TraceLine(32,0,__PYX_ERR(0, 32, __pyx_L1_error)) __pyx_t_1 = __pyx_v_n; __pyx_t_2 = __pyx_t_1; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+033: diff = diff_cn(u, n, p, i)
__Pyx_TraceLine(33,0,__PYX_ERR(0, 33, __pyx_L1_error)) __pyx_v_diff = __pyx_f_7copulae_3gof_13_rad_sym_test_diff_cn(__pyx_v_u, __pyx_v_n, __pyx_v_p, __pyx_v_i);
+034: s += diff * diff
__Pyx_TraceLine(34,0,__PYX_ERR(0, 34, __pyx_L1_error)) __pyx_v_s = (__pyx_v_s + (__pyx_v_diff * __pyx_v_diff)); }
035:
+036: return s
__Pyx_TraceLine(36,0,__PYX_ERR(0, 36, __pyx_L1_error)) __Pyx_XDECREF(__pyx_r); __pyx_t_4 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
037:
038:
+039: def rad_sym_replicate(double[:, :] u, long[:, :] ir, const int n, const int p, bint has_ties):
/* Python wrapper */ static PyObject *__pyx_pw_7copulae_3gof_13_rad_sym_test_3rad_sym_replicate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_7copulae_3gof_13_rad_sym_test_2rad_sym_replicate[] = "One instance of bootstrap replication for radial symmetry test"; static PyMethodDef __pyx_mdef_7copulae_3gof_13_rad_sym_test_3rad_sym_replicate = {"rad_sym_replicate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7copulae_3gof_13_rad_sym_test_3rad_sym_replicate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7copulae_3gof_13_rad_sym_test_2rad_sym_replicate}; static PyObject *__pyx_pw_7copulae_3gof_13_rad_sym_test_3rad_sym_replicate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { __Pyx_memviewslice __pyx_v_u = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_ir = { 0, 0, { 0 }, { 0 }, { 0 } }; int __pyx_v_n; int __pyx_v_p; int __pyx_v_has_ties; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rad_sym_replicate (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_u,&__pyx_n_s_ir,&__pyx_n_s_n,&__pyx_n_s_p,&__pyx_n_s_has_ties,0}; PyObject* values[5] = {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 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_u)) != 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_ir)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("rad_sym_replicate", 1, 5, 5, 1); __PYX_ERR(0, 39, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("rad_sym_replicate", 1, 5, 5, 2); __PYX_ERR(0, 39, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("rad_sym_replicate", 1, 5, 5, 3); __PYX_ERR(0, 39, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_has_ties)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("rad_sym_replicate", 1, 5, 5, 4); __PYX_ERR(0, 39, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rad_sym_replicate") < 0)) __PYX_ERR(0, 39, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { 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); } __pyx_v_u = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_u.memview)) __PYX_ERR(0, 39, __pyx_L3_error) __pyx_v_ir = __Pyx_PyObject_to_MemoryviewSlice_dsds_long(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ir.memview)) __PYX_ERR(0, 39, __pyx_L3_error) __pyx_v_n = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 39, __pyx_L3_error) __pyx_v_p = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_p == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 39, __pyx_L3_error) __pyx_v_has_ties = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_has_ties == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 39, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("rad_sym_replicate", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 39, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("copulae.gof._rad_sym_test.rad_sym_replicate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7copulae_3gof_13_rad_sym_test_2rad_sym_replicate(__pyx_self, __pyx_v_u, __pyx_v_ir, __pyx_v_n, __pyx_v_p, __pyx_v_has_ties); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7copulae_3gof_13_rad_sym_test_2rad_sym_replicate(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_u, __Pyx_memviewslice __pyx_v_ir, int __pyx_v_n, int __pyx_v_p, int __pyx_v_has_ties) { __Pyx_memviewslice __pyx_v_ub = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_tub = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_order = { 0, 0, { 0 }, { 0 }, { 0 } }; int __pyx_v_i; int __pyx_v_j; PyObject *__pyx_r = NULL; __Pyx_TraceDeclarations __Pyx_TraceFrameInit(__pyx_codeobj__2) __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rad_sym_replicate", 0); __Pyx_TraceCall("rad_sym_replicate", __pyx_f[0], 39, 0, __PYX_ERR(0, 39, __pyx_L1_error)); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1); __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1); __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1); __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1); __Pyx_XDECREF(__pyx_t_27); __Pyx_XDECREF(__pyx_t_28); __Pyx_XDECREF(__pyx_t_29); __Pyx_AddTraceback("copulae.gof._rad_sym_test.rad_sym_replicate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __PYX_XDEC_MEMVIEW(&__pyx_v_ub, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_tub, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_order, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_u, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_ir, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_TraceReturn(__pyx_r, 0); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__23 = PyTuple_Pack(10, __pyx_n_s_u, __pyx_n_s_ir, __pyx_n_s_n, __pyx_n_s_p, __pyx_n_s_has_ties, __pyx_n_s_ub, __pyx_n_s_tub, __pyx_n_s_order, __pyx_n_s_i, __pyx_n_s_j); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__23); __Pyx_GIVEREF(__pyx_tuple__23); /* … */ __Pyx_TraceLine(39,0,__PYX_ERR(0, 39, __pyx_L1_error)) __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7copulae_3gof_13_rad_sym_test_3rad_sym_replicate, NULL, __pyx_n_s_copulae_gof__rad_sym_test); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_rad_sym_replicate, __pyx_t_2) < 0) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(5, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_copulae_gof__rad_sym_test_pyx, __pyx_n_s_rad_sym_replicate, 39, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(0, 39, __pyx_L1_error)
040: """One instance of bootstrap replication for radial symmetry test"""
041: cdef:
+042: double[:, :] ub = np.copy(u), tub
__Pyx_TraceLine(42,0,__PYX_ERR(0, 42, __pyx_L1_error)) __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_u, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_ub = __pyx_t_5; __pyx_t_5.memview = NULL; __pyx_t_5.data = NULL;
043: long[:] order
044: int i, j
045:
+046: for i in range(n):
__Pyx_TraceLine(46,0,__PYX_ERR(0, 46, __pyx_L1_error)) __pyx_t_6 = __pyx_v_n; __pyx_t_7 = __pyx_t_6; for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v_i = __pyx_t_8;
+047: if (<double>rand() / RAND_MAX) < 0.5:
__Pyx_TraceLine(47,0,__PYX_ERR(0, 47, __pyx_L1_error)) __pyx_t_9 = (((((double)rand()) / ((double)RAND_MAX)) < 0.5) != 0); if (__pyx_t_9) { /* … */ } }
+048: for j in range(p):
__Pyx_TraceLine(48,0,__PYX_ERR(0, 48, __pyx_L1_error)) __pyx_t_10 = __pyx_v_p; __pyx_t_11 = __pyx_t_10; for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { __pyx_v_j = __pyx_t_12;
+049: ub[i, j] = 1 - u[i, j]
__Pyx_TraceLine(49,0,__PYX_ERR(0, 49, __pyx_L1_error)) __pyx_t_13 = __pyx_v_i; __pyx_t_14 = __pyx_v_j; __pyx_t_15 = __pyx_v_i; __pyx_t_16 = __pyx_v_j; *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ub.data + __pyx_t_15 * __pyx_v_ub.strides[0]) ) + __pyx_t_16 * __pyx_v_ub.strides[1]) )) = (1.0 - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_u.data + __pyx_t_13 * __pyx_v_u.strides[0]) ) + __pyx_t_14 * __pyx_v_u.strides[1]) )))); }
050:
+051: if has_ties:
__Pyx_TraceLine(51,0,__PYX_ERR(0, 51, __pyx_L1_error)) __pyx_t_9 = (__pyx_v_has_ties != 0); if (__pyx_t_9) { /* … */ }
+052: for i in range(p):
__Pyx_TraceLine(52,0,__PYX_ERR(0, 52, __pyx_L1_error)) __pyx_t_6 = __pyx_v_p; __pyx_t_7 = __pyx_t_6; for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v_i = __pyx_t_8;
+053: order = np.argsort(ub[:, i])
__Pyx_TraceLine(53,0,__PYX_ERR(0, 53, __pyx_L1_error)) __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_argsort); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_17.data = __pyx_v_ub.data; __pyx_t_17.memview = __pyx_v_ub.memview; __PYX_INC_MEMVIEW(&__pyx_t_17, 0); __pyx_t_17.shape[0] = __pyx_v_ub.shape[0]; __pyx_t_17.strides[0] = __pyx_v_ub.strides[0]; __pyx_t_17.suboffsets[0] = -1; { Py_ssize_t __pyx_tmp_idx = __pyx_v_i; Py_ssize_t __pyx_tmp_stride = __pyx_v_ub.strides[1]; if ((0)) __PYX_ERR(0, 53, __pyx_L1_error) __pyx_t_17.data += __pyx_tmp_idx * __pyx_tmp_stride; } __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_17, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1); __pyx_t_17.memview = NULL; __pyx_t_17.data = NULL; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_ds_long(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_XDEC_MEMVIEW(&__pyx_v_order, 1); __pyx_v_order = __pyx_t_18; __pyx_t_18.memview = NULL; __pyx_t_18.data = NULL;
054:
+055: tub = np.copy(ub)
__Pyx_TraceLine(55,0,__PYX_ERR(0, 55, __pyx_L1_error)) __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_ub, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_XDEC_MEMVIEW(&__pyx_v_tub, 1); __pyx_v_tub = __pyx_t_5; __pyx_t_5.memview = NULL; __pyx_t_5.data = NULL;
+056: for j in range(n):
__Pyx_TraceLine(56,0,__PYX_ERR(0, 56, __pyx_L1_error)) __pyx_t_10 = __pyx_v_n; __pyx_t_11 = __pyx_t_10; for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { __pyx_v_j = __pyx_t_12;
+057: ub[j] = tub[<int>order[j]]
__Pyx_TraceLine(57,0,__PYX_ERR(0, 57, __pyx_L1_error)) __pyx_t_19 = __pyx_v_j; __pyx_t_17.data = __pyx_v_tub.data; __pyx_t_17.memview = __pyx_v_tub.memview; __PYX_INC_MEMVIEW(&__pyx_t_17, 0); { Py_ssize_t __pyx_tmp_idx = ((int)(*((long *) ( /* dim=0 */ (__pyx_v_order.data + __pyx_t_19 * __pyx_v_order.strides[0]) )))); Py_ssize_t __pyx_tmp_stride = __pyx_v_tub.strides[0]; if ((0)) __PYX_ERR(0, 57, __pyx_L1_error) __pyx_t_17.data += __pyx_tmp_idx * __pyx_tmp_stride; } __pyx_t_17.shape[0] = __pyx_v_tub.shape[1]; __pyx_t_17.strides[0] = __pyx_v_tub.strides[1]; __pyx_t_17.suboffsets[0] = -1; __pyx_t_20.data = __pyx_v_ub.data; __pyx_t_20.memview = __pyx_v_ub.memview; __PYX_INC_MEMVIEW(&__pyx_t_20, 0); { Py_ssize_t __pyx_tmp_idx = __pyx_v_j; Py_ssize_t __pyx_tmp_stride = __pyx_v_ub.strides[0]; if ((0)) __PYX_ERR(0, 57, __pyx_L1_error) __pyx_t_20.data += __pyx_tmp_idx * __pyx_tmp_stride; } __pyx_t_20.shape[0] = __pyx_v_ub.shape[1]; __pyx_t_20.strides[0] = __pyx_v_ub.strides[1]; __pyx_t_20.suboffsets[0] = -1; if (unlikely(__pyx_memoryview_copy_contents(__pyx_t_17, __pyx_t_20, 1, 1, 0) < 0)) __PYX_ERR(0, 57, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1); __pyx_t_20.memview = NULL; __pyx_t_20.data = NULL; __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1); __pyx_t_17.memview = NULL; __pyx_t_17.data = NULL; }
058:
+059: tub = np.copy(ub)
__Pyx_TraceLine(59,0,__PYX_ERR(0, 59, __pyx_L1_error)) __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_ub, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_XDEC_MEMVIEW(&__pyx_v_tub, 1); __pyx_v_tub = __pyx_t_5; __pyx_t_5.memview = NULL; __pyx_t_5.data = NULL;
+060: for j in range(n):
__Pyx_TraceLine(60,0,__PYX_ERR(0, 60, __pyx_L1_error)) __pyx_t_10 = __pyx_v_n; __pyx_t_11 = __pyx_t_10; for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { __pyx_v_j = __pyx_t_12;
+061: ub[j, i] = tub[ir[j, i], i]
__Pyx_TraceLine(61,0,__PYX_ERR(0, 61, __pyx_L1_error)) __pyx_t_21 = __pyx_v_j; __pyx_t_22 = __pyx_v_i; __pyx_t_23 = (*((long *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ir.data + __pyx_t_21 * __pyx_v_ir.strides[0]) ) + __pyx_t_22 * __pyx_v_ir.strides[1]) ))); __pyx_t_24 = __pyx_v_i; __pyx_t_25 = __pyx_v_j; __pyx_t_26 = __pyx_v_i; *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ub.data + __pyx_t_25 * __pyx_v_ub.strides[0]) ) + __pyx_t_26 * __pyx_v_ub.strides[1]) )) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_tub.data + __pyx_t_23 * __pyx_v_tub.strides[0]) ) + __pyx_t_24 * __pyx_v_tub.strides[1]) ))); } }
062:
+063: ub = pseudo_obs(ub)
__Pyx_TraceLine(63,0,__PYX_ERR(0, 63, __pyx_L1_error)) __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pseudo_obs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_ub, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_XDEC_MEMVIEW(&__pyx_v_ub, 1); __pyx_v_ub = __pyx_t_5; __pyx_t_5.memview = NULL; __pyx_t_5.data = NULL;
+064: return rad_sym_test_stat(np.ravel(ub, 'F'), n, p)
__Pyx_TraceLine(64,0,__PYX_ERR(0, 64, __pyx_L1_error)) __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_rad_sym_test_stat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_27 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ravel); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_27); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_ub, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_28 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_27))) { __pyx_t_28 = PyMethod_GET_SELF(__pyx_t_27); if (likely(__pyx_t_28)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_27); __Pyx_INCREF(__pyx_t_28); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_27, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_27)) { PyObject *__pyx_temp[3] = {__pyx_t_28, __pyx_t_4, __pyx_n_u_F}; __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_27, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_28); __pyx_t_28 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_27)) { PyObject *__pyx_temp[3] = {__pyx_t_28, __pyx_t_4, __pyx_n_u_F}; __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_27, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_28); __pyx_t_28 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_29 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_29); if (__pyx_t_28) { __Pyx_GIVEREF(__pyx_t_28); PyTuple_SET_ITEM(__pyx_t_29, 0, __pyx_t_28); __pyx_t_28 = NULL; } __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_29, 0+__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_n_u_F); __Pyx_GIVEREF(__pyx_n_u_F); PyTuple_SET_ITEM(__pyx_t_29, 1+__pyx_t_6, __pyx_n_u_F); __pyx_t_4 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_27, __pyx_t_29, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; } __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0; __pyx_t_27 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_27); __pyx_t_29 = __Pyx_PyInt_From_int(__pyx_v_p); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_29); __pyx_t_4 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_3, __pyx_t_27, __pyx_t_29}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0; __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_3, __pyx_t_27, __pyx_t_29}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0; __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; } else #endif { __pyx_t_28 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_28); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_28, 0+__pyx_t_6, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_27); PyTuple_SET_ITEM(__pyx_t_28, 1+__pyx_t_6, __pyx_t_27); __Pyx_GIVEREF(__pyx_t_29); PyTuple_SET_ITEM(__pyx_t_28, 2+__pyx_t_6, __pyx_t_29); __pyx_t_3 = 0; __pyx_t_27 = 0; __pyx_t_29 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
065:
066:
+067: cdef double diff_cn(const double[:] u, const int n, const int p, const int k) nogil:
static double __pyx_f_7copulae_3gof_13_rad_sym_test_diff_cn(__Pyx_memviewslice __pyx_v_u, int const __pyx_v_n, int const __pyx_v_p, int const __pyx_v_k) { double __pyx_v_sumind; int __pyx_v_i; int __pyx_v_j; int __pyx_v_ind1; int __pyx_v_ind2; double __pyx_r; __Pyx_TraceDeclarations __Pyx_TraceCall("diff_cn", __pyx_f[0], 67, 1, __PYX_ERR(0, 67, __pyx_L1_error)); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_WriteUnraisable("copulae.gof._rad_sym_test.diff_cn", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1); __pyx_r = 0; __pyx_L0:; __Pyx_TraceReturn(Py_None, 1); return __pyx_r; } /* … */ __Pyx_TraceLine(67,0,__PYX_ERR(0, 67, __pyx_L1_error))
068: """
069: Difference between the multivariate empirical copula and the multivariate survival empirical copula
070: for the radial symmetry test
071:
072: Parameters
073: ----------
074: u: ndarray
075: Pseudo-observations
076:
077: n: int
078: Number of observations
079:
080: p: int
081: Dimension of data
082:
083: k: int
084: "line" of `u` at which to compute the difference
085:
086: Returns
087: -------
088: float
089: The value of the difference at u[k + n * j], j=1...p`
090: """
091: cdef:
+092: double sumind = 0.0
__Pyx_TraceLine(92,1,__PYX_ERR(0, 92, __pyx_L1_error)) __pyx_v_sumind = 0.0;
093: int i, j, ind1, ind2
094:
+095: for i in range(n):
__Pyx_TraceLine(95,1,__PYX_ERR(0, 95, __pyx_L1_error)) __pyx_t_1 = __pyx_v_n; __pyx_t_2 = __pyx_t_1; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+096: ind1 = 1
__Pyx_TraceLine(96,1,__PYX_ERR(0, 96, __pyx_L1_error)) __pyx_v_ind1 = 1;
+097: ind2 = 1
__Pyx_TraceLine(97,1,__PYX_ERR(0, 97, __pyx_L1_error)) __pyx_v_ind2 = 1;
098:
+099: for j in range(p):
__Pyx_TraceLine(99,1,__PYX_ERR(0, 99, __pyx_L1_error)) __pyx_t_4 = __pyx_v_p; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_j = __pyx_t_6;
+100: ind1 *= (u[i + n * j] <= u[k + n * j])
__Pyx_TraceLine(100,1,__PYX_ERR(0, 100, __pyx_L1_error)) __pyx_t_7 = (__pyx_v_i + (__pyx_v_n * __pyx_v_j)); __pyx_t_8 = (__pyx_v_k + (__pyx_v_n * __pyx_v_j)); __pyx_v_ind1 = (__pyx_v_ind1 * ((*((double const *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_7 * __pyx_v_u.strides[0]) ))) <= (*((double const *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_8 * __pyx_v_u.strides[0]) )))));
+101: ind2 *= (1.0 - u[i + n * j] <= u[k + n * j])
__Pyx_TraceLine(101,1,__PYX_ERR(0, 101, __pyx_L1_error)) __pyx_t_9 = (__pyx_v_i + (__pyx_v_n * __pyx_v_j)); __pyx_t_10 = (__pyx_v_k + (__pyx_v_n * __pyx_v_j)); __pyx_v_ind2 = (__pyx_v_ind2 * ((1.0 - (*((double const *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_9 * __pyx_v_u.strides[0]) )))) <= (*((double const *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_10 * __pyx_v_u.strides[0]) ))))); }
102:
+103: sumind += <double>ind1 - <double>ind2
__Pyx_TraceLine(103,1,__PYX_ERR(0, 103, __pyx_L1_error)) __pyx_v_sumind = (__pyx_v_sumind + (((double)__pyx_v_ind1) - ((double)__pyx_v_ind2))); }
104:
+105: return sumind / n
__Pyx_TraceLine(105,1,__PYX_ERR(0, 105, __pyx_L1_error)) __pyx_r = (__pyx_v_sumind / ((double)__pyx_v_n)); goto __pyx_L0;